summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Ruppert <idl0r@gentoo.org>2009-02-03 17:46:13 +0000
committerChristian Ruppert <idl0r@gentoo.org>2009-02-03 17:46:13 +0000
commit34ca9c7121546cb86973d562cc16fe0ae7e80440 (patch)
treed2de843574d5bcac5411333b7643023b0d31ec55 /scripts
parentdev-libs/lockdev: New ebuild for bug 257333 thanks to Christian (idl0r) and T... (diff)
downloadsunrise-reviewed-34ca9c7121546cb86973d562cc16fe0ae7e80440.tar.gz
sunrise-reviewed-34ca9c7121546cb86973d562cc16fe0ae7e80440.tar.bz2
sunrise-reviewed-34ca9c7121546cb86973d562cc16fe0ae7e80440.zip
added check for obsolete package.mask entries
svn path=/sunrise/; revision=7841
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/cleanemptydirs.py38
1 files changed, 36 insertions, 2 deletions
diff --git a/scripts/cleanemptydirs.py b/scripts/cleanemptydirs.py
index 43364eda2..7e5e7fef5 100755
--- a/scripts/cleanemptydirs.py
+++ b/scripts/cleanemptydirs.py
@@ -1,12 +1,46 @@
#!/usr/bin/env python
-"""find empty dirs"""
+"""find empty dirs and check for obsolete package.mask entries"""
+from os.path import join, getsize, isfile, isdir
+from sys import stderr
+from portage.versions import pkgsplit
+import portage.env.config
import os
-from os.path import join, getsize
+
+# find empty directories
for root, dirs, files in os.walk('.'):
for ignoredir in ('CVS','.svn','.git','eclass'):
if ignoredir in dirs:
dirs.remove(ignoredir)
if len(dirs)+len(files) == 0:
print root, "seems to be empty"
+
+
+# find obsolete package.mask entries
+PACKAGE_MASK = join(os.getcwd(), "profiles/package.mask")
+TOCHECK = []
+
+if not isfile(PACKAGE_MASK):
+ print >> stderr, "can't find package.mask, you must be in the overlay root!"
+ exit(1)
+
+PMASK = portage.env.config.PackageMaskFile(PACKAGE_MASK)
+PMASK.load()
+
+for key in PMASK.keys():
+ # remove =, >=, ~ etc.
+ while not key[0].isalpha():
+ key = key[1:]
+ # remove trailing * or . like in: ...-1.4.* or so
+ while key[-1] == "*" or key[-1] == ".":
+ key = key[:-1]
+
+ if pkgsplit(key):
+ TOCHECK.append(pkgsplit(key)[0])
+ else:
+ TOCHECK.append(key)
+
+for item in TOCHECK:
+ if not isdir(item):
+ print item, "is obsolete"