Update Archive-Tar to CPAN version 2.08
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Mon, 16 May 2016 11:20:21 +0000 (12:20 +0100)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Mon, 16 May 2016 11:51:14 +0000 (12:51 +0100)
MANIFEST
Porting/Maintainers.pl
cpan/Archive-Tar/lib/Archive/Tar.pm
cpan/Archive-Tar/lib/Archive/Tar/Constant.pm
cpan/Archive-Tar/lib/Archive/Tar/File.pm
cpan/Archive-Tar/t/09_roundtrip.t [new file with mode: 0644]

index 233dfad..7bc78b9 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -33,6 +33,7 @@ cpan/Archive-Tar/t/04_resolved_issues.t                       Archive::Tar tests
 cpan/Archive-Tar/t/05_iter.t                           Archive::Tar tests
 cpan/Archive-Tar/t/06_error.t                          Archive::Tar tests
 cpan/Archive-Tar/t/08_ptargrep.t
+cpan/Archive-Tar/t/09_roundtrip.t
 cpan/Archive-Tar/t/90_symlink.t                                Archive::Tar tests
 cpan/Archive-Tar/t/99_pod.t                            Archive::Tar tests
 cpan/Archive-Tar/t/src/header/signed.tar               Archive::Tar tests
index e3c102d..1710666 100755 (executable)
@@ -120,7 +120,7 @@ use File::Glob qw(:case);
 %Modules = (
 
     'Archive::Tar' => {
-        'DISTRIBUTION' => 'BINGOS/Archive-Tar-2.06.tar.gz',
+        'DISTRIBUTION' => 'BINGOS/Archive-Tar-2.08.tar.gz',
         'FILES'        => q[cpan/Archive-Tar],
         'BUGS'         => 'bug-archive-tar@rt.cpan.org',
         'EXCLUDED'     => [
index 1c16078..adbb548 100644 (file)
@@ -31,7 +31,7 @@ use vars qw[$DEBUG $error $VERSION $WARN $FOLLOW_SYMLINK $CHOWN $CHMOD
 $DEBUG                  = 0;
 $WARN                   = 1;
 $FOLLOW_SYMLINK         = 0;
-$VERSION                = "2.06";
+$VERSION                = "2.08";
 $CHOWN                  = 1;
 $CHMOD                  = 1;
 $SAME_PERMISSIONS       = $> == 0 ? 1 : 0;
index 4dc1a3b..ac91400 100644 (file)
@@ -3,7 +3,7 @@ package Archive::Tar::Constant;
 BEGIN {
     require Exporter;
 
-    $VERSION    = '2.06';
+    $VERSION    = '2.08';
     @ISA        = qw[Exporter];
 
     require Time::Local if $^O eq "MacOS";
index 1207dbd..5821304 100644 (file)
@@ -13,7 +13,7 @@ use Archive::Tar::Constant;
 
 use vars qw[@ISA $VERSION];
 #@ISA        = qw[Archive::Tar];
-$VERSION    = '2.06';
+$VERSION    = '2.08';
 
 ### set value to 1 to oct() it during the unpack ###
 
diff --git a/cpan/Archive-Tar/t/09_roundtrip.t b/cpan/Archive-Tar/t/09_roundtrip.t
new file mode 100644 (file)
index 0000000..82cf444
--- /dev/null
@@ -0,0 +1,62 @@
+BEGIN { chdir 't' if -d 't' }
+
+use Test::More;
+use strict;
+use lib '../lib';
+
+use File::Spec ();
+use File::Temp qw( tempfile );
+
+use Archive::Tar;
+
+# tarballs available for testing
+my @archives = (
+  [qw( src short bar.tar )],
+  [qw( src long bar.tar )],
+  [qw( src linktest linktest_with_dir.tar )],
+);
+push @archives,
+  [qw( src short foo.tgz )],
+  [qw( src long foo.tgz )]
+  if Archive::Tar->has_zlib_support;
+push @archives,
+  [qw( src short foo.tbz )],
+  [qw( src long foo.tbz )]
+  if Archive::Tar->has_bzip2_support;
+
+@archives = map File::Spec->catfile(@$_), @archives;
+
+plan tests => scalar @archives;
+
+# roundtrip test
+for my $archive (@archives) {
+
+      # create a new tarball with the same content as the old one
+      my $old = Archive::Tar->new($archive);
+      my $new = Archive::Tar->new();
+      $new->add_files( $old->get_files );
+
+      # save differently if compressed
+      my $ext = ( split /\./, $archive )[-1];
+      my @compress =
+          $ext =~ /t?gz$/       ? (COMPRESS_GZIP)
+        : $ext =~ /(tbz|bz2?)$/ ? (COMPRESS_BZIP)
+        : ();
+
+      my ( $fh, $filename ) = tempfile( UNLINK => 1 );
+      $new->write( $filename, @compress );
+
+      # read the archive again from disk
+      $new = Archive::Tar->new($filename);
+
+      TODO: {
+        local $TODO = 'Need to work out why no trailing slash';
+
+      # compare list of files
+      is_deeply(
+          [ $new->list_files ],
+          [ $old->list_files ],
+          "$archive roundtrip on file names"
+      );
+      };
+}