commit:     c74e72983b4c0f34bd56f0d9b16857339cdda8b6
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  8 20:08:54 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Aug  8 20:08:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=c74e7298

grs/WorldConf.py: remove added files to managed dirs during clean.

 grs/WorldConf.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/grs/WorldConf.py b/grs/WorldConf.py
index c496e5f..b005f0e 100644
--- a/grs/WorldConf.py
+++ b/grs/WorldConf.py
@@ -74,13 +74,22 @@ class WorldConf():
                 slot = slotvar
             slot_atoms.append(re.sub('[/:]', '_', '%s:%s' % (p, slot)))
 
+        # Also let's get a list of all the possible canonical file names
+        config = configparser.RawConfigParser(delimiters=':', 
allow_no_value=True, comment_prefixes=None)
+        config.read(CONST.WORLD_CONFIG)
+        canon = []
+        for s in config.sections():
+            p_slot_atom = re.sub('[/:]', '_', s)
+            canon.append(p_slot_atom)
+
         # Walk through all files in /etc/portage and remove any files for 
uninstalled pkgs.
         for dirpath, dirnames, filenames in os.walk(CONST.PORTAGE_CONFIGDIR):
             # Only look at select files and directories.
             if not os.path.basename(dirpath) in WorldConf.manageddirs:
                 continue
 
+            # Remove all filenames that match uninstalled slot_atoms or are 
not in the canon
             for f in filenames:
                 fpath = os.path.realpath(os.path.join(dirpath, f))
-                if f in slot_atoms:
+                if f in slot_atoms or not f in canon:
                     os.remove(fpath)

Reply via email to