summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Mauch <genone@gentoo.org>2006-01-24 15:20:58 +0000
committerMarius Mauch <genone@gentoo.org>2006-01-24 15:20:58 +0000
commitdb0bcba4665397a30003d7c03af9c7829d298b1a (patch)
treec395ac35e6fdee175842a22569e51db0ea0ef256 /bin/emaint
parentAdd further checks for correct DEPEND syntax (diff)
downloadportage-multirepo-db0bcba4665397a30003d7c03af9c7829d298b1a.tar.gz
portage-multirepo-db0bcba4665397a30003d7c03af9c7829d298b1a.tar.bz2
portage-multirepo-db0bcba4665397a30003d7c03af9c7829d298b1a.zip
fix possible path and vdb location issues
svn path=/main/trunk/; revision=2581
Diffstat (limited to 'bin/emaint')
-rwxr-xr-xbin/emaint29
1 files changed, 15 insertions, 14 deletions
diff --git a/bin/emaint b/bin/emaint
index 803b5a72..4ea4e73b 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -55,10 +55,10 @@ class VdbKeyHandler(object):
self.keys = ["HOMEPAGE", "SRC_URI", "KEYWORDS", "DESCRIPTION"]
for p in self.list:
- mydir = "/var/db/pkg/"+p
+ mydir = os.path.join(os.sep, portage.settings["ROOT"], portage_const.VDB_PATH, p)+os.sep
ismissing = True
for k in self.keys:
- if os.path.exists(mydir+"/"+k):
+ if os.path.exists(mydir+k):
ismissing = False
break
if ismissing:
@@ -72,32 +72,33 @@ class VdbKeyHandler(object):
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"))
+ mydir = os.path.join(os.sep, portage.settings["ROOT"], portage_const.VDB_PATH, p)+os.sep
+ 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")
+ 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+"=")]
+ s = [l for l in envlines if l.startswith(k+"=")]
if len(s) > 1:
- errors.append("multiple matches for %s found in %s/environment.bz2" % (k, mydir))
+ errors.append("multiple matches for %s found in %senvironment.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()
+ s = " ".join(s.split()).strip()
if s != "":
- keyfile = open(mydir+"/"+k, "w")
- keyfile.write(s+"\n")
- keyfile.close()
+ try:
+ keyfile = open(mydir+os.sep+k, "w")
+ keyfile.write(s+"\n")
+ keyfile.close()
+ except (IOError, OSError), e:
+ errors.append("Could not write %s, reason was: %s" % (mydir+k, e))
return errors