diff options
author | 2009-06-06 10:53:38 +0000 | |
---|---|---|
committer | 2009-06-06 10:53:38 +0000 | |
commit | be704137cf5f75a9adbe1b313abe7e92232f96cd (patch) | |
tree | a69aabeb6a9d33d37c1232dd4ccadd06c25f5cb5 | |
parent | my $_, except for the server code, which could still run on older perl (diff) | |
download | wireguard-openbsd-be704137cf5f75a9adbe1b313abe7e92232f96cd.tar.xz wireguard-openbsd-be704137cf5f75a9adbe1b313abe7e92232f96cd.zip |
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.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCfl.pm | 10 |
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; |