summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-23 16:38:56 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-23 16:38:56 +0000
commit5f0ec80af00591a5479ff11f12470e5ebb02db58 (patch)
treef1faba32be41ae1afd8cd57f83bb1f043fb8d615
parent42f4c5c2e972306ab7040353eb916337d1cda51b (diff)
downloadurpmi-5f0ec80af00591a5479ff11f12470e5ebb02db58.tar
urpmi-5f0ec80af00591a5479ff11f12470e5ebb02db58.tar.gz
urpmi-5f0ec80af00591a5479ff11f12470e5ebb02db58.tar.bz2
urpmi-5f0ec80af00591a5479ff11f12470e5ebb02db58.tar.xz
urpmi-5f0ec80af00591a5479ff11f12470e5ebb02db58.zip
- urpmi.addmedia, urpmi.update:
o for remote media, instead of first checking reconfig.urpmi, try MD5SUM. If it fails try reconfig.urpmi
-rw-r--r--NEWS2
-rw-r--r--urpm/media.pm28
2 files changed, 20 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index c6d9f2fb..50076203 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
- use "versioned" media_info files
(needed for aria2 to handle mirrors not having some media_info/*)
- urpmi.addmedia, urpmi.update:
+ o for remote media, instead of first checking reconfig.urpmi, try MD5SUM.
+ If it fails try reconfig.urpmi
o only look for "descriptions" in media_info/
o do not get "descriptions" on non update media since it's useless and
potentially slow
diff --git a/urpm/media.pm b/urpm/media.pm
index 9619717b..c8c3428b 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -1021,10 +1021,9 @@ sub may_reconfig_urpmi {
$f = urpm::download::sync_rel_one($urpm, $medium, 'reconfig.urpmi',
quiet => 1, preclean => 1) or return;
}
- if (-s $f) {
- reconfig_urpmi($urpm, $f, $medium);
- }
+ my $reconfigured = -s $f && reconfig_urpmi($urpm, $f, $medium);
unlink $f if !is_local_medium($medium);
+ $reconfigured;
}
#- read a reconfiguration file for urpmi, and reconfigure media accordingly
@@ -1045,7 +1044,7 @@ sub reconfig_urpmi {
#- the first line of reconfig.urpmi must be magic, to be sure it's not an error file
$magic =~ /^# this is an urpmi reconfiguration file/ or return undef;
- $urpm->{log}(N("reconfiguring urpmi for media \"%s\"", $medium->{name}));
+ $urpm->{info}(N("reconfiguring urpmi for media \"%s\"", $medium->{name}));
my @replacements;
foreach (@lines) {
@@ -1358,6 +1357,11 @@ sub _update_medium__parse_if_unmodified__local {
urpm::removable::try_mounting_medium($urpm, $medium) or return;
}
+ #- check for a reconfig.urpmi file (if not already reconfigured)
+ if (!$medium->{noreconfigure}) {
+ may_reconfig_urpmi($urpm, $medium);
+ }
+
#- try to probe for possible with_synthesis parameter, unless
#- it is already defined (and valid).
if (!_valid_synthesis_dir($medium) && $options->{probe_with} ne 'rpms') {
@@ -1449,7 +1453,16 @@ sub _update_medium__parse_if_unmodified__remote {
#- examine if a distant MD5SUM file is available.
if (!$options->{nomd5sum}) {
- my $new_MD5SUM = _download_MD5SUM_and_check($urpm, $medium, !$updating) or return;
+ my $new_MD5SUM = _download_MD5SUM_and_check($urpm, $medium, !$updating);
+
+ if (!$new_MD5SUM) {
+ #- check for a reconfig.urpmi file (if not already reconfigured)
+ if (!$medium->{noreconfigure}) {
+ may_reconfig_urpmi($urpm, $medium)
+ and goto &_update_medium__parse_if_unmodified__remote;
+ }
+ return;
+ }
if ($options->{force} < 2 && _is_statedir_MD5SUM_uptodate($urpm, $medium, $new_MD5SUM)) {
_medium_is_up_to_date($urpm, $medium);
return 'unmodified';
@@ -1548,11 +1561,6 @@ sub _update_medium_ {
_pick_mirror_if_needed($urpm, $medium, 'allow-cache-update');
- #- check for a reconfig.urpmi file (if not already reconfigured)
- if (!$medium->{noreconfigure}) {
- may_reconfig_urpmi($urpm, $medium);
- }
-
{
my $rc =
is_local_medium($medium)