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

Properly respect DESTDIR in the build env. #240

Merged
merged 2 commits into from
Dec 9, 2015

Conversation

mikepurvis
Copy link
Member

The method is to explicitly inject _CATKIN_SETUP_DIR into the generated build_env.sh environment wrapper, allowing the build to proceed even when the installspace at build-time is not in its final runtime location.

I'm open to suggestions for what tests could validate the behaviour here— the main scenario where it comes into play is when building two packages, one of which find_packages the other. With DESTDIR specified, the build_env of the second package will have CMAKE_PREFIX_PATH set incorrectly, and the find_package call will fail. Perhaps there's room for a new type of test to be added which covers interactions between multiple packages in a workspace?

This is a follow-on to #238, addressing #235.

The method is to inject _CATKIN_SETUP_DIR into the generated
build_env.sh environment wrapper, allowing the build to proceed
even when the installspace at build-time is not in its final
runtime location.
@mikepurvis
Copy link
Member Author

Tried a few other build configurations, corrected an issue with building against isolated develspaces.

# Intentionally not using os.path.join in this instance, as it's expected that
# when DESTDIR is specified, the install space is an absolute path, so a straight
# concatenation is more suitable than os.path.join.
space_path = context.destdir + context.install_space_abs
Copy link
Member

Choose a reason for hiding this comment

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

A better explanation (in my opinion) is that since the install space is absolute (and it always is, not just when used in conjunction with DESTDIR), os.path.join will not return the concatenation but rather just the install space. It's not that this is more suitable than os.path.join (which to me implies os.path.join would also work) but instead that os.path.join doesn't work at all and therefore this is necessary, e.g.:

>>> import os
>>> a = '/tmp/build/'
>>> b = '/usr'
>>> os.path.join(a, b)
'/usr'
>>> a = '/tmp/build'
>>> os.path.join(a, b)
'/usr'

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that was the reason, and you're right it should say so. I just didn't want it to become a novel. I can try again, or switch it to do what catkin does. What's your preference?

Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine. I might update the comment on merge.

Copy link
Member

Choose a reason for hiding this comment

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

I updated it in 72c5f3e, let me know if you think that's incorrect.

@wjwwood
Copy link
Member

wjwwood commented Dec 9, 2015

Other than a comment about a comment (so meta) this lgtm. It seems to line up well as the equivalent to ros/catkin@7282a4b which made catkin_make_isolated support DESTDIR.

@wjwwood
Copy link
Member

wjwwood commented Dec 9, 2015

Since you're using catkin build in conjunction with DESTDIR, and I just ran this pr through some common uses of catkin build and didn't see any problems, I'm going to merge this now and check off the DESTDIR item from #90.

wjwwood added a commit that referenced this pull request Dec 9, 2015
Properly respect DESTDIR in the build env.
@wjwwood wjwwood merged commit 8bb45db into catkin:master Dec 9, 2015
@mikepurvis
Copy link
Member Author

Sweet, thanks for the quick review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants