aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Pipkin <j@dawnrazor.net>2012-11-04 12:53:44 -0600
committerJacob Pipkin <j@dawnrazor.net>2012-11-04 12:53:44 -0600
commit9000e498363367a97e01f5e116df6be20c82c497 (patch)
tree5bba5e45df27b5c6fe8da23cc096ecac4d3795ec
parent1c0c886cfd56905e44fa87095ba53e854df6895c (diff)
downloadsbotools2-9000e498363367a97e01f5e116df6be20c82c497.tar.xz
remove compare_md5s sub, call verify_distfile from get_distfile instead of comparing in both places
-rw-r--r--SBO-Lib/lib/SBO/Lib.pm13
1 files changed, 4 insertions, 9 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm
index 3190ad1..b1aa75c 100644
--- a/SBO-Lib/lib/SBO/Lib.pm
+++ b/SBO-Lib/lib/SBO/Lib.pm
@@ -398,12 +398,6 @@ sub compute_md5sum ($) {
return $md5sum;
}
-sub compare_md5s {
- exists $_[1] or script_error 'compare_md5s requires two arguments.';
- my ($first, $second) = @_;
- return $first eq $second ? 1 : undef;
-}
-
# for a given distfile, see whether or not it exists, and if so, if its md5sum
# matches the sbo's .info file
sub verify_distfile ($$) {
@@ -413,14 +407,14 @@ sub verify_distfile ($$) {
return unless -d $distfiles;
return unless -f $filename;
my $md5sum = compute_md5sum $filename;
- return compare_md5s ($info_md5sum, $md5sum);
+ return $info_md5 eq $md5sum ? 1 : 0;
}
# for a given distfile, attempt to retrieve it and, if successful, check its
# md5sum against that in the sbo's .info file
sub get_distfile ($$) {
exists $_[1] or script_error 'get_distfile requires an argument';
- my ($link, $exp_md5) = @_;
+ my ($link, $info_md5) = @_;
my $filename = get_filename_from_link $link;
mkdir $distfiles unless -d $distfiles;
chdir $distfiles;
@@ -428,7 +422,8 @@ sub get_distfile ($$) {
die "Unable to wget $link\n";
my $md5sum = compute_md5sum $filename;
# can't do anything if the link in the .info doesn't lead to a good d/l
- compare_md5s ($md5sum, $exp_md5) or die "md5sum failure for $filename.\n";
+ verify_distfile ($link, $info_md5) ? return 1
+ : die "md5sum failure for $filename.\n";
return 1;
}