Hello tech@,
On the 6 Aug snap I ran into this issue:
$ pkg_info | grep libevent
libevent-2.0.22 event notification library
$ pkg-config --atleast-version=2.0.1 libevent && echo yes
Argument "22-stabl" isn't numeric in numeric eq (==) at /usr/bin/pkg-config
line 662.
yes
So it works but spits out that error. The issue is that the libevent
port reports its version as 2.0.22-stable, which does not follow the
convention used by the compare() sub in pkg-config. The attached
patch gets rid of the error albeit in a very pointilistic way; perhaps
a more general solution is desired, but I'm not sure what the best
approach is, especially given that there is something called
pkg-config available pretty much everywhere but based on very
different implementations...
It doesn't appear as though my patch introduces any regressions,
although I'm still sussing out how the regression tests work so I'm
not sure if I'm doing anything wrong... it appears that five of
pkg-config's regression tests fail regardless of my patch:
FAIL usr.bin/pkg-config/static-cflags2
FAIL usr.bin/pkg-config/static-libs2
FAIL usr.bin/pkg-config/static-libs3
FAIL usr.bin/pkg-config/static-libs4
FAIL usr.bin/pkg-config/missing-req-2
In all cases it looks like the difference is ordering, except for the
last where two errors are produced but only one is expected. I'll
work on a patch to fix these failures next.
Feedback, comments most welcome.
Pax, -A
--
http://trac.haqistan.net | [email protected] | 0xE6CC1EDB
Index: pkg-config
===================================================================
RCS file: /cvs/src/usr.bin/pkg-config/pkg-config,v
retrieving revision 1.85
diff -u -p -r1.85 pkg-config
--- pkg-config 17 Nov 2014 22:16:23 -0000 1.85
+++ pkg-config 11 Aug 2015 17:53:24 -0000
@@ -625,16 +625,16 @@ sub compare
# is there a valid non-numeric suffix to deal with later?
# accepted are (in order): a(lpha) < b(eta) < rc < ' '.
# suffix[0] is the 'alpha' part, suffix[1] is the '1' part in 'alpha1'.
- if ($a =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
- say_debug("valid suffix $1$2 found in $a$1$2.");
- $suffix_a[0] = $1;
- $suffix_a[1] = $2;
+ if ($a =~ s/(|-)(stable|rc|beta|b|alpha|a)(|\d+)$//) {
+ say_debug("valid suffix $2$3 found in $a$2$3.");
+ $suffix_a[0] = $2;
+ $suffix_a[1] = $3;
}
- if ($b =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
- say_debug("valid suffix $1$2 found in $b$1$2.");
- $suffix_b[0] = $1;
- $suffix_b[1] = $2;
+ if ($b =~ s/(|-)(stable|rc|beta|b|alpha|a)(|\d+)$//) {
+ say_debug("valid suffix $2$3 found in $b$2$3.");
+ $suffix_b[0] = $2;
+ $suffix_b[1] = $3;
}
# The above are standard suffixes; deal with single alphabetical