summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-21 11:19:46 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-21 11:19:46 +0000
commitc8ca455c13b5083d3c91e61a6e0c326c1ef744aa (patch)
treeac574a9cedb661c75bf636572e947c64bbe3f79a
parent54df8bebc17e3148e16387ad8c4f3ce0d2a0ebd2 (diff)
downloadurpmi-c8ca455c13b5083d3c91e61a6e0c326c1ef744aa.tar
urpmi-c8ca455c13b5083d3c91e61a6e0c326c1ef744aa.tar.gz
urpmi-c8ca455c13b5083d3c91e61a6e0c326c1ef744aa.tar.bz2
urpmi-c8ca455c13b5083d3c91e61a6e0c326c1ef744aa.tar.xz
urpmi-c8ca455c13b5083d3c91e61a6e0c326c1ef744aa.zip
create get_hdlist_or_synthesis_and_check_md5sum__local() out of
_update_medium__parse_if_unmodified__or_get_files__local() and so make things clearer
-rw-r--r--urpm.pm55
1 files changed, 29 insertions, 26 deletions
diff --git a/urpm.pm b/urpm.pm
index b971a8c6..385d4dbb 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -1375,6 +1375,21 @@ sub get_hdlist_or_synthesis__local {
}
}
+sub get_hdlist_or_synthesis_and_check_md5sum__local {
+ my ($urpm, $medium, $retrieved_md5sum, $callback) = @_;
+
+ get_hdlist_or_synthesis__local($urpm, $medium, $callback) or return;
+
+ #- keep checking md5sum of file just copied ! (especially on nfs or removable device).
+ if ($retrieved_md5sum) {
+ $urpm->{log}(N("computing md5sum of copied source hdlist (or synthesis)"));
+ md5sum(cachedir_hdlist($urpm, $medium)) eq $retrieved_md5sum or
+ $urpm->{error}(N("copy of [%s] failed (md5sum mismatch)", _url_with_hdlist($medium))), return;
+ }
+
+ 1;
+}
+
#- options: callback, force, force_building_hdlist, nomd5sum, nopubkey, probe_with
sub _update_medium__parse_if_unmodified__or_get_files__local {
my ($urpm, $medium, $second_pass, $clean_cache, $rpm_files, $options) = @_;
@@ -1437,35 +1452,23 @@ this could happen if you mounted manually the directory when creating the medium
}
}
- my $error;
-
#- if the source hdlist is present and we are not forcing using rpm files
if (!$options->{force_building_hdlist} && -e _url_with_hdlist($medium)) {
- get_hdlist_or_synthesis__local($urpm, $medium, $options->{callback})
- or $error = 1;
- }
-
- #- keep checking md5sum of file just copied ! (especially on nfs or removable device).
- if (!$error && $retrieved_md5sum) {
- $urpm->{log}(N("computing md5sum of copied source hdlist (or synthesis)"));
- md5sum(cachedir_hdlist($urpm, $medium)) eq $retrieved_md5sum or
- $error = 1, $urpm->{error}(N("copy of [%s] failed (md5sum mismatch)", _url_with_hdlist($medium)));
- }
-
- #- check if the files are equal... and no force copy...
- if (!$error && !$options->{force} && -e statedir_synthesis($urpm, $medium)) {
- _read_existing_synthesis_and_hdlist_if_same_time_and_msize($urpm, $medium, $medium->{hdlist})
- and return 'unmodified';
- }
-
- #- if copying hdlist has failed, try to build it directly.
- if ($error) {
- if ($urpm->{options}{'build-hdlist-on-error'}) {
- $options->{force_building_hdlist} = 1;
+ if (get_hdlist_or_synthesis_and_check_md5sum__local($urpm, $medium, $retrieved_md5sum, $options->{callback})) {
+ #- check if the files are equal... and no force copy...
+ if (!$options->{force}) {
+ _read_existing_synthesis_and_hdlist_if_same_time_and_msize($urpm, $medium, $medium->{hdlist})
+ and return 'unmodified';
+ }
} else {
- $urpm->{error}(N("unable to access hdlist file of \"%s\", medium ignored", $medium->{name}));
- $medium->{ignore} = 1;
- return;
+ #- if copying hdlist has failed, try to build it directly.
+ if ($urpm->{options}{'build-hdlist-on-error'}) {
+ $options->{force_building_hdlist} = 1;
+ } else {
+ $urpm->{error}(N("unable to access hdlist file of \"%s\", medium ignored", $medium->{name}));
+ $medium->{ignore} = 1;
+ return;
+ }
}
}
} else {