diff options
author | Tim Harder <radhermit@gmail.com> | 2015-06-22 22:28:12 -0400 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2015-06-22 23:20:26 -0400 |
commit | eb0eec6b260a938ad7aeec45243e46c730f3bb41 (patch) | |
tree | 6e49b3f0f6ab5d114db3b135513b473aa0b44339 | |
parent | drop deprecated support for loading /etc/make.conf (diff) | |
download | pkgcore-eb0eec6b260a938ad7aeec45243e46c730f3bb41.tar.gz pkgcore-eb0eec6b260a938ad7aeec45243e46c730f3bb41.tar.bz2 pkgcore-eb0eec6b260a938ad7aeec45243e46c730f3bb41.zip |
remove all possible portdir references
The only one left in the code is required to be exported to the ebuild
environment according to PMS and should really be deprecated and dropped
from a future EAPI.
Besides that, references are scattered throughout the docs and may be
cleaned up in the future.
-rw-r--r-- | doc/dev-notes/heapy.rst | 2 | ||||
-rw-r--r-- | doc/dev-notes/portage-differences.rst | 11 | ||||
-rw-r--r-- | doc/getting-started/pquery-usage.rst | 2 | ||||
-rw-r--r-- | pkgcore/config/central.py | 4 | ||||
-rw-r--r-- | pkgcore/ebuild/ebd.py | 6 | ||||
-rw-r--r-- | pkgcore/ebuild/eclass_cache.py | 16 | ||||
-rw-r--r-- | pkgcore/ebuild/repository.py | 30 | ||||
-rw-r--r-- | pkgcore/pkgsets/live_rebuild_set.py | 22 | ||||
-rw-r--r-- | pkgcore/test/ebuild/test_eclass_cache.py | 2 |
9 files changed, 47 insertions, 48 deletions
diff --git a/doc/dev-notes/heapy.rst b/doc/dev-notes/heapy.rst index b984f0fd..06073beb 100644 --- a/doc/dev-notes/heapy.rst +++ b/doc/dev-notes/heapy.rst @@ -60,7 +60,7 @@ get later. Now do your memory-intensive thing:: - >>> l = list(x for x in c.repo["portdir"] if x.data) + >>> l = list(x for x in c.repo["gentoo"] if x.data) Keep an eye on system memory consumption. You want to use up a lot but not all of your system ram for nicer statistics. The python process diff --git a/doc/dev-notes/portage-differences.rst b/doc/dev-notes/portage-differences.rst index 8c150e99..67a64b68 100644 --- a/doc/dev-notes/portage-differences.rst +++ b/doc/dev-notes/portage-differences.rst @@ -59,13 +59,14 @@ Pkgcore internally uses a sane/uniform repository abstraction- the benefits of this are: - repository class (which implements the accessing of the on disk/remote tree) - is pluggable. Remote vdb/portdir is doable, as is having your repository - tree ran strictly from downloaded metadata (for example), or running from a - tree stored in a tarball/zip file (mildly crazy, but it's doable). + is pluggable. Remote source or installed repos are doable, as is having your + repository tree ran strictly from downloaded metadata (for example), or + running from a tree stored in a tarball/zip file (mildly crazy, but it's + doable). -- seperated repository instances. We've not thrown out overlays (as paludis +- separated repository instances. We've not thrown out overlays (as paludis did), but pkgcore doesn't force every new repository to be an overlay of the - 'master' PORTDIR as portage does. + default 'master' repo as portage does. - optimized repository classes- for the usual vdb and ebuild repository (those being on disk backwards compatible with portage 2.x), the number of diff --git a/doc/getting-started/pquery-usage.rst b/doc/getting-started/pquery-usage.rst index bfd7d42e..668913a9 100644 --- a/doc/getting-started/pquery-usage.rst +++ b/doc/getting-started/pquery-usage.rst @@ -14,7 +14,7 @@ those packages. It is important to understand that the information printing and repository selection options are almost completely separate from the restriction options. The only exception to that is that restrictions on contents automatically select the vdb (installed packages) repository, since -running them on the portdir repository makes no sense. +running them on source repos makes no sense. Another switch that could do with some extra explanation is ``--raw``. Specifying ``--raw`` makes your configuration not affect the results. Example: :: diff --git a/pkgcore/config/central.py b/pkgcore/config/central.py index 027cc2a0..972559c0 100644 --- a/pkgcore/config/central.py +++ b/pkgcore/config/central.py @@ -382,10 +382,6 @@ class ConfigManager(object): if section_stack is None: if not raise_on_missing: return None - if name == "portdir": - # gentoo-related usability --jokey - raise errors.ConfigurationError( - "no section called %r, maybe you didn't add autoload-portage to your file" % (name,)) raise errors.ConfigurationError( 'no section called %r' % (name,)) try: diff --git a/pkgcore/ebuild/ebd.py b/pkgcore/ebuild/ebd.py index e1a1d7cb..4263adb3 100644 --- a/pkgcore/ebuild/ebd.py +++ b/pkgcore/ebuild/ebd.py @@ -591,9 +591,9 @@ class buildable(ebd, setup_mixin, format.build): self.env["FILESDIR"] = pjoin(os.path.dirname(pkg.ebuild.path), "files") self.eclass_cache = eclass_cache self.env["ECLASSDIR"] = eclass_cache.eclassdir - portdir = self.env["PORTDIR"] = eclass_cache.portdir - if portdir is None: - del self.env["PORTDIR"] + + # this needs to be deprecated and dropped from future EAPIs + self.env["PORTDIR"] = eclass_cache.location self.run_test = self.feat_or_bool("test", domain_settings) self.allow_failed_test = self.feat_or_bool("test-fail-continue", domain_settings) diff --git a/pkgcore/ebuild/eclass_cache.py b/pkgcore/ebuild/eclass_cache.py index abb2df15..3fa540d3 100644 --- a/pkgcore/ebuild/eclass_cache.py +++ b/pkgcore/ebuild/eclass_cache.py @@ -31,11 +31,11 @@ class base(object): Maintains the cache information about eclasses available to an ebuild. """ - def __init__(self, portdir=None, eclassdir=None): + def __init__(self, location=None, eclassdir=None): self._eclass_data_inst_cache = WeakValCache() # generate this. # self.eclasses = {} # {"Name": ("location", "_mtime_")} - self.portdir = portdir + self.location = location self.eclassdir = eclassdir def get_eclass_data(self, inherits): @@ -85,14 +85,14 @@ class base(object): class cache(base): - pkgcore_config_type = ConfigHint({"path":"str", "portdir":"str"}, + pkgcore_config_type = ConfigHint({"path":"str", "location":"str"}, typename='eclass_cache') - def __init__(self, path, portdir=None): + def __init__(self, path, location=None): """ - :param portdir: ondisk location of the tree we're working with + :param location: ondisk location of the tree we're working with """ - base.__init__(self, portdir=portdir, eclassdir=normpath(path)) + base.__init__(self, location=location, eclassdir=normpath(path)) def _load_eclasses(self): """Force an update of the internal view of on disk/remote eclasses.""" @@ -122,7 +122,7 @@ class StackedCaches(base): """ pkgcore_config_type = ConfigHint( - {'caches': 'refs:eclass_cache', 'portdir': 'str', 'eclassdir': 'str'}, + {'caches': 'refs:eclass_cache', 'location': 'str', 'eclassdir': 'str'}, typename='eclass_cache') def __init__(self, caches, **kwds): @@ -138,7 +138,7 @@ class StackedCaches(base): "%s requires at least two eclass_caches" % self.__class__) kwds.setdefault("eclassdir", caches[0].eclassdir) - kwds.setdefault("portdir", + kwds.setdefault("location", os.path.dirname(kwds["eclassdir"].rstrip(os.path.sep))) self._caches = caches base.__init__(self, **kwds) diff --git a/pkgcore/ebuild/repository.py b/pkgcore/ebuild/repository.py index 1bad8689..5d23788a 100644 --- a/pkgcore/ebuild/repository.py +++ b/pkgcore/ebuild/repository.py @@ -104,25 +104,25 @@ def _sort_eclasses(config, raw_repo, eclasses): if eclasses: return eclasses - loc = raw_repo.location + repo_path = raw_repo.location masters = raw_repo.masters eclasses = [] - default = portdir = config.get_default('raw_repo') - if portdir is None: - portdir = loc + default = config.get_default('raw_repo') + if default is None: + location = repo_path else: - portdir = portdir.location + location = default.location if not masters: - if masters is None and raw_repo.repo_id != 'gentoo': + if masters is None: # if it's None, that means it's not a standalone, and is PMS, or misconfigured. # empty tuple means it's a standalone repository if default is None: raise Exception( "repository %r named %r wants the default repository " - "(portdir for example), but no repository is marked as the default. " - "Fix your configuration." % (loc, raw_repo.repo_id)) - eclasses = [default.location] + "(gentoo for example), but no repository is marked as the default. " + "Fix your configuration." % (repo_path, raw_repo.repo_id)) + eclasses = [location] else: repo_map = {r.repo_id: r.location for r in config.objects['raw_repo'].itervalues()} @@ -132,18 +132,18 @@ def _sort_eclasses(config, raw_repo, eclasses): missing = ', '.join(sorted(missing)) raise Exception( "repo %r at path %r has masters %s; we cannot find " - "the following repositories: %s" - % (raw_repo.repo_id, loc, ', '.join(map(repr, masters)), missing)) + "the following repos: %s" + % (raw_repo.repo_id, repo_path, ', '.join(map(repr, masters)), missing)) eclasses = [repo_map[x] for x in masters] # add the repositories eclasses directories if it's not specified. # do it in this fashion so that the repositories masters can actually interpose # this repositories eclasses in between others. # admittedly an odd thing to do, but it has some benefits - if loc not in eclasses: - eclasses.append(loc) + if repo_path not in eclasses: + eclasses.append(repo_path) - eclasses = [eclass_cache_module.cache(pjoin(x, 'eclass'), portdir=portdir) + eclasses = [eclass_cache_module.cache(pjoin(x, 'eclass'), location=location) for x in eclasses] if len(eclasses) == 1: @@ -151,7 +151,7 @@ def _sort_eclasses(config, raw_repo, eclasses): else: eclasses = list(reversed(eclasses)) eclasses = eclass_cache_module.StackedCaches( - eclasses, portdir=portdir, eclassdir=portdir) + eclasses, location=location, eclassdir=location) return eclasses diff --git a/pkgcore/pkgsets/live_rebuild_set.py b/pkgcore/pkgsets/live_rebuild_set.py index d40006f4..94913548 100644 --- a/pkgcore/pkgsets/live_rebuild_set.py +++ b/pkgcore/pkgsets/live_rebuild_set.py @@ -10,27 +10,29 @@ Note: HACK. Quick proof of concept, could do with cleaning up. from pkgcore.config import ConfigHint from pkgcore.pkgsets.installed import VersionedInstalled +from pkgcore.repository.util import RepositoryGroup class EclassConsumerSet(VersionedInstalled): - pkgcore_config_type = ConfigHint({'vdb': 'refs:repo', - 'portdir': 'ref:repo', - 'eclasses': 'list'}, - typename='pkgset') + pkgcore_config_type = ConfigHint( + typename='pkgset', + types={ + 'vdb': 'refs:repo', + 'repos': 'refs:repo', + 'eclasses': 'list'}, + ) - def __init__(self, vdb, portdir, eclasses): + def __init__(self, vdb, repos, eclasses): VersionedInstalled.__init__(self, vdb) - self.portdir = portdir + self.repos = RepositoryGroup(repos) self.eclasses = frozenset(eclasses) def __iter__(self): for atom in VersionedInstalled.__iter__(self): - pkgs = self.portdir.match(atom) + pkgs = self.repos.match(atom) if not pkgs: - # This thing is in the vdb but no longer in portdir - # (or someone misconfigured us to use a bogus - # portdir). Just ignore it. + # pkg is installed but no longer in any repo, just ignore it. continue assert len(pkgs) == 1, 'I do not know what I am doing: %r' % (pkgs,) pkg = pkgs[0] diff --git a/pkgcore/test/ebuild/test_eclass_cache.py b/pkgcore/test/ebuild/test_eclass_cache.py index 01dcf98e..240eca54 100644 --- a/pkgcore/test/ebuild/test_eclass_cache.py +++ b/pkgcore/test/ebuild/test_eclass_cache.py @@ -15,7 +15,7 @@ from pkgcore.test import TestCase class FakeEclassCache(eclass_cache.base): def __init__(self, path): - eclass_cache.base.__init__(self, portdir=path, eclassdir=path) + eclass_cache.base.__init__(self, location=path, eclassdir=path) self.eclasses = { "eclass1":LazilyHashedPath(path, mtime=100), "eclass2":LazilyHashedPath(path, mtime=200)} |