summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackingList.pm
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-11-09 10:30:27 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-11-09 10:30:27 +0000
commit1a1e459e8fbaa0eabab65e957d9cb7986693c4cb (patch)
treea0837cbccffd1b742375f5caf2fb496df1154f55 /usr.sbin/pkg_add/OpenBSD/PackingList.pm
parent0d54b6753087a536e4886327faab98283098e9a4 (diff)
avoid scanning the whole packing-list when looking for info that are
at the top anyways: recent packages have arch markers, and are in `normal order'. First cwd we meet, we're out. (speeds up the scanning of conflicts by 4 or 5).
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackingList.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm24
1 files changed, 23 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index a6b6e60bb49..9532dbd0de7 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingList.pm,v 1.30 2004/10/26 17:25:36 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.31 2004/11/09 10:30:26 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -102,6 +102,17 @@ sub DependOnly
my ($fh, $cont) = @_;
local $_;
while (<$fh>) {
+ # XXX optimization
+ if (m/^\@arch\b/) {
+ while (<$fh>) {
+ if (m/^\@(?:pkgdep|newdepend|libdepend)\b/) {
+ &$cont($_);
+ } elsif (m/^\@(?:groups|users|cwd)\b/) {
+ last;
+ }
+ }
+ return;
+ }
next unless m/^\@(?:pkgdep|newdepend|libdepend)\b/;
&$cont($_);
}
@@ -112,6 +123,17 @@ sub ConflictOnly
my ($fh, $cont) = @_;
local $_;
while (<$fh>) {
+ # XXX optimization
+ if (m/^\@arch\b/) {
+ while (<$fh>) {
+ if (m/^\@(?:pkgcfl|conflict|option|name)\b/) {
+ &$cont($_);
+ } elsif (m/^\@(?:pkgdep|newdepend|libdepend|groups|users|cwd)\b/) {
+ last;
+ }
+ }
+ return;
+ }
next unless m/^\@(?:pkgcfl|conflict|option|name)\b/;
&$cont($_);
}