Merged from trunk -r15417:15421
authorFabian Groffen <grobian@gentoo.org>
Mon, 22 Feb 2010 13:02:22 +0000 (13:02 -0000)
committerFabian Groffen <grobian@gentoo.org>
Mon, 22 Feb 2010 13:02:22 +0000 (13:02 -0000)
   | 15418   | Bug #299095 - Add a deprecation warning for check_license    |
   | zmedico | calls with EAPI >= 3 since it is superceded by LICENSE       |
   |         | masking.                                                     |

   | 15419   | Use lazy import for the portage.dbapi module.                |
   | zmedico |                                                              |

   | 15420   | Don't import the portage.dbapi.dbapi class as portage.dbapi  |
   | zmedico | anymore, since it results in a strange namespace collision   |
   |         | (portage.dbapi is both a class and a module). Hopefully this |
   |         | won't break any api consumers since it's a pure virtual      |
   |         | class anyway.                                                |

   | 15421   | Create a directory for splitting the portage.util module     |
   | zmedico | into smaller files.                                          |

svn path=/main/branches/prefix/; revision=15433

bin/repoman
man/repoman.1
pym/_emerge/FakeVartree.py
pym/_emerge/PackageVirtualDbapi.py
pym/_emerge/depgraph.py
pym/portage/__init__.py
pym/portage/glsa.py
pym/repoman/checks.py

index a8bcc9d65cba21d53e277914faf7158eed2661e1..c74fcd00c5b77a43a0cfab300001136784df0d03 100755 (executable)
@@ -286,6 +286,7 @@ qahelp={
        "DESCRIPTION.missing":"Ebuilds that have a missing or empty DESCRIPTION variable",
        "DESCRIPTION.toolong":"DESCRIPTION is over %d characters" % max_desc_len,
        "EAPI.definition":"EAPI is defined after an inherit call (must be defined before)",
+       "EAPI.deprecated":"Ebuilds that use features that are deprecated in the current EAPI",
        "EAPI.incompatible":"Ebuilds that use features that are only available with a different EAPI",
        "EAPI.unsupported":"Ebuilds that have an unsupported EAPI version (you must upgrade portage)",
        "SLOT.invalid":"Ebuilds that have a missing or invalid SLOT variable value",
@@ -367,6 +368,7 @@ qawarnings = set((
 "DEPEND.badmaskedindev","RDEPEND.badmaskedindev","PDEPEND.badmaskedindev",
 "DEPEND.badtilde", "RDEPEND.badtilde", "PDEPEND.badtilde",
 "DESCRIPTION.toolong",
+"EAPI.deprecated",
 "HOMEPAGE.virtual",
 "LICENSE.virtual",
 "KEYWORDS.dropped",
index 129ffd00bac4bbedb9c542e251449bba9d63b098..9d8f299d429dad62cb6ae7c4ddb515fec87c9dcf 100644 (file)
@@ -110,6 +110,9 @@ Ebuilds that have a missing or empty DESCRIPTION variable
 .B EAPI.definition
 EAPI is defined after an inherit call (must be defined before)
 .TP
+.B EAPI.deprecated
+Ebuilds that use features that are deprecated in the current EAPI
+.TP
 .B EAPI.incompatible
 Ebuilds that use features that are only available with a different EAPI
 .TP
index 728d44a715bba752af540604af4d8c8c86c8401c..c408a21610b5711a77e82b7cec78117140971342 100644 (file)
@@ -8,11 +8,12 @@ import portage
 from portage import os
 from _emerge.Package import Package
 from _emerge.PackageVirtualDbapi import PackageVirtualDbapi
+from portage.dbapi.vartree import vartree
 
 if sys.hexversion >= 0x3000000:
        long = int
 
-class FakeVartree(portage.vartree):
+class FakeVartree(vartree):
        """This is implements an in-memory copy of a vartree instance that provides
        all the interfaces required for use by the depgraph.  The vardb is locked
        during the constructor call just long enough to read a copy of the
index e557f0489830e9e373ff4fdbc9e1b2542fc1aa1d..026b6cc7264dad9dd82a53a901c3fd1276318fcb 100644 (file)
@@ -3,9 +3,9 @@
 # $Id$
 
 import sys
-import portage
+from portage.dbapi import dbapi
 
-class PackageVirtualDbapi(portage.dbapi):
+class PackageVirtualDbapi(dbapi):
        """
        A dbapi-like interface class that represents the state of the installed
        package database as new packages are installed, replacing any packages
@@ -14,7 +14,7 @@ class PackageVirtualDbapi(portage.dbapi):
        internally (passed in via cpv_inject() and cpv_remove() calls).
        """
        def __init__(self, settings):
-               portage.dbapi.__init__(self)
+               dbapi.__init__(self)
                self.settings = settings
                self._match_cache = {}
                self._cp_map = {}
@@ -80,7 +80,7 @@ class PackageVirtualDbapi(portage.dbapi):
                result = self._match_cache.get(origdep)
                if result is not None:
                        return result[:]
-               result = portage.dbapi.match(self, origdep, use_cache=use_cache)
+               result = dbapi.match(self, origdep, use_cache=use_cache)
                self._match_cache[origdep] = result
                return result[:]
 
index a90d0a70898a2d96352bab64e6a0c8870289d8d3..c3f893ab11f1273576ad17009ad1efd25628623c 100644 (file)
@@ -14,6 +14,7 @@ from itertools import chain
 import portage
 from portage import os
 from portage import digraph
+from portage.dbapi import dbapi
 from portage.dep import Atom
 from portage.output import bold, blue, colorize, create_color_func, darkblue, \
        darkgreen, green, nc_len, red, teal, turquoise, yellow
@@ -5236,7 +5237,7 @@ class depgraph(object):
        def get_runtime_pkg_mask(self):
                return self._dynamic_config._runtime_pkg_mask.copy()
 
-class _dep_check_composite_db(portage.dbapi):
+class _dep_check_composite_db(dbapi):
        """
        A dbapi-like interface that is optimized for use in dep_check() calls.
        This is built on top of the existing depgraph package selection logic.
@@ -5245,7 +5246,7 @@ class _dep_check_composite_db(portage.dbapi):
        via dep_check().
        """
        def __init__(self, depgraph, root):
-               portage.dbapi.__init__(self)
+               dbapi.__init__(self)
                self._depgraph = depgraph
                self._root = root
                self._match_cache = {}
index 98341655986df24734fc39926d8c1ac2ccabf707..aabbb000a59867b7eaf382257c6fb4c1e6399fb4 100644 (file)
@@ -83,6 +83,12 @@ try:
                'portage.data',
                'portage.data:lchown,ostype,portage_gid,portage_uid,secpass,' + \
                        'uid,userland,userpriv_groups,wheelgid',
+               'portage.dbapi',
+               'portage.dbapi.bintree:bindbapi,binarytree',
+               'portage.dbapi.porttree:close_portdbapi_caches,FetchlistDict,' + \
+                       'portagetree,portdbapi',
+               'portage.dbapi.vartree:vardbapi,vartree,dblink',
+               'portage.dbapi.virtual:fakedbapi',
                'portage.dep',
                'portage.dep:best_match_to_list,dep_getcpv,dep_getkey,' + \
                        'flatten,get_operator,isjustname,isspecific,isvalidatom,' + \
@@ -2118,9 +2124,10 @@ class config(object):
 
                        #getting categories from an external file now
                        categories = [grabfile(os.path.join(x, "categories")) for x in locations]
+                       category_re = dbapi.dbapi._category_re
                        self.categories = tuple(sorted(
                                x for x in stack_lists(categories, incremental=1)
-                               if dbapi._category_re.match(x) is not None))
+                               if category_re.match(x) is not None))
                        del categories
 
                        archlist = [grabfile(os.path.join(x, "arch.list")) for x in locations]
@@ -8783,13 +8790,6 @@ auxdbkeys=[
        ]
 auxdbkeylen=len(auxdbkeys)
 
-from portage.dbapi import dbapi
-from portage.dbapi.virtual import fakedbapi
-from portage.dbapi.bintree import bindbapi, binarytree
-from portage.dbapi.vartree import vardbapi, vartree, dblink
-from portage.dbapi.porttree import FetchlistDict, \
-       close_portdbapi_caches, portagetree, portdbapi
-
 def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None,
        vartree=None, prev_mtimes=None, blockers=None):
        """will merge a .tbz2 file, returning a list of runtime dependencies
index 98602e4cc081d46f7389815f5601b5ce4a749a19..38b07ad32be07988d71822b29ef4dffeadc35db5 100644 (file)
@@ -268,12 +268,12 @@ def makeVersion(versionNode):
 
 def match(atom, dbapi, match_type="default"):
        """
-       wrapper that calls revisionMatch() or portage.dbapi.match() depending on 
+       wrapper that calls revisionMatch() or portage.dbapi.dbapi.match() depending on 
        the given atom.
        
        @type   atom: string
        @param  atom: a <~ or >~ atom or a normal portage atom that contains the atom to match against
-       @type   dbapi: portage.dbapi
+       @type   dbapi: portage.dbapi.dbapi
        @param  dbapi: one of the portage databases to use as information source
        @type   match_type: string
        @param  match_type: if != "default" passed as first argument to dbapi.xmatch 
@@ -297,7 +297,7 @@ def revisionMatch(revisionAtom, dbapi, match_type="default"):
        
        @type   revisionAtom: string
        @param  revisionAtom: a <~ or >~ atom that contains the atom to match against
-       @type   dbapi: portage.dbapi
+       @type   dbapi: portage.dbapi.dbapi
        @param  dbapi: one of the portage databases to use as information source
        @type   match_type: string
        @param  match_type: if != "default" passed as first argument to portdb.xmatch 
index 36e074c9f129884a6a62a7762166f46cceabce46..941cb41889f98ab6bd2952a235a08b14badbb8cd 100644 (file)
@@ -438,6 +438,24 @@ class BuiltWithUse(LineCheck):
        re = re.compile('^.*built_with_use')
        error = errors.BUILT_WITH_USE
 
+# EAPI-3 checks
+class Eapi3DeprecatedFuncs(LineCheck):
+       repoman_check_name = 'EAPI.deprecated'
+       ignore_line = re.compile(r'(^\s*#)')
+       deprecated_commands_re = re.compile(r'^\s*(check_license)\b')
+
+       def new(self, pkg):
+               self.eapi = pkg.metadata['EAPI']
+
+       def check_eapi(self, eapi):
+               return self.eapi not in ('0', '1', '2')
+
+       def check(self, num, line):
+               m = self.deprecated_commands_re.match(line)
+               if m is not None:
+                       return ("'%s'" % m.group(1)) + \
+                               " has been deprecated in EAPI=3 on line: %d"
+
 # EAPI-4 checks
 class Eapi4IncompatibleFuncs(LineCheck):
        repoman_check_name = 'EAPI.incompatible'
@@ -481,7 +499,8 @@ _constant_checks = tuple((c() for c in (
        IUseUndefined, InheritAutotools,
        EMakeParallelDisabled, EMakeParallelDisabledViaMAKEOPTS, NoAsNeeded,
        DeprecatedBindnowFlags, SrcUnpackPatches, WantAutoDefaultValue,
-       SrcCompileEconf, Eapi4IncompatibleFuncs, Eapi4GoneVars, BuiltWithUse)))
+       SrcCompileEconf, Eapi3DeprecatedFuncs,
+       Eapi4IncompatibleFuncs, Eapi4GoneVars, BuiltWithUse)))
 
 _here_doc_re = re.compile(r'.*\s<<[-]?(\w+)$')