aboutsummaryrefslogtreecommitdiff
path: root/grs
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-08-08 16:08:54 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-08-08 16:08:54 -0400
commitc74e72983b4c0f34bd56f0d9b16857339cdda8b6 (patch)
treea845abd10f5c15d3747da6f674a82db01ec501cd /grs
parentgrs/WorldConf.py: don't delete from non-existing directories. (diff)
downloadgrss-c74e72983b4c0f34bd56f0d9b16857339cdda8b6.tar.gz
grss-c74e72983b4c0f34bd56f0d9b16857339cdda8b6.tar.bz2
grss-c74e72983b4c0f34bd56f0d9b16857339cdda8b6.zip
grs/WorldConf.py: remove added files to managed dirs during clean.
Diffstat (limited to 'grs')
-rw-r--r--grs/WorldConf.py11
1 files changed, 10 insertions, 1 deletions
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)