aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib/SBO/Lib.pm
diff options
context:
space:
mode:
authorJ Pipkin <j@dawnrazor.net>2013-01-06 02:12:55 -0600
committerJ Pipkin <j@dawnrazor.net>2013-01-06 02:12:55 -0600
commit1876ab4a8448a913c4065ab4118e5bf2a86f5726 (patch)
tree48159b39b40539674c0907ddf26565d5bd2dd12d /SBO-Lib/lib/SBO/Lib.pm
parent3da88c764fa1edd1effa3d71deb074ce189790a5 (diff)
downloadsbotools2-1876ab4a8448a913c4065ab4118e5bf2a86f5726.tar.xz
perform download, md5sum verification, and creation of symlinks prior to building any sbos
Diffstat (limited to 'SBO-Lib/lib/SBO/Lib.pm')
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm26
1 files changed, 21 insertions, 5 deletions
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;
}