summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-21 11:06:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-21 11:06:24 +0000
commita6e151d1eb76c5dbc198aa0b88b8e9483b8b6e08 (patch)
tree3251653768301c6a463265d13d361b62a1a7720b
parent81d752ea0d53aef3179da432f4c1e4fcd560b989 (diff)
downloadurpmi-a6e151d1eb76c5dbc198aa0b88b8e9483b8b6e08.tar
urpmi-a6e151d1eb76c5dbc198aa0b88b8e9483b8b6e08.tar.gz
urpmi-a6e151d1eb76c5dbc198aa0b88b8e9483b8b6e08.tar.bz2
urpmi-a6e151d1eb76c5dbc198aa0b88b8e9483b8b6e08.tar.xz
urpmi-a6e151d1eb76c5dbc198aa0b88b8e9483b8b6e08.zip
simplify
-rw-r--r--urpm.pm13
1 files changed, 5 insertions, 8 deletions
diff --git a/urpm.pm b/urpm.pm
index 177adb7c..6c28029f 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -1430,8 +1430,7 @@ this could happen if you mounted manually the directory when creating the medium
unless ($medium->{virtual}) {
if ($medium->{with_hdlist}) {
if (!$options->{nomd5sum} && file_size(_hdlist_dir($medium) . '/MD5SUM') > 32) {
- recompute_local_md5sum($urpm, $medium, $options->{force});
- if ($medium->{md5sum}) {
+ if (recompute_local_md5sum($urpm, $medium, $options->{force})) {
$retrieved_md5sum = parse_md5sum($urpm, _hdlist_dir($medium) . '/MD5SUM', basename($medium->{with_hdlist}));
_read_existing_synthesis_and_hdlist_if_same_md5sum($urpm, $medium, $retrieved_md5sum)
and return 'unmodified';
@@ -1554,8 +1553,7 @@ sub _update_medium__parse_if_unmodified__or_get_files__remote {
sync_webfetch($urpm, $medium,
[ reduce_pathname(_hdlist_dir($medium) . '/MD5SUM') ],
quiet => 1) && file_size("$urpm->{cachedir}/partial/MD5SUM") > 32) {
- recompute_local_md5sum($urpm, $medium, $options->{force} >= 2);
- if ($medium->{md5sum}) {
+ if (recompute_local_md5sum($urpm, $medium, $options->{force} >= 2)) {
$retrieved_md5sum = parse_md5sum($urpm, "$urpm->{cachedir}/partial/MD5SUM", $basename);
_read_existing_synthesis_and_hdlist_if_same_md5sum($urpm, $medium, $retrieved_md5sum)
and return 'unmodified';
@@ -3301,8 +3299,9 @@ sub recompute_local_md5sum {
#- force downloading the file again, else why a force option has been defined ?
delete $medium->{md5sum};
} else {
- compute_local_md5sum($urpm, $medium) if !$medium->{md5sum};
+ $medium->{md5sum} ||= compute_local_md5sum($urpm, $medium);
}
+ $medium->{md5sum};
}
sub compute_local_md5sum {
@@ -3310,9 +3309,7 @@ sub compute_local_md5sum {
$urpm->{log}(N("computing md5sum of existing source hdlist (or synthesis)"));
my $f = statedir_hdlist_or_synthesis($urpm, $medium);
- if (-e $f) {
- $medium->{md5sum} = md5sum($f);
- }
+ -e $f && md5sum($f);
}
sub syserror { my ($urpm, $msg, $info) = @_; $urpm->{error}("$msg [$info] [$!]") }