summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm47
-rw-r--r--usr.sbin/pkg_add/pkg_add17
-rw-r--r--usr.sbin/pkg_add/pkg_delete9
3 files changed, 46 insertions, 27 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index f51723d918d..554ab68a489 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.19 2004/11/11 10:23:53 espie Exp $
+# $OpenBSD: Update.pm,v 1.20 2004/11/11 10:47:26 espie Exp $
#
# Copyright (c) 2004 Marc Espie <espie@openbsd.org>
#
@@ -77,8 +77,9 @@ sub extract
print "extracting $tempname\n" if $state->{very_verbose};
$file->{name} = $tempname;
- $file->create();
$self->{tempname} = $tempname;
+ return if $state->{not};
+ $file->create();
}
package OpenBSD::PackingElement::Dir;
@@ -179,13 +180,16 @@ sub can_do
$state->{libs_to_check} = [];
my $plist = OpenBSD::PackingList->fromfile(installed_info($toreplace).CONTENTS);
$plist->visit('can_update', $state);
+ if ($state->{okay} == 0) {
+ print "Old package contains impossible to update elements\n";
+ }
if (-f $$r) {
$wantlist = $r->list();
my $done_wanted = {};
for my $wanting (@$wantlist) {
next if defined $done_wanted->{$wanting};
$done_wanted->{$wanting} = 1;
- print "Verifying dependencies still match for $wanting\n";
+ print "Verifying dependencies still match for $wanting\n" if $state->{verbose};
my $p2 = OpenBSD::PackingList->fromfile(installed_info($wanting).CONTENTS,
\&OpenBSD::PackingList::DependOnly);
$p2->visit('validate_depend', $state, $wanting, $toreplace, $replacement);
@@ -233,10 +237,13 @@ sub split_libs
sub walk_depends_closure
{
- my ($start, $name) = @_;
+ my ($start, $name, $state) = @_;
my @todo = ($start);
my $done = {};
+ print "Packages that depend on those shared libraries:\n"
+ if $state->{beverbose};
+
my $write = OpenBSD::RequiredBy->new($name);
while (my $pkg = shift @todo) {
@@ -247,11 +254,12 @@ sub walk_depends_closure
for my $pkg2 (@$list) {
next if $done->{$pkg2};
push(@todo, $pkg2);
- $write->add($pkg2);
+ print "\t$pkg2\n" if $state->{beverbose};
+ $write->add($pkg2) unless $state->{not};
my $contents = installed_info($pkg2).CONTENTS;
my $plist = OpenBSD::PackingList->fromfile($contents);
OpenBSD::PackingElement::PkgDep->add($plist, $name);
- $plist->tofile($contents);
+ $plist->tofile($contents) unless $state->{not};
$done->{$pkg2} = 1;
}
}
@@ -268,23 +276,30 @@ sub save_old_libraries
my $libs = {};
my $p = {};
+ print "Looking for changes in shared libraries\n"
+ if $state->{beverbose};
$old_plist->visit('mark_lib', $libs, $p);
$new_plist->visit('unmark_lib', $libs, $p);
+ print "Libraries to keep: ", join(",", sort(keys %$libs)), "\n"
+ if $state->{beverbose};
if (%$libs) {
my $stub_list = split_libs($old_plist, $libs);
my $stub_name = $stub_list->pkgname();
my $dest = installed_info($stub_name);
- mkdir($dest);
- my $oldname = $old_plist->pkgname();
- open my $comment, '>', $dest.COMMENT;
- print $comment "Stub libraries for $oldname";
- close $comment;
- link($dest.COMMENT, $dest.DESC);
- $stub_list->tofile($dest.CONTENTS);
- $old_plist->tofile(installed_info($oldname).CONTENTS);
-
- walk_depends_closure($old_plist->pkgname(), $stub_name);
+ print "Keeping them in $stub_name\n" if $state->{beverbose};
+ unless ($state->{not}) {
+ mkdir($dest);
+ my $oldname = $old_plist->pkgname();
+ open my $comment, '>', $dest.COMMENT;
+ print $comment "Stub libraries for $oldname";
+ close $comment;
+ link($dest.COMMENT, $dest.DESC);
+ $stub_list->tofile($dest.CONTENTS);
+ $old_plist->tofile(installed_info($oldname).CONTENTS);
+ }
+
+ walk_depends_closure($old_plist->pkgname(), $stub_name, $state);
}
}
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 58960806edc..931961149f4 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.98 2004/11/09 11:02:42 espie Exp $
+# $OpenBSD: pkg_add,v 1.99 2004/11/11 10:47:26 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -539,10 +539,13 @@ sub really_add($$)
require OpenBSD::RequiredBy;
require OpenBSD::Update;
+ print "Adjusting dependencies for $pkgname\n"
+ if $state->{beverbose};
my $d = OpenBSD::RequiredBy->new($pkgname);
for my $dep (@{$plist->{replacing}->{wantlist}}) {
- $d->add($dep);
- OpenBSD::Update::adjust_dependency($dep, $plist->{replacing}->pkgname(), $pkgname);
+ 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};
}
}
}
@@ -642,10 +645,6 @@ if ($opt_P) {
Fatal "bad option: -P $opt_P";
}
}
-if ($opt_x) {
- OpenBSD::ProgressMeter::enable();
-}
-
$opt_L = '/usr/local' unless defined $opt_L;
my $state = new OpenBSD::Error;
@@ -687,6 +686,10 @@ $state->{very_verbose} = $opt_v >= 2;
$state->{verbose} = $opt_v;
$state->{beverbose} = $opt_n || ($opt_v >= 2);
+if ($opt_x && !$state->{beverbose}) {
+ OpenBSD::ProgressMeter::enable();
+}
+
fill_conflict_lists($state);
my @todo = (@ARGV);
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index 6f6e0496347..2e4eb435780 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.69 2004/11/09 11:11:01 espie Exp $
+# $OpenBSD: pkg_delete,v 1.70 2004/11/11 10:47:26 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -54,9 +54,6 @@ if (defined $opt_d) {
Fatal "Option d is obsolete";
}
-if ($opt_x) {
- OpenBSD::ProgressMeter::enable();
-}
if ($opt_f) {
%forced = map {($_, 1)} split(/,/, $opt_f);
}
@@ -78,6 +75,10 @@ $state->{extra} = $opt_c;
$state->{dont_run_scripts} = $opt_I;
$ENV{'PKG_DELETE_EXTRA'} = $state->{extra} ? "Yes" : "No";
+if ($opt_x && $state->{beverbose}) {
+ OpenBSD::ProgressMeter::enable();
+}
+
# First, resolve pkg names
my @realnames;