From f2f41ae6e38b9bc3cd226006eb387010ccc6e19e Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Mon, 22 Feb 2010 13:02:22 +0000 Subject: [PATCH] Merged from trunk -r15417:15421 | 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 | 2 ++ man/repoman.1 | 3 +++ pym/_emerge/FakeVartree.py | 3 ++- pym/_emerge/PackageVirtualDbapi.py | 8 ++++---- pym/_emerge/depgraph.py | 5 +++-- pym/portage/__init__.py | 16 ++++++++-------- pym/portage/glsa.py | 6 +++--- pym/repoman/checks.py | 21 ++++++++++++++++++++- 8 files changed, 45 insertions(+), 19 deletions(-) diff --git a/bin/repoman b/bin/repoman index a8bcc9d65..c74fcd00c 100755 --- a/bin/repoman +++ b/bin/repoman @@ -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", diff --git a/man/repoman.1 b/man/repoman.1 index 129ffd00b..9d8f299d4 100644 --- a/man/repoman.1 +++ b/man/repoman.1 @@ -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 diff --git a/pym/_emerge/FakeVartree.py b/pym/_emerge/FakeVartree.py index 728d44a71..c408a2161 100644 --- a/pym/_emerge/FakeVartree.py +++ b/pym/_emerge/FakeVartree.py @@ -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 diff --git a/pym/_emerge/PackageVirtualDbapi.py b/pym/_emerge/PackageVirtualDbapi.py index e557f0489..026b6cc72 100644 --- a/pym/_emerge/PackageVirtualDbapi.py +++ b/pym/_emerge/PackageVirtualDbapi.py @@ -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[:] diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index a90d0a708..c3f893ab1 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -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 = {} diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 983416559..aabbb000a 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -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 diff --git a/pym/portage/glsa.py b/pym/portage/glsa.py index 98602e4cc..38b07ad32 100644 --- a/pym/portage/glsa.py +++ b/pym/portage/glsa.py @@ -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 diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 36e074c9f..941cb4188 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -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+)$') -- 2.26.2