summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Stelling <blubb@gentoo.org>2006-05-01 18:34:37 +0000
committerSimon Stelling <blubb@gentoo.org>2006-05-01 18:34:37 +0000
commitcf4a8d3da43c1f2bd5986bedcf22c76b1ad7fb9b (patch)
treefcc31dde27d8fa323d448a4f790a261620c027cf
parent7bea59f8a8f70be0ffdcd4b920f43ff15a9b550b (diff)
downloadportage-cf4a8d3da43c1f2bd5986bedcf22c76b1ad7fb9b.tar.gz
portage-cf4a8d3da43c1f2bd5986bedcf22c76b1ad7fb9b.tar.bz2
portage-cf4a8d3da43c1f2bd5986bedcf22c76b1ad7fb9b.zip
allow escaping in elog_base() to fix bug 131913
svn path=/main/trunk/; revision=3294
-rwxr-xr-xbin/emaint152
-rw-r--r--bin/isolated-functions.sh2
-rwxr-xr-xbin/repoman8
3 files changed, 154 insertions, 8 deletions
diff --git a/bin/emaint b/bin/emaint
index 472656bc7..8411bf267 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -104,10 +104,156 @@ class VdbKeyHandler(object):
return errors
+
+
+def checkDict(dict):
+ noneInstalled = []
+ noneAffected = []
+
+ # iterate over all entries in the dict
+ for entry_cp in dict.keys():
+ # find installed packages of type entry
+ iPkgs = portage.vardbapi(portage.root).match(entry_cp)
+
+ # check if packages are installed
+ if not len(iPkgs):
+ noneInstalled.append(", ".join(dict[entry_cp]))
+ continue
+
+ count = 0
+ # now check for every installed package, if it is hit by the entry
+ for i in iPkgs:
+ count += len(portage.match_to_list(i, dict[entry_cp]))
+ if count > 0:
+ break;
+ if count == 0:
+ noneAffected.append(", ".join(dict[entry_cp]))
+ continue
+
+ #check if there are entries in the file, that didn't match
+ #ie: package.keywords contains "=kde-base/kde-3.0.0 ... and =kde-base/kde-2.0.0 ..."
+ # now if kde-4.0.0 is installed, kde-3.0.0 is still not recognized as redundant, as it
+ # gives a match and count > 0.
+ #solution: do the check again for single entries like "=*" and "~*"
+ if len(dict[entry_cp]) > 1:
+ for x in dict[entry_cp]:
+ if x[0] == "=" or x[0] == "~":
+ count = 0
+ # now check for every installed package, if it is hit by the entry
+ for i in iPkgs:
+ count += len(portage.match_to_list(i, [x]))
+ if count > 0:
+ break
+ if count == 0:
+ noneAffected.append(x)
+
+ return (noneInstalled, noneAffected)
+
+def fixFile(fileName, noneInstalled, noneAffected):
+ errors = []
+ strNoneInstalled = "NONE INSTALLED"
+ strNoneAffected = "NONE AFFECTED"
+ try:
+ ifile = open(fileName)
+ lines = ifile.readlines()
+ ifile.close()
+
+ ofile = open(fileName, "w")
+
+ # now check every line if it contains a problematic entry
+ for line in lines:
+ prefix = ""
+ for x in noneInstalled:
+ if line.find(x) >= 0:
+ prefix += strNoneInstalled
+ for x in noneAffected:
+ if line.find(x) >= 0:
+ prefix += strNoneAffected
+
+ if prefix:
+ prefix = "# "+prefix+" "
+ errors.append("fixed: " + prefix + line.strip()) #remove \n
+
+ ofile.write(prefix+line)
+
+ ofile.close()
+
+ except OSError:
+ errors.append(fileName + " could not be opened for reading or writing")
+
+ return errors
+
+
+class PackageKeywordsHandler(object):
+
+ def name():
+ return "p.keywords"
+ name = staticmethod(name)
+
+
+ def __init__(self):
+ print "init"
+ self.noneInstalled = []
+ self.noneAffected = []
+
+ # cache the config object
+ cfg = portage.config(config_profile_path=portage.root, config_incrementals=portage_const.INCREMENTALS)
+
+ #transforming the format of pkeywordsdict into something like punmaskdict i.e. key : [entry1, entry2, ...], key : [...
+ dict = {}
+ for k, v in cfg.pkeywordsdict.items():
+ t = []
+ for k2, v2 in v.items():
+ t.append(k2)
+ dict[k] = t
+
+ (self.noneInstalled , self.noneAffected) = checkDict( dict )
+
+ def check(self):
+ errors = []
+ errors += map(lambda x: "'%s' has no installed packages" % x, self.noneInstalled)
+ errors += map(lambda x: "'%s' affects no installed package(-version)" % x, self.noneAffected)
+ return errors
+
+ def fix(self):
+ return fixFile("/etc/portage/package.keywords", self.noneInstalled, self.noneAffected)
+
+
+class PackageUnmaskHandler(object):
+
+ def name():
+ return "p.unmask"
+ name = staticmethod(name)
+
+ def __init__(self):
+ print "init"
+ self.noneInstalled = []
+ self.noneAffected = []
+
+ # cache the config object
+ cfg = portage.config(config_profile_path=portage.root, config_incrementals=portage_const.INCREMENTALS)
+
+ (self.noneInstalled , self.noneAffected) = checkDict( cfg.punmaskdict )
+
+ def check(self):
+ errors = []
+ errors += map(lambda x: "'%s' has no installed packages" % x, self.noneInstalled)
+ errors += map(lambda x: "'%s' affects no installed package(-version)" % x, self.noneAffected)
+ return errors
+
+ def fix(self):
+ return fixFile("/etc/portage/package.unmask", self.noneInstalled, self.noneAffected)
+
+
+
+
# this sucks, should track this in a different manner.
-#modules = {"world" : WorldHandler,
-# "vdbkeys": VdbKeyHandler}
-modules = {"world" : WorldHandler}
+modules = {"world" : WorldHandler,
+ "vdbkeys": VdbKeyHandler,
+ "p.keywords" : PackageKeywordsHandler,
+ "p.unmask" : PackageUnmaskHandler}
+
+#modules = {"world" : WorldHandler}
module_names = modules.keys()
module_names.sort()
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 40b846eb0..3d3b93741 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -16,7 +16,7 @@ elog_base() {
return 1
;;
esac
- echo "$*" >> ${T}/logging/${EBUILD_PHASE:-other}.${messagetype}
+ echo -e "$*" >> ${T}/logging/${EBUILD_PHASE:-other}.${messagetype}
return 0
}
diff --git a/bin/repoman b/bin/repoman
index a6bbd8fa2..e91169f29 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -1074,10 +1074,10 @@ for x in scanlist:
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
- if not baddepsyntax:
- if x11_deprecation_check(" ".join([myaux["DEPEND"], myaux["RDEPEND"], myaux["PDEPEND"]])):
- stats["usage.obsolete"] += 1
- fails["usage.obsolete"].append("%s/%s.ebuild: not migrated to modular X" % (x, y))
+# if not baddepsyntax:
+# if x11_deprecation_check(" ".join([myaux["DEPEND"], myaux["RDEPEND"], myaux["PDEPEND"]])):
+# stats["usage.obsolete"] += 1
+# fails["usage.obsolete"].append("%s/%s.ebuild: not migrated to modular X" % (x, y))
for keyword,arch,groups in arches: