From 5e43be53b49b68aae81664025e1de76b23ff46b7 Mon Sep 17 00:00:00 2001 From: Brian Harring Date: Sun, 14 Aug 2005 01:01:24 +0000 Subject: domain support, and a few underlying repository tweaks for configured package trees, creating one from an unconfigured tree during domain instantion. Package returned are mutable within limits of use restrictions (arch included); all depset (for ebuilds) returned are flattened, no use conditionals exposed. --- portage/config/domain.py | 20 ++++++++++++++--- portage/ebuild/conditionals.py | 4 ++-- portage/ebuild/ebuild_package.py | 4 ++-- portage/ebuild/ebuild_repository.py | 44 ++++++++++++++++++++++++------------- portage/repository/prototype.py | 5 +++-- 5 files changed, 53 insertions(+), 24 deletions(-) diff --git a/portage/config/domain.py b/portage/config/domain.py index b7e74c3..ba6f88d 100644 --- a/portage/config/domain.py +++ b/portage/config/domain.py @@ -1,10 +1,10 @@ # 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.5 2005/08/09 07:47:34 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/config/domain.py,v 1.6 2005/08/14 01:01:24 ferringb Exp $ from portage.restrictions.collapsed import DictBased -from portage.restrictions.restrictionSet import OrRestrictionSet, AndRestrictionSet +from portage.restrictions.restriction_set import OrRestrictionSet, AndRestrictionSet import os from errors import BaseException from portage.util.file import iter_read_bash @@ -36,7 +36,11 @@ def package_keywords_splitter(val): # ow ow ow ow ow ow.... # this manages a *lot* of crap. so... this is fun. +# +# note also, that this is rather ebuild centric. it shouldn't be, and should be redesigned to be a seperation of +# configuration instantiation manglers, and then the ebuild specific chunk (which is selected by config) # ~harring + class domain: def __init__(self, incrementals, root, profile, repositories, **settings): # voodoo, unfortunately (so it goes) @@ -153,5 +157,15 @@ class domain: del master_license, license - self.repos = map(post_curry(filterTree, filter, False), repositories) + + self.repos = [] + for repo in repositories: + print "repo=",repo,"configured?",repo.configured + if not repo.configured: + print "configuring",repo + self.repos.append(repo.configure(repo, settings)) + else: + self.repos.append(repo) + + self.repos = map(post_curry(filterTree, filter, False), self.repos) self.settings = settings diff --git a/portage/ebuild/conditionals.py b/portage/ebuild/conditionals.py index 090cdaf..cef834d 100644 --- a/portage/ebuild/conditionals.py +++ b/portage/ebuild/conditionals.py @@ -1,12 +1,12 @@ # 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.4 2005/08/09 07:53:33 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/conditionals.py,v 1.5 2005/08/14 01:01:24 ferringb Exp $ # TODO: move exceptions elsewhere, bind them to a base exception for portage import logging -from portage.restrictions.restrictionSet import RestrictionSet, OrRestrictionSet +from portage.restrictions.restriction_set import RestrictionSet, OrRestrictionSet from portage.util.strings import iter_tokens from portage.package.conditionals import base as Conditional diff --git a/portage/ebuild/ebuild_package.py b/portage/ebuild/ebuild_package.py index e04c364..5bf7e57 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.6 2005/08/09 07:56:38 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/ebuild_package.py,v 1.7 2005/08/14 01:01:24 ferringb Exp $ import os from portage import package @@ -11,7 +11,7 @@ from portage.package.atom import atom #from digest import parse_digest from portage.util.mappings import LazyValDict from portage.restrictions.restriction import PackageRestriction, StrExactMatch -from portage.restrictions.restrictionSet import AndRestrictionSet, OrRestrictionSet +from portage.restrictions.restriction_set import AndRestrictionSet, OrRestrictionSet class EbuildPackage(package.metadata.package): diff --git a/portage/ebuild/ebuild_repository.py b/portage/ebuild/ebuild_repository.py index 656f27c..bbf0c28 100644 --- a/portage/ebuild/ebuild_repository.py +++ b/portage/ebuild/ebuild_repository.py @@ -1,20 +1,24 @@ # 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_repository.py,v 1.4 2005/08/09 07:56:38 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/ebuild/ebuild_repository.py,v 1.5 2005/08/14 01:01:24 ferringb Exp $ import os, stat from portage.repository import prototype, errors #import ebuild_internal import ebuild_package +from weakref import proxy +from portage.package.conditionals import PackageWrapper + def convert_depset(instance, conditionals): return instance.evaluate_depset(conditionals) class UnconfiguredTree(prototype.tree): - false_categories = ("eclass","profiles","packages","distfiles","licenses","scripts") - + false_categories = set(["eclass","profiles","packages","distfiles","licenses","scripts"]) + configured=False + configure = None def __init__(self, location, cache=None, eclass_cache=None): super(UnconfiguredTree, self).__init__() self.base = self.location = location @@ -73,15 +77,25 @@ class UnconfiguredTree(prototype.tree): class ConfiguredTree(UnconfiguredTree): configured = True - configurable = ("use",) - l=["license","depends","rdepends","bdepends", "fetchables", "keywords"] - wrappable = dict(zip(l, len(l)*[convert_depset])) - def configure_it(self, key): - return PackageWrapper("use", initial_settings=[self.default_use], unchangable_settings=[self.arch], - attributes_to_wrap=wrappable) - - def __init__(self, tree, default_use, arch): - self.default_use = default_use - self.tree = tree - -UnconfiguredTree.configured = ConfiguredTree + l=["license","depends","rdepends","bdepends", "fetchables"] + wrappables = dict(zip(l, len(l)*[convert_depset])) + + def __init__(self, raw_repo, domain_settings): + for x in ("USE", "ARCH"): + if x not in domain_settings: + raise errors.InitializationError("%s requires the following settings: '%s', not supplied" % + (str(self.__class__), x)) + + self.default_use = domain_settings["USE"][:] + self.arch = domain_settings["ARCH"] + self.default_use.append(self.arch) + self.raw_repo = raw_repo + + def package_class(self, *a): + return PackageWrapper(self.raw_repo.package_class(*a), "use", initial_settings=self.default_use, unchangable_settings=self.arch, + attributes_to_wrap=self.wrappables) + + def __getattr__(self, attr, default=None): + return getattr(self.raw_repo, attr, default) + +UnconfiguredTree.configure = ConfiguredTree diff --git a/portage/repository/prototype.py b/portage/repository/prototype.py index e62b449..d1f56b2 100644 --- a/portage/repository/prototype.py +++ b/portage/repository/prototype.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/repository/prototype.py,v 1.4 2005/08/09 08:00:06 ferringb Exp $ +# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/portage/repository/prototype.py,v 1.5 2005/08/14 01:01:24 ferringb Exp $ from portage.util.mappings import IndexableSequence from weakref import proxy @@ -13,7 +13,8 @@ def ix_cat_callable(*cat): class tree(object): package_class = None configured = True - + configure = () + def __init__(self, frozen=True): self.categories = IndexableSequence(self._get_categories, self._get_categories, returnIterFunc=ix_cat_callable, returnEmpty=True, modifiable=(not frozen)) -- cgit v1.2.3-65-gdbad