diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-06-26 15:39:20 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-06-26 15:39:20 +0000 |
commit | 8ee52398fd9a47ceb0a33912089ac1affeff321e (patch) | |
tree | b87833b727e975a2c3e10e66d61e22df5d69a938 /usr.sbin | |
parent | f09308df4e0f28dd217b6c7a9479665e7c868060 (diff) |
expose the name aliasing operation, since it can be useful.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Ustar.pm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index 989a05f3a93..6f3d1bc8c38 100644 --- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm +++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Ustar.pm,v 1.28 2005/06/21 17:52:49 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.29 2005/06/26 15:39:19 espie Exp $ # # Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org> # @@ -325,6 +325,16 @@ sub write } } +sub alias +{ + my ($self, $arc, $alias) = @_; + + my $k = $self->{archive}.":".$self->{archive}->{cachename}; + if (!defined $arc->{key}->{$k}) { + $arc->{key}->{$k} = $alias; + } +} + sub write_contents { # only files have anything to write @@ -395,7 +405,7 @@ sub resolve_links if (defined $arc->{key}->{$k}) { $self->{linkname} = $arc->{key}->{$k}; } else { - die "Can't copy link over: original NOT available\n"; + die "Can't copy link over: original for $k NOT available\n"; } } @@ -565,10 +575,7 @@ sub copy_contents if ($size % 512) { print $out "\0" x (512 - $size % 512); } - my $k = $self->{archive}.":".$self->{archive}->{cachename}; - if (!defined $arc->{key}->{$k}) { - $arc->{key}->{$k} = $self->{name}; - } + $self->alias($arc, $self->{name}); } sub isFile() { 1 } |