Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catkin tools plugin: add catkin tools support. #1593

Merged
merged 9 commits into from Nov 17, 2017

Conversation

cratliff
Copy link
Contributor

@cratliff cratliff commented Oct 6, 2017

Adding suppot for catkin tools. Initially the only difference is
the build is being performed by catkin tools instead of catkin_make,
while all other function inherits from catkin_make.

LP: #1693380

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on bug reports?
  • If this is a new feature. Have you discussed the design on the forum?
  • Have you successfully run ./runtests.sh static?
  • Have you successfully run ./runtests.sh unit?

Copy link
Contributor

@come-maiz come-maiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this @cratliff !
I just had a quick look and left a couple of nit comments, because I'll leave the full review to Kyle.

I think that we can refactor a base catkin plugin to make the inheritance clearer. One base, and then two implementations, one with catkin_make_isolated and the other with catkin. But your code looks very nice, we can do the refactor afterwards.

However, I'm not entirely convinced that this should be a separate plugin, instead of a single catkin plugin with an attribute like build-tool. But I will just run away and leave that discussion to the two of you :)

@@ -0,0 +1,124 @@
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2016 Canonical Ltd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update the copyright year here.

super().__init__(name, options, project)
self.build_packages.extend(['python-catkin-tools'])

def _prepare_build(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that this method is too long. Maybe it can be split into _clean_catkin, _add_catkin_profile and _install_catkin_packages

@sergiusens sergiusens added this to Robotics in 17.10 Oct 7, 2017
@cratliff cratliff force-pushed the catkin-tools-plugin branch 2 times, most recently from 5821d1d to c466ae1 Compare October 11, 2017 00:27
@cratliff
Copy link
Contributor Author

I edited the copyright and broke up the _prepare_build function to be to be a shorter.

That refactor makes sense. I would be fine to do it now or later.

@kyrofa and I talked about that at the rally. He had some thoughts about why this should be another plugin. One I know of is that catkin tools has a number of options that may be added later at the plugin is expanded that wouldn't be compatible with catkin.

Copy link
Contributor

@kyrofa kyrofa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking pretty good. I'm not a catkin tools pro, so I have a few questions in here. Also, have you tried it with content sharing at all? Finally, we will definitely need a snapd integration test for this.

def _add_catkin_profile(self):
# Overwrite the default catkin profile to ensure builds
# aren't affected by profile changes.
catkincmd = ['catkin', 'profile', 'add', '-f', 'default']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any downside to potentially overwriting this profile? Is it possible for the developer to create one with settings that are necessary for the build to succeed, and our overwriting it here causes it to fail? Likewise, I'm sure it's possible for their changes to break the build in the snap... perhaps that's more likely. Just want to get your thoughts on this.

Copy link
Contributor Author

@cratliff cratliff Oct 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a user I would probably prefer to be able to use in my own profile. It would mean the catkin tools plugin would be less maintenance as well, since almost anything you would want to add can be done directly through a profile. My thought was that a user's settings could break the build in the snap if they were utilizing some features, use source not in the parts directory, or not install properly. Would a field in the schema be appropriate to allow the user to use their profile understanding it could break things? Even if we allow the user's profile we would still want to change the source, build, and install space.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your logic seems sound, here. Indeed, the schema seems a good place for this, but I think what we have here is a good and safe first step. Anything more could come as a follow-up.

@@ -401,7 +401,7 @@ def pull(self):

# Pull our own compilers so we use ones that match up with the version
# of ROS we're using.
compilers = _Compilers(
compilers = Compilers(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's on my TODO to split this out into a common area, FYI.

catkincmd = ['catkin', 'config']

# Use the newly created default profile.
catkincmd.extend(['--profile', 'default'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not set this profile to be active in _add_catkin_profile()? It would save your needing to explicitly use it in every subsequent command, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there was only one subsequent command, I'm good to change that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need, just a thought.

catkincmd = ['catkin', 'build']

# Prevent notification that the build is complete.
catkincmd.append('--no-notify')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this explode on headless systems? Might be kinda useful, really.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I'm aware of. My thought was that it could be confusing to receive a notification that your build is complete when you still need to go through the stage, prime, and snap steps of the build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a good point.

self._compilers_path, self.PLUGIN_STAGE_SOURCES, self.project)

# This command must run in bash due to a bug in Catkin that causes it
# to explode if there are spaces in the cmake args (which there are).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this bug still bites catkin tools? What about this bug from of old?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping here.

'make nil python qmake scons \n'
'autotools cmake go gulp kbuild '
'maven nodejs python2 ruby tar-content\n'
'catkin copy godeps jdk kernel meson '
Copy link
Contributor

@kyrofa kyrofa Oct 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, this is always so much fun to edit, right?

@kyrofa
Copy link
Contributor

kyrofa commented Oct 13, 2017

However, I'm not entirely convinced that this should be a separate plugin, instead of a single catkin plugin with an attribute like build-tool. But I will just run away and leave that discussion to the two of you :)

@kyrofa and I talked about that at the rally. He had some thoughts about why this should be another plugin. One I know of is that catkin tools has a number of options that may be added later at the plugin is expanded that wouldn't be compatible with catkin.

I don't have super strong opinions here, but let me lay out all my thoughts.

  • The Catkin plugin is stable, and it uses the build tool recommended by ROS.
  • Catkin Tools is still in beta, and as such could break API.
  • Now in ROS2 they're moving to ament, so I'm not sure how long work will continue to go into Catkin Tools.
  • As @cratliff mentions, Catkin Tools is a much more capability-rich tool than Catkin. I feel that combining them in such a way that both Catkin and Catkin Tools are supported would make for a very complex plugin over time as we try to expose various capabilities. And man... it's already complex.
  • Having a Catkin Tools plugin means we can label it as a beta plugin.

Long-term, if development continues on Catkin Tools and we don't see breakage between Catkin and Catkin Tools, I envision eventually replacing the Catkin plugin with this. We just need to ensure this plugin continues to be a superset of capabilities from the Catkin plugin, and they don't diverge.

class CatkinToolsPlugin(snapcraft.plugins.catkin.CatkinPlugin):
def __init__(self, name, options, project):
super().__init__(name, options, project)
self.build_packages.extend(['python-catkin-tools'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a note that this is a beta plugin? See the ruby plugin for reference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping here.

@cratliff
Copy link
Contributor Author

This is looking pretty good. I'm not a catkin tools pro, so I have a few questions in here. Also, have you tried it with content sharing at all? Finally, we will definitely need a snapd integration test for this.

No, by content sharing do you mean an overlay or underlay of the workspaces?

Long-term, if development continues on Catkin Tools and we don't see breakage between Catkin and Catkin Tools, I envision eventually replacing the Catkin plugin with this. We just need to ensure this plugin continues to be a superset of capabilities from the Catkin plugin, and they don't diverge.

My initial transition to catkin tools required cleaning the build from catkin_make then using catkin tools. Transitioning should be simple enough.

@kyrofa
Copy link
Contributor

kyrofa commented Oct 19, 2017

No, by content sharing do you mean an overlay or underlay of the workspaces?

Right, take a look at demos/shared-ros/. I'd like to see if that continues to work with catkin-tools. Note that this is not a blocker for this PR, but something we'll need to ensure works before stabilizing this plugin.

@kyrofa
Copy link
Contributor

kyrofa commented Oct 24, 2017

I'm mostly +1 on this. I'm curious about the bash bug and I'd like it to be marked a beta plugin, but other than that you just have a conflict to fix.

@cratliff
Copy link
Contributor Author

I tested the bash bug and am seeing it. I also tested content sharing, it did not work, but didn't get a chance to look into why. Since we had been talking about them I also tested the profile overwriting and cleaning a more. They might not be necessary and just me being overcautious. I'll make sure to add the beta plugin.

@kyrofa
Copy link
Contributor

kyrofa commented Oct 24, 2017

I tested the bash bug and am seeing it.

So it's not actually fixed in catkin tools? Bah.

I also tested content sharing, it did not work, but didn't get a chance to look into why.

That's okay, we can figure it out after this lands.

Adding suppot for catkin tools.  Initially the only difference is
the build is being performed by catkin tools instead of catkin_make,
while all other function inherits from catkin_make.

LP: #1693380
@cratliff
Copy link
Contributor Author

Added the beta warning and fixed the conflict.

@sergiusens sergiusens added this to the 2.36 milestone Oct 26, 2017
self.build_packages.extend(['python-catkin-tools'])

# Beta Warning
# Remove this comment and warning once ruby plugin is stable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the comment here-- still says "ruby" 😛 .

Copy link
Contributor

@kyrofa kyrofa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo in the beta warning comment, but overall +1 from me.

@kyrofa
Copy link
Contributor

kyrofa commented Nov 14, 2017

Sorry for the delay @cratliff, our testing infra fell over and we're trying to get a release out the door. As soon as that happens stuff can start landing again.

@sergiusens sergiusens merged commit 7e31fa0 into canonical:master Nov 17, 2017
come-maiz pushed a commit to come-maiz/snapcraft that referenced this pull request Nov 21, 2017
Adding suppot for catkin tools.  Initially the only difference is
the build is being performed by catkin tools instead of catkin_make,
while all other function inherits from catkin_make.

LP: #1693380
matiasb pushed a commit to matiasb/snapcraft that referenced this pull request Nov 24, 2017
Adding suppot for catkin tools.  Initially the only difference is
the build is being performed by catkin tools instead of catkin_make,
while all other function inherits from catkin_make.

LP: #1693380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
17.10
Robotics
Development

Successfully merging this pull request may close these issues.

None yet

4 participants