Skip to content

Commit

Permalink
remove all possible portdir references
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
radhermit committed Jun 23, 2015
1 parent a3695d0 commit 27f2958
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 47 deletions.
2 changes: 1 addition & 1 deletion doc/dev-notes/heapy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions doc/dev-notes/portage-differences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/getting-started/pquery-usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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: ::
Expand Down
4 changes: 0 additions & 4 deletions pkgcore/config/central.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,6 @@ def collapse_named_section(self, name, raise_on_missing=True):
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:
Expand Down
6 changes: 3 additions & 3 deletions pkgcore/ebuild/ebd.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,9 @@ def __init__(self, domain, pkg, verified_files, eclass_cache,
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)
Expand Down
16 changes: 8 additions & 8 deletions pkgcore/ebuild/eclass_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -85,14 +85,14 @@ def rebuild_cache_entry(self, entry_eclasses):

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."""
Expand Down Expand Up @@ -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):
Expand All @@ -138,7 +138,7 @@ def __init__(self, caches, **kwds):
"%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)
Expand Down
28 changes: 14 additions & 14 deletions pkgcore/ebuild/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()}
Expand All @@ -133,25 +133,25 @@ def _sort_eclasses(config, raw_repo, eclasses):
raise Exception(
"repo %r at path %r has masters %s; we cannot find "
"the following repos: %s"
% (raw_repo.repo_id, loc, ', '.join(map(repr, masters)), missing))
% (raw_repo.repo_id, repo_path, ', '.join(map(repr, masters)), missing))
eclasses = [repo_map[x] for x in masters]

# add the repo's eclasses directories if it's not specified.
# do it in this fashion so that the repo's masters can actually interpose
# this repo's 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:
eclasses = eclasses[0]
else:
eclasses = list(reversed(eclasses))
eclasses = eclass_cache_module.StackedCaches(
eclasses, portdir=portdir, eclassdir=portdir)
eclasses, location=location, eclassdir=location)
return eclasses


Expand Down
22 changes: 12 additions & 10 deletions pkgcore/pkgsets/live_rebuild_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,29 @@

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]
Expand Down
2 changes: 1 addition & 1 deletion pkgcore/test/ebuild/test_eclass_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
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)}
Expand Down

0 comments on commit 27f2958

Please sign in to comment.