From 0d9ae2af69c646703414d8f5686d3f99d256a3eb Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 8 May 2008 21:19:35 +0000 Subject: Make some confmem behavior modifications in order to try and make it less confusing for people who have forgotten about the --noconfmem option or are completely unaware of it. Thanks to Joe Peterson for suggesting these: * Always behave like --noconfmem is enabled for downgrades. * Purge confmem entries when a package is unmerged rather than replaced. (trunk r10250) svn path=/main/branches/2.1.2/; revision=10251 --- pym/portage.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'pym/portage.py') diff --git a/pym/portage.py b/pym/portage.py index 944499838..4bb4cbca6 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -8822,7 +8822,11 @@ class dblink: vartree=self.vartree)) dest_root = normalize_path(self.vartree.root).rstrip(os.path.sep) + \ os.path.sep - dest_root_len = len(dest_root) + dest_root_len = len(dest_root) - 1 + + conf_mem_file = os.path.join(dest_root, CONFIG_MEMORY_FILE) + cfgfiledict = grabdict(conf_mem_file) + stale_confmem = [] unmerge_orphans = "unmerge-orphans" in self.settings.features @@ -8887,6 +8891,9 @@ class dblink: continue if obj.startswith(dest_root): relative_path = obj[dest_root_len:] + if not others_in_slot and \ + relative_path in cfgfiledict: + stale_confmem.append(relative_path) is_owned = False for dblnk in others_in_slot: if dblnk.isowner(relative_path, dest_root): @@ -9011,6 +9018,12 @@ class dblink: show_unmerge("---", "!empty", "dir", obj) del e + # Remove stale entries from config memory. + if stale_confmem: + for filename in stale_confmem: + del cfgfiledict[filename] + writedict(cfgfiledict, conf_mem_file) + #remove self from vartree database so that our own virtual gets zapped if we're the last node self.vartree.zap(self.mycpv) @@ -9504,6 +9517,15 @@ class dblink: else: cfgfiledict["IGNORE"]=0 + # Always behave like --noconfmem is enabled for downgrades + # so that people who don't know about this option are less + # likely to get confused when doing upgrade/downgrade cycles. + pv_split = catpkgsplit(self.mycpv)[1:] + for other in others_in_slot: + if pkgcmp(pv_split, catpkgsplit(other.mycpv)[1:]) < 0: + cfgfiledict["IGNORE"] = 1 + break + # Don't bump mtimes on merge since some application require # preservation of timestamps. This means that the unmerge phase must # check to see if file belongs to an installed instance in the same -- cgit v1.2.3-1-g7c22