summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2006-01-22 21:05:35 +0000
committerMarius Mauch <genone@gentoo.org>2006-01-22 21:05:35 +0000
commit18857e5b06f9405f9f25df66eb00ef9a53ec5b82 (patch)
tree8f8d2c91d891ab4b853c83c0ff3b72f20210c481
parentf3b54baabdcaa38435b8e49d8a690b84db4f9860 (diff)
downloadportage-18857e5b06f9405f9f25df66eb00ef9a53ec5b82.tar.gz
portage-18857e5b06f9405f9f25df66eb00ef9a53ec5b82.tar.bz2
portage-18857e5b06f9405f9f25df66eb00ef9a53ec5b82.zip
store all auxdbkeys in vdb and add a new emaint target to create missing entries
svn path=/main/trunk/; revision=2568
-rwxr-xr-xbin/ebuild.sh3
-rwxr-xr-xbin/emaint61
2 files changed, 61 insertions, 3 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 0ccd616c4..afd0343c2 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -914,7 +914,8 @@ dyn_compile() {
for f in ASFLAGS CATEGORY CBUILD CC CFLAGS CHOST CTARGET CXX \
CXXFLAGS DEPEND EXTRA_ECONF EXTRA_EINSTALL EXTRA_MAKE \
FEATURES INHERITED IUSE LDFLAGS LIBCFLAGS LIBCXXFLAGS \
- LICENSE PDEPEND PF PKGUSE PROVIDE RDEPEND RESTRICT SLOT; do
+ LICENSE PDEPEND PF PKGUSE PROVIDE RDEPEND RESTRICT SLOT \
+ KEYWORDS HOMEPAGE SRC_URI DESCRIPTION; do
[ -n "${!f}" ] && echo $(echo "${!f}" | tr '\n,\r,\t' ' , , ' | sed s/' \+'/' '/g) > ${f}
done
echo "${USE}" > USE
diff --git a/bin/emaint b/bin/emaint
index a3868772f..be538033d 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -4,7 +4,7 @@ import sys
from copy import copy
from optparse import OptionParser, OptionValueError
-
+import re
import os, portage, portage_const
class WorldHandler(object):
@@ -44,9 +44,66 @@ class WorldHandler(object):
errors.append(portage_const.WORLD_FILE + " could not be opened for writing")
return errors
+class VdbKeyHandler(object):
+ def name():
+ return "vdbkeys"
+ name = staticmethod(name)
+<<<<<<< .mine
+ def __init__(self):
+ self.list = portage.db["/"]["vartree"].dbapi.cpv_all()
+ self.missing = []
+ self.keys = ["HOMEPAGE", "SRC_URI", "KEYWORDS", "DESCRIPTION"]
+
+ for p in self.list:
+ mydir = "/var/db/pkg/"+p
+ ismissing = True
+ for k in self.keys:
+ if os.path.exists(mydir+"/"+k):
+ ismissing = False
+ break
+ if ismissing:
+ self.missing.append(p)
+
+ def check(self):
+ return ["%s has missing keys" % x for x in self.missing]
+
+ def fix(self):
+
+ errors = []
+
+ for p in self.missing:
+ mydir = "/var/db/pkg/"+p
+ if not os.access(mydir+"/environment.bz2", os.R_OK):
+ errors.append("Can't access %s" % (mydir+"/environment.bz2"))
+ elif not os.access(mydir, os.W_OK):
+ errors.append("Can't create files in %s" % mydir)
+ else:
+ env = os.popen("bzip2 -dcq "+mydir+"/environment.bz2", "r")
+ envlines = env.read().split("\n")
+ env.close()
+ for k in self.keys:
+ s = [l for l in envlines if l.strip("\"\'").startswith(k+"=")]
+ if len(s) > 1:
+ errors.append("multiple matches for %s found in %s/environment.bz2" % (k, mydir))
+ elif len(s) == 0:
+ s = ""
+ else:
+ s = s[0].split("=",1)[1]
+ s = s.lstrip("$").strip("\'\"")
+ s = re.sub("(\\\\[nrt])+", " ", s)
+ s = re.sub("[\n\r\t]+"," ",s)
+ s = re.sub(" +"," ",s)
+ s = s.strip()
+ if s != "":
+ keyfile = open(mydir+"/"+k, "w")
+ keyfile.write(s+"\n")
+ keyfile.close()
+
+ return errors
# this sucks, should track this in a different manner.
-modules = {"world" : WorldHandler}
+modules = {"world" : WorldHandler,
+ "vdbkeys": VdbKeyHandler}
module_names = modules.keys()
module_names.sort()