Re: [PATCH] add support for versions with '-' before a/b/rc

2019-12-13 Thread Marc Espie
On Fri, Dec 13, 2019 at 02:19:26PM +0100, Matija Skala wrote:
> Dne petek, 13. december 2019 ob 13:34:57 CET je Marc Espie napisal(a):
> > On Fri, Dec 13, 2019 at 08:45:08AM +0100, Jasper Lievisse Adriaanse wrote:
> > > Hello Matija,
> > >
> > > Could you please provide a testcase for inclusion in
> > > src/regress/usr.bin/pkg-config too? Also, is there a particular port or
> > > pkg-config file in the wild that you ran into which exhibits this
> > > particular pattern?
> > I'm going to ask more strongly: is this something that mainstream pkg-config
> > does ?
> pkgconf does do this. Not sure about pkg-config
> >
> > Also, pedantically, the change is wrong.  You should always quote non-alpha
> > characters when they stand for themselves. Yes, that includes \-
> >
> Right, here a new patch
> diff --git a/regress/usr.bin/pkg-config/pcdir/alpha2.pc b/regress/usr.bin/pkg-
> config/pcdir/alpha2.pc
> new file mode 100644
> index 0..7958d3717
> --- /dev/null
> +++ b/regress/usr.bin/pkg-config/pcdir/alpha2.pc
> @@ -0,0 +1,4 @@
> +Name: alpha suffix test
> +Description: pkg-config(1) regress file
> +Version: 0.1.0-alpha2
> +Libs: -lalpha2
> diff --git a/regress/usr.bin/pkg-config/pcdir/beta2.pc b/regress/usr.bin/pkg-
> config/pcdir/beta2.pc
> new file mode 100644
> index 0..cc1959848
> --- /dev/null
> +++ b/regress/usr.bin/pkg-config/pcdir/beta2.pc
> @@ -0,0 +1,3 @@
> +Name: beta suffix test
> +Description: pkg-config(1) regress file
> +Version: 0.1.0-beta2
> diff --git a/regress/usr.bin/pkg-config/pcdir/rc2.pc b/regress/usr.bin/pkg-
> config/pcdir/rc2.pc
> new file mode 100644
> index 0..499242745
> --- /dev/null
> +++ b/regress/usr.bin/pkg-config/pcdir/rc2.pc
> @@ -0,0 +1,3 @@
> +Name: rc suffix test
> +Description: pkg-config(1) regress file
> +Version: 0.1.0-rc2
> diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config
> index c1aab9576..1102696af 100644
> --- a/usr.bin/pkg-config/pkg-config
> +++ b/usr.bin/pkg-config/pkg-config
> @@ -674,13 +674,13 @@ 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+)$//) {
> + 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 ($b =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
> + 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;
> 
> 
> 
> 
Fair enough. I'm okay with it then.



Re: [PATCH] add support for versions with '-' before a/b/rc

2019-12-13 Thread Matija Skala
Dne petek, 13. december 2019 ob 13:34:57 CET je Marc Espie napisal(a):
> On Fri, Dec 13, 2019 at 08:45:08AM +0100, Jasper Lievisse Adriaanse wrote:
> > Hello Matija,
> >
> > Could you please provide a testcase for inclusion in
> > src/regress/usr.bin/pkg-config too? Also, is there a particular port or
> > pkg-config file in the wild that you ran into which exhibits this
> > particular pattern?
> I'm going to ask more strongly: is this something that mainstream pkg-config
> does ?
pkgconf does do this. Not sure about pkg-config
>
> Also, pedantically, the change is wrong.  You should always quote non-alpha
> characters when they stand for themselves. Yes, that includes \-
>
Right, here a new patch
diff --git a/regress/usr.bin/pkg-config/pcdir/alpha2.pc b/regress/usr.bin/pkg-
config/pcdir/alpha2.pc
new file mode 100644
index 0..7958d3717
--- /dev/null
+++ b/regress/usr.bin/pkg-config/pcdir/alpha2.pc
@@ -0,0 +1,4 @@
+Name: alpha suffix test
+Description: pkg-config(1) regress file
+Version: 0.1.0-alpha2
+Libs: -lalpha2
diff --git a/regress/usr.bin/pkg-config/pcdir/beta2.pc b/regress/usr.bin/pkg-
config/pcdir/beta2.pc
new file mode 100644
index 0..cc1959848
--- /dev/null
+++ b/regress/usr.bin/pkg-config/pcdir/beta2.pc
@@ -0,0 +1,3 @@
+Name: beta suffix test
+Description: pkg-config(1) regress file
+Version: 0.1.0-beta2
diff --git a/regress/usr.bin/pkg-config/pcdir/rc2.pc b/regress/usr.bin/pkg-
config/pcdir/rc2.pc
new file mode 100644
index 0..499242745
--- /dev/null
+++ b/regress/usr.bin/pkg-config/pcdir/rc2.pc
@@ -0,0 +1,3 @@
+Name: rc suffix test
+Description: pkg-config(1) regress file
+Version: 0.1.0-rc2
diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config
index c1aab9576..1102696af 100644
--- a/usr.bin/pkg-config/pkg-config
+++ b/usr.bin/pkg-config/pkg-config
@@ -674,13 +674,13 @@ 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+)$//) {
+   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 ($b =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
+   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;





Re: [PATCH] add support for versions with '-' before a/b/rc

2019-12-13 Thread Marc Espie
On Fri, Dec 13, 2019 at 08:45:08AM +0100, Jasper Lievisse Adriaanse wrote:
> Hello Matija,
> 
> Could you please provide a testcase for inclusion in 
> src/regress/usr.bin/pkg-config too?
> Also, is there a particular port or pkg-config file in the wild that you ran 
> into which exhibits this particular pattern?

I'm going to ask more strongly: is this something that mainstream pkg-config
does ?

Also, pedantically, the change is wrong.  You should always quote non-alpha
characters when they stand for themselves. Yes, that includes \-

> > On 12 Dec 2019, at 18:28, Matija Skala  wrote:
> > 
> > From fa66eb42d0bd2fec7b364644684e6a4cc9ae9baa Mon Sep 17 00:00:00 2001
> > From: Matija Skala 
> > Date: Thu, 28 Nov 2019 19:24:42 +0100
> > Subject: [PATCH] add support for versions with '-' before a/b/rc
> > 
> > ---
> > usr.bin/pkg-config/pkg-config | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config
> > index 6dfbd3224eb..c050e9b058e 100644
> > --- a/usr.bin/pkg-config/pkg-config
> > +++ b/usr.bin/pkg-config/pkg-config
> > @@ -674,13 +674,13 @@ 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+)$//) {
> > +   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 ($b =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
> > +   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;
> > 
> > 
> 
> 



Re: [PATCH] add support for versions with '-' before a/b/rc

2019-12-13 Thread Matija Skala
> Could you please provide a testcase for inclusion in
> src/regress/usr.bin/pkg-config too?

diff --git a/regress/usr.bin/pkg-config/pcdir/minusrc.pc b/regress/usr.bin/pkg-
config/pcdir/minusrc.pc
new file mode 100644
index 000..5bde7da0b44
--- /dev/null
+++ b/regress/usr.bin/pkg-config/pcdir/minusrc.pc
@@ -0,0 +1,3 @@
+Name: minusrc suffix test
+Description: pkg-config(1) regress file
+Version: 0.1.0-rc2


> Also, is there a particular port or
> pkg-config file in the wild that you ran into which exhibits this
> particular pattern?

pkg-config file of libffi 3.3rc0 has 'Version: 3.3-rc0'





Re: [PATCH] add support for versions with '-' before a/b/rc

2019-12-12 Thread Jasper Lievisse Adriaanse
Hello Matija,

Could you please provide a testcase for inclusion in 
src/regress/usr.bin/pkg-config too?
Also, is there a particular port or pkg-config file in the wild that you ran 
into which exhibits this particular pattern?

Cheers,
Jasper

> On 12 Dec 2019, at 18:28, Matija Skala  wrote:
> 
> From fa66eb42d0bd2fec7b364644684e6a4cc9ae9baa Mon Sep 17 00:00:00 2001
> From: Matija Skala 
> Date: Thu, 28 Nov 2019 19:24:42 +0100
> Subject: [PATCH] add support for versions with '-' before a/b/rc
> 
> ---
> usr.bin/pkg-config/pkg-config | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config
> index 6dfbd3224eb..c050e9b058e 100644
> --- a/usr.bin/pkg-config/pkg-config
> +++ b/usr.bin/pkg-config/pkg-config
> @@ -674,13 +674,13 @@ 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+)$//) {
> + 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 ($b =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
> + 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;
> 
> 



[PATCH] add support for versions with '-' before a/b/rc

2019-12-12 Thread Matija Skala
From fa66eb42d0bd2fec7b364644684e6a4cc9ae9baa Mon Sep 17 00:00:00 2001
From: Matija Skala 
Date: Thu, 28 Nov 2019 19:24:42 +0100
Subject: [PATCH] add support for versions with '-' before a/b/rc

---
 usr.bin/pkg-config/pkg-config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr.bin/pkg-config/pkg-config b/usr.bin/pkg-config/pkg-config
index 6dfbd3224eb..c050e9b058e 100644
--- a/usr.bin/pkg-config/pkg-config
+++ b/usr.bin/pkg-config/pkg-config
@@ -674,13 +674,13 @@ 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+)$//) {
+   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 ($b =~ s/(rc|beta|b|alpha|a)(\d+)$//) {
+   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;