summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--urpm/mirrors.pm5
2 files changed, 7 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 830bdcdc..91592f94 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- properly invalidate mirror cache when the distro version changes
+ (ie when product.id changes). Fixes bug #52133, patch from Aurélien Lefebvre
- adjust parsing of aria2 output for aria2 1.4, fixes bug #51354, patch from
Funda Wang
- use urpmi log API for the transaction failed message instead of
diff --git a/urpm/mirrors.pm b/urpm/mirrors.pm
index 0ea9b58f..8be3b621 100644
--- a/urpm/mirrors.pm
+++ b/urpm/mirrors.pm
@@ -110,6 +110,7 @@ sub _pick_one_ {
# the cache will be deemed outdated if network_mtime is more recent than the cache's
$cache->{network_mtime} = _network_mtime() if $set_network_mtime;
+ $cache->{product_id_mtime} = _product_id_mtime();
}
$cache->{chosen} = $cache->{list}[0]{url} or return;
@@ -145,6 +146,9 @@ sub _cache__may_clean_if_outdated {
time() > $cache->{time} + 24*60*60 * $urpm->{options}{'days-between-mirrorlist-update'}) {
$urpm->{log}("not using outdated cached mirror list $mirrorlist");
%$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 = ();
}
}
$cache;
@@ -299,6 +303,7 @@ sub _is_only_one_mirror {
}
sub _network_mtime() { (stat('/etc/resolv.conf'))[9] }
+sub _product_id_mtime() { (stat('/etc/product.id'))[9] }
sub parse_LDAP_namespace_structure {
my ($s) = @_;