summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2006-12-01 16:17:04 +0000
committerMarc Espie <espie@cvs.openbsd.org>2006-12-01 16:17:04 +0000
commita66448ed11b2f3fb46ae2bf1385cf042f09ac4ce (patch)
tree9c63d2dadfe23a80588a49ebed5cd510af82f82e /usr.sbin/pkg_add/OpenBSD
parent97df163c6c94c9a0e91b045e63342498ae8169a6 (diff)
Fixes parsing of variables/delimiters, so that we classify like pkgconfig.
Augment the Requires parser to deal correctly with comparisons.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgConfig.pm19
1 files changed, 14 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm b/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm
index 8cc5b0d4a98..7bbafd55b66 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgConfig.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PkgConfig.pm,v 1.6 2006/11/30 13:18:22 espie Exp $
+# $OpenBSD: PkgConfig.pm,v 1.7 2006/12/01 16:17:03 espie Exp $
#
# Copyright (c) 2006 Marc Espie <espie@openbsd.org>
#
@@ -23,13 +23,22 @@ package OpenBSD::PkgConfig;
# specific properties may have specific needs.
my $parse = {
- Requires => sub { [split /[,\s]\s*/, shift ] }
+ Requires => sub {
+ [split qr{
+ (?<![<=>]) # not preceded by <=>
+ [,\s]+ # delimiter
+ (?![<=>]) # not followed by <=>
+ }x, shift ] }
};
+
my $write = {
Libs => sub { " ".__PACKAGE__->compress(shift) }
};
+$parse->{'Requires.private'} = $parse->{Requires};
+$write->{'Libs.private'} = $write->{Libs};
+
sub new
{
my $class = shift;
@@ -83,11 +92,11 @@ sub read_fh
chomp;
next if m/^\s*$/;
next if m/^\#/;
- if (m/^(.*?)\=\s*(.*)$/) {
+ if (m/^([\w.]*)\=\s*(.*)$/) {
$cfg->add_variable($1, $2);
- } elsif (m/^(.*?)\:\s+(.*)$/) {
+ } elsif (m/^([\w.]*)\:\s+(.*)$/) {
$cfg->add_property($1, $2);
- } elsif (m/^(.*?)\:\s*$/) {
+ } elsif (m/^([\w.]*)\:\s*$/) {
$cfg->add_property($1);
} else {
die "Incorrect cfg file $name";