From: Arfrever Frehtes Taifersar Arahesis Date: Sun, 15 Jan 2012 23:53:04 +0000 (+0100) Subject: Support repository dependencies in EAPI="4-python". X-Git-Tag: v2.2.0_alpha85~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=caf67ac8df3528382ff960b2de4cf853a14a0141;p=portage.git Support repository dependencies in EAPI="4-python". --- diff --git a/bin/portageq b/bin/portageq index e532f1c7f..5ecbb21ca 100755 --- a/bin/portageq +++ b/bin/portageq @@ -42,6 +42,7 @@ except ImportError: del pym_path from portage import os +from portage.eapi import eapi_has_repo_deps from portage.util import writemsg, writemsg_stdout portage.proxy.lazyimport.lazyimport(globals(), 'subprocess', @@ -88,8 +89,9 @@ def has_version(argv): warnings = [] + allow_repo = atom_validate_strict is False or eapi_has_repo_deps(eapi) try: - atom = portage.dep.Atom(argv[1]) + atom = portage.dep.Atom(argv[1], allow_repo=allow_repo) except portage.exception.InvalidAtom: if atom_validate_strict: portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1], @@ -100,7 +102,7 @@ def has_version(argv): else: if atom_validate_strict: try: - atom = portage.dep.Atom(argv[1], eapi=eapi) + atom = portage.dep.Atom(argv[1], allow_repo=allow_repo, eapi=eapi) except portage.exception.InvalidAtom as e: warnings.append( portage._unicode_decode("QA Notice: %s: %s") % \ @@ -135,8 +137,9 @@ def best_version(argv): warnings = [] + allow_repo = atom_validate_strict is False or eapi_has_repo_deps(eapi) try: - atom = portage.dep.Atom(argv[1]) + atom = portage.dep.Atom(argv[1], allow_repo=allow_repo) except portage.exception.InvalidAtom: if atom_validate_strict: portage.writemsg("ERROR: Invalid atom: '%s'\n" % argv[1], @@ -147,7 +150,7 @@ def best_version(argv): else: if atom_validate_strict: try: - atom = portage.dep.Atom(argv[1], eapi=eapi) + atom = portage.dep.Atom(argv[1], allow_repo=allow_repo, eapi=eapi) except portage.exception.InvalidAtom as e: warnings.append( portage._unicode_decode("QA Notice: %s: %s") % \ diff --git a/doc/package/ebuild/eapi/4-python.docbook b/doc/package/ebuild/eapi/4-python.docbook index c13debed4..b4cbc1ad4 100644 --- a/doc/package/ebuild/eapi/4-python.docbook +++ b/doc/package/ebuild/eapi/4-python.docbook @@ -31,12 +31,46 @@ official EAPI 4-python Specification. The "." character is allowed in USE flags. -
-REPOSITORY +
+REPOSITORY Variable The new REPOSITORY variable is set in ebuild environment. This variable contains name of repository, which contains currently used ebuild.
+
+Repository Dependencies + +Repository dependencies are supported in atoms in DEPEND, PDEPEND and RDEPEND and atoms passed to best_version and has_version functions. +Repository dependency is specified by two colons followed by repository name. + +Repository Dependency Examples + + + + +Atom + + + + +dev-lang/python::progress + + +>=dev-lang/python-3.2::progress + + +dev-lang/python:3.2::progress + + +dev-lang/python::progress[xml] + + +dev-lang/python:3.2::progress[xml] + + + +
+
Extended Repository-Level Configuration diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 72411b7c7..389916f8e 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -1,5 +1,5 @@ # deps.py -- Portage dependency resolution functions -# Copyright 2003-2011 Gentoo Foundation +# Copyright 2003-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = [ @@ -38,7 +38,8 @@ portage.proxy.lazyimport.lazyimport(globals(), from portage import _unicode_decode from portage.eapi import eapi_has_slot_deps, eapi_has_src_uri_arrows, \ - eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_use_dep_defaults + eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_use_dep_defaults, \ + eapi_has_repo_deps from portage.exception import InvalidAtom, InvalidData, InvalidDependString from portage.localization import _ from portage.versions import catpkgsplit, catsplit, \ @@ -1074,6 +1075,9 @@ class Atom(_atom_base): _atom_base.__init__(s) + if eapi_has_repo_deps(eapi): + allow_repo = True + if "!" == s[:1]: blocker = self._blocker(forbid_overlap=("!" == s[1:2])) if blocker.overlap.forbid: diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py index 65c99c7e5..c3c4f2d22 100644 --- a/pym/portage/eapi.py +++ b/pym/portage/eapi.py @@ -51,3 +51,6 @@ def eapi_has_required_use(eapi): def eapi_has_use_dep_defaults(eapi): return eapi not in ("0", "1", "2", "3") + +def eapi_has_repo_deps(eapi): + return eapi in ("4-python",) diff --git a/pym/portage/package/ebuild/_ipc/QueryCommand.py b/pym/portage/package/ebuild/_ipc/QueryCommand.py index fb6e61e06..949a14801 100644 --- a/pym/portage/package/ebuild/_ipc/QueryCommand.py +++ b/pym/portage/package/ebuild/_ipc/QueryCommand.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 import io @@ -7,6 +7,7 @@ import portage from portage import os from portage import _unicode_decode from portage.dep import Atom +from portage.eapi import eapi_has_repo_deps from portage.elog import messages as elog_messages from portage.exception import InvalidAtom from portage.package.ebuild._ipc.IpcCommand import IpcCommand @@ -31,14 +32,16 @@ class QueryCommand(IpcCommand): cmd, root, atom_str = argv + eapi = self.settings.get('EAPI') + allow_repo = eapi_has_repo_deps(eapi) try: - atom = Atom(atom_str) + atom = Atom(atom_str, allow_repo=allow_repo) except InvalidAtom: return ('', 'invalid atom: %s\n' % atom_str, 2) warnings = [] try: - atom = Atom(atom_str, eapi=self.settings.get('EAPI')) + atom = Atom(atom_str, allow_repo=allow_repo, eapi=eapi) except InvalidAtom as e: warnings.append(_unicode_decode("QA Notice: %s: %s") % (cmd, e))