Merge lp:~ted/snapcraft/ros-catkin-plugin into lp:~snappy-dev/snapcraft/core
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Sergio Schvezov on 2015-10-16 | ||||
| Approved revision: | 208 | ||||
| Merged at revision: | 243 | ||||
| Proposed branch: | lp:~ted/snapcraft/ros-catkin-plugin | ||||
| Merge into: | lp:~snappy-dev/snapcraft/core | ||||
| Diff against target: |
845 lines (+726/-0) 16 files modified
debian/control (+2/-0) examples/ros/icon.svg (+1/-0) examples/ros/snapcraft.yaml (+27/-0) examples/ros/src/CMakeLists.txt (+47/-0) examples/ros/src/beginner_tutorials/CMakeLists.txt (+39/-0) examples/ros/src/beginner_tutorials/msg/Num.msg (+1/-0) examples/ros/src/beginner_tutorials/package.xml (+42/-0) examples/ros/src/beginner_tutorials/src/add_two_ints_client.cpp (+30/-0) examples/ros/src/beginner_tutorials/src/add_two_ints_server.cpp (+23/-0) examples/ros/src/beginner_tutorials/src/listener.cpp (+60/-0) examples/ros/src/beginner_tutorials/src/talker.cpp (+87/-0) examples/ros/src/beginner_tutorials/srv/AddTwoInts.srv (+4/-0) snapcraft/meta.py (+3/-0) snapcraft/plugins/catkin.py (+270/-0) snapcraft/plugins/roscore.py (+83/-0) snapcraft/yaml.py (+7/-0) |
||||
| To merge this branch: | bzr merge lp:~ted/snapcraft/ros-catkin-plugin | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Sergio Schvezov | Approve on 2015-10-16 | ||
| John Lenton | 2015-10-01 | Needs Fixing on 2015-10-01 | |
|
Review via email:
|
|||
Commit Message
Adding a catkin plugin
| Leo Arias (elopio) wrote : | # |
It's probably not a good idea to use config={} in the arguments of the methods because {} is mutable and it can cause some unexpected behaviors. See more info here: http://
As the article suggest, it's better to use config=None, and then if config is None: config = {}.
Also, your python files are not passing the mccabe test:
./snapcraft/
./snapcraft/
You should extract methods for the loops. The more the merrier.
| Sergio Schvezov (sergiusens) wrote : | # |
Hey good work on getting everything to this point. Seems like a really useful plugin. I do have some comments though.
I've been giving this a bit more of a look and I don't think we want config={} at all, parts should not have knowledge of config, it is what keeps them independent. We also don't want to have it write a services entry, that should be in the users control.
Last but not least, as elopio mentions, the code needs to be split out a bit.
| Sergio Schvezov (sergiusens) wrote : | # |
Also merge lp:~sergiusens/snapcraft/catkin which adds the roscore binaries
| Ted Gould (ted) wrote : | # |
On Fri, 2015-10-02 at 22:39 +0000, Sergio Schvezov wrote:
> I've been giving this a bit more of a look and I don't think we want
> config={} at all, parts should not have knowledge of config, it is
> what keeps them independent. We also don't want to have it write a
> services entry, that should be in the users control.
So, I actually think the opposite, we need it more or an actual step for
it.
I think that we do want the plugins to provide smarter generation of the
packages.yaml file, we can argue whether they should do services, but I
think we definitely want them to do frameworks and add capabilities on
individual binaries/
plugin. For QML to be useful it needs the Mir Framework and every binary
needs to have the mir_client capability. I don't think that we should
require the developer to understand those, just understand that he/she
needs to pull in QML. The QML plugin should add those onto the packages
file where it can.
Perhaps a solution for the services would be to provide a way to insert
a commented block into the packages.yaml file. So the plugin could see
if there was a ROS Master and if not throw some comments in saying "hey,
you might want these keys."
While for ROS I think this isn't as important, but as we start adding
things to the wiki you'd want to add postgres to your snap, not
configure postgres as a server in your snap. It seems that there needs
to be some way to have the service come along with the plugin.
- 190. By Ted Gould on 2015-10-02
-
Lint fixes
- 191. By Ted Gould on 2015-10-05
-
Restructuring code to pull XML parsing out of the file handling
- 192. By Ted Gould on 2015-10-05
-
Pulling the dependency resolution into its own function and using set logic to simplify
- 193. By Ted Gould on 2015-10-05
-
Making more sets instead of lists
- 194. By Ted Gould on 2015-10-05
-
Updates from Sergio
| Ted Gould (ted) wrote : | # |
So I think the complexity is taken care off and the other little comments.
I'm going to leave the *attr() ones because they match the other code, if we're going to change those I'm happy with that, but it should be one branch to change them all.
Wait for Sergio's comment/discussion on the config variable and how we want to handle that.
| Ted Gould (ted) wrote : | # |
Oh, also note, this push breaks the Erle Spider codebase as the switch to sets exposes some more dependency declaration that is needed in their codebase.
- 195. By Ted Gould on 2015-10-05
-
Change formatting of string to make it easier to read.
- 196. By Ted Gould on 2015-10-14
-
Update to trunk and roscore updates
- 197. By Ted Gould on 2015-10-14
-
Grab changes from roscore branch
- 198. By Ted Gould on 2015-10-15
-
Get schemas and other changes needed by the new plugins system
- 199. By Ted Gould on 2015-10-15
-
Drop 'config' parameters
- 200. By Ted Gould on 2015-10-15
-
Revert plugin.py changes
| Sergio Schvezov (sergiusens) wrote : | # |
I've done a first pass, the code looks really good, just a couple nits here and there.
One thing we haven't been doing and I started addressing was that all our methods our public and I'd make them private (prefix the method with _), this becomes more important now that we inherit from plugins instead of 'requiring' them.
| Ted Gould (ted) wrote : | # |
On Thu, 2015-10-15 at 23:44 +0000, Sergio Schvezov wrote:
> One thing we haven't been doing and I started addressing was that all our methods our public and I'd make them private (prefix the method with _), this becomes more important now that we inherit from plugins instead of 'requiring' them.
Fixed.
> > +binaries:
> > + listener:
> > + exec: opt/ros/
> > + talker:
> > + exec: opt/ros/
> > +
> > +parts:
> > + roscore:
> > + plugin: roscore
> > + catkin-tutorials:
> > + plugin: catkin
> > + source: .
> > + catkin-packages:
> > + - beginner_tutorials
> > +
> > +services:
>
> just a minor thing, but maybe put this upstairs (above) together with binaries
Fixed
> > + rosmaster:
> > + start: bin/roscore-
> > + description: ROS Master Service
> > + ports:
>
> this can be dropped, I think it is being killed and nothing uses it so it can just go away to not confuse people (ports and everything under it)
Fixed, we should probably mark it deprecated in the schema then, no?
> > + def __init__(self, name, options):
> > + super()
> > + self.rosversion = options.rosversion
>
> the base class already saves options as self.options from way back and I guess we never noticed that, but maybe all these 'options' attribs don't need specific assigns.
Fixed.
> > + except lxml.etree.
> > + logger.
>
> use .format instead of + or maybe ('string %r' % pkg)
Fixed.
> > + return
>
> what are the consequences of this, even if handled internally maybe raising a RuntimeError is good here and logging from whoever calls this.
My thoughts here is that we can let the developer decide, if they care
that we can't parse it they can fix the file. If they don't care and
they just want to add the dependencies via stage-packages manually we
should allow that too. I kinda see packages.xml as nicety instead of a
requirement for a build.
> > +
> > + for deptype in ['buildtool_
>
> use () instead of [] here.
Fixed. But I don't understand why that would be better, it seems like a
list would always be less memory?
- 201. By Ted Gould on 2015-10-16
-
Making private functions private
- 202. By Ted Gould on 2015-10-16
-
Make directories us os.path.join()
- 203. By Ted Gould on 2015-10-16
-
Move services and drop port info
- 204. By Ted Gould on 2015-10-16
-
Don't cache the rosversion
- 205. By Ted Gould on 2015-10-16
-
Change string formatting
- 206. By Ted Gould on 2015-10-16
-
Set instead of a list
- 207. By Ted Gould on 2015-10-16
-
PEP8 is lame


inline