Support repository dependencies in EAPI="4-python".
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sun, 15 Jan 2012 23:53:04 +0000 (00:53 +0100)
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sun, 15 Jan 2012 23:53:04 +0000 (00:53 +0100)
bin/portageq
doc/package/ebuild/eapi/4-python.docbook
pym/portage/dep/__init__.py
pym/portage/eapi.py
pym/portage/package/ebuild/_ipc/QueryCommand.py

index e532f1c7feef11a002aecc403a2bc183b502c49c..5ecbb21ca1f18a0fa17f1a2919587d2189608a3f 100755 (executable)
@@ -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") % \
index c13debed40b7430f48acfe0410a0a20e68cdcb79..b4cbc1ad480aa39e4842310ef6eb63f5faffcef4 100644 (file)
@@ -31,12 +31,46 @@ official EAPI 4-python Specification</ulink>.
 The "." character is allowed in USE flags.
 </para>
 </section>
-<section id='package-ebuild-eapi-4-python-repository'>
-<title>REPOSITORY</title>
+<section id='package-ebuild-eapi-4-python-repository-variable'>
+<title>REPOSITORY Variable</title>
 <para>
 The new REPOSITORY variable is set in ebuild environment. This variable contains name of repository, which contains currently used ebuild.
 </para>
 </section>
+<section id='package-ebuild-eapi-4-python-repository-dependencies'>
+<title>Repository Dependencies</title>
+<para>
+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.
+</para>
+<table><title>Repository Dependency Examples</title>
+<tgroup cols='1' align='left' >
+<colspec colname='atom'/>
+<thead>
+<row>
+<entry>Atom</entry>
+</row>
+</thead>
+<tbody>
+<row>
+<entry>dev-lang/python::progress</entry>
+</row>
+<row>
+<entry>&gt;=dev-lang/python-3.2::progress</entry>
+</row>
+<row>
+<entry>dev-lang/python:3.2::progress</entry>
+</row>
+<row>
+<entry>dev-lang/python::progress[xml]</entry>
+</row>
+<row>
+<entry>dev-lang/python:3.2::progress[xml]</entry>
+</row>
+</tbody>
+</tgroup>
+</table>
+</section>
 <section id='package-ebuild-eapi-4-python-repo-level-config'>
 <title>Extended Repository-Level Configuration</title>
 <para>
index 72411b7c7938dbbf7d4cfe98b9c9cd169094d640..389916f8e3198a6ed16301f40d84744bf71c9323 100644 (file)
@@ -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:
index 65c99c7e57dd7508013a8a1ac75b3b9eeb7ff7b5..c3c4f2d22b11f60a3fff63fe31ded93113696c6c 100644 (file)
@@ -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",)
index fb6e61e06fd52b1f274e150f946d388bf1ae9064..949a148015b5bb1bf494033d17b68aabe1e52249 100644 (file)
@@ -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))