aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm26
-rwxr-xr-xsboupgrade10
-rwxr-xr-xt/test.t6
3 files changed, 34 insertions, 8 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;
}
diff --git a/sboupgrade b/sboupgrade
index 12c086f..4d7647a 100755
--- a/sboupgrade
+++ b/sboupgrade
@@ -194,7 +194,15 @@ sub process_sbos($) {
exists $_[0] or script_error 'process_sbos requires an argument.';
my $todo = shift;
my %failures;
- FIRST: for my $sbo (@$todo) {
+ for my $sbo (@$todo) {
+ $compat32 = $sbo =~ /-compat32$/ ? 1 : 0;
+ eval { check_distfiles(
+ LOCATION => $locations{$sbo}, COMPAT32 => $compat32
+ ); };
+ $failures{$sbo} = $@ if $@;
+ }
+ return %failures if keys %failures > 0;
+ for my $sbo (@$todo) {
my $opts = 0;
$opts = $options{$sbo} if defined $options{$sbo};
my $cmds = $commands{$sbo} if defined $commands{$sbo};
diff --git a/t/test.t b/t/test.t
index ae9e94c..41095e7 100755
--- a/t/test.t
+++ b/t/test.t
@@ -225,8 +225,10 @@ 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');
+#%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,
+ 'check_distfiles test 01');
# check_home tests
$config{SBO_HOME} = "$pwd/test_sbo";