summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm22
-rw-r--r--usr.sbin/pkg_add/pkg_add14
3 files changed, 18 insertions, 25 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index 85b596d3336..d88c1690c9a 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.59 2007/05/29 13:52:07 espie Exp $
+# $OpenBSD: Add.pm,v 1.60 2007/05/29 14:39:03 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -49,7 +49,6 @@ sub register_installation
my $plist = shift;
return if $main::not;
my $dest = installed_info($plist->pkgname);
- my $dir = $plist->infodir;
mkdir($dest);
$plist->copy_info($dest);
$plist->set_infodir($dest);
@@ -69,7 +68,7 @@ sub validate_plist
sub borked_installation
{
- my ($plist, $dir, $not, @msg) = @_;
+ my ($plist, $not, @msg) = @_;
Fatal @msg if $not;
use OpenBSD::PackingElement;
@@ -560,7 +559,7 @@ sub prepare_for_addition
my ($self, $state, $pkgname) = @_;
my $fname = installed_info($pkgname).$self->{name};
- my $cname = $state->{dir}.'/'.$self->{name};
+ my $cname = $self->fullname;
my $size = $self->{size};
if (!defined $size) {
$size = (stat $cname)[7];
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index 0a33d330127..57852e8bc12 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.49 2007/05/28 13:00:05 espie Exp $
+# $OpenBSD: Delete.pm,v 1.50 2007/05/29 14:39:03 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -47,7 +47,7 @@ sub rename_file_to_temp
sub keep_old_files
{
- my ($state, $plist, $dir) = @_;
+ my ($state, $plist) = @_;
my $p = new OpenBSD::PackingList;
for my $i (qw(cvstags no-default-conflict conflict) ) {
if (defined $plist->{$i}) {
@@ -71,12 +71,12 @@ sub keep_old_files
my $borked = borked_package($plist->pkgname);
OpenBSD::PackingElement::Name->add($p, $borked);
$p->{name}->{name} = $borked;
- my $dest = installed_info($borked);
- mkdir($dest);
+ $p->set_info(installed_info($borked));
+ mkdir($p->infodir);
require File::Copy;
- File::Copy::copy($dir.COMMENT, $dest);
- File::Copy::copy($dir.DESC, $dest);
+ File::Copy::copy($plist->infodir.COMMENT, $p->infodir);
+ File::Copy::copy($plist->infodir.DESC, $p->infodir);
$p->to_installation;
return $borked;
}
@@ -114,7 +114,9 @@ sub validate_plist
sub remove_packing_info
{
- my $dir = shift;
+ my $plist = shift;
+
+ my $dir = $plist->infodir;
for my $fname (info_names()) {
unlink($dir.$fname);
@@ -153,8 +155,6 @@ sub delete_plist
my $totsize = $plist->{totsize};
my $pkgname = $plist->pkgname;
$state->{pkgname} = $pkgname;
- my $dir = installed_info($pkgname);
- $state->{dir} = $dir;
$ENV{'PKG_PREFIX'} = $plist->localbase;
if ($plist->has(REQUIRE)) {
$plist->get(REQUIRE)->delete($state);
@@ -191,13 +191,13 @@ sub delete_plist
return if $state->{not};
if ($state->{baddelete}) {
- my $borked = keep_old_files($state, $plist, $dir);
+ my $borked = keep_old_files($state, $plist);
$state->print("Files kept as $borked package\n");
delete $state->{baddelete};
}
- remove_packing_info($dir);
+ remove_packing_info($plist);
}
package OpenBSD::PackingElement;
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 94687061fbf..e5edc320891 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.288 2007/05/29 13:52:07 espie Exp $
+# $OpenBSD: pkg_add,v 1.289 2007/05/29 14:39:03 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -193,7 +193,6 @@ sub can_install
my $old_handle = OpenBSD::Handle->new;
$old_handle->{plist} = $rplist;
$old_handle->{pkgname} = $toreplace;
- $rplist->{dir} = installed_info($toreplace);
$set->add_older($old_handle);
}
$set->{skipupdatedeps} = \%conflicts;
@@ -312,8 +311,7 @@ sub failed_install
if ($interrupted) {
$msg ="Caught SIG$interrupted. $msg";
}
- OpenBSD::Add::borked_installation($plist,
- $handle->{location}->info, $not, $msg);
+ OpenBSD::Add::borked_installation($plist, $not, $msg);
}
sub really_add
@@ -323,13 +321,10 @@ sub really_add
my $location = $handle->{location};
my $destdir = $state->{destdir};
my $plist = $handle->{plist};
- my $dir = $location->info;
$plist->set_infodir($location->info);
my $pkgname = $handle->{pkgname};
my $errors = 0;
$state->{archive} = $location;
- $plist->{dir} = $dir;
- $state->{dir} = $plist->{dir};
$state->set_pkgname($pkgname);
$set->setup_header($state);
@@ -409,7 +404,7 @@ sub really_add
OpenBSD::Delete::delete_plist($op, $state);
} catchall {
Warn $_;
- OpenBSD::Add::borked_installation($plist, $dir,
+ OpenBSD::Add::borked_installation($plist,
$state->{not},
"Deinstallation of ",
$op->pkgname, " failed");
@@ -424,7 +419,6 @@ sub really_add
# Here there should be code to handle old libs
OpenBSD::ProgressMeter::set_header("$pkgname (installing)");
- $state->{dir} = $plist->{dir};
$state->set_pkgname($pkgname);
}
@@ -488,7 +482,7 @@ sub really_add
};
}
- unlink($dir.CONTENTS);
+ unlink($plist->infodir.CONTENTS);
if ($state->{interrupted} || $errors) {
failed_install($handle, $state->{not}, $state->{interrupted});
}