summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-07-02 06:24:36 +0000
committerZac Medico <zmedico@gentoo.org>2006-07-02 06:24:36 +0000
commita6f5ec1a6fb97b33295b1d3960877c04ccbf9d2d (patch)
tree6ab99be4f5d321d1216678af257c5c3c88b2c807 /bin
parent5f4d3665ec58ae8f54d8e52ba834ca09ac536171 (diff)
downloadportage-a6f5ec1a6fb97b33295b1d3960877c04ccbf9d2d.tar.gz
portage-a6f5ec1a6fb97b33295b1d3960877c04ccbf9d2d.tar.bz2
portage-a6f5ec1a6fb97b33295b1d3960877c04ccbf9d2d.zip
Add a new parse_use_local_desc() function.
svn path=/main/trunk/; revision=3748
Diffstat (limited to 'bin')
-rwxr-xr-xbin/repoman36
1 files changed, 25 insertions, 11 deletions
diff --git a/bin/repoman b/bin/repoman
index ebd3882a5..59fbb2713 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -523,20 +523,34 @@ if "--pretend" in myoptions:
elif quiet < 1:
print green("\nRepoMan scours the neighborhood...")
+def parse_use_local_desc(mylines, usedict=None):
+ """returns a dict of the form {cpv:set(flags)}"""
+ if usedict is None:
+ usedict = {}
+ lineno = 0
+ for l in mylines:
+ lineno += 1
+ if not l or l.startswith("#"):
+ continue
+ mysplit = l.split(None, 1)
+ if not mysplit:
+ continue
+ mysplit = mysplit[0].split(":")
+ if len(mysplit) != 2:
+ raise ParseError("line %d: Malformed input: '%s'" % \
+ (lineno, l.rstrip("\n")))
+ usedict.setdefault(mysplit[0], set())
+ usedict[mysplit[0]].add(mysplit[1])
+ return usedict
+
# retreive local USE list
luselist={}
try:
- mylist=portage.grabfile(portdir+"/profiles/use.local.desc")
- for mypos in range(0,len(mylist)):
- mysplit=mylist[mypos].split()[0]
- myuse=string.split(mysplit,":")
- if len(myuse)==2:
- if not luselist.has_key(myuse[0]):
- luselist[myuse[0]] = []
- luselist[myuse[0]].append(myuse[1])
-except SystemExit, e:
- raise # Need to propogate this
-except:
+ f = open(os.path.join(portdir, "profiles", "use.local.desc"))
+ parse_use_local_desc(f, luselist)
+ f.close()
+except (IOError, OSError, ParseError), e:
+ print >> sys.stderr, str(e)
err("Couldn't read from use.local.desc")
# setup a uselist from portage