summaryrefslogtreecommitdiffstats
path: root/urpm/mirrors.pm
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-08-18 13:47:58 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-08-18 13:47:58 +0000
commit5aba667cd39f7e5b54e0c459e4b3b6b6dc9f00a3 (patch)
treee575ae7b2d5556846950c410c34ec1cc7532cec9 /urpm/mirrors.pm
parent6256b52efee60cde8d6744434a348c9700f7fbf6 (diff)
downloadurpmi-5aba667cd39f7e5b54e0c459e4b3b6b6dc9f00a3.tar
urpmi-5aba667cd39f7e5b54e0c459e4b3b6b6dc9f00a3.tar.gz
urpmi-5aba667cd39f7e5b54e0c459e4b3b6b6dc9f00a3.tar.bz2
urpmi-5aba667cd39f7e5b54e0c459e4b3b6b6dc9f00a3.tar.xz
urpmi-5aba667cd39f7e5b54e0c459e4b3b6b6dc9f00a3.zip
append a 'reason' field to api.mandriva.com queries when the query is
meant to update the mirror list
Diffstat (limited to 'urpm/mirrors.pm')
-rw-r--r--urpm/mirrors.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/urpm/mirrors.pm b/urpm/mirrors.pm
index 8be3b621..b033e80c 100644
--- a/urpm/mirrors.pm
+++ b/urpm/mirrors.pm
@@ -131,6 +131,15 @@ sub black_list {
}
}
+sub _trigger_cache_update {
+ my ($urpm, $cache, $o_is_upgrade) = @_;
+
+ my $reason = $o_is_upgrade?"reason=upgrade":"reason=update";
+ $urpm->{log}("URPMI_ADDMEDIA_REASON $reason");
+ $ENV{URPMI_ADDMEDIA_REASON} = $reason;
+ %$cache = ();
+}
+
#- side-effects:
#- + those of _cache ($urpm->{mirrors_cache})
sub _cache__may_clean_if_outdated {
@@ -141,14 +150,14 @@ sub _cache__may_clean_if_outdated {
if ($allow_cache_update) {
if ($cache->{network_mtime} && _network_mtime() > $cache->{network_mtime}) {
$urpm->{log}("not using cached mirror list $mirrorlist since network configuration changed");
- %$cache = ();
+ _trigger_cache_update ($urpm, $cache);
} elsif ($cache->{time} &&
time() > $cache->{time} + 24*60*60 * $urpm->{options}{'days-between-mirrorlist-update'}) {
$urpm->{log}("not using outdated cached mirror list $mirrorlist");
- %$cache = ();
+ _trigger_cache_update ($urpm, $cache);
} elsif ($cache->{product_id_mtime} && _product_id_mtime() != $cache->{product_id_mtime}) {
$urpm->{log}("not using cached mirror list $mirrorlist since product id file changed");
- %$cache = ();
+ _trigger_cache_update ($urpm, $cache, 1);
}
}
$cache;