From a2f0fbf76c63abc482a6e6586670327aa9ac4585 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 7 Aug 2008 11:22:40 +0000 Subject: [PATCH] Fix a bug in vardbapi.removeFromContents() which sometimes prevents the CONTENTS from being updated when it should. svn path=/main/trunk/; revision=11341 --- pym/portage/dbapi/vartree.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 8d40c24be..e59571173 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -942,7 +942,7 @@ class vardbapi(dbapi): root = self.root root_len = len(root) - 1 new_contents = pkg.getcontents().copy() - contents_key = None + removed = 0 for filename in paths: filename = normalize_path(filename) @@ -953,8 +953,9 @@ class vardbapi(dbapi): contents_key = pkg._match_contents(relative_filename, root) if contents_key: del new_contents[contents_key] + removed += 1 - if contents_key: + if removed: f = atomic_ofstream(os.path.join(pkg.dbdir, "CONTENTS")) write_contents(new_contents, root, f) f.close() -- 2.26.2