aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2015-06-21 16:56:38 -0400
committerTim Harder <radhermit@gmail.com>2015-06-28 11:46:59 -0400
commitc2067f71e0b85392e29a9d9e9bd878fd7ca33e29 (patch)
tree11913c8a84d4dccf613c01bafabc6936a80fc4b6
parentchange DISTDIR, PKGDIR, and "PORTDIR" defaults (diff)
downloadpkgcore-c2067f71e0b85392e29a9d9e9bd878fd7ca33e29.tar.gz
pkgcore-c2067f71e0b85392e29a9d9e9bd878fd7ca33e29.tar.bz2
pkgcore-c2067f71e0b85392e29a9d9e9bd878fd7ca33e29.zip
repos: remove the 'base' attr (only provide and use 'location')
This simplifies things as they appeared to be used interchangeably in certain places.
-rw-r--r--pkgcore/binpkg/repository.py22
-rw-r--r--pkgcore/ebuild/repository.py40
-rw-r--r--pkgcore/vdb/ondisk.py8
3 files changed, 35 insertions, 35 deletions
diff --git a/pkgcore/binpkg/repository.py b/pkgcore/binpkg/repository.py
index ed00f04bf..574659d64 100644
--- a/pkgcore/binpkg/repository.py
+++ b/pkgcore/binpkg/repository.py
@@ -241,7 +241,7 @@ class tree(prototype.tree):
If True, silently ignore -scm ebuilds.
"""
super(tree, self).__init__()
- self.base = location
+ self.location = location
if repo_id is None:
repo_id = location
self.repo_id = repo_id
@@ -249,17 +249,17 @@ class tree(prototype.tree):
self.ignore_paludis_versioning = ignore_paludis_versioning
# XXX rewrite this when snakeoil.osutils grows an access equivalent.
- if not access(self.base, os.X_OK | os.R_OK):
+ if not access(self.location, os.X_OK | os.R_OK):
# either it doesn't exist, or we don't have perms.
- if not os.path.exists(self.base):
+ if not os.path.exists(self.location):
raise errors.InitializationError(
- "base %r doesn't exist: %s" % self.base)
+ "binpkg repo doesn't exist: %r" % self.location)
raise errors.InitializationError(
"base directory %r with mode 0%03o isn't readable/executable"
" by this user" %
- (self.base, os.stat(self.base).st_mode & 04777))
+ (self.location, os.stat(self.location).st_mode & 04777))
- self.cache = remote.get_cache_kls(cache_version)(pjoin(self.base, self.cache_name))
+ self.cache = remote.get_cache_kls(cache_version)(pjoin(self.location, self.cache_name))
self.package_class = wrap_factory(self.package_factory, self)
def __str__(self):
@@ -271,13 +271,13 @@ class tree(prototype.tree):
return {}
try:
return tuple(
- x for x in listdir_dirs(self.base)
+ x for x in listdir_dirs(self.location)
if x.lower() != "all")
except EnvironmentError as e:
raise_from(KeyError("failed fetching categories: %s" % str(e)))
def _get_packages(self, category):
- cpath = pjoin(self.base, category.lstrip(os.path.sep))
+ cpath = pjoin(self.location, category.lstrip(os.path.sep))
l = set()
d = {}
lext = len(self.extension)
@@ -314,7 +314,7 @@ class tree(prototype.tree):
except EnvironmentError as e:
raise_from(KeyError(
"failed fetching packages for category %s: %s" %
- (pjoin(self.base, category.lstrip(os.path.sep)), str(e))))
+ (pjoin(self.location, category.lstrip(os.path.sep)), str(e))))
self._versions_tmp_cache.update(d)
return tuple(l)
@@ -324,7 +324,7 @@ class tree(prototype.tree):
def _get_path(self, pkg):
s = "%s-%s" % (pkg.package, pkg.fullver)
- return pjoin(self.base, pkg.category, s+".tbz2")
+ return pjoin(self.location, pkg.category, s+".tbz2")
_get_ebuild_path = _get_path
@@ -350,7 +350,7 @@ class tree(prototype.tree):
def notify_remove_package(self, pkg):
prototype.tree.notify_remove_package(self, pkg)
try:
- os.rmdir(pjoin(self.base, pkg.category))
+ os.rmdir(pjoin(self.location, pkg.category))
except OSError as oe:
if oe.errno != errno.ENOTEMPTY:
raise
diff --git a/pkgcore/ebuild/repository.py b/pkgcore/ebuild/repository.py
index e471cefec..2a33672ed 100644
--- a/pkgcore/ebuild/repository.py
+++ b/pkgcore/ebuild/repository.py
@@ -261,20 +261,20 @@ class _UnconfiguredTree(prototype.tree):
repo_config = repo_objs.RepoConfig(location)
self.config = repo_config
self._repo_id = override_repo_id
- self.base = self.location = location
+ self.location = location
try:
- if not stat.S_ISDIR(os.stat(self.base).st_mode):
+ if not stat.S_ISDIR(os.stat(self.location).st_mode):
raise errors.InitializationError(
- "base not a dir: %s" % self.base)
+ "repo base not a dir: %s" % self.location)
except OSError:
raise_from(errors.InitializationError(
- "lstat failed on base %s" % (self.base,)))
+ "lstat failed on repo base %s" % (self.location,)))
self.eclass_cache = eclass_cache
self.licenses = repo_objs.Licenses(location)
- fp = pjoin(self.base, metadata_offset, "thirdpartymirrors")
+ fp = pjoin(self.location, metadata_offset, "thirdpartymirrors")
mirrors = {}
try:
for k, v in read_dict(fp, splitter=None).iteritems():
@@ -330,7 +330,7 @@ class _UnconfiguredTree(prototype.tree):
def hardcoded_categories(self):
# try reading $LOC/profiles/categories if it's available.
cats = readlines(
- pjoin(self.base, 'profiles', 'categories'),
+ pjoin(self.location, 'profiles', 'categories'),
True, True, True)
if cats is not None:
cats = tuple(imap(intern, cats))
@@ -348,12 +348,12 @@ class _UnconfiguredTree(prototype.tree):
try:
return tuple(imap(intern, ifilterfalse(
self.false_categories.__contains__,
- (x for x in listdir_dirs(self.base) if x[0:1] != "."))))
+ (x for x in listdir_dirs(self.location) if x[0:1] != "."))))
except EnvironmentError as e:
raise_from(KeyError("failed fetching categories: %s" % str(e)))
def _get_packages(self, category):
- cpath = pjoin(self.base, category.lstrip(os.path.sep))
+ cpath = pjoin(self.location, category.lstrip(os.path.sep))
try:
return tuple(ifilterfalse(
self.false_packages.__contains__, listdir_dirs(cpath)))
@@ -365,10 +365,10 @@ class _UnconfiguredTree(prototype.tree):
return ()
raise_from(KeyError(
"failed fetching packages for category %s: %s" %
- (pjoin(self.base, category.lstrip(os.path.sep)), str(e))))
+ (pjoin(self.location, category.lstrip(os.path.sep)), str(e))))
def _get_versions(self, catpkg):
- cppath = pjoin(self.base, catpkg[0], catpkg[1])
+ cppath = pjoin(self.location, catpkg[0], catpkg[1])
pkg = catpkg[-1] + "-"
lp = len(pkg)
extension = self.extension
@@ -394,17 +394,17 @@ class _UnconfiguredTree(prototype.tree):
except EnvironmentError as e:
raise_from(KeyError(
"failed fetching versions for package %s: %s" %
- (pjoin(self.base, '/'.join(catpkg)), str(e))))
+ (pjoin(self.location, '/'.join(catpkg)), str(e))))
def _get_ebuild_path(self, pkg):
if pkg.revision is None:
if pkg.fullver not in self.versions[(pkg.category, pkg.package)]:
# daft explicit -r0 on disk.
return pjoin(
- self.base, pkg.category, pkg.package,
+ self.location, pkg.category, pkg.package,
"%s-%s-r0%s" % (pkg.package, pkg.fullver, self.extension))
return pjoin(
- self.base, pkg.category, pkg.package,
+ self.location, pkg.category, pkg.package,
"%s-%s%s" % (pkg.package, pkg.fullver, self.extension))
def _get_ebuild_src(self, pkg):
@@ -422,11 +422,11 @@ class _UnconfiguredTree(prototype.tree):
def _get_metadata_xml(self, category, package):
return repo_objs.LocalMetadataXml(pjoin(
- self.base, category, package, "metadata.xml"))
+ self.location, category, package, "metadata.xml"))
def _get_manifest(self, category, package):
return digest.Manifest(pjoin(
- self.base, category, package, "Manifest"),
+ self.location, category, package, "Manifest"),
thin=self.config.manifests.thin,
enforce_gpg=self.enable_gpg)
@@ -443,14 +443,14 @@ class _UnconfiguredTree(prototype.tree):
def __str__(self):
return "%s.%s: location %s" % (
- self.__class__.__module__, self.__class__.__name__, self.base)
+ self.__class__.__module__, self.__class__.__name__, self.location)
def __repr__(self):
return "<ebuild %s location=%r @%#8x>" % (
- self.__class__.__name__, self.base, id(self))
+ self.__class__.__name__, self.location, id(self))
def _visibility_limiters(self):
- path = pjoin(self.base, 'profiles', 'package.mask')
+ path = pjoin(self.location, 'profiles', 'package.mask')
pos, neg = [], []
try:
if not self.config.profile_formats.intersection(['pms', 'portage-2']):
@@ -462,7 +462,7 @@ class _UnconfiguredTree(prototype.tree):
line = line.strip()
if line in ('-', ''):
raise profiles.ProfileError(
- pjoin(self.base, 'profiles'),
+ pjoin(self.location, 'profiles'),
'package.mask', "encountered empty negation: -")
if line.startswith('-'):
neg.append(atom.atom(line[1:]))
@@ -473,7 +473,7 @@ class _UnconfiguredTree(prototype.tree):
raise
except ebuild_errors.MalformedAtom as ma:
raise_from(profiles.ProfileError(
- pjoin(self.base, 'profiles'),
+ pjoin(self.location, 'profiles'),
'package.mask', ma))
return [neg, pos]
diff --git a/pkgcore/vdb/ondisk.py b/pkgcore/vdb/ondisk.py
index dbdbd18f1..066809ea8 100644
--- a/pkgcore/vdb/ondisk.py
+++ b/pkgcore/vdb/ondisk.py
@@ -56,15 +56,15 @@ class tree(prototype.tree):
st = os.stat(self.location)
if not stat.S_ISDIR(st.st_mode):
raise errors.InitializationError(
- "base not a dir: %r" % self.location)
- elif not st.st_mode & (os.X_OK|os.R_OK):
+ "vdb base not a dir: %r" % self.location)
+ elif not st.st_mode & (os.X_OK | os.R_OK):
raise errors.InitializationError(
- "base lacks read/executable: %r" % self.location)
+ "vdb base lacks read/executable: %r" % self.location)
except OSError as e:
if e.errno != errno.ENOENT:
compatibility.raise_from(errors.InitializationError(
- "lstat failed on base %r" % self.location))
+ "lstat failed on vdb: %r" % self.location))
self.package_class = self.package_factory(self)