diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-08-07 14:18:06 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-08-07 14:18:06 +0000 |
commit | 11c8b909d521fdf96aff3b931e828f9a94646216 (patch) | |
tree | 99a37f75557a487f0961e7d95eeb3638aae23358 /usr.sbin/pkg_add/pkg_merge | |
parent | c3d7ac66121443cc12be9008b2bb13e9b25ecc9e (diff) |
wrapper around Ustar that replaces long names/links with LongName#/LongLink#.
The archive will unpack correctly with tar, except that those names won't
be preserved.
The wrapper checks names against the packing-list to restore the correct names
on the fly.
Put into a separate file, as it is an extension of Ustar proper, and we're
going to do more archive checking in the future.
Lots of tests by Bernd Ahlers. Comments by Tom Cosgrove.
Diffstat (limited to 'usr.sbin/pkg_add/pkg_merge')
-rw-r--r-- | usr.sbin/pkg_add/pkg_merge | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/pkg_merge b/usr.sbin/pkg_add/pkg_merge index bd3cab8723b..9b71291b599 100644 --- a/usr.sbin/pkg_add/pkg_merge +++ b/usr.sbin/pkg_add/pkg_merge @@ -20,6 +20,7 @@ use OpenBSD::PackingList; use OpenBSD::Getopt; use OpenBSD::Error; use OpenBSD::Ustar; +use OpenBSD::ArcCheck; use File::Copy; use File::Path; @@ -40,18 +41,18 @@ sub copy_over { my ($self, $wrarc, $prefix, $pkg) = @_; my $e = $pkg->{pkg}->next(); - if ($e->{name} ne $self->{name}) { + if (!$e->check_name($self->{name})) { die "Names don't match: ", $e->{name}, " ", $self->{name}; } $e->{name} = $prefix."/".$e->{name}; - $e->copy($wrarc); + $e->copy_long($wrarc); } sub make_alias { my ($self, $wrarc, $prefix, $pkg, $alias) = @_; my $e = $pkg->{pkg}->next(); - if ($e->{name} ne $self->{name}) { + if (!$e->check_name($self->{name})) { die "Names don't match: ", $e->{name}, " ", $self->{name}; } $e->{name} = $prefix."/".$e->{name}; |