From 1876ab4a8448a913c4065ab4118e5bf2a86f5726 Mon Sep 17 00:00:00 2001 From: J Pipkin Date: Sun, 6 Jan 2013 02:12:55 -0600 Subject: perform download, md5sum verification, and creation of symlinks prior to building any sbos --- SBO-Lib/lib/SBO/Lib.pm | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index ed70fcd..59118f7 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -43,6 +43,7 @@ our @EXPORT = qw( get_build_queue merge_queues get_installed_cpans + check_distfiles $tempdir $conf_dir $conf_file @@ -567,14 +568,29 @@ sub revert_slackbuild($) { return 1; } -# for each $download, see if we have it, and if the copy we have is good, -# otherwise download a new copy +# for the given location, pull list of downloads and check to see if any exist; +# if so, verify they md5 correctly and if not, download them and check the new +# download's md5sum, then create required symlinks for them. sub check_distfiles { - exists $_[0] or script_error 'check_distfiles requires an argument.'; - my %dists = @_; - while (my ($link, $md5) = each %dists) { + my %args = ( + LOCATION => '', + COMPAT32 => 0, + @_ + ); + $args{LOCATION} or script_error 'check_distfiles requires LOCATION.'; + + my $location = $args{LOCATION}; + my $sbo = get_sbo_from_loc $location; + my %downloads = get_sbo_downloads( + LOCATION => $location, + 32 => $args{COMPAT32} + ); + die "Unable to get download information from $location/$sbo.info.\n" unless + keys %downloads > 0; + while (my ($link, $md5) = each %downloads) { get_distfile($link, $md5) unless verify_distfile($link, $md5); } + my @symlinks = create_symlinks($args{LOCATION}, %downloads); return 1; } -- cgit v1.2.3 From 4dce56387b2437a6bd1b21e572168c02194e0d60 Mon Sep 17 00:00:00 2001 From: J Pipkin Date: Sun, 6 Jan 2013 03:42:39 -0600 Subject: remove old check_distfiles() code from do_slackbuild() --- SBO-Lib/lib/SBO/Lib.pm | 9 --------- 1 file changed, 9 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 59118f7..f81350a 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -758,15 +758,6 @@ sub do_slackbuild { } } } - # get a hash of downloads and md5sums, ensure we have 'em, symlink 'em - my %downloads = get_sbo_downloads( - LOCATION => $location, - 32 => $args{COMPAT32} - ); - die "Unable to get download information from $location/$sbo.info.\n" unless - keys %downloads > 0; - check_distfiles %downloads; - my @symlinks = create_symlinks($args{LOCATION}, %downloads); # setup and run the .SlackBuild itself my ($pkg, $src) = perform_sbo( OPTS => $args{OPTS}, -- cgit v1.2.3 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 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') 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; } -- cgit v1.2.3