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

do not restrict version range when probing --modversion #151

Closed
wants to merge 1 commit into from

Conversation

selfisekai
Copy link

this should fix the crate with a pkgconf 2.0.0 breaking change (closes #150)

this should fix the crate with a pkgconf 2.0.0 breaking change
@ptrcnull
Copy link

ptrcnull commented Aug 4, 2023

moved my comment from the commit into here:

wouldn't it be better to omit the first name with modversion? the main issue is that it's printing the same name twice, former without any constraint, latter with one; it would be useful to still keep the constraint, just... not put the same package name twice

@ptrcnull
Copy link

ptrcnull commented Aug 4, 2023

with some experimenting, i feel like this should be enough:

--- a/src/lib.rs
+++ b/src/lib.rs
@@ -499,7 +499,9 @@ impl Config {
         if self.print_system_cflags {
             cmd.env("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS", "1");
         }
-        cmd.arg(name);
+        if self.min_version == Bound::Unbounded && self.max_version == Bound::Unbounded {
+            cmd.arg(name);
+        }
         match self.min_version {
             Bound::Included(ref version) => {
                 cmd.arg(&format!("{} >= {}", name, version));

edit: nevermind, this still fails when both bounds are provided, but you get what i mean

@selfisekai
Copy link
Author

when running Config::probe, it first executes --libs --cflags first, where these bounds are checked by pkgconf without a problem, and only then checks --modversion. if they're not met, an error is already returned earlier. I think this covers the whole public API. another question is whether this can introduce some quirks with multiple library versions available? but that's an edge case I think we might not have in alpine.

@ptrcnull
Copy link

ptrcnull commented Aug 4, 2023

another question is whether this can introduce some quirks with multiple library versions available?

both pkgconf and pkg-config seem to handle it by returning the first one from their search path:

$ rg '^Version' /usr/local/lib/pkgconfig/dbus-1.pc
18:Version: 1.15.8
$ rg '^Version' /usr/lib/pkgconfig/dbus-1.pc      
18:Version: 1.14.8
$ pkg-config --modversion dbus-1
1.15.8
$ pkg-config --modversion 'dbus-1 < 1.15'
Package dependency requirement 'dbus-1 < 1.15' could not be satisfied.
Package 'dbus-1' has version '1.15.8', required version is '< 1.15'
root@a32a659efc83:/# grep Version /usr/lib/x86_64-linux-gnu/pkgconfig/dbus-1.pc 
Version: 1.12.16
root@a32a659efc83:/# grep Version /usr/local/lib/pkgconfig/dbus-1.pc
Version: 1.13.0
root@a32a659efc83:/# pkg-config --modversion dbus-1
1.13.0
root@a32a659efc83:/# pkg-config --modversion 'dbus-1 < 1.13'
Requested 'dbus-1 < 1.13' but version of dbus is 1.13.0

@sdroege
Copy link
Collaborator

sdroege commented Aug 8, 2023

It seems like this is considered a bug in pkgconf, so maybe let's just wait until it's fixed there instead of adding a complicated workaround here.

@selfisekai
Copy link
Author

@selfisekai selfisekai closed this Aug 11, 2023
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.

fails with pkgconf 2.0.0 breaking changes
3 participants