summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Archive-Tar
diff options
context:
space:
mode:
authorafresh1 <afresh1@openbsd.org>2019-02-13 21:15:00 +0000
committerafresh1 <afresh1@openbsd.org>2019-02-13 21:15:00 +0000
commit9f11ffb7133c203312a01e4b986886bc88c7d74b (patch)
tree6618511204c614b20256e4ef9dea39a7b311d638 /gnu/usr.bin/perl/cpan/Archive-Tar
parentImport perl-5.28.1 (diff)
downloadwireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.tar.xz
wireguard-openbsd-9f11ffb7133c203312a01e4b986886bc88c7d74b.zip
Fix merge issues, remove excess files - match perl-5.28.1 dist
looking good sthen@, Great! bluhm@
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Archive-Tar')
-rw-r--r--gnu/usr.bin/perl/cpan/Archive-Tar/bin/ptar8
-rw-r--r--gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm27
-rw-r--r--gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm7
-rw-r--r--gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm13
4 files changed, 26 insertions, 29 deletions
diff --git a/gnu/usr.bin/perl/cpan/Archive-Tar/bin/ptar b/gnu/usr.bin/perl/cpan/Archive-Tar/bin/ptar
index 9dc6402c666..67d41301710 100644
--- a/gnu/usr.bin/perl/cpan/Archive-Tar/bin/ptar
+++ b/gnu/usr.bin/perl/cpan/Archive-Tar/bin/ptar
@@ -94,12 +94,12 @@ sub usage {
=head1 NAME
- ptar - a tar-like program written in perl
+ptar - a tar-like program written in perl
=head1 DESCRIPTION
- ptar is a small, tar look-alike program that uses the perl module
- Archive::Tar to extract, create and list tar archives.
+ptar is a small, tar look-alike program that uses the perl module
+Archive::Tar to extract, create and list tar archives.
=head1 SYNOPSIS
@@ -123,7 +123,7 @@ sub usage {
=head1 SEE ALSO
- tar(1), L<Archive::Tar>.
+L<tar(1)>, L<Archive::Tar>.
=cut
diff --git a/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm b/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm
index d110bd7bd8f..e08b5e59033 100644
--- a/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm
+++ b/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm
@@ -31,7 +31,7 @@ use vars qw[$DEBUG $error $VERSION $WARN $FOLLOW_SYMLINK $CHOWN $CHMOD
$DEBUG = 0;
$WARN = 1;
$FOLLOW_SYMLINK = 0;
-$VERSION = "2.04_01";
+$VERSION = "2.30";
$CHOWN = 1;
$CHMOD = 1;
$SAME_PERMISSIONS = $> == 0 ? 1 : 0;
@@ -263,7 +263,7 @@ sub _get_handle {
### different reader/writer modules, different error vars... sigh
if( MODE_READ->($mode) ) {
- $fh = IO::Uncompress::Bunzip2->new( $file ) or do {
+ $fh = IO::Uncompress::Bunzip2->new( $file, MultiStream => 1 ) or do {
$self->_error( qq[Could not read '$file': ] .
$IO::Uncompress::Bunzip2::Bunzip2Error
);
@@ -601,6 +601,7 @@ sub extract {
my $self = shift;
my @args = @_;
my @files;
+ my $hashmap;
# use the speed optimization for all extracted files
local($self->{cwd}) = cwd() unless $self->{cwd};
@@ -617,16 +618,15 @@ sub extract {
### go find it then
} else {
- my $found;
- for my $entry ( @{$self->_data} ) {
- next unless $file eq $entry->full_path;
+ # create hash-map once to speed up lookup
+ $hashmap = $hashmap || {
+ map { $_->full_path, $_ } @{$self->_data}
+ };
+ if (exists $hashmap->{$file}) {
### we found the file you're looking for
- push @files, $entry;
- $found++;
- }
-
- unless( $found ) {
+ push @files, $hashmap->{$file};
+ } else {
return $self->_error(
qq[Could not find '$file' in archive] );
}
@@ -861,7 +861,7 @@ sub _extract_file {
}
if( length $entry->type && $entry->is_file ) {
my $fh = IO::File->new;
- $fh->open( '>' . $full ) or (
+ $fh->open( $full, '>' ) or (
$self->_error( qq[Could not open file '$full': $!] ),
return
);
@@ -1770,7 +1770,8 @@ Example usage:
sub iter {
my $class = shift;
- my $filename = shift or return;
+ my $filename = shift;
+ return unless defined $filename;
my $compressed = shift || 0;
my $opts = shift || {};
@@ -2263,7 +2264,7 @@ For example, if you add a Unicode string like
$tar->add_data('file.txt', "Euro: \x{20AC}");
then there will be a problem later when the tarfile gets written out
-to disk via C<$tar->write()>:
+to disk via C<< $tar->write() >>:
Wide character in print at .../Archive/Tar.pm line 1014.
diff --git a/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm b/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm
index f9557e90197..66fad51a07a 100644
--- a/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm
+++ b/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm
@@ -3,7 +3,7 @@ package Archive::Tar::Constant;
BEGIN {
require Exporter;
- $VERSION = '2.04_01';
+ $VERSION = '2.30';
@ISA = qw[Exporter];
require Time::Local if $^O eq "MacOS";
@@ -11,6 +11,9 @@ BEGIN {
@EXPORT = Archive::Tar::Constant->_list_consts( __PACKAGE__ );
+use strict;
+use warnings;
+
use constant FILE => 0;
use constant HARDLINK => 1;
use constant SYMLINK => 2;
@@ -50,7 +53,7 @@ use constant MODE => do { 0666 & (0777 & ~umask) };
use constant STRIP_MODE => sub { shift() & 0777 };
use constant CHECK_SUM => " ";
-use constant UNPACK => 'A100 A8 A8 A8 a12 A12 A8 A1 A100 A6 A2 A32 A32 A8 A8 A155 x12'; # cdrake - size must be a12 - not A12 - or else screws up huge file sizes (>8gb)
+use constant UNPACK => 'a100 a8 a8 a8 a12 a12 a8 a1 a100 A6 a2 a32 a32 a8 a8 a155 x12'; # cdrake - size must be a12 - not A12 - or else screws up huge file sizes (>8gb)
use constant PACK => 'a100 a8 a8 a8 a12 a12 A8 a1 a100 a6 a2 a32 a32 a8 a8 a155 x12';
use constant NAME_LENGTH => 100;
use constant PREFIX_LENGTH => 155;
diff --git a/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm b/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm
index 3ecad56fab2..b6fbecf6c9a 100644
--- a/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm
+++ b/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm
@@ -13,7 +13,7 @@ use Archive::Tar::Constant;
use vars qw[@ISA $VERSION];
#@ISA = qw[Archive::Tar];
-$VERSION = '2.04_01';
+$VERSION = '2.30';
### set value to 1 to oct() it during the unpack ###
@@ -396,12 +396,7 @@ sub _prefix_and_file {
my $path = shift;
my ($vol, $dirs, $file) = File::Spec->splitpath( $path, $self->is_dir );
- my @dirs = File::Spec->splitdir( $dirs );
-
- ### so sometimes the last element is '' -- probably when trailing
- ### dir slashes are encountered... this is of course pointless,
- ### so remove it
- pop @dirs while @dirs and not length $dirs[-1];
+ my @dirs = File::Spec->splitdir( File::Spec->canonpath($dirs) );
### if it's a directory, then $file might be empty
$file = pop @dirs if $self->is_dir and not length $file;
@@ -409,9 +404,7 @@ sub _prefix_and_file {
### splitting ../ gives you the relative path in native syntax
map { $_ = '..' if $_ eq '-' } @dirs if ON_VMS;
- my $prefix = File::Spec::Unix->catdir(
- grep { length } $vol, @dirs
- );
+ my $prefix = File::Spec::Unix->catdir(@dirs);
return( $prefix, $file );
}