Alien-Build
view release on metacpan or search on metacpan
t/alien_build_plugin_extract_commandline.t view on Meta::CPAN
my $new = path(tempdir( CLEANUP => 1))->child("foo-1.00.$ext");
$original->copy($new);
$new->stringify;
};
note "archive = $archive";
$build->install_prop->{download_detail}->{$archive} = {
protocol => 'file',
digest => [ FAKE => 'deadbeaf' ],
};
my($out, $dir, $error) = capture_merged {
my $dir = eval { $build->extract($archive) };
($dir, $@);
};
is $error, '', 'no error from extract';
if($error ne '')
{
diag "[output ] $_", for split /\n/, $out;
diag "[exception ] $_", for split /\n/, $error;
if($ext eq 'tar.xz' && $^O eq 'openbsd')
{
diag "[xz --version] $_" for split /\n/, capture_merged {
system 'xz --version';
};
diag "[\$( ] $(";
diag "[\$) ] $)";
if(-r "/etc/fstab")
{
diag "[/etc/fstab ] $_" for grep m{/tmp}, path("/etc/fstab")->lines;
}
diag "SEE https://github.com/PerlAlien/Alien-Build/issues/62";
diag "if you can help with this.\n";
}
return;
}
note $out if $out ne '';
note $error if $error;
$dir = path($dir);
ok( defined $dir && -d $dir, "directory created" );
note "dir = $dir";
foreach my $name (qw( configure foo.c ))
{
my $file = $dir->child($name);
ok -f $file, "$name exists";
}
}
}
};
subtest 'archive with pax_global_header' => sub {
skip_all "system does not support tar" unless Alien::Build::Plugin::Extract::CommandLine->new->handles('tar');
my $build = alienfile_ok q{
use alienfile;
use Path::Tiny qw( path );
plugin 'Test::Mock',
probe => 'share',
download => {
'foo.tar' => path(__FILE__)->parent->parent->child('corpus/dist2/foo.tar')->slurp_raw,
};
share {
plugin 'Extract::CommandLine';
};
};
my $dir = alien_extract_ok;
if(defined $dir)
{
my $file = path($dir)->child('foo.txt');
my $content = eval { $file->slurp };
is($content, "xx\n", "file content matches");
unless(-f $file)
{
diag "listing:";
foreach my $child (path($dir)->children)
{
diag $child;
}
}
}
};
done_testing;
( run in 1.760 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )