summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-06-06 10:53:39 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-06-06 10:53:39 +0000
commit734413c2b07eae469a0157e2ac6bc8c40c31366c (patch)
tree9525815b166eb286fa476803f27d1975007eb54c /usr.sbin
parent5e708ee26a2dad9857869b1d3172fba91a21e210 (diff)
quick path for pkg cfl: check whether the new package conflicts with
installed stuff first. If that's the case, and we're not in replacement mode, we don't really need to scan all the installed packages.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCfl.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm
index 4135c003564..70d3e76ef9e 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCfl.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCfl.pm,v 1.26 2009/04/19 14:58:32 espie Exp $
+# $OpenBSD: PkgCfl.pm,v 1.27 2009/06/06 10:53:38 espie Exp $
#
# Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org>
#
@@ -115,10 +115,14 @@ sub find_all
my $l = OpenBSD::PkgCfl->make_conflict_list($plist);
$plist->{conflicts} = $l;
+ my @first = $l->conflicts_with(installed_packages());
+ # XXX optimization
+ if (@first > 0 && !$state->{allow_replacing}) {
+ return @first;
+ }
my @conflicts = find($pkgname, $state);
- push(@conflicts, $l->conflicts_with(installed_packages()));
- return @conflicts;
+ return (@conflicts, @first);
}
1;