summaryrefslogtreecommitdiff
path: root/usr.bin/pkg-config
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2018-05-18 17:01:58 +0000
committerMarc Espie <espie@cvs.openbsd.org>2018-05-18 17:01:58 +0000
commitd8bf634149843891e2fe83e778c97d04f0da7a20 (patch)
tree71f8d2eab113bf3a1a056afdeaa75d76ab115610 /usr.bin/pkg-config
parent53648ee51bc065786202c2dba46dd1da64153177 (diff)
negative assertions only work well on constant-width regexp, do things
the hard way: cut on space, THEN coalesce stuff wrt <=> signs. okay jasper@, aja@
Diffstat (limited to 'usr.bin/pkg-config')
-rw-r--r--usr.bin/pkg-config/OpenBSD/PkgConfig.pm25
1 files changed, 19 insertions, 6 deletions
diff --git a/usr.bin/pkg-config/OpenBSD/PkgConfig.pm b/usr.bin/pkg-config/OpenBSD/PkgConfig.pm
index 6b4791335e9..3a7f7efbffe 100644
--- a/usr.bin/pkg-config/OpenBSD/PkgConfig.pm
+++ b/usr.bin/pkg-config/OpenBSD/PkgConfig.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PkgConfig.pm,v 1.6 2015/10/26 18:08:44 jasper Exp $
+# $OpenBSD: PkgConfig.pm,v 1.7 2018/05/18 17:01:57 espie Exp $
#
# Copyright (c) 2006 Marc Espie <espie@openbsd.org>
#
@@ -24,11 +24,24 @@ package OpenBSD::PkgConfig;
my $parse = {
Requires => sub {
- [split qr{
- (?<![<=>]) # not preceded by <=>
- [,\s]+ # delimiter
- (?![<=>]) # not followed by <=>
- }x, shift ] }
+ my @l = split(/[,\s]+/, shift);
+ my @r = ();
+ while (@l > 0) {
+ my $n = shift @l;
+ if ($n =~ m/[<=>]+$/) {
+ if (@l > 0) {
+ $n .= shift @l;
+ }
+ }
+ if ($n =~ m/^[<=>]+/) {
+ if (@r > 0) {
+ $n = (pop @r).$n;
+ }
+ }
+ push(@r, $n);
+ }
+ return \@r;
+ },
};