summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-11-12 21:52:02 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-11-12 21:52:02 +0000
commit197945d1c30d7875063e69c1e15bf2837930adf6 (patch)
tree1902dca3fc4044d47167b7328e98b08d7bc07c94 /usr.sbin
parent90dfc606ada76d0cdc21d64f22912ca56786d84e (diff)
be saner wrt directory creation during pkg updates:
don't disturb existing objects if they're not directories, create them better if they don't exist.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Update.pm14
-rw-r--r--usr.sbin/pkg_add/TODO4
3 files changed, 14 insertions, 10 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index b6b027b8d1c..a5abadd108a 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.14 2004/11/11 12:29:58 espie Exp $
+# $OpenBSD: Add.pm,v 1.15 2004/11/12 21:52:01 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -245,15 +245,15 @@ sub install
my $destdir = $state->{destdir};
if ($state->{replacing}) {
-
return if $state->{not};
+ File::Path::mkpath(dirname($destdir.$fullname));
if (defined $self->{link}) {
link($destdir.$self->{link}, $destdir.$fullname);
} elsif (defined $self->{symlink}) {
symlink($self->{symlink}, $destdir.$fullname);
} else {
rename($self->{tempname}, $destdir.$fullname) or
- Fatal "Can't move file to $fullname: $!";
+ Fatal "Can't move ", $self->{tempname}, " to $fullname: $!";
print "moving ", $self->{tempname}, " -> $destdir$fullname\n" if $state->{very_verbose};
undef $self->{tempname};
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index 9e2092f62de..9d230fca960 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.26 2004/11/11 22:40:38 espie Exp $
+# $OpenBSD: Update.pm,v 1.27 2004/11/12 21:52:01 espie Exp $
#
# Copyright (c) 2004 Marc Espie <espie@openbsd.org>
#
@@ -74,11 +74,18 @@ sub extract
return;
}
+ my $d = dirname($file->{destdir}.$file->{name});
+ while (!-d $d && -e _) {
+ $d = dirname($d);
+ }
+ if (!-e _) {
+ File::Path::mkpath($d);
+ }
if ($state->{not}) {
- print "extracting tempfile under ", dirname($file->{destdir}.$file->{name}), "\n";
+ print "extracting tempfile under $d\n";
} else {
my ($fh, $tempname) = tempfile('pkg.XXXXXXXXXX',
- DIR => dirname($file->{destdir}.$file->{name}));
+ DIR => $d);
print "extracting $tempname\n" if $state->{very_verbose};
$file->{name} = $tempname;
@@ -94,6 +101,7 @@ sub extract
my $fullname = $self->fullname();
my $destdir = $state->{destdir};
+ return if -e $destdir.$fullname;
print "new directory ", $destdir, $fullname, "\n" if $state->{very_verbose};
return if $state->{not};
File::Path::mkpath($destdir.$fullname);
diff --git a/usr.sbin/pkg_add/TODO b/usr.sbin/pkg_add/TODO
index 4636bad7901..9c533844de9 100644
--- a/usr.sbin/pkg_add/TODO
+++ b/usr.sbin/pkg_add/TODO
@@ -10,10 +10,6 @@
- smart package dependency handling
Known update issues:
-- symlink to directory doesn't get created during extraction, which
-throws off the rest of the extraction (probably needs to create those
-correctly). More generally: extraction may fail if the updated package
-renames directory structure.
- error during extraction breaks things badly: need a mechanism to register
borked package similar to pkg_add. Preferably avoid doing it.
- shared libs must be matched against the package that holds the deps, not