diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-10-14 13:46:26 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-10-14 13:46:26 +0000 |
commit | 49b9a9a9680bcb1eefb6f3d464ba30526b7df30a (patch) | |
tree | 07551e6bf46a081a369c837d9723cb694842d703 /usr.sbin/pkg_add | |
parent | 731d22214a646dfcb1c5ced925377ce44ba3c3d6 (diff) |
add a few comments, finish killing kitchensink.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 25 |
2 files changed, 22 insertions, 11 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index de00ae5d00a..73df87d02f2 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.86 2009/10/14 11:08:16 espie Exp $ +# $OpenBSD: Update.pm,v 1.87 2009/10/14 13:46:25 espie Exp $ # # Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org> # @@ -34,7 +34,7 @@ sub new sub add_updateset { my ($self, $set, $handle, $location) = @_; - + my $n = OpenBSD::Handle->from_location($location); $set->add_newer($n); } @@ -48,7 +48,7 @@ sub process_handle print "Update to $pkgname already found\n"; return 0; } - + if ($pkgname =~ m/^(?:\.libs\d*|partial)\-/o) { $state->progress->clear; print "Not updating $pkgname, remember to clean it\n"; @@ -114,7 +114,7 @@ sub process_handle $self->add_updateset($set, $h, $l->[0]); return 1; } - if (defined $found && $found eq $l->[0] && + if (defined $found && $found eq $l->[0] && !$plist->uses_old_libs && !$state->{defines}->{installed}) { my $msg = "No need to update $pkgname"; $state->progress->message($msg); diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index f7e3ba2bc86..f9f6461896a 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.349 2009/10/14 11:16:15 espie Exp $ +# $OpenBSD: pkg_add,v 1.350 2009/10/14 13:46:25 espie Exp $ # # Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org> # @@ -555,8 +555,7 @@ sub install_set return (); } if ($handle->has_error) { - if ((!$state->{defines}->{kitchensink} || - $handle->has_error(OpenBSD::Handle::BAD_PACKAGE)) && + if ($handle->has_error(OpenBSD::Handle::BAD_PACKAGE) && !$handle->{tweaked}) { $state->set_name_from_handle($handle); $state->fatal("Fatal error"); @@ -754,6 +753,9 @@ lock_db($state->{not}) unless $state->{defines}->{nolock}; $state->setup_progressmeter($opt_x); $state->check_root; +# Here we create the list of packages to install +# actually, an updateset list (@todo2), and we hope to do this lazily +# later for the most part... my @todo2 = (); if ($opt_l) { @@ -766,6 +768,8 @@ if ($opt_l) { } } +# three cases: +# 1/ match fuzzily against a list if ($opt_l || $opt_z) { my $k = OpenBSD::Search::FilterLocation->keep_most_recent; $state->progress->set_header("Looking for packages"); @@ -784,6 +788,7 @@ if ($opt_l || $opt_z) { push(@todo2, OpenBSD::UpdateSet->from_location($r)); } } +# 2/ update existing stuff } elsif ($opt_u) { require OpenBSD::Update; require OpenBSD::PackageRepository::Installed; @@ -846,6 +851,7 @@ if ($opt_l || $opt_z) { } print "Running update ", join(',', map {$_->short_print} @todo2), "\n"; } else { +# 3/ actual names find_truelocations(\@ARGV, \@todo2, $state); OpenBSD::Add::tag_user_packages(@todo2); } @@ -854,19 +860,25 @@ if ($bad) { exit(1); } + + +# This is the actual very small loop that adds all packages eval { while (my $set = shift @todo2) { unshift(@todo2, install_set($set, $state, @todo2)); } }; - +# Note how well we performed. We need to clean up BEFORE we exit anyways. my $dielater = $@; +# cleanup various things $state->{recorder}->cleanup($state); OpenBSD::PackingElement::Fontdir::finish_fontdirs($state); OpenBSD::Add::manpages_index($state); OpenBSD::PackingElement::Lib::ensure_ldconfig($state); + +# and display delayed thingies. if ($state->{packages_with_sig}) { print "Packages with signatures: ", $state->{packages_with_sig}; if ($state->{packages_without_sig}) { @@ -883,9 +895,8 @@ if (defined $state->{updatedepends} && %{$state->{updatedepends}}) { join(' ', sort(keys %{$state->{updatedepends}})), " may remain\n"; } -if (defined $state->{defines}->{kitchensink}) { - print "Added:\n", (map { "\t$_\n" } sort $state->installed), "\n"; -} + +# show any error, and show why we died... rethrow $dielater; } catch { print STDERR "$0: $_\n"; |