diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2006-01-04 12:15:00 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2006-01-04 12:15:00 +0000 |
commit | baeec0542495b5b631fbd629f0fb0d8497a6ef47 (patch) | |
tree | 7bc11a56208d8ee12b55a587a5a99aa6276342e8 /urpm.pm | |
parent | 32e89e0ecfd8d1415053bcaeb45d2c4e143635be (diff) | |
download | urpmi-baeec0542495b5b631fbd629f0fb0d8497a6ef47.tar urpmi-baeec0542495b5b631fbd629f0fb0d8497a6ef47.tar.gz urpmi-baeec0542495b5b631fbd629f0fb0d8497a6ef47.tar.bz2 urpmi-baeec0542495b5b631fbd629f0fb0d8497a6ef47.tar.xz urpmi-baeec0542495b5b631fbd629f0fb0d8497a6ef47.zip |
Refactoring
Diffstat (limited to 'urpm.pm')
-rw-r--r-- | urpm.pm | 51 |
1 files changed, 21 insertions, 30 deletions
@@ -1214,21 +1214,7 @@ this could happen if you mounted manually the directory when creating the medium unless ($medium->{virtual}) { if ($medium->{with_hdlist}) { if (!$options{nomd5sum} && -s reduce_pathname("$with_hdlist_dir/../MD5SUM") > 32) { - if ($options{force}) { - #- force downloading the file again, else why a force option has been defined ? - delete $medium->{md5sum}; - } else { - unless ($medium->{md5sum}) { - $urpm->{log}(N("computing md5sum of existing source hdlist (or synthesis)")); - if ($medium->{synthesis}) { - -e "$urpm->{statedir}/synthesis.$medium->{hdlist}" and - $medium->{md5sum} = md5sum("$urpm->{statedir}/synthesis.$medium->{hdlist}"); - } else { - -e "$urpm->{statedir}/$medium->{hdlist}" and - $medium->{md5sum} = md5sum("$urpm->{statedir}/$medium->{hdlist}"); - } - } - } + recompute_local_md5sum($urpm, $medium, $options{force}); if ($medium->{md5sum}) { $retrieved_md5sum = parse_md5sum($urpm, reduce_pathname("$with_hdlist_dir/../MD5SUM"), $basename); #- If an existing hdlist or synthesis file has the same md5sum, we assume @@ -1488,21 +1474,7 @@ this could happen if you mounted manually the directory when creating the medium } }; if (!$@ && -e "$urpm->{cachedir}/partial/MD5SUM" && -s _ > 32) { - if ($options{force} >= 2) { - #- force downloading the file again, else why a force option has been defined ? - delete $medium->{md5sum}; - } else { - unless ($medium->{md5sum}) { - $urpm->{log}(N("computing md5sum of existing source hdlist (or synthesis)")); - if ($medium->{synthesis}) { - -e "$urpm->{statedir}/synthesis.$medium->{hdlist}" and - $medium->{md5sum} = md5sum("$urpm->{statedir}/synthesis.$medium->{hdlist}"); - } else { - -e "$urpm->{statedir}/$medium->{hdlist}" and - $medium->{md5sum} = md5sum("$urpm->{statedir}/$medium->{hdlist}"); - } - } - } + recompute_local_md5sum($urpm, $medium, $options{force} >= 2); if ($medium->{md5sum}) { $retrieved_md5sum = parse_md5sum($urpm, "$urpm->{cachedir}/partial/MD5SUM", $basename); #- if an existing hdlist or synthesis file has the same md5sum, we assume the @@ -3406,6 +3378,25 @@ sub parse_md5sum { return $retrieved_md5sum; } +sub recompute_local_md5sum { + my ($urpm, $medium, $force) = @_; + if ($force) { + #- force downloading the file again, else why a force option has been defined ? + delete $medium->{md5sum}; + } else { + unless ($medium->{md5sum}) { + $urpm->{log}(N("computing md5sum of existing source hdlist (or synthesis)")); + if ($medium->{synthesis}) { + -e "$urpm->{statedir}/synthesis.$medium->{hdlist}" and + $medium->{md5sum} = md5sum("$urpm->{statedir}/synthesis.$medium->{hdlist}"); + } else { + -e "$urpm->{statedir}/$medium->{hdlist}" and + $medium->{md5sum} = md5sum("$urpm->{statedir}/$medium->{hdlist}"); + } + } + } +} + sub syserror { my ($urpm, $msg, $info) = @_; $urpm->{error}("$msg [$info] [$!]") } sub open_safe { |