Archive-Tar-Wrapper

 view release on metacpan or  search on metacpan

t/001Basic.t  view on Meta::CPAN

);

my $f1 = $a2->locate('001Basic.t');
my $f2 = $a2->locate('foo/bar/baz');
ok( -s $f1 > 0, 'Checking tarball files sizes' );
ok( -s $f2 > 0, 'Checking tarball files sizes' );

is( -s $f1, -s $f2, 'Comparing tarball files sizes' );

my $f3                  = $a2->locate('foo/bar/permtest');
my $expected_permission = sprintf '%3o', ( ( stat($f3) )[2] & 07777 );

SKIP: {
    skip 'Permissions are too different on Microsoft Windows', 1
      if ( $Config{osname} eq 'MSWin32' || $Config{osname} eq 'msys' );
    is( $expected_permission, '770',
        'testing file permission inside the tarball' );
}

my $f4 = $a2->locate('foo/bar/string');
open( my $in, '<', $f4 ) or die "Cannot open $f4: $!";

t/001Basic.t  view on Meta::CPAN

}

note('Testing original file permissions');
umask(022);
my $a5 = Archive::Tar::Wrapper->new( tar_read_options => 'p', );
$a5->read( File::Spec->catfile( TARDIR, 'bar.tar' ) );
$f1 = $a5->locate('bar/bar.dat');

# TODO: add conditional note on Alpine to indicate that tar over there is broken regarding -p parameter
if ($f1) {
    $expected_permission = sprintf '%3o', ( ( stat($f1) )[2] & 07777 );
}
else {
    note( 'Could not locate "bar/bar.dat" inside the tarball '
          . File::Spec->catfile( TARDIR, 'bar.tar' ) );
}

SKIP: {
    skip 'Cannot check permissions on a non-existent file', 1 unless $f1;
    skip 'Permissions are too different on Microsoft Windows', 1
      if ( $Config{osname} eq 'MSWin32' || $Config{osname} eq 'msys' );



( run in 1.041 second using v1.01-cache-2.11-cpan-49f99fa48dc )