diff options
author | 2005-08-03 00:27:14 +0000 | |
---|---|---|
committer | 2005-08-03 00:27:14 +0000 | |
commit | 83c79b76136b6aa652afd2d0a5676e5aa264b9e3 (patch) | |
tree | 43eb54a10f318c34406fcae079fe8024b81b8c1c | |
parent | __str__ , and cleanup/bug fixing of versionmatch (diff) | |
download | portage-cvs-83c79b76136b6aa652afd2d0a5676e5aa264b9e3.tar.gz portage-cvs-83c79b76136b6aa652afd2d0a5676e5aa264b9e3.tar.bz2 portage-cvs-83c79b76136b6aa652afd2d0a5676e5aa264b9e3.zip |
cleanup, and a few bug fixes to profiles.
s:pref_curry:pre_curry: for proccessor
ebuild_package had USE added as an attribute...
and conditionals got cleanup + __str__
-rw-r--r-- | portage/ebuild/conditionals.py | 4 | ||||
-rw-r--r-- | portage/ebuild/ebuild_package.py | 4 | ||||
-rw-r--r-- | portage/ebuild/processor.py | 4 | ||||
-rw-r--r-- | portage/ebuild/profiles.py | 70 |
4 files changed, 46 insertions, 36 deletions
diff --git a/portage/ebuild/conditionals.py b/portage/ebuild/conditionals.py index 3edb917..67c2b6c 100644 --- a/portage/ebuild/conditionals.py +++ b/portage/ebuild/conditionals.py @@ -1,7 +1,7 @@ # Copyright: 2005 Gentoo Foundation # Author(s): Jason Stubbs (jstubbs@gentoo.org), Brian Harring (ferringb@gentoo.org) # License: GPL2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/conditionals.py,v 1.2 2005/07/20 14:33:12 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/conditionals.py,v 1.3 2005/08/03 00:27:14 ferringb Exp $ # TODO: move exceptions elsewhere, bind them to a base exception for portage @@ -102,8 +102,6 @@ class DepSet(RestrictionSet): self.has_conditionals = has_conditionals[0] def __str__(self): return ' '.join(map(str,self.restrictions)) - def __iter__(self): return iter(self.restrictions) - def evaluate_depset(self, cond_dict): """passed in a depset, does lookups of the node in cond_dict. diff --git a/portage/ebuild/ebuild_package.py b/portage/ebuild/ebuild_package.py index e800aba..d437e4a 100644 --- a/portage/ebuild/ebuild_package.py +++ b/portage/ebuild/ebuild_package.py @@ -1,7 +1,7 @@ # Copyright: 2005 Gentoo Foundation # Author(s): Brian Harring (ferringb@gentoo.org) # License: GPL2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/ebuild_package.py,v 1.4 2005/07/27 02:23:27 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/ebuild_package.py,v 1.5 2005/08/03 00:27:14 ferringb Exp $ import os from portage import package @@ -38,6 +38,8 @@ class EbuildPackage(package.metadata.package): val = DepSet(self.data["LICENSE"], str) elif key == "description": val = self.data["DESCRIPTION"] + elif key == "keywords": + val = self.data["KEYWORDS"].split() else: return super(EbuildPackage, self).__getattr__(key) self.__dict__[key] = val diff --git a/portage/ebuild/processor.py b/portage/ebuild/processor.py index ba15ea3..7c01e72 100644 --- a/portage/ebuild/processor.py +++ b/portage/ebuild/processor.py @@ -1,7 +1,7 @@ # Copyright: 2004-2005 Gentoo Foundation # Author(s): Brian Harring (ferringb@gentoo.org) # License: GPL2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/processor.py,v 1.3 2005/07/20 14:33:12 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/processor.py,v 1.4 2005/08/03 00:27:14 ferringb Exp $ # this needs work. it's been pruned heavily from what ebd used originally, but it still isn't what # I would define as 'right' @@ -362,6 +362,7 @@ class ebuild_processor: return metadata_keys + def _receive_key(self, line, keys_dict): line=line.split("=",1) l=len(line) @@ -438,6 +439,7 @@ class ebuild_processor: v = fp.val; del fp return v + def chuck_UnhandledCommand(processor, line): print "chucking unhandled" raise UnhandledCommand(line) diff --git a/portage/ebuild/profiles.py b/portage/ebuild/profiles.py index c2565cd..84aa1c8 100644 --- a/portage/ebuild/profiles.py +++ b/portage/ebuild/profiles.py @@ -1,14 +1,16 @@ # Copyright: 2005 Gentoo Foundation # Author(s): Brian Harring (ferringb@gentoo.org) # License: GPL2 -# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/profiles.py,v 1.3 2005/07/27 02:30:16 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/profiles.py,v 1.4 2005/08/03 00:27:14 ferringb Exp $ from portage.config import profiles import os, logging from portage.util.lists import unique from portage.util.file import iter_read_bash, read_dict, read_bash_dict +from portage.util.currying import pre_curry from portage.package.atom import atom from portage.config.central import list_parser +from portage.util.dicts import ProtectedDict class OnDiskProfile(profiles.base): positional = ("base_repo","profile") @@ -58,26 +60,29 @@ class OnDiskProfile(profiles.base): del parents - # build up visibility limiters. + def loop_iter_read(files, callable=iter_read_bash): + for fp in files: + if os.path.exists(fp): + try: + yield fp, callable(fp) + except (OSError, IOError), e: + raise profiles.ProfileException("failed reading '%s': %s" % (e.filename, str(e))) + + # build up visibility limiters. stack.reverse() - pkgs = {} - for fp in [os.path.join(prof, "packages") for prof in stack]: - if os.path.exists(fp): - try: i = iter_read_bash(os.path.join(prof, "packages")) - except (IOError, OSError), e: - raise profiles.ProfileException("failed reading '%s': %s" % (e.filename, str(e))) - for p in i: - if p[0] == "-": - try: del pkgs[p[0]] - except KeyError: - logger.warn("%s is reversed in %s, but isn't set yet!" % (p[1:], fp)) - else: - pkgs[p] = None + pkgs = set() + for fp, i in loop_iter_read(os.path.join(prof, "packages") for prof in stack): + for p in i: + if p[0] == "-": + try: pkgs.remove(p[1:]) + except KeyError: + logger.warn("%s is reversed in %s, but isn't set yet!" % (p[1:], fp)) + else: pkgs.add(p) visibility = [] sys = [] - for p in pkgs.keys(): + for p in pkgs: if p[0] == "*": # system set. sys.append(atom(p[1:])) @@ -88,6 +93,18 @@ class OnDiskProfile(profiles.base): self.sys = sys self.visibility = visibility + use_mask = set() + for fp, i in loop_iter_read(os.path.join(prof, "use.mask") for prof in stack): + for p in i: + if p[0] == "-": + try: use_mask.remove(p[1:]) + except KeyError: + logger.warn("%s is reversed in %s, but isn't set yet!" % (p[1:], fp)) + else: + use_mask.add(p) + self.use_mask = list(use_mask) + del use_mask + fp = os.path.join(basepath, "thirdpartymirrors") if os.path.isfile(fp): mirrors = read_dict(fp, splitter='\t') @@ -95,23 +112,14 @@ class OnDiskProfile(profiles.base): mirrors = {} maskers = [] - - for fp in [os.path.join(prof, "package.mask") for prof in stack + [basepath]]: - if os.path.exists(fp): - try: maskers.extend(map(atom, iter_read_bash(fp))) - except (IOError, OSError), e: - raise profiles.ProfileException("failed reading '%s': %s" % (fp, str(e))) + for fp, i in loop_iter_read(os.path.join(prof, "package.mask") for prof in stack + [basepath]): + maskers.extend(map(atom,i)) self.maskers = maskers - confs = [{}] # oh yay. - for fp in [os.path.join(prof, "make.defaults") for prof in stack]: - if os.path.exists(fp): - try: confs.append(read_bash_dict(fp, vars_dict=confs[-1])) - except (IOError, OSError), e: - raise profiles.ProfileException("failed reading '%s': %s" % (fp, str(e))) + d = {} - confs.pop(0) - for dc in confs: + for fp, dc in loop_iter_read((os.path.join(prof, "make.defaults") for prof in stack), + lambda x:read_bash_dict(x, vars_dict=ProtectedDict(d))): for k,v in dc.items(): # potentially make incrementals a dict for ~O(1) here, rather then O(N) if k in incrementals: @@ -120,7 +128,7 @@ class OnDiskProfile(profiles.base): else: d[k] = v else: d[k] = v - del confs + # use_expand d["USE_EXPAND"] = d.get("USE_EXPAND",'').split() for u in d["USE_EXPAND"]: |