diff options
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 9 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/CollisionReport.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 3 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageInfo.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 35 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 42 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add.1 | 4 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_info | 3 |
9 files changed, 44 insertions, 72 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index c3b1046220c..c16e3f6a3d6 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.24 2004/12/12 11:26:16 espie Exp $ +# $OpenBSD: Add.pm,v 1.25 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -46,6 +46,7 @@ sub manpages_index sub register_installation { my ($dir, $dest, $plist) = @_; + return if $main::not; mkdir($dest); for my $i (info_names()) { copy($dir.$i, $dest); @@ -104,11 +105,11 @@ sub validate_plist($$) sub borked_installation { - my ($plist, $dir) = @_; + my ($plist, $dir, @msg) = @_; use OpenBSD::PackingElement; - my $borked = borked_package(); + my $borked = borked_package($plist->pkgname()); # fix packing list for pkg_delete $plist->{items} = $plist->{done}; @@ -136,7 +137,7 @@ sub borked_installation $plist->{pkgdep} = []; my $dest = installed_info($borked); register_installation($dir, $dest, $plist); - Fatal "Installation of $pkgname failed, partial installation recorded as $borked"; + Fatal @msg, ", partial installation recorded as $borked"; } # used by newuser/newgroup to deal with options. diff --git a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm index 1b027aae011..b28eda98c5c 100644 --- a/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm +++ b/usr.sbin/pkg_add/OpenBSD/CollisionReport.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: CollisionReport.pm,v 1.4 2004/11/15 17:05:50 espie Exp $ +# $OpenBSD: CollisionReport.pm,v 1.5 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -52,7 +52,7 @@ sub collision_report($$) for my $item (sort @{$bypkg->{$pkg}}) { print "\t$item ($pkg)\n"; } - if ($pkg =~ m/^borked\.\d+$/) { + if ($pkg =~ m/^partial\-/) { $clueless_bat = $pkg; } } diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index 19ac1bd56a6..c84c9029d3e 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.16 2004/12/15 01:07:10 espie Exp $ +# $OpenBSD: Delete.pm,v 1.17 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -150,7 +150,6 @@ sub delete_plist } remove_packing_info($dir) unless $state->{not}; - $plist->forget(); } package OpenBSD::PackingElement; diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm index 873758a0843..e6eed5776c5 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackageInfo.pm,v 1.13 2004/11/14 19:10:41 espie Exp $ +# $OpenBSD: PackageInfo.pm,v 1.14 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -119,14 +119,18 @@ sub installed_contents($) return installed_info(shift).CONTENTS; } -sub borked_package() +sub borked_package($) { + my $pkgname = $_[0]; + unless (-e "$pkg_db/partial-$pkgname") { + return "partial-$pkgname"; + } my $i = 1; - while (-e "$pkg_db/borked.$i") { + while (-e "$pkg_db/partial-$pkgname.$i") { $i++; } - return "borked.$i"; + return "partial-$pkgname.$i"; } sub is_installed($) diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index d2552514585..13178f54d06 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.74 2004/12/09 18:58:25 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.75 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -434,7 +434,7 @@ sub ensure_ldconfig if ($todo) { require OpenBSD::SharedLibs; - &OpenBSD::SharedLibs::ensure_ldconfig(); + &OpenBSD::SharedLibs::ensure_ldconfig; } } diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 6c6f8a42758..781983dcb24 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.42 2004/12/15 01:07:10 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.43 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -67,7 +67,6 @@ sub read $plist = $a; } else { $plist = new $a; - $plist->{code} = $code; } &$code($fh, sub { @@ -334,30 +333,22 @@ sub from_installation require OpenBSD::PackageInfo; - if (defined $plist_cache->{\&defaultCode}->{$pkgname}) { - return $plist_cache->{\&defaultCode}->{$pkgname}; - } $code = \&defaultCode if !defined $code; - if (!defined $plist_cache->{$code}->{$pkgname}) { - my $plist = - $o->fromfile(OpenBSD::PackageInfo::installed_contents($pkgname), - $code); - if (defined $plist) { - $plist_cache->{$code}->{$pkgname} = $plist; - return $plist; - } else { - return undef; - } + if ($code == \&DependOnly && defined $plist_cache->{$pkgname}) { + return $plist_cache->{$pkgname}; + } + my $plist = + $o->fromfile(OpenBSD::PackageInfo::installed_contents($pkgname), + $code); + if (defined $plist && $code == \&DependOnly) { + $plist_cache->{$pkgname} = $plist; } - return $plist_cache->{$code}->{$pkgname}; + return $plist; } sub to_cache { - my ($self) = @_; - - $plist_cache->{\&defaultCode}->{$self->pkgname()} = $self; } sub to_installation @@ -366,7 +357,6 @@ sub to_installation require OpenBSD::PackageInfo; - $self->to_cache(); return if $main::not; $self->tofile(OpenBSD::PackageInfo::installed_contents($self->pkgname())); @@ -375,11 +365,6 @@ sub to_installation sub forget { - my ($self) = @_; - - if (defined $plist_cache->{$self->{code}}) { - delete $plist_cache->{$self->{code}}->{$self->pkgname()}; - } } 1; diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 893ac20d353..e9a14589b3e 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.142 2004/12/15 01:07:10 espie Exp $ +# $OpenBSD: pkg_add,v 1.143 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -303,21 +303,17 @@ sub really_add($$) Warn $_; $errors++; }; - last if $errors; push(@{$plist->{done}}, $item); if (defined $item->{size}) { $donesize += $item->{size}; OpenBSD::ProgressMeter::show($donesize, $totsize); } - last if $interrupted; + last if $interrupted || $errors; } OpenBSD::ProgressMeter::next(); if ($interrupted || $errors) { - if ($not) { - Fatal "Installation of $pkgname failed"; - } else { - OpenBSD::Add::borked_installation($plist, $dir); - } + OpenBSD::Add::borked_installation($plist, $dir, + "Installation of $pkgname failed"); } OpenBSD::ProgressMeter::set_header($plist->{replacing}->pkgname()." (deleting)"); @@ -327,12 +323,9 @@ sub really_add($$) OpenBSD::Delete::delete_plist($plist->{replacing}, $state); } catchall { Warn $_; - if ($not) { - Fatal "Deinstallation of ", - $plist->{replacing}->pkgname(), " failed"; - } else { - OpenBSD::Add::borked_installation($plist, $dir); - } + OpenBSD::Add::borked_installation($plist, $dir, + "Deinstallation of ", + $plist->{replacing}->pkgname(), " failed"); }; delete_installed($plist->{replacing}->pkgname()); @@ -354,8 +347,8 @@ sub really_add($$) catchall { Warn $_; $errors++; - last; }; + last if $errors; push(@{$plist->{done}}, $item); if (defined $item->{size}) { $donesize += $item->{size}; @@ -383,21 +376,12 @@ sub really_add($$) unlink($dir.CONTENTS); if ($interrupted || $errors) { - if ($not) { - Fatal "Installation of $pkgname failed"; - } else { - OpenBSD::Add::borked_installation($plist, $dir); - } - } - if ($not) { - $plist->to_cache(); - } else { - my $dest = installed_info($pkgname); - OpenBSD::Add::register_installation($dir, $dest, $plist); - if (!$state->{replace}) { - $plist->forget(); - } + OpenBSD::Add::borked_installation($plist, $dir, + "Installation of $pkgname failed"); } + OpenBSD::SharedLibs::add_plist_libs($plist); + my $dest = installed_info($pkgname); + OpenBSD::Add::register_installation($dir, $dest, $plist); if (defined $handle->{solved_dependencies}) { require OpenBSD::RequiredBy; diff --git a/usr.sbin/pkg_add/pkg_add.1 b/usr.sbin/pkg_add/pkg_add.1 index 869cd5d0eff..a6bdb393a15 100644 --- a/usr.sbin/pkg_add/pkg_add.1 +++ b/usr.sbin/pkg_add/pkg_add.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_add.1,v 1.27 2004/12/09 18:58:25 espie Exp $ +.\" $OpenBSD: pkg_add.1,v 1.28 2004/12/16 11:07:33 espie Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -361,7 +361,7 @@ Note that it is safe to interrupt through .Dv SIGINT , as it will safely record an interrupted install as -.Pa borked.n . +.Pa partial-<pkgname>[.n] . .Sh ENVIRONMENT .Bl -tag -width PKG_DESTDIR .It Ev FTPMODE diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info index 6eeb6e83215..9dc6c51502a 100644 --- a/usr.sbin/pkg_add/pkg_info +++ b/usr.sbin/pkg_add/pkg_info @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_info,v 1.24 2004/12/12 11:26:16 espie Exp $ +# $OpenBSD: pkg_info,v 1.25 2004/12/16 11:07:33 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -104,7 +104,6 @@ sub filter_files push(@result, $pkg); } } - $plist->forget(); }); } return @result; |