From 844863c5da7884273bcc02ba05c475ae6f6103c1 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 12 Jun 2007 02:44:26 +0000 Subject: For bug #181021, during unmerge use all slot matches for reference counts (in case the user has set AUTOCLEAN=no). svn path=/main/trunk/; revision=6814 --- pym/portage/dbapi/vartree.py | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'pym') diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index c7f5dc113..288cd0dbb 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1124,27 +1124,21 @@ class dblink(object): writemsg_stdout("No package files given... Grabbing a set.\n") pkgfiles = self.getcontents() - if not new_contents: - counter = self.vartree.dbapi.cpv_counter(self.mycpv) - slot = self.vartree.dbapi.aux_get(self.mycpv, ["SLOT"])[0] - slot_matches = self.vartree.dbapi.match( - "%s:%s" % (dep_getkey(self.mycpv), slot)) - new_cpv = None - if slot_matches: - max_counter = -1 - for cur_cpv in slot_matches: - cur_counter = self.vartree.dbapi.cpv_counter(cur_cpv) - if cur_counter == counter and \ - cur_cpv == self.mycpv: - continue - if cur_counter > max_counter: - max_counter = cur_counter - new_cpv = cur_cpv - if new_cpv: - # The current instance has been replaced by a newer instance. - new_cat, new_pkg = catsplit(new_cpv) - new_contents = dblink(new_cat, new_pkg, self.vartree.root, - self.settings, vartree=self.vartree).getcontents() + counter = self.vartree.dbapi.cpv_counter(self.mycpv) + slot = self.vartree.dbapi.aux_get(self.mycpv, ["SLOT"])[0] + slot_matches = self.vartree.dbapi.match( + "%s:%s" % (dep_getkey(self.mycpv), slot)) + claimed_paths = set() + if new_contents: + claimed_paths.update(new_contents) + for cur_cpv in slot_matches: + cur_counter = self.vartree.dbapi.cpv_counter(cur_cpv) + if cur_counter == counter and \ + cur_cpv == self.mycpv: + continue + claimed_paths.update(dblink(self.cat, catsplit(cur_cpv)[1], + self.vartree.root, self.settings, + vartree=self.vartree).getcontents()) if pkgfiles: mykeys = pkgfiles.keys() @@ -1156,7 +1150,7 @@ class dblink(object): modprotect = "/lib/modules/" for objkey in mykeys: obj = normalize_path(objkey) - if new_contents and obj in new_contents: + if obj in claimed_paths: # A new instance of this package claims the file, so don't # unmerge it. writemsg_stdout("--- !owned %s %s\n" % \ -- cgit v1.2.3-1-g7c22