diff options
author | 2005-08-03 00:29:17 +0000 | |
---|---|---|
committer | 2005-08-03 00:29:17 +0000 | |
commit | 857e909091b93fdce5c3613590c39b026ccb833f (patch) | |
tree | 69897283259a109039534f8ced66605b4874a2b3 | |
parent | cleanup, and a few bug fixes to profiles. (diff) | |
download | portage-cvs-857e909091b93fdce5c3613590c39b026ccb833f.tar.gz portage-cvs-857e909091b93fdce5c3613590c39b026ccb833f.tar.bz2 portage-cvs-857e909091b93fdce5c3613590c39b026ccb833f.zip |
whitespace fix in errors.py
s:pref_curry:pre_curry: in central
hey look, domain has code now, and domain-instance.repos (which is visibility wrapped, p.mask + unmask atm only)
-rw-r--r-- | portage/config/central.py | 6 | ||||
-rw-r--r-- | portage/config/domain.py | 74 | ||||
-rw-r--r-- | portage/config/errors.py | 3 |
3 files changed, 74 insertions, 9 deletions
diff --git a/portage/config/central.py b/portage/config/central.py index f28f408..09ca6c1 100644 --- a/portage/config/central.py +++ b/portage/config/central.py @@ -1,14 +1,14 @@ # 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/config/central.py,v 1.7 2005/07/28 18:54:15 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/config/central.py,v 1.8 2005/08/03 00:29:17 ferringb Exp $ import errors, new from portage.const import CONF_DEFAULTS from portage.util.modules import load_attribute from ConfigParser import ConfigParser from portage.util.dicts import LazyValDict -from portage.util.currying import pref_curry +from portage.util.currying import pre_curry class config: """Central configuration manager. @@ -53,7 +53,7 @@ class config: # except errors.QuoteInterpretationError, qe: # qe.var = v # raise qe - setattr(self, t, LazyValDict(pref_curry(self.sections, t), self.instantiate_section)) + setattr(self, t, LazyValDict(pre_curry(self.sections, t), self.instantiate_section)) def collapse_config(self, section, verify=True): """collapse a section's config down to a dict for use in instantiating that section. diff --git a/portage/config/domain.py b/portage/config/domain.py index 11d3ba9..303ee56 100644 --- a/portage/config/domain.py +++ b/portage/config/domain.py @@ -1,14 +1,78 @@ # 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/config/domain.py,v 1.3 2005/07/20 14:33:12 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/config/domain.py,v 1.4 2005/08/03 00:29:17 ferringb Exp $ + +from portage.restrictions.collapsed import DictBased +from portage.restrictions.restrictionSet import OrRestrictionSet, AndRestrictionSet +import os +from errors import BaseException +from portage.util.file import iter_read_bash +from portage.package.atom import atom +from portage.restrictions.collapsed import DictBased +from portage.repository.visibility import filterTree +from portage.util.currying import post_curry +from portage.util.lists import unique + +class MissingFile(BaseException): + def __init__(self, file, setting): self.file, self.setting = file, setting + def __str__(self): return "setting %s points at %s, which doesn't exist." % (self.setting, self.file) + +class Failure(BaseException): + def __init__(self, text): self.text + def __str__(self): return "domain failure: %s" % text + + +def split_atom(atom): + return atom.category + "/" + atom.package, atom.restrictions[2:] +def get_key_from_package(pkg): + return pkg.category + "/" + pkg.package + # ow ow ow ow ow ow.... # this manages a *lot* of crap. so... this is fun. # ~harring class domain: - def __init__(self, use, distdir, features): - self.__master = config + def __init__(self, incrementals, root, profile, repositories, **settings): + # voodoo, unfortunately (so it goes) + maskers, unmaskers, keywords, visibility = profile.maskers[:], [], [], profile.visibility + + for key, val in (("package.mask", maskers), ("package.unmask", unmaskers), ("package.keywords", keywords)): + if key in settings: + if os.path.exists(settings[key]): + try: val.extend(map(atom, iter_read_bash(fp))) + except (IOError, OSError), e: + raise Failure("failed reading '%s': %s" % (settings[key], str(e))) + else: + raise MissingFile(settings[key], key) + del settings[key] + + inc_d = set(incrementals) + for x in profile.conf.keys(): + if x in settings: + if x in inc_d: + # strings overwrite, lists append. + if isinstance(settings[x], (list, tuple)): + settings[x] += profile.conf[x] + else: + settings[x] = profile.conf[x] + del inc_d + + # visibility mask... + # if (package.mask and not package.unmask) or system-visibility-filter or not (package.keywords or accept_keywords) + + filter = OrRestrictionSet() + masker_d = DictBased(maskers, get_key_from_package, split_atom) + if len(unmaskers): + masker_d = AndRestrictionSet(masker_d, DictBased(unmaskers, get_key_from_package, split_atom, negate=True)) + filter.add_restriction(masker_d) + + # profile visibility filters. + if len(visibility): + filter.add_restriction(DictBased(visibility, get_key_from_package, split_atom)) - def load_all_repositories(self): - +# keywords, license = [], [] +# if "accept_keywords" in settings: +# keywords = settings["accept_keywords"] + + self.repos = map(post_curry(filterTree, filter, False), repositories) diff --git a/portage/config/errors.py b/portage/config/errors.py index 9ddc0bc..4b3655c 100644 --- a/portage/config/errors.py +++ b/portage/config/errors.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/config/errors.py,v 1.2 2005/07/13 05:51:35 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/config/errors.py,v 1.3 2005/08/03 00:29:17 ferringb Exp $ # potentially use an intermediate base for user config errors, seperate base for instantiation? class BaseException(Exception): @@ -70,3 +70,4 @@ class BrokenSectionDefinition(BaseException): self.section, self.errmsg = section, errormsg def __str__(self): return "Section '%s' definition: error %s" % (self.section, self.errmsg) + |