summaryrefslogtreecommitdiffstats
path: root/urpm/md5sum.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-12-19 14:42:12 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-12-19 14:42:12 +0000
commitfed64bf5e2814aa4fad6d7fac44f768d08af76c4 (patch)
treebe4fcc1e3c96696727fe02f0693a4a236095189c /urpm/md5sum.pm
parent7a718bd220b3c2d62d0bd2e3b6e7f4f990b2ee8a (diff)
downloadurpmi-fed64bf5e2814aa4fad6d7fac44f768d08af76c4.tar
urpmi-fed64bf5e2814aa4fad6d7fac44f768d08af76c4.tar.gz
urpmi-fed64bf5e2814aa4fad6d7fac44f768d08af76c4.tar.bz2
urpmi-fed64bf5e2814aa4fad6d7fac44f768d08af76c4.tar.xz
urpmi-fed64bf5e2814aa4fad6d7fac44f768d08af76c4.zip
o replace /var/lib/urpmi/MD5SUM with /var/lib/urpmi/MD5SUM.<medium_name>
(this will allow checking xml media_info is up-to-date even if we don't update it at the same time as synthesis is updated) and further cleanup urpm::media code (esp. modify {force} behaviour, may need some adjustments)
Diffstat (limited to 'urpm/md5sum.pm')
-rw-r--r--urpm/md5sum.pm35
1 files changed, 6 insertions, 29 deletions
diff --git a/urpm/md5sum.pm b/urpm/md5sum.pm
index 05176086..73870dba 100644
--- a/urpm/md5sum.pm
+++ b/urpm/md5sum.pm
@@ -4,48 +4,25 @@ use urpm;
use urpm::util;
use urpm::msg;
+sub parse {
+ my ($md5sum_file) = @_;
-#- parse an MD5SUM file from a mirror
-sub from_MD5SUM {
- my ($md5sum_file, $f) = @_;
- my $basename = basename($f);
-
- my ($retrieved_md5sum) = map {
+ my %h = map {
my ($md5sum, $file) = m|(\S+)\s+(?:\./)?(\S+)|;
- $file && $file eq $basename ? $md5sum : @{[]};
+ $file => $md5sum;
} cat_($md5sum_file);
- $retrieved_md5sum;
+ \%h;
}
sub from_MD5SUM__or_warn {
my ($urpm, $md5sum_file, $basename) = @_;
$urpm->{log}(N("examining %s file", $md5sum_file));
- my $retrieved_md5sum = from_MD5SUM($md5sum_file, $basename)
+ my $retrieved_md5sum = parse($md5sum_file)->{$basename}
or $urpm->{log}(N("warning: md5sum for %s unavailable in MD5SUM file", $basename));
return $retrieved_md5sum;
}
-sub on_local_medium {
- my ($urpm, $medium, $force) = @_;
- if ($force) {
- #- force downloading the file again, else why a force option has been defined ?
- delete $medium->{md5sum};
- } else {
- $medium->{md5sum} ||= compute_on_local_medium($urpm, $medium);
- }
- $medium->{md5sum};
-}
-
-sub compute_on_local_medium {
- my ($urpm, $medium) = @_;
-
- require urpm::media; #- help perl_checker
- my $f = urpm::media::statedir_synthesis($urpm, $medium);
- $urpm->{log}(N("computing md5sum of existing source synthesis [%s]", $f));
- -e $f && compute($f);
-}
-
sub compute {
my ($file) = @_;
eval { require Digest::MD5 };