diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-11-01 15:45:03 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-11-01 15:45:03 +0000 |
commit | 8cfc58854a57f371d9043e27cc1e80f6d167d4f2 (patch) | |
tree | 29e9e916264ab05ae5d7070bf11b4bffa46549a2 /usr.sbin/pkg_add/OpenBSD/Update.pm | |
parent | 6c4c450d2acff947fae77df81d4e19b7ae75c53a (diff) |
move all the checking prior to extraction to a `prepare_to_extract' function.
check that linknames match while we're at it.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/Update.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 5ee7859e9e8..aa4bfe460d2 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.4 2004/11/01 14:30:00 espie Exp $ +# $OpenBSD: Update.pm,v 1.5 2004/11/01 15:45:02 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -43,25 +43,17 @@ use File::Temp qw/tempfile/; sub extract { my ($self, $state) = @_; - my $fullname = $self->fullname(); - my $file=$state->{archive}->next(); - if ($file->{name} ne $self->{name}) { - Fatal "Error: archive does not match", $file->{name}, "!=", - $self->{name}, "\n"; - } - my $destdir = $state->{destdir}; + my $file = $self->prepare_to_extract($state); if (defined $self->{link} || defined $self->{symlink}) { $self->{tempname} = 1; return; } - my ($fh, $tempname) = tempfile(DIR => dirname($destdir.$fullname)); + my ($fh, $tempname) = tempfile(DIR => dirname($file->{destdir}.$file->{name})); print "extracting $tempname\n"; $file->{name} = $tempname; - $file->{cwd} = $self->{cwd}; - $file->{destdir} = $destdir; $file->create(); $self->{tempname} = $tempname; } |