aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ Pipkin <j@dawnrazor.net>2013-01-06 05:00:51 -0600
committerJ Pipkin <j@dawnrazor.net>2013-01-06 05:00:51 -0600
commitfaf29b0064c6a0f37cde53d6026a15af21e6ce96 (patch)
treee67a4e611349b3aa86731c14b0518c75d38df5a2
parent4254f4742fc9d857d1ee8373eb970c736fb551e8 (diff)
parent7b2703d27973908fb7b87066c29e16dd1e02c5d4 (diff)
downloadsbotools2-faf29b0064c6a0f37cde53d6026a15af21e6ce96.tar.xz
Merge branch 'dl_vr_first', fixes #35
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm40
-rwxr-xr-xsboupgrade12
-rwxr-xr-xt/test.t5
3 files changed, 38 insertions, 19 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
index 2b39d05..b8142be 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
@@ -568,15 +569,30 @@ 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);
}
- return 1;
+ my @symlinks = create_symlinks($args{LOCATION}, %downloads);
+ return \@symlinks;
}
# given a location and a list of download links, assemble a list of symlinks,
@@ -721,6 +737,7 @@ sub do_slackbuild {
JOBS => 0,
LOCATION => '',
COMPAT32 => 0,
+ SYMLINKS => '',
@_
);
$args{LOCATION} or script_error 'do_slackbuild requires LOCATION.';
@@ -743,15 +760,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},
@@ -762,7 +770,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 12c086f..e33beca 100755
--- a/sboupgrade
+++ b/sboupgrade
@@ -194,7 +194,16 @@ sub process_sbos($) {
exists $_[0] or script_error 'process_sbos requires an argument.';
my $todo = shift;
my %failures;
- FIRST: for my $sbo (@$todo) {
+ my %symlinks;
+ for my $sbo (@$todo) {
+ $compat32 = $sbo =~ /-compat32$/ ? 1 : 0;
+ eval { $symlinks{$sbo} = 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};
@@ -210,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 ae9e94c..19297d9 100755
--- a/t/test.t
+++ b/t/test.t
@@ -225,8 +225,9 @@ 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');
+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
$config{SBO_HOME} = "$pwd/test_sbo";