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

homebrew: accept keg-only packages as installed #799

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HesselM
Copy link

@HesselM HesselM commented Jan 30, 2021

fixes #764 #513 #490 (and others)

As suggested by @NikolausDemmel in his comment :

The issue is that qt5 is keg-only and rosdep marks it as "not installed", when it in fact, it is installed yet not symlinked as mentioned by brew during (re)installation:

==> Reinstalling qt 
==> Pouring qt-5.15.2.catalina.bottle.tar.gz
==> Caveats
We agreed to the Qt open source license for you.
If this is unacceptable you should uninstall.

qt is keg-only, which means it was not symlinked into /usr/local,
because Qt 5 has CMake issues when linked.

If you need to have qt first in your PATH, run:
  echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> /Users/Electroozz/.bash_profile

For compilers to find qt you may need to set:
  export LDFLAGS="-L/usr/local/opt/qt/lib"
  export CPPFLAGS="-I/usr/local/opt/qt/include"

For pkg-config to find qt you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/qt/lib/pkgconfig"

As a result, Rosdep fails:

$ rosdep install -i --from-path src --rosdistro foxy -y
executing command [brew install qt5]
Warning: qt 5.15.2 is already installed and up-to-date.
To reinstall 5.15.2, run:
  brew reinstall qt
ERROR: the following rosdeps failed to install
  homebrew: Failed to detect successful installation of [qt5]

By checking if a package is keg-only when no linked keg is found, packages like Qt are accepted and rosdep finished clean.

@codecov-io
Copy link

Codecov Report

Merging #799 (5d2fe81) into master (d6c44cb) will decrease coverage by 0.06%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #799      +/-   ##
==========================================
- Coverage   74.93%   74.87%   -0.07%     
==========================================
  Files          42       42              
  Lines        3280     3283       +3     
==========================================
  Hits         2458     2458              
- Misses        822      825       +3     
Impacted Files Coverage Δ
src/rosdep2/platforms/osx.py 51.08% <0.00%> (-0.85%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6c44cb...5d2fe81. Read the comment docs.

@nuclearsandwich
Copy link
Contributor

@HesselM thanks for opening this PR and proposing changes to improve the situation with homebrew. My main concern with the change as proposed is keg-only dependencies will require additional setup to be usable and rosdep may mask that fact by reporting keg-only packages as installed.

I think we definitely need keg-only packages to be recognized as installed but does it make sense to print an info message when a dependency is found as keg-only?

@wjwwood
Copy link
Contributor

wjwwood commented Jul 1, 2021

I think it's important to have some notice to the user that the formula is keg-only and that rosdep hasn't resolved that issue, but maybe the caveat output of Homebrew during the rosdep install is sufficient?

I don't feel strongly about it.

Copy link
Contributor

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm once the conceptual question is resolved.

@scpeters
Copy link

scpeters commented Jul 2, 2021

I think it's important to have some notice to the user that the formula is keg-only and that rosdep hasn't resolved that issue, but maybe the caveat output of Homebrew during the rosdep install is sufficient?

I don't feel strongly about it.

Using keg-only formulae often requires adding some extra paths to environment variables (see this bit of code from the scripts for build.osrfoundation.org for an example). I was going to suggest the caveats printed by Homebrew as well, which can be viewed with brew info:

$ brew info qt@5
qt@5: stable 5.15.2 (bottled) [keg-only]
Cross-platform application and UI framework
https://www.qt.io/
...
==> Caveats
We agreed to the Qt open source license for you.
If this is unacceptable you should uninstall.

qt@5 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have qt@5 first in your PATH, run:
  echo 'export PATH="/usr/local/opt/qt@5/bin:$PATH"' >> /Users/scpeters/.bash_profile

For compilers to find qt@5 you may need to set:
  export LDFLAGS="-L/usr/local/opt/qt@5/lib"
  export CPPFLAGS="-I/usr/local/opt/qt@5/include"

For pkg-config to find qt@5 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/qt@5/lib/pkgconfig"

return False
keg_only = pkg_info['keg_only']
if keg_only:
return True
Copy link

Choose a reason for hiding this comment

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

I think this code will return True for any keg-only formula, even if it's not actually installed. Do you want to use the installed field instead?

note that the caveats field in the json does not match the full output printed by brew info. I believe running brew ruby -e 'require "caveats"; puts Caveats.new("qt@5".f).keg_only_text' can generate the full caveats string

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

Successfully merging this pull request may close these issues.

I have a problem using rosdep install command
5 participants