summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-12-15 01:07:11 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-12-15 01:07:11 +0000
commitf3f52f34475ca68bce3bf9aad3faad77e24288fd (patch)
tree540cdc7e81d84736ac82648831a8ba98f712e7d3 /usr.sbin
parent9ea4df7bae6083bb81d9ca10483553659eee4a6b (diff)
move -n down into RequiredBy and PackingList (as $main::not, since we
don't want to load RequiredBy all the time). Remove a few $state->{not} tests that are no longer needed. pkg_add -n / pkg_delete -n should work much better when they need to handle multiple dependencies. (todo: kill plist caches, finish replacing with specialized caches like libraries).
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingList.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/RequiredBy.pm4
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm3
-rw-r--r--usr.sbin/pkg_add/pkg_add22
-rw-r--r--usr.sbin/pkg_add/pkg_delete4
6 files changed, 25 insertions, 18 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index 8c713d5051f..19ac1bd56a6 100644
--- a/usr.sbin/pkg_add/OpenBSD/Delete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.15 2004/12/12 11:26:16 espie Exp $
+# $OpenBSD: Delete.pm,v 1.16 2004/12/15 01:07:10 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -135,7 +135,7 @@ sub delete_plist
if $state->{very_verbose} or $state->{not};
local $@;
try {
- OpenBSD::RequiredBy->new($name)->delete($pkgname) unless $state->{not};
+ OpenBSD::RequiredBy->new($name)->delete($pkgname);
} catchall {
print STDERR "$_\n";
};
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm
index 000abf5b9ff..6c6f8a42758 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.41 2004/11/18 21:46:07 espie Exp $
+# $OpenBSD: PackingList.pm,v 1.42 2004/12/15 01:07:10 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -366,8 +366,10 @@ sub to_installation
require OpenBSD::PackageInfo;
- $self->tofile(OpenBSD::PackageInfo::installed_contents($self->pkgname()));
$self->to_cache();
+ return if $main::not;
+
+ $self->tofile(OpenBSD::PackageInfo::installed_contents($self->pkgname()));
}
diff --git a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm
index bb13d269e88..e2b574e7794 100644
--- a/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm
+++ b/usr.sbin/pkg_add/OpenBSD/RequiredBy.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: RequiredBy.pm,v 1.6 2004/12/14 12:22:47 espie Exp $
+# $OpenBSD: RequiredBy.pm,v 1.7 2004/12/15 01:07:10 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -50,6 +50,8 @@ sub fill_entries($)
sub synch
{
my $self = shift;
+ return if $main::not;
+
if (!unlink $self->{filename}) {
if ($self->{nonempty}) {
die "Can't erase $self->{filename}: $!";
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index 802956e522f..9da4bba7e38 100644
--- a/usr.sbin/pkg_add/OpenBSD/Update.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Update.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Update.pm,v 1.39 2004/12/12 11:26:16 espie Exp $
+# $OpenBSD: Update.pm,v 1.40 2004/12/15 01:07:10 espie Exp $
#
# Copyright (c) 2004 Marc Espie <espie@openbsd.org>
#
@@ -361,7 +361,6 @@ sub walk_depends_closure
push(@todo, $pkg2);
print "\t$pkg2\n" if $state->{beverbose};
$done->{$pkg2} = 1;
- next if $state->{not};
$write->add($pkg2);
my $l = OpenBSD::Requiring->new($pkg2);
if (!$l->list()) {
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 9fd28e085ff..893ac20d353 100644
--- a/usr.sbin/pkg_add/pkg_add
+++ b/usr.sbin/pkg_add/pkg_add
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_add,v 1.141 2004/12/13 21:28:08 espie Exp $
+# $OpenBSD: pkg_add,v 1.142 2004/12/15 01:07:10 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -36,6 +36,7 @@ use OpenBSD::SharedLibs;
our %forced = ();
package main;
+our $not;
sub fill_conflict_lists
{
@@ -396,15 +397,15 @@ sub really_add($$)
if (!$state->{replace}) {
$plist->forget();
}
- if (defined $handle->{solved_dependencies}) {
- require OpenBSD::RequiredBy;
+ }
+ if (defined $handle->{solved_dependencies}) {
+ require OpenBSD::RequiredBy;
- my $r = OpenBSD::Requiring->new($pkgname);
+ my $r = OpenBSD::Requiring->new($pkgname);
- for my $dep (keys %{$handle->{solved_dependencies}}) {
- OpenBSD::RequiredBy->new($dep)->add($pkgname);
- $r->add($dep);
- }
+ for my $dep (keys %{$handle->{solved_dependencies}}) {
+ OpenBSD::RequiredBy->new($dep)->add($pkgname);
+ $r->add($dep);
}
}
add_installed($pkgname);
@@ -421,8 +422,8 @@ sub really_add($$)
my $d = OpenBSD::RequiredBy->new($pkgname);
for my $dep (@{$plist->{replacing}->{wantlist}}) {
print "\t$dep\n" if $state->{beverbose};
- $d->add($dep) unless $state->{not};
- OpenBSD::Update::adjust_dependency($dep, $plist->{replacing}->pkgname(), $pkgname) unless $state->{not};
+ $d->add($dep);
+ OpenBSD::Update::adjust_dependency($dep, $plist->{replacing}->pkgname(), $pkgname);
}
}
}
@@ -666,6 +667,7 @@ if (defined $state->{destdir}) {
$state->{conflict_list} = {};
$state->{not} = $opt_n;
+$not = $opt_n;
$state->{quick} = $opt_q;
$state->{extra} = $opt_c;
$state->{dont_run_scripts} = $opt_I;
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index 5bcc27f5428..b95d6ff28dd 100644
--- a/usr.sbin/pkg_add/pkg_delete
+++ b/usr.sbin/pkg_add/pkg_delete
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_delete,v 1.81 2004/12/12 11:26:16 espie Exp $
+# $OpenBSD: pkg_delete,v 1.82 2004/12/15 01:07:10 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -28,6 +28,7 @@ use OpenBSD::Delete;
use OpenBSD::PackageInfo;
our %forced = ();
+our $not;
set_usage('pkg_delete [-cInqvx] [-B pkg-destdir] [-f keys] pkgname [...]');
our ($opt_v, $opt_D, $opt_d, $opt_n, $opt_q, $opt_p, $opt_c, $opt_L, $opt_B, $opt_I, $opt_x);
@@ -72,6 +73,7 @@ my $removed;
try {
my $state = new OpenBSD::Error;
$state->{not} = $opt_n;
+$not = $opt_n;
$state->{quick} = $opt_q;
$state->{verbose} = $opt_v >= 2;
$state->{very_verbose} = $opt_v;