summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-07-24 15:47:27 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-07-24 15:47:27 +0000
commit3d17ce895bc56e71299348512e5e367b3ebb1af7 (patch)
tree48d03b2939a8a1292314b8b723603eb1613a21f8 /urpm
parentdd31480d4c9f48132b5df16caa4ef7734468c3e1 (diff)
downloadurpmi-3d17ce895bc56e71299348512e5e367b3ebb1af7.tar
urpmi-3d17ce895bc56e71299348512e5e367b3ebb1af7.tar.gz
urpmi-3d17ce895bc56e71299348512e5e367b3ebb1af7.tar.bz2
urpmi-3d17ce895bc56e71299348512e5e367b3ebb1af7.tar.xz
urpmi-3d17ce895bc56e71299348512e5e367b3ebb1af7.zip
invalidate mirrorlist cache when distro version changes
If mirrors.cache contains mirrors for 2009.1 and product.id changes to have version=2010.0, cache is used and urpmi.addmedia --distrib --mirrorlist will add 2009.1 mirrors. Store mtime of product.id in the mirror cache to properly detect when product.id was modified
Diffstat (limited to 'urpm')
-rw-r--r--urpm/mirrors.pm5
1 files changed, 5 insertions, 0 deletions
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) = @_;