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

Check for, and prefer, pkgconf when looking for pkg-config #8551

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dcbaker
Copy link
Member

@dcbaker dcbaker commented Mar 17, 2021

Some distros (debian and nix) provide pkg-config and pkgconf, but don't link pkgconf to pkg-config. Others do link pkg-config to pkgconf (arch). pkgconf is just better than pkg-config is pretty much every way, so we should prefer pkgconf if it's installed. Right now we don't even search for pkgconf.

This series fixes that, and also centralizes the names to look for in a single place.

@dcbaker dcbaker requested a review from jpakkane as a code owner March 17, 2021 18:25
Copy link
Member

@xclaesse xclaesse left a comment

Choose a reason for hiding this comment

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

Small nitpicking. Other than that, LGTM.

docs/markdown/snippets/prefer_pkgconf.md Outdated Show resolved Hide resolved
docs/markdown/snippets/prefer_pkgconf.md Outdated Show resolved Hide resolved
@xclaesse
Copy link
Member

@dcbaker At least on Ubuntu pkgconf package conflicts with pkg-config, so you can install only one of them. And if you install pkgconf you get a symlink /usr/bin/pkg-config -> pkgconf

@dcbaker
Copy link
Member Author

dcbaker commented Mar 17, 2021

Nix at least allows you to install both simultaneously and doesn't create a symlink, I'm sure Gentoo does the same.

@dcbaker dcbaker force-pushed the submit/use-pkgconf branch 3 times, most recently from 4d330aa to 07b2dca Compare March 22, 2021 17:22
@jpakkane
Copy link
Member

That test failure is suspicious as it only happens on this MR.

@lgtm-com
Copy link

lgtm-com bot commented Jul 20, 2022

This pull request introduces 2 alerts when merging d39e74d into 5f3c712 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Module is imported with 'import' and 'import from'

@codecov
Copy link

codecov bot commented Jul 20, 2022

Codecov Report

Merging #8551 (063b030) into master (5f3c712) will decrease coverage by 1.48%.
The diff coverage is n/a.

❗ Current head 063b030 differs from pull request most recent head 4b78bff. Consider uploading reports for the commit 4b78bff to get more accurate results

@@            Coverage Diff             @@
##           master    #8551      +/-   ##
==========================================
- Coverage   68.82%   67.33%   -1.49%     
==========================================
  Files         406      203     -203     
  Lines       88020    44019   -44001     
  Branches    19550     9775    -9775     
==========================================
- Hits        60580    29641   -30939     
+ Misses      22868    12125   -10743     
+ Partials     4572     2253    -2319     
Impacted Files Coverage Δ
modules/unstable_cuda.py 0.00% <0.00%> (-72.64%) ⬇️
templates/cudatemplates.py 37.50% <0.00%> (-62.50%) ⬇️
compilers/cuda.py 19.63% <0.00%> (-45.40%) ⬇️
dependencies/cuda.py 20.19% <0.00%> (-42.79%) ⬇️
compilers/detect.py 41.95% <0.00%> (-4.45%) ⬇️
linkers/linkers.py 56.36% <0.00%> (-1.22%) ⬇️
environment.py 78.98% <0.00%> (-1.07%) ⬇️
dependencies/misc.py 44.44% <0.00%> (-0.75%) ⬇️
compilers/compilers.py 82.20% <0.00%> (-0.47%) ⬇️
mesonlib/universal.py 74.69% <0.00%> (-0.31%) ⬇️
... and 204 more

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 5f3c712...4b78bff. Read the comment docs.

Rather than a big complicated set of monkey patches (that don't use
mock) a single mock patch that simply sets `ExternalProgram.found()` to
always return False will suffice.
@lgtm-com
Copy link

lgtm-com bot commented Jul 20, 2022

This pull request introduces 1 alert when merging 0880f3b into 5f3c712 - view on LGTM.com

new alerts:

  • 1 for Module is imported with 'import' and 'import from'

if shutil.which('pkg-config'):
if not shutil.which('sdl2-config'):
self.assertMesonRaises("dependency('sdl2', method : 'sdlconfig')", self.dnf)
if not shutil.which('pkg-config'):
Copy link
Member

Choose a reason for hiding this comment

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

So... Apparently this was always broken? This deserves a call-out in the commit message.

Copy link
Member Author

Choose a reason for hiding this comment

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

Does the revised commit message look better?

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I was thinking about the fact that this test only passes if sdl2-config skips... because if it gets to the pkg-config check, it only runs when pkg-config is found, and then it asserts that the dependency must not be found, which seems... confusing.

docs/markdown/snippets/prefer_pkgconf.md Outdated Show resolved Hide resolved
The test is currently all but useless because it skips completely if
`sdl-config` is found in $PATH. There are other pieces of the test,
however, than can still be run even if `sdl-config` is found, and only
that portion should be skipped.
This also means that we'll detect pkgconf by default, which we currently
don't.
@lgtm-com
Copy link

lgtm-com bot commented Jul 22, 2022

This pull request introduces 1 alert when merging 4b78bff into ec388fe - view on LGTM.com

new alerts:

  • 1 for Module is imported with 'import' and 'import from'

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.

None yet

5 participants