From 7b2703d27973908fb7b87066c29e16dd1e02c5d4 Mon Sep 17 00:00:00 2001 From: J Pipkin Date: Sun, 6 Jan 2013 03:57:04 -0600 Subject: propogate @symlinks from check_distfiles to do_slackbuild, update tests accordingly --- SBO-Lib/lib/SBO/Lib.pm | 5 +++-- sboupgrade | 4 +++- t/test.t | 5 ++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index f81350a..afddc3e 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -591,7 +591,7 @@ sub check_distfiles { get_distfile($link, $md5) unless verify_distfile($link, $md5); } my @symlinks = create_symlinks($args{LOCATION}, %downloads); - return 1; + return \@symlinks; } # given a location and a list of download links, assemble a list of symlinks, @@ -736,6 +736,7 @@ sub do_slackbuild { JOBS => 0, LOCATION => '', COMPAT32 => 0, + SYMLINKS => '', @_ ); $args{LOCATION} or script_error 'do_slackbuild requires LOCATION.'; @@ -768,7 +769,7 @@ sub do_slackbuild { X32 => $x32, ); $pkg = do_convertpkg $pkg if $args{COMPAT32}; - unlink $_ for @symlinks; + unlink $_ for @{$args{SYMLINKS}}; return $version, $pkg, $src; } diff --git a/sboupgrade b/sboupgrade index 4d7647a..e33beca 100755 --- a/sboupgrade +++ b/sboupgrade @@ -194,9 +194,10 @@ sub process_sbos($) { exists $_[0] or script_error 'process_sbos requires an argument.'; my $todo = shift; my %failures; + my %symlinks; for my $sbo (@$todo) { $compat32 = $sbo =~ /-compat32$/ ? 1 : 0; - eval { check_distfiles( + eval { $symlinks{$sbo} = check_distfiles( LOCATION => $locations{$sbo}, COMPAT32 => $compat32 ); }; $failures{$sbo} = $@ if $@; @@ -218,6 +219,7 @@ sub process_sbos($) { JOBS => $jobs, LOCATION => $locations{$sbo}, COMPAT32 => $compat32, + SYMLINKS => $symlinks{$sbo}, ); }; if ($@) { $failures{$sbo} = $@; diff --git a/t/test.t b/t/test.t index 41095e7..19297d9 100755 --- a/t/test.t +++ b/t/test.t @@ -225,9 +225,8 @@ is(get_pkg_name $tempfh, 'skype-2.2.0.35-i486-1_SBo.tgz', 'get_pkg_name good'); #rmdir '/tmp/SBo/test.2.d'; # check_distfiles test -#%downloads = get_sbo_downloads(LOCATION => "$sbo_home/perl/perl-Sort-Versions"); -#is((check_distfiles %downloads), 1, 'check_distfiles good'); -is (check_distfiles(LOCATION => "$sbo_home/perl/perl-Sort-Versions"), 1, +my $symlinks = check_distfiles(LOCATION => "$sbo_home/perl/perl-Sort-Versions"); +is($$symlinks[0], "$sbo_home/perl/perl-Sort-Versions/Sort-Versions-1.5.tar.gz", 'check_distfiles test 01'); # check_home tests -- cgit v1.2.3