citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 8512349a2acc965fc0d5dca8fcb0505e97a10a3b
parent e989f89bb6f0396e408f4e6d4e26e9af57f43f03
Author: Kyle Milz <kyle@0x30.net>
Date:   Thu, 16 Jun 2016 22:11:08 -0600

Test: cache distfiles used in packages

Diffstat:
MTest/Package.pm | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Test/Package.pm b/Test/Package.pm @@ -1,6 +1,7 @@ package Test::Package; use strict; +use Cwd; use IPC::Open2; use File::Temp qw( tempdir ); @@ -14,9 +15,14 @@ sub new { my $dir = tempdir( CLEANUP => 1 ); $self->{dir} = $dir; - my $dist_url = "$dist_root$dist_name"; - system("cd $dir && curl -O $dist_url") == 0 or die "download failed"; - system("cd $dir && $extract_cmd $dist_name") == 0 or die "extract failed"; + mkdir "distfiles"; + if (! -e "distfiles/$dist_name") { + my $dist_url = "$dist_root$dist_name"; + system("curl $dist_url -o distfiles/$dist_name") == 0 or die "download failed"; + } + + my $abs_dist_path = getcwd . "/distfiles/$dist_name"; + system("cd $dir && $extract_cmd $abs_dist_path") == 0 or die "extract failed"; return $self; }