* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, ...
@ 2012-05-13 1:07 Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2012-05-13 1:07 UTC (permalink / raw
To: gentoo-commits
commit: af50fee789e71c1fff0b405db4cf55b618b73466
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun May 13 01:07:29 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun May 13 01:07:29 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=af50fee7
_pkg_str: add slot and repo attributes
---
pym/_emerge/Package.py | 12 ++++++----
pym/portage/dbapi/__init__.py | 14 +++++++++---
.../package/ebuild/_config/KeywordsManager.py | 21 ++++++++++---------
.../package/ebuild/_config/LicenseManager.py | 9 ++++---
pym/portage/package/ebuild/_config/UseManager.py | 12 +++++++---
pym/portage/package/ebuild/_config/helper.py | 4 +-
pym/portage/package/ebuild/config.py | 10 +++++---
pym/portage/package/ebuild/getmaskingstatus.py | 14 ++++++++----
pym/portage/versions.py | 8 +++++-
9 files changed, 64 insertions(+), 40 deletions(-)
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index ec0c3f6..69739ac 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -10,6 +10,7 @@ from portage.const import EBUILD_PHASES
from portage.dep import Atom, check_required_use, use_reduce, \
paren_enclose, _slot_re, _slot_separator, _repo_separator, \
_unknown_repo
+from portage.versions import _pkg_str
from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
from portage.exception import InvalidDependString
from portage.repository.config import _gen_valid_repo
@@ -50,7 +51,6 @@ class Package(Task):
self.metadata = _PackageMetadataWrapper(self, self._raw_metadata)
if not self.built:
self.metadata['CHOST'] = self.root_config.settings.get('CHOST', '')
- self.cp = portage.cpv_getkey(self.cpv)
slot = self.slot
if _slot_re.match(slot) is None:
self._invalid_metadata('SLOT.invalid',
@@ -58,6 +58,12 @@ class Package(Task):
# Avoid an InvalidAtom exception when creating slot_atom.
# This package instance will be masked due to empty SLOT.
slot = '0'
+ repo = _gen_valid_repo(self.metadata.get('repository', ''))
+ if not repo:
+ repo = self.UNKNOWN_REPO
+ self.metadata['repository'] = repo
+ self.cpv = _pkg_str(self.cpv, slot=slot, repo=repo)
+ self.cp = self.cpv.cp
if (self.iuse.enabled or self.iuse.disabled) and \
not eapi_has_iuse_defaults(self.metadata["EAPI"]):
if not self.installed:
@@ -69,10 +75,6 @@ class Package(Task):
self.pv_split = self.cpv_split[1:]
if self.inherited is None:
self.inherited = frozenset()
- repo = _gen_valid_repo(self.metadata.get('repository', ''))
- if not repo:
- repo = self.UNKNOWN_REPO
- self.metadata['repository'] = repo
self._validate_deps()
self.masks = self._masks()
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 96e85ce..a835d4d 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2011 Gentoo Foundation
+# Copyright 1998-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ["dbapi"]
@@ -11,7 +11,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.dep:match_from_list',
'portage.output:colorize',
'portage.util:cmp_sort_key,writemsg',
- 'portage.versions:catsplit,catpkgsplit,vercmp',
+ 'portage.versions:catsplit,catpkgsplit,vercmp,_pkg_str',
)
from portage import os
@@ -155,11 +155,13 @@ class dbapi(object):
2) Check enabled/disabled flag states.
"""
- aux_keys = ["IUSE", "SLOT", "USE"]
+ aux_keys = ["IUSE", "SLOT", "USE", "repository"]
for cpv in cpv_iter:
try:
metadata = dict(zip(aux_keys,
self.aux_get(cpv, aux_keys, myrepo=atom.repo)))
+ if not metadata["repository"]:
+ del metadata["repository"]
except KeyError:
continue
@@ -209,7 +211,11 @@ class dbapi(object):
elif not self.settings.local_config:
# Check masked and forced flags for repoman.
- pkg = "%s:%s" % (cpv, metadata["SLOT"])
+ if hasattr(cpv, 'slot'):
+ pkg = cpv
+ else:
+ pkg = _pkg_str(cpv, slot=metadata["SLOT"],
+ repo=metadata.get("repository"))
usemask = self.settings._getUseMask(pkg)
if usemask.intersection(atom.use.enabled):
return False
diff --git a/pym/portage/package/ebuild/_config/KeywordsManager.py b/pym/portage/package/ebuild/_config/KeywordsManager.py
index 2f9f7b3..0c613ce 100644
--- a/pym/portage/package/ebuild/_config/KeywordsManager.py
+++ b/pym/portage/package/ebuild/_config/KeywordsManager.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = (
@@ -11,7 +11,7 @@ from portage.dep import ExtendedAtomDict, _repo_separator, _slot_separator
from portage.localization import _
from portage.package.ebuild._config.helper import ordered_by_atom_specificity
from portage.util import grabdict_package, stack_lists, writemsg
-from portage.versions import cpv_getkey
+from portage.versions import cpv_getkey, _pkg_str
class KeywordsManager(object):
"""Manager class to handle keywords processing and validation"""
@@ -77,10 +77,11 @@ class KeywordsManager(object):
def getKeywords(self, cpv, slot, keywords, repo):
- cp = cpv_getkey(cpv)
- pkg = "".join((cpv, _slot_separator, slot))
- if repo and repo != Package.UNKNOWN_REPO:
- pkg = "".join((pkg, _repo_separator, repo))
+ if not hasattr(cpv, 'slot'):
+ pkg = _pkg_str(cpv, slot=slot, repo=repo)
+ else:
+ pkg = cpv
+ cp = pkg.cp
keywords = [[x for x in keywords.split() if x != "-*"]]
for pkeywords_dict in self._pkeywords_list:
cpdict = pkeywords_dict.get(cp)
@@ -260,18 +261,19 @@ class KeywordsManager(object):
"""
pgroups = global_accept_keywords.split()
+ if not hasattr(cpv, 'slot'):
+ cpv = _pkg_str(cpv, slot=slot, repo=repo)
cp = cpv_getkey(cpv)
unmaskgroups = []
if self._p_accept_keywords:
- cpv_slot = "%s:%s" % (cpv, slot)
accept_keywords_defaults = tuple('~' + keyword for keyword in \
pgroups if keyword[:1] not in "~-")
for d in self._p_accept_keywords:
cpdict = d.get(cp)
if cpdict:
pkg_accept_keywords = \
- ordered_by_atom_specificity(cpdict, cpv_slot)
+ ordered_by_atom_specificity(cpdict, cpv)
if pkg_accept_keywords:
for x in pkg_accept_keywords:
if not x:
@@ -280,9 +282,8 @@ class KeywordsManager(object):
pkgdict = self.pkeywordsdict.get(cp)
if pkgdict:
- cpv_slot = "%s:%s" % (cpv, slot)
pkg_accept_keywords = \
- ordered_by_atom_specificity(pkgdict, cpv_slot, repo=repo)
+ ordered_by_atom_specificity(pkgdict, cpv)
if pkg_accept_keywords:
for x in pkg_accept_keywords:
unmaskgroups.extend(x)
diff --git a/pym/portage/package/ebuild/_config/LicenseManager.py b/pym/portage/package/ebuild/_config/LicenseManager.py
index effd55b..f76e7e2 100644
--- a/pym/portage/package/ebuild/_config/LicenseManager.py
+++ b/pym/portage/package/ebuild/_config/LicenseManager.py
@@ -1,4 +1,4 @@
-# Copyright 2010 Gentoo Foundation
+# Copyright 201-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = (
@@ -10,7 +10,7 @@ from portage.dep import ExtendedAtomDict, use_reduce
from portage.exception import InvalidDependString
from portage.localization import _
from portage.util import grabdict, grabdict_package, writemsg
-from portage.versions import cpv_getkey
+from portage.versions import cpv_getkey, _pkg_str
from portage.package.ebuild._config.helper import ordered_by_atom_specificity
@@ -119,8 +119,9 @@ class LicenseManager(object):
cp = cpv_getkey(cpv)
cpdict = self._plicensedict.get(cp)
if cpdict:
- cpv_slot = "%s:%s" % (cpv, slot)
- plicence_list = ordered_by_atom_specificity(cpdict, cpv_slot, repo)
+ if not hasattr(cpv, slot):
+ cpv = _pkg_str(cpv, slot=slot, repo=repo)
+ plicence_list = ordered_by_atom_specificity(cpdict, cpv)
if plicence_list:
accept_license = list(self._accept_license)
for x in plicence_list:
diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py
index 0506af0..e1ec7f4 100644
--- a/pym/portage/package/ebuild/_config/UseManager.py
+++ b/pym/portage/package/ebuild/_config/UseManager.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = (
@@ -7,10 +7,10 @@ __all__ = (
from _emerge.Package import Package
from portage import os
-from portage.dep import ExtendedAtomDict, remove_slot, _get_useflag_re
+from portage.dep import dep_getrepo, dep_getslot, ExtendedAtomDict, remove_slot, _get_useflag_re
from portage.localization import _
from portage.util import grabfile, grabdict_package, read_corresponding_eapi_file, stack_lists, writemsg
-from portage.versions import cpv_getkey
+from portage.versions import cpv_getkey, _pkg_str
from portage.package.ebuild._config.helper import ordered_by_atom_specificity
@@ -148,9 +148,13 @@ class UseManager(object):
return frozenset(stack_lists(
self._usemask_list, incremental=True))
+ slot = None
cp = getattr(pkg, "cp", None)
if cp is None:
- cp = cpv_getkey(remove_slot(pkg))
+ slot = dep_getslot(pkg)
+ repo = dep_getrepo(pkg)
+ pkg = _pkg_str(remove_slot(pkg), slot=slot, repo=repo)
+ cp = pkg.cp
usemask = []
if hasattr(pkg, "repo") and pkg.repo != Package.UNKNOWN_REPO:
repos = []
diff --git a/pym/portage/package/ebuild/_config/helper.py b/pym/portage/package/ebuild/_config/helper.py
index 4f46781..ee0c090 100644
--- a/pym/portage/package/ebuild/_config/helper.py
+++ b/pym/portage/package/ebuild/_config/helper.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = (
@@ -24,7 +24,7 @@ def ordered_by_atom_specificity(cpdict, pkg, repo=None):
order to achieve desired results (and thus corrupting
the ChangeLog like ordering of the file).
"""
- if repo and repo != Package.UNKNOWN_REPO:
+ if not hasattr(pkg, 'repo') and repo and repo != Package.UNKNOWN_REPO:
pkg = pkg + _repo_separator + repo
results = []
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 2434208..aa4a62e 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -43,7 +43,7 @@ from portage.util import ensure_dirs, getconfig, grabdict, \
grabdict_package, grabfile, grabfile_package, LazyItemsDict, \
normalize_path, shlex_split, stack_dictlist, stack_dicts, stack_lists, \
writemsg, writemsg_level
-from portage.versions import catpkgsplit, catsplit, cpv_getkey
+from portage.versions import catpkgsplit, catsplit, cpv_getkey, _pkg_str
from portage.package.ebuild._config import special_env_vars
from portage.package.ebuild._config.env_var_validation import validate_cmd_var
@@ -1239,7 +1239,7 @@ class config(object):
slot = pkg_configdict["SLOT"]
iuse = pkg_configdict["IUSE"]
if pkg is None:
- cpv_slot = "%s:%s" % (self.mycpv, slot)
+ cpv_slot = _pkg_str(self.mycpv, slot=slot, repo=repository)
else:
cpv_slot = pkg
pkginternaluse = []
@@ -1691,11 +1691,13 @@ class config(object):
@return: A list of properties that have not been accepted.
"""
accept_properties = self._accept_properties
+ if not hasattr(cpv, 'slot'):
+ cpv = _pkg_str(cpv, slot=metadata["SLOT"],
+ repo=metadata.get("repository"))
cp = cpv_getkey(cpv)
cpdict = self._ppropertiesdict.get(cp)
if cpdict:
- cpv_slot = "%s:%s" % (cpv, metadata["SLOT"])
- pproperties_list = ordered_by_atom_specificity(cpdict, cpv_slot, repo=metadata.get('repository'))
+ pproperties_list = ordered_by_atom_specificity(cpdict, cpv)
if pproperties_list:
accept_properties = list(self._accept_properties)
for x in pproperties_list:
diff --git a/pym/portage/package/ebuild/getmaskingstatus.py b/pym/portage/package/ebuild/getmaskingstatus.py
index b89fbf5..9bf605d 100644
--- a/pym/portage/package/ebuild/getmaskingstatus.py
+++ b/pym/portage/package/ebuild/getmaskingstatus.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Gentoo Foundation
+# Copyright 2010-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = ['getmaskingstatus']
@@ -9,7 +9,7 @@ import portage
from portage import eapi_is_supported, _eapi_is_deprecated
from portage.localization import _
from portage.package.ebuild.config import config
-from portage.versions import catpkgsplit
+from portage.versions import catpkgsplit, _pkg_str
if sys.hexversion >= 0x3000000:
basestring = str
@@ -51,9 +51,6 @@ def _getmaskingstatus(mycpv, settings, portdb, myrepo=None):
metadata = pkg.metadata
installed = pkg.installed
- mysplit = catpkgsplit(mycpv)
- if not mysplit:
- raise ValueError(_("invalid CPV: %s") % mycpv)
if metadata is None:
db_keys = list(portdb._aux_cache_keys)
try:
@@ -68,6 +65,13 @@ def _getmaskingstatus(mycpv, settings, portdb, myrepo=None):
else:
metadata["USE"] = ""
+ if not hasattr(mycpv, 'slot'):
+ try:
+ mycpv = _pkg_str(mycpv, slot=metadata['SLOT'],
+ repo=metadata.get('repository'))
+ except portage.exception.InvalidData:
+ raise ValueError(_("invalid CPV: %s") % mycpv)
+
rValue = []
# package.mask checking
diff --git a/pym/portage/versions.py b/pym/portage/versions.py
index ea8d5ae..33c7159 100644
--- a/pym/portage/versions.py
+++ b/pym/portage/versions.py
@@ -339,10 +339,10 @@ class _pkg_str(_unicode):
manually convert them to a plain unicode object first.
"""
- def __new__(cls, cpv, eapi=None):
+ def __new__(cls, cpv, slot=None, repo=None, eapi=None):
return _unicode.__new__(cls, cpv)
- def __init__(self, cpv, eapi=None):
+ def __init__(self, cpv, slot=None, repo=None, eapi=None):
if not isinstance(cpv, _unicode):
# Avoid TypeError from _unicode.__init__ with PyPy.
cpv = _unicode_decode(cpv)
@@ -353,6 +353,10 @@ class _pkg_str(_unicode):
self.__dict__['cp'] = self.cpv_split[0] + '/' + self.cpv_split[1]
# for match_from_list introspection
self.__dict__['cpv'] = self
+ if slot is not None:
+ self.__dict__['slot'] = slot
+ if repo is not None:
+ self.__dict__['repo'] = repo
def __setattr__(self, name, value):
raise AttributeError("_pkg_str instances are immutable",
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, ...
@ 2012-08-25 4:14 Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2012-08-25 4:14 UTC (permalink / raw
To: gentoo-commits
commit: 741093a384ff8256965ec4842664216cf911bcb5
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 25 04:08:47 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Aug 25 04:08:47 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=741093a3
_pkg_str: pass in config + metadata with KEYWORDS
This will be needed in order to support stable use.mask/force for
bug #431078.
---
pym/_emerge/Package.py | 15 +++++++++++----
pym/portage/dbapi/__init__.py | 16 ++++++++--------
pym/portage/dbapi/porttree.py | 4 ++--
pym/portage/dbapi/virtual.py | 4 ++--
pym/portage/dep/dep_check.py | 19 ++++---------------
.../package/ebuild/_config/KeywordsManager.py | 15 +++++++++------
pym/portage/package/ebuild/config.py | 10 ++++++----
pym/portage/package/ebuild/getmaskingstatus.py | 7 ++++---
pym/portage/tests/ebuild/test_doebuild_spawn.py | 2 ++
pym/portage/versions.py | 13 +++++++++++--
10 files changed, 59 insertions(+), 46 deletions(-)
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py
index 14d0694..c8a0c90 100644
--- a/pym/_emerge/Package.py
+++ b/pym/_emerge/Package.py
@@ -17,6 +17,9 @@ from _emerge.Task import Task
if sys.hexversion >= 0x3000000:
basestring = str
long = int
+ _unicode = str
+else:
+ _unicode = unicode
class Package(Task):
@@ -51,9 +54,8 @@ class Package(Task):
if not self.built:
self.metadata['CHOST'] = self.root_config.settings.get('CHOST', '')
eapi_attrs = _get_eapi_attrs(self.metadata["EAPI"])
- self.cpv = _pkg_str(self.cpv, slot=self.metadata["SLOT"],
- repo=self.metadata.get('repository', ''),
- eapi=self.metadata["EAPI"])
+ self.cpv = _pkg_str(self.cpv, metadata=self.metadata,
+ settings=self.root_config.settings)
if hasattr(self.cpv, 'slot_invalid'):
self._invalid_metadata('SLOT.invalid',
"SLOT: invalid value: '%s'" % self.metadata["SLOT"])
@@ -87,6 +89,11 @@ class Package(Task):
type_name=self.type_name)
self._hash_value = hash(self._hash_key)
+ # For consistency with _pkg_str
+ @property
+ def _metadata(self):
+ return self.metadata
+
# These are calculated on-demand, so that they are calculated
# after FakeVartree applies its metadata tweaks.
@property
@@ -154,7 +161,7 @@ class Package(Task):
# So overwrite the repo_key with type_name.
repo_key = type_name
- return (type_name, root, cpv, operation, repo_key)
+ return (type_name, root, _unicode(cpv), operation, repo_key)
def _validate_deps(self):
"""
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index b999fb5..97b4255 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -25,7 +25,7 @@ class dbapi(object):
_use_mutable = False
_known_keys = frozenset(x for x in auxdbkeys
if not x.startswith("UNUSED_0"))
- _pkg_str_aux_keys = ("EAPI", "SLOT", "repository")
+ _pkg_str_aux_keys = ("EAPI", "KEYWORDS", "SLOT", "repository")
def __init__(self):
pass
@@ -153,8 +153,7 @@ class dbapi(object):
metadata = dict(zip(self._pkg_str_aux_keys,
self.aux_get(cpv, self._pkg_str_aux_keys, myrepo=repo)))
- return _pkg_str(cpv, slot=metadata["SLOT"],
- repo=metadata["repository"], eapi=metadata["EAPI"])
+ return _pkg_str(cpv, metadata=metadata, settings=self.settings)
def _iter_match_repo(self, atom, cpv_iter):
for cpv in cpv_iter:
@@ -182,7 +181,7 @@ class dbapi(object):
2) Check enabled/disabled flag states.
"""
- aux_keys = ["IUSE", "SLOT", "USE", "repository"]
+ aux_keys = ["IUSE", "KEYWORDS", "SLOT", "USE", "repository"]
for cpv in cpv_iter:
try:
metadata = dict(zip(aux_keys,
@@ -234,11 +233,12 @@ class dbapi(object):
elif not self.settings.local_config:
# Check masked and forced flags for repoman.
- if hasattr(cpv, 'slot'):
- pkg = cpv
+ try:
+ cpv.slot
+ except AttributeError:
+ pkg = _pkg_str(cpv, metadata=metadata, settings=self.settings)
else:
- pkg = _pkg_str(cpv, slot=metadata["SLOT"],
- repo=metadata.get("repository"))
+ pkg = cpv
usemask = self.settings._getUseMask(pkg)
if any(x in usemask for x in atom.use.enabled):
return False
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 945c22c..0cb290f 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -827,8 +827,8 @@ class portdbapi(dbapi):
continue
try:
- pkg_str = _pkg_str(cpv, slot=metadata["SLOT"],
- repo=metadata["repository"], eapi=metadata["EAPI"])
+ pkg_str = _pkg_str(cpv, metadata=metadata,
+ settings=self.settings)
except InvalidData:
continue
diff --git a/pym/portage/dbapi/virtual.py b/pym/portage/dbapi/virtual.py
index 213708c..30d6c22 100644
--- a/pym/portage/dbapi/virtual.py
+++ b/pym/portage/dbapi/virtual.py
@@ -89,8 +89,8 @@ class fakedbapi(dbapi):
if metadata is None:
mycpv = _pkg_str(mycpv)
else:
- mycpv = _pkg_str(mycpv, slot=metadata.get('SLOT'),
- repo=metadata.get('repository'), eapi=metadata.get('EAPI'))
+ mycpv = _pkg_str(mycpv, metadata=metadata,
+ settings=self.settings)
mycp = mycpv.cp
try:
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py
index d575ab3..ecb8a9b 100644
--- a/pym/portage/dep/dep_check.py
+++ b/pym/portage/dep/dep_check.py
@@ -350,14 +350,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_pkg = mydbapi.match(atom.without_use)
if avail_pkg:
avail_pkg = avail_pkg[-1] # highest (ascending order)
- try:
- slot = avail_pkg.slot
- except AttributeError:
- eapi, slot, repo = mydbapi.aux_get(avail_pkg,
- ["EAPI", "SLOT", "repository"])
- avail_pkg = _pkg_str(avail_pkg, eapi=eapi,
- slot=slot, repo=repo)
- avail_slot = Atom("%s:%s" % (atom.cp, slot))
+ avail_pkg = mydbapi._pkg_str(avail_pkg, atom.repo)
+ avail_slot = Atom("%s:%s" % (atom.cp, avail_pkg.slot))
if not avail_pkg:
all_available = False
all_use_satisfied = False
@@ -372,13 +366,8 @@ def dep_zapdeps(unreduced, reduced, myroot, use_binaries=0, trees=None):
avail_pkg_use = avail_pkg_use[-1]
if avail_pkg_use != avail_pkg:
avail_pkg = avail_pkg_use
- try:
- slot = avail_pkg.slot
- except AttributeError:
- eapi, slot, repo = mydbapi.aux_get(avail_pkg,
- ["EAPI", "SLOT", "repository"])
- avail_pkg = _pkg_str(avail_pkg,
- eapi=eapi, slot=slot, repo=repo)
+ avail_pkg = mydbapi._pkg_str(avail_pkg, atom.repo)
+ avail_slot = Atom("%s:%s" % (atom.cp, avail_pkg.slot))
slot_map[avail_slot] = avail_pkg
highest_cpv = cp_map.get(avail_pkg.cp)
diff --git a/pym/portage/package/ebuild/_config/KeywordsManager.py b/pym/portage/package/ebuild/_config/KeywordsManager.py
index 0c613ce..74c7d0a 100644
--- a/pym/portage/package/ebuild/_config/KeywordsManager.py
+++ b/pym/portage/package/ebuild/_config/KeywordsManager.py
@@ -11,7 +11,7 @@ from portage.dep import ExtendedAtomDict, _repo_separator, _slot_separator
from portage.localization import _
from portage.package.ebuild._config.helper import ordered_by_atom_specificity
from portage.util import grabdict_package, stack_lists, writemsg
-from portage.versions import cpv_getkey, _pkg_str
+from portage.versions import _pkg_str
class KeywordsManager(object):
"""Manager class to handle keywords processing and validation"""
@@ -77,7 +77,9 @@ class KeywordsManager(object):
def getKeywords(self, cpv, slot, keywords, repo):
- if not hasattr(cpv, 'slot'):
+ try:
+ cpv.slot
+ except AttributeError:
pkg = _pkg_str(cpv, slot=slot, repo=repo)
else:
pkg = cpv
@@ -237,7 +239,7 @@ class KeywordsManager(object):
if not mygroups:
# If KEYWORDS is empty then we still have to return something
# in order to distinguish from the case of "none missing".
- mygroups.append("**")
+ mygroups = ["**"]
missing = mygroups
return missing
@@ -261,9 +263,11 @@ class KeywordsManager(object):
"""
pgroups = global_accept_keywords.split()
- if not hasattr(cpv, 'slot'):
+ try:
+ cpv.slot
+ except AttributeError:
cpv = _pkg_str(cpv, slot=slot, repo=repo)
- cp = cpv_getkey(cpv)
+ cp = cpv.cp
unmaskgroups = []
if self._p_accept_keywords:
@@ -288,4 +292,3 @@ class KeywordsManager(object):
for x in pkg_accept_keywords:
unmaskgroups.extend(x)
return unmaskgroups
-
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 4d871f4..94c0bbc 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1284,7 +1284,8 @@ class config(object):
slot = pkg_configdict["SLOT"]
iuse = pkg_configdict["IUSE"]
if pkg is None:
- cpv_slot = _pkg_str(self.mycpv, slot=slot, repo=repository)
+ cpv_slot = _pkg_str(self.mycpv, metadata=pkg_configdict,
+ settings=self)
else:
cpv_slot = pkg
pkginternaluse = []
@@ -1740,9 +1741,10 @@ class config(object):
@return: A list of properties that have not been accepted.
"""
accept_properties = self._accept_properties
- if not hasattr(cpv, 'slot'):
- cpv = _pkg_str(cpv, slot=metadata["SLOT"],
- repo=metadata.get("repository"))
+ try:
+ cpv.slot
+ except AttributeError:
+ cpv = _pkg_str(cpv, metadata=metadata, settings=self)
cp = cpv_getkey(cpv)
cpdict = self._ppropertiesdict.get(cp)
if cpdict:
diff --git a/pym/portage/package/ebuild/getmaskingstatus.py b/pym/portage/package/ebuild/getmaskingstatus.py
index 9bf605d..954abce 100644
--- a/pym/portage/package/ebuild/getmaskingstatus.py
+++ b/pym/portage/package/ebuild/getmaskingstatus.py
@@ -65,10 +65,11 @@ def _getmaskingstatus(mycpv, settings, portdb, myrepo=None):
else:
metadata["USE"] = ""
- if not hasattr(mycpv, 'slot'):
+ try:
+ mycpv.slot
+ except AttributeError:
try:
- mycpv = _pkg_str(mycpv, slot=metadata['SLOT'],
- repo=metadata.get('repository'))
+ mycpv = _pkg_str(mycpv, metadata=metadata, settings=settings)
except portage.exception.InvalidData:
raise ValueError(_("invalid CPV: %s") % mycpv)
diff --git a/pym/portage/tests/ebuild/test_doebuild_spawn.py b/pym/portage/tests/ebuild/test_doebuild_spawn.py
index 89e27a3..a0a80ac 100644
--- a/pym/portage/tests/ebuild/test_doebuild_spawn.py
+++ b/pym/portage/tests/ebuild/test_doebuild_spawn.py
@@ -36,10 +36,12 @@ class DoebuildSpawnTestCase(TestCase):
'EAPI' : '2',
'INHERITED' : 'python eutils',
'IUSE' : 'build doc epydoc python3 selinux',
+ 'KEYWORDS' : 'x86',
'LICENSE' : 'GPL-2',
'PROVIDE' : 'virtual/portage',
'RDEPEND' : '>=app-shells/bash-3.2_p17 >=dev-lang/python-2.6',
'SLOT' : '0',
+ 'repository': 'gentoo',
}
root_config = playground.trees[playground.eroot]['root_config']
pkg = Package(built=False, cpv=cpv, installed=False,
diff --git a/pym/portage/versions.py b/pym/portage/versions.py
index 2794753..36eb8ac 100644
--- a/pym/portage/versions.py
+++ b/pym/portage/versions.py
@@ -337,14 +337,23 @@ class _pkg_str(_unicode):
manually convert them to a plain unicode object first.
"""
- def __new__(cls, cpv, slot=None, repo=None, eapi=None):
+ def __new__(cls, cpv, metadata=None, settings=None, eapi=None,
+ repo=None, slot=None):
return _unicode.__new__(cls, cpv)
- def __init__(self, cpv, slot=None, repo=None, eapi=None):
+ def __init__(self, cpv, metadata=None, settings=None, eapi=None,
+ repo=None, slot=None):
if not isinstance(cpv, _unicode):
# Avoid TypeError from _unicode.__init__ with PyPy.
cpv = _unicode_decode(cpv)
_unicode.__init__(cpv)
+ if metadata is not None:
+ self.__dict__['_metadata'] = metadata
+ slot = metadata.get('SLOT', slot)
+ repo = metadata.get('repository', repo)
+ eapi = metadata.get('EAPI', eapi)
+ if settings is not None:
+ self.__dict__['_settings'] = settings
if eapi is not None:
self.__dict__['eapi'] = eapi
self.__dict__['cpv_split'] = catpkgsplit(cpv, eapi=eapi)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, ...
@ 2012-11-16 4:44 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 4+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-11-16 4:44 UTC (permalink / raw
To: gentoo-commits
commit: 89129c2f4b3e781b4d8e0701a93431ec0a7030cb
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Fri Nov 16 04:44:05 2012 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Fri Nov 16 04:44:05 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=89129c2f
Fix PORTAGE_BUILDIR_LOCKED typo.
---
pym/_emerge/AbstractEbuildProcess.py | 2 +-
pym/_emerge/EbuildBuildDir.py | 4 ++--
pym/portage/dbapi/vartree.py | 4 ++--
.../package/ebuild/_config/special_env_vars.py | 4 ++--
pym/portage/package/ebuild/_spawn_nofetch.py | 2 +-
pym/portage/package/ebuild/doebuild.py | 6 +++---
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index 91b962f..375688b 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -67,7 +67,7 @@ class AbstractEbuildProcess(SpawnProcess):
if self._enable_ipc_daemon:
self.settings.pop('PORTAGE_EBUILD_EXIT_FILE', None)
if self.phase not in self._phases_without_builddir:
- if 'PORTAGE_BUILDIR_LOCKED' not in self.settings:
+ if 'PORTAGE_BUILDDIR_LOCKED' not in self.settings:
self._build_dir = EbuildBuildDir(
scheduler=self.scheduler, settings=self.settings)
self._build_dir.lock()
diff --git a/pym/_emerge/EbuildBuildDir.py b/pym/_emerge/EbuildBuildDir.py
index 5d6a262..58905c2 100644
--- a/pym/_emerge/EbuildBuildDir.py
+++ b/pym/_emerge/EbuildBuildDir.py
@@ -59,7 +59,7 @@ class EbuildBuildDir(SlotObject):
builddir_lock.wait()
self._assert_lock(builddir_lock)
self._lock_obj = builddir_lock
- self.settings['PORTAGE_BUILDIR_LOCKED'] = '1'
+ self.settings['PORTAGE_BUILDDIR_LOCKED'] = '1'
finally:
self.locked = self._lock_obj is not None
catdir_lock.unlock()
@@ -91,7 +91,7 @@ class EbuildBuildDir(SlotObject):
self._lock_obj.unlock()
self._lock_obj = None
self.locked = False
- self.settings.pop('PORTAGE_BUILDIR_LOCKED', None)
+ self.settings.pop('PORTAGE_BUILDDIR_LOCKED', None)
catdir_lock = AsynchronousLock(path=self._catdir, scheduler=self.scheduler)
catdir_lock.start()
if catdir_lock.wait() == os.EX_OK:
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 0a74f47..735cf3b 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1874,7 +1874,7 @@ class dblink(object):
try:
# Only create builddir_lock if the caller
# has not already acquired the lock.
- if "PORTAGE_BUILDIR_LOCKED" not in self.settings:
+ if "PORTAGE_BUILDDIR_LOCKED" not in self.settings:
builddir_lock = EbuildBuildDir(
scheduler=scheduler,
settings=self.settings)
@@ -3585,7 +3585,7 @@ class dblink(object):
# Clone the config in case one of these has to be unmerged since
# we need it to have private ${T} etc... for things like elog.
settings_clone = config(clone=self.settings)
- settings_clone.pop("PORTAGE_BUILDIR_LOCKED", None)
+ settings_clone.pop("PORTAGE_BUILDDIR_LOCKED", None)
settings_clone.reset()
others_in_slot.append(dblink(self.cat, catsplit(cur_cpv)[1],
settings=settings_clone,
diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py
index 150dafe..578e417 100644
--- a/pym/portage/package/ebuild/_config/special_env_vars.py
+++ b/pym/portage/package/ebuild/_config/special_env_vars.py
@@ -20,7 +20,7 @@ env_blacklist = frozenset((
"INHERITED", "IUSE", "IUSE_EFFECTIVE",
"KEYWORDS", "LICENSE", "MERGE_TYPE",
"PDEPEND", "PF", "PKGUSE", "PORTAGE_BACKGROUND",
- "PORTAGE_BACKGROUND_UNMERGE", "PORTAGE_BUILDIR_LOCKED",
+ "PORTAGE_BACKGROUND_UNMERGE", "PORTAGE_BUILDDIR_LOCKED",
"PORTAGE_BUILT_USE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE",
"PORTAGE_NONFATAL", "PORTAGE_REPO_NAME",
"PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "REPOSITORY",
@@ -152,7 +152,7 @@ environ_filter += [
"GENTOO_MIRRORS", "NOCONFMEM", "O",
"PORTAGE_BACKGROUND", "PORTAGE_BACKGROUND_UNMERGE",
"PORTAGE_BINHOST",
- "PORTAGE_BUILDIR_LOCKED",
+ "PORTAGE_BUILDDIR_LOCKED",
"PORTAGE_CHECKSUM_FILTER",
"PORTAGE_ELOG_CLASSES",
"PORTAGE_ELOG_MAILFROM", "PORTAGE_ELOG_MAILSUBJECT",
diff --git a/pym/portage/package/ebuild/_spawn_nofetch.py b/pym/portage/package/ebuild/_spawn_nofetch.py
index c4e1831..151fc2e 100644
--- a/pym/portage/package/ebuild/_spawn_nofetch.py
+++ b/pym/portage/package/ebuild/_spawn_nofetch.py
@@ -60,7 +60,7 @@ def spawn_nofetch(portdb, ebuild_path, settings=None):
settings['PORTAGE_TMPDIR'] = private_tmpdir
settings.backup_changes('PORTAGE_TMPDIR')
# private temp dir was just created, so it's not locked yet
- settings.pop('PORTAGE_BUILDIR_LOCKED', None)
+ settings.pop('PORTAGE_BUILDDIR_LOCKED', None)
try:
doebuild_environment(ebuild_path, 'nofetch',
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 5002c5b..be33f63 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -692,7 +692,7 @@ def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
if mydo in clean_phases:
builddir_lock = None
if not returnpid and \
- 'PORTAGE_BUILDIR_LOCKED' not in mysettings:
+ 'PORTAGE_BUILDDIR_LOCKED' not in mysettings:
builddir_lock = EbuildBuildDir(
scheduler=EventLoop(main=False),
settings=mysettings)
@@ -834,7 +834,7 @@ def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
if newstuff:
if builddir_lock is None and \
- 'PORTAGE_BUILDIR_LOCKED' not in mysettings:
+ 'PORTAGE_BUILDDIR_LOCKED' not in mysettings:
builddir_lock = EbuildBuildDir(
scheduler=EventLoop(main=False),
settings=mysettings)
@@ -857,7 +857,7 @@ def doebuild(myebuild, mydo, _unused=None, settings=None, debug=0, listonly=0,
if not parallel_fetchonly and \
mydo not in ('digest', 'fetch', 'help', 'manifest'):
if not returnpid and \
- 'PORTAGE_BUILDIR_LOCKED' not in mysettings:
+ 'PORTAGE_BUILDDIR_LOCKED' not in mysettings:
builddir_lock = EbuildBuildDir(
scheduler=EventLoop(main=False),
settings=mysettings)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, ...
@ 2013-02-11 6:35 Zac Medico
0 siblings, 0 replies; 4+ messages in thread
From: Zac Medico @ 2013-02-11 6:35 UTC (permalink / raw
To: gentoo-commits
commit: ce06761841f181d12c004a56ac945a14bb5d1758
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 11 06:30:13 2013 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Feb 11 06:33:14 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ce067618
repoman: fix use.stable, bug #456342
Make child package inherit stable status from the parent package.
This is required in order for USE deps of unstable packages to be
resolved correctly, since otherwise use.stable.{mask,force} settings
of dependencies may conflict (see bug #456342).
---
bin/repoman | 8 ++++++++
pym/portage/dbapi/__init__.py | 6 ++++--
pym/portage/package/ebuild/_config/UseManager.py | 12 +++++++-----
pym/portage/package/ebuild/config.py | 9 +++++----
4 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/bin/repoman b/bin/repoman
index 3532bab..c1bb357 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -2178,6 +2178,14 @@ for x in effective_scanlist:
# just in case, prevent config.reset() from nuking these.
dep_settings.backup_changes("ACCEPT_KEYWORDS")
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
if not baddepsyntax:
ismasked = not ebuild_archs or \
pkg.cpv not in portdb.xmatch("match-visible", pkg.cp)
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 79d1e7a..ab4306d 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -253,11 +253,13 @@ class dbapi(object):
pkg = _pkg_str(cpv, metadata=metadata, settings=self.settings)
else:
pkg = cpv
- usemask = self.settings._getUseMask(pkg)
+ usemask = self.settings._getUseMask(pkg,
+ stable=self.settings._parent_stable)
if any(x in usemask for x in atom.use.enabled):
return False
- useforce = self.settings._getUseForce(pkg)
+ useforce = self.settings._getUseForce(pkg,
+ stable=self.settings._parent_stable)
if any(x in useforce and x not in usemask
for x in atom.use.disabled):
return False
diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py
index 743160c..8e7aaa2 100644
--- a/pym/portage/package/ebuild/_config/UseManager.py
+++ b/pym/portage/package/ebuild/_config/UseManager.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2012 Gentoo Foundation
+# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
__all__ = (
@@ -291,7 +291,7 @@ class UseManager(object):
# stable check against the correct profile here.
return self._is_stable(pkg)
- def getUseMask(self, pkg=None):
+ def getUseMask(self, pkg=None, stable=None):
if pkg is None:
return frozenset(stack_lists(
self._usemask_list, incremental=True))
@@ -304,7 +304,8 @@ class UseManager(object):
pkg = _pkg_str(remove_slot(pkg), slot=slot, repo=repo)
cp = pkg.cp
- stable = self._isStable(pkg)
+ if stable is None:
+ stable = self._isStable(pkg)
usemask = []
@@ -351,7 +352,7 @@ class UseManager(object):
return frozenset(stack_lists(usemask, incremental=True))
- def getUseForce(self, pkg=None):
+ def getUseForce(self, pkg=None, stable=None):
if pkg is None:
return frozenset(stack_lists(
self._useforce_list, incremental=True))
@@ -363,7 +364,8 @@ class UseManager(object):
pkg = _pkg_str(remove_slot(pkg), slot=slot, repo=repo)
cp = pkg.cp
- stable = self._isStable(pkg)
+ if stable is None:
+ stable = self._isStable(pkg)
useforce = []
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index a40cdd7..0090e4e 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -221,6 +221,7 @@ class config(object):
self._accept_properties = None
self._features_overrides = []
self._make_defaults = None
+ self._parent_stable = None
# _unknown_features records unknown features that
# have triggered warning messages, and ensures that
@@ -1734,11 +1735,11 @@ class config(object):
return iuse_implicit
- def _getUseMask(self, pkg):
- return self._use_manager.getUseMask(pkg)
+ def _getUseMask(self, pkg, stable=None):
+ return self._use_manager.getUseMask(pkg, stable=stable)
- def _getUseForce(self, pkg):
- return self._use_manager.getUseForce(pkg)
+ def _getUseForce(self, pkg, stable=None):
+ return self._use_manager.getUseForce(pkg, stable=stable)
def _getMaskAtom(self, cpv, metadata):
"""
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-11 6:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-11 6:35 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/dbapi/, Zac Medico
-- strict thread matches above, loose matches on Subject: below --
2012-11-16 4:44 Arfrever Frehtes Taifersar Arahesis
2012-08-25 4:14 Zac Medico
2012-05-13 1:07 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox