* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/depend/, pym/repoman/modules/scan/arches/, ...
@ 2016-04-25 15:32 Brian Dolbec
2016-04-29 17:24 ` [gentoo-commits] proj/portage:master commit in: pym/repoman/modules/scan/arches/, pym/repoman/modules/scan/, Brian Dolbec
0 siblings, 1 reply; 2+ messages in thread
From: Brian Dolbec @ 2016-04-25 15:32 UTC (permalink / raw
To: gentoo-commits
commit: aea571e7b772f4c1cf23399dc6e685a123d6982f
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 18 07:25:17 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 15:28:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=aea571e7
WIP: repoman: convert all modules to the new data transfer system
Use Future instances for all non-pointer type variables modified by the modules.
Create set_result_pass() and set_result_raise() in ScanBase to reduce code duplication.
Create a get_result() in ScanBase which returns either a result or an unset_value rather
than raise an InvalidStateError.
pym/repoman/modules/scan/arches/arches.py | 7 +++-
pym/repoman/modules/scan/depend/__init__.py | 8 ++--
pym/repoman/modules/scan/depend/depend.py | 19 ++++++---
pym/repoman/modules/scan/depend/unknown.py | 10 ++---
pym/repoman/modules/scan/directories/files.py | 2 +-
pym/repoman/modules/scan/directories/mtime.py | 6 +--
pym/repoman/modules/scan/eapi/eapi.py | 4 +-
pym/repoman/modules/scan/ebuild/__init__.py | 2 +-
pym/repoman/modules/scan/ebuild/ebuild.py | 31 +++++++++------
pym/repoman/modules/scan/ebuild/isebuild.py | 28 +++++--------
pym/repoman/modules/scan/ebuild/multicheck.py | 4 +-
pym/repoman/modules/scan/eclasses/live.py | 16 ++++----
pym/repoman/modules/scan/eclasses/ruby.py | 6 +--
pym/repoman/modules/scan/fetch/fetches.py | 4 +-
pym/repoman/modules/scan/keywords/keywords.py | 8 ++--
pym/repoman/modules/scan/manifest/manifests.py | 6 +--
pym/repoman/modules/scan/metadata/__init__.py | 2 +-
pym/repoman/modules/scan/metadata/description.py | 6 +--
.../modules/scan/metadata/ebuild_metadata.py | 16 ++++----
pym/repoman/modules/scan/metadata/license.py | 6 +--
pym/repoman/modules/scan/metadata/pkgmetadata.py | 12 +++++-
pym/repoman/modules/scan/metadata/restrict.py | 4 +-
pym/repoman/modules/scan/metadata/unused.py | 9 ++---
.../modules/scan/mirrors/thirdpartymirrors.py | 8 ++--
pym/repoman/modules/scan/options/options.py | 4 +-
pym/repoman/modules/scan/scanbase.py | 38 +++++++++++++++++-
pym/repoman/modules/scan/status/vcsstatus.py | 6 ++-
pym/repoman/modules/scan/use/use_flags.py | 15 ++++---
pym/repoman/scanner.py | 46 ++++++++++++++++------
29 files changed, 207 insertions(+), 126 deletions(-)
diff --git a/pym/repoman/modules/scan/arches/arches.py b/pym/repoman/modules/scan/arches/arches.py
index 90ec04d..8bc7a24 100644
--- a/pym/repoman/modules/scan/arches/arches.py
+++ b/pym/repoman/modules/scan/arches/arches.py
@@ -23,7 +23,7 @@ class ArchChecks(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary, including arches set
'''
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
if self.options.ignore_arches:
arches = [[
self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],
@@ -67,7 +67,10 @@ class ArchChecks(ScanBase):
# Use an empty profile for checking dependencies of
# packages that have empty KEYWORDS.
arches.add(('**', '**', ('**',)))
- return {'continue': False, 'arches': arches}
+ # update the dynamic data
+ dyn_arches = kwargs.get('arches')
+ dyn_arches.update(arches)
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index a2b8534..735604d 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -21,7 +21,7 @@ module_spec = {
'mod_kwargs': ['qatracker', 'portdb'
],
'func_kwargs': {'ebuild': None, 'pkg': None, 'unknown_pkgs': 'set',
- 'type_list': [], 'badlicsyntax': 'Future',
+ 'type_list': 'list', 'badlicsyntax': 'Future',
'baddepsyntax': 'Future',
},
},
@@ -37,8 +37,8 @@ module_spec = {
'repo_settings', 'include_arches', 'caches',
'repoman_incrementals', 'env', 'have', 'dev_keywords'
],
- 'func_kwargs': {'arches': 'set', 'ebuild': None, 'pkg': None,
- 'unknown_pkgs': 'set', 'baddepsyntax': 'Future',
+ 'func_kwargs': {'arches': None, 'ebuild': None, 'pkg': None,
+ 'unknown_pkgs': None, 'baddepsyntax': None,
},
},
'unknown-module': {
@@ -52,7 +52,7 @@ module_spec = {
'mod_kwargs': ['qatracker',
],
'func_kwargs': {'ebuild': None, 'unknown_pkgs': 'set',
- 'baddepsyntax': 'Future',
+ 'baddepsyntax': None,
},
},
}
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index eaafc95..0efe5de 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -26,11 +26,10 @@ class DependChecks(ScanBase):
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
- @returns: dictionary including {unknown_pkgs, type_list,
- badlicsyntax, baddepsyntax}
+ @returns: boolean
'''
- ebuild = kwargs.get('ebuild')
- pkg = kwargs.get('pkg')
+ ebuild = kwargs.get('ebuild').result()
+ pkg = kwargs.get('pkg').result()
unknown_pkgs = set()
@@ -144,8 +143,16 @@ class DependChecks(ScanBase):
badlicsyntax = badlicsyntax > 0
#badprovsyntax = badprovsyntax > 0
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
- 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
+ # update the dynamic data
+ dyn_unknown = kwargs.get('unknown_pkgs')
+ dyn_unknown.update(unknown_pkgs)
+ dyn_type_list = kwargs.get('type_list')
+ dyn_type_list.extend(type_list)
+ self.set_result_pass([
+ (kwargs.get('badlicsyntax'), badlicsyntax),
+ (kwargs.get('baddepsyntax'), baddepsyntax),
+ ])
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
index 3aa7c79..9e8f7f8 100644
--- a/pym/repoman/modules/scan/depend/unknown.py
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -16,13 +16,13 @@ class DependUnknown(ScanBase):
def check(self, **kwargs):
'''Perform unknown dependancy checks
- @param ebuild: Ebuild which we check (object).
- @param baddepsyntax: boolean
+ @param ebuild: Future.result == Ebuild which we check (object).
+ @param baddepsyntax: Future.result == boolean
@param unknown_pkgs: set of tuples (type, atom.unevaluated_atom)
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
- baddepsyntax = kwargs.get('baddepsyntax')
+ ebuild = kwargs.get('ebuild').result()
+ baddepsyntax = self.get_result(kwargs.get('baddepsyntax'), False)
unknown_pkgs = kwargs.get('unknown_pkgs')
if not baddepsyntax and unknown_pkgs:
@@ -33,7 +33,7 @@ class DependUnknown(ScanBase):
self.qatracker.add_error(
"dependency.unknown", "%s: %s: %s"
% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
- return {'continue': False}
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/directories/files.py b/pym/repoman/modules/scan/directories/files.py
index a394658..94a0791 100644
--- a/pym/repoman/modules/scan/directories/files.py
+++ b/pym/repoman/modules/scan/directories/files.py
@@ -86,7 +86,7 @@ class FileChecks(ScanBase):
finally:
if f is not None:
f.close()
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py
index 56a7f05..6c667df 100644
--- a/pym/repoman/modules/scan/directories/mtime.py
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -15,14 +15,14 @@ class MtimeChecks(ScanBase):
@param changed: dictionary instance
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
changed = kwargs.get('changed')
- pkg = kwargs.get('pkg')
+ pkg = kwargs.get('pkg').result()
if not self.vcs_settings.vcs_preserves_mtime:
if ebuild.ebuild_path not in changed.new_ebuilds and \
ebuild.ebuild_path not in changed.ebuilds:
pkg.mtime = None
- return {'continue': False}
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/eapi/eapi.py b/pym/repoman/modules/scan/eapi/eapi.py
index fad1c18..18bab3d 100644
--- a/pym/repoman/modules/scan/eapi/eapi.py
+++ b/pym/repoman/modules/scan/eapi/eapi.py
@@ -23,11 +23,11 @@ class EAPIChecks(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
if not self._checkBanned(ebuild):
self._checkDeprecated(ebuild)
- return {'continue': False}
+ return False
def _checkBanned(self, ebuild):
if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi):
diff --git a/pym/repoman/modules/scan/ebuild/__init__.py b/pym/repoman/modules/scan/ebuild/__init__.py
index eb9098c..ea21ece 100644
--- a/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/pym/repoman/modules/scan/ebuild/__init__.py
@@ -21,7 +21,7 @@ module_spec = {
'mod_kwargs': ['portdb', 'qatracker', 'repo_settings'
],
'func_kwargs': {'checkdirlist': 'list', 'checkdir': None, 'xpkg': None,
- 'validity_fuse': None, 'can_force': 'Future', 'pkgs': 'dict',
+ 'validity_fuse': None, 'can_force': None, 'pkgs': 'dict',
},
},
'ebuild-module': {
diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py b/pym/repoman/modules/scan/ebuild/ebuild.py
index 67eee3f..b015985 100644
--- a/pym/repoman/modules/scan/ebuild/ebuild.py
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py
@@ -8,7 +8,6 @@ from repoman.modules.scan.scanbase import ScanBase
# import our initialized portage instance
from repoman._portage import portage
from portage import os
-from portage.util.futures import InvalidStateError
pv_toolong_re = re.compile(r'[0-9]{19,}')
@@ -86,7 +85,9 @@ class Ebuild(ScanBase):
# ebuild not added to vcs
self.qatracker.add_error(
"ebuild.notadded", self.xpkg + "/" + self.y_ebuild + ".ebuild")
- return {'continue': False, 'ebuild': self}
+ # update the dynamic data
+ self.set_result_raise([('ebuild', self)])
+ return False
def set_pkg_data(self, **kwargs):
'''Sets some classwide data needed for some of the checks
@@ -100,7 +101,7 @@ class Ebuild(ScanBase):
self.inherited = self.pkg.inherited
self.keywords = self.metadata["KEYWORDS"].split()
self.archs = set(kw.lstrip("~") for kw in self.keywords if not kw.startswith("-"))
- return {'continue': False}
+ return False
def bad_split_check(self, **kwargs):
'''Checks for bad category/package splits.
@@ -117,13 +118,13 @@ class Ebuild(ScanBase):
if is_pv_toolong or is_pv_toolong2:
self.qatracker.add_error(
"ebuild.invalidname", self.xpkg + "/" + self.y_ebuild + ".ebuild")
- return {'continue': True}
+ return True
elif myesplit[0] != pkgdir:
print(pkgdir, myesplit[0])
self.qatracker.add_error(
"ebuild.namenomatch", self.xpkg + "/" + self.y_ebuild + ".ebuild")
- return {'continue': True}
- return {'continue': False}
+ return True
+ return False
def pkg_invalid(self, **kwargs):
'''Sets some pkg info and checks for invalid packages
@@ -136,12 +137,18 @@ class Ebuild(ScanBase):
for k, msgs in self.pkg.invalid.items():
for msg in msgs:
self.qatracker.add_error(k, "%s: %s" % (self.relative_path, msg))
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
- return {'continue': True, 'pkg': self.pkg}
- return {'continue': False, 'pkg': self.pkg}
+ # update the dynamic data
+ self.set_result_pass([
+ (fuse, False),])
+ self.set_result_raise([
+ (kwargs.get('pkg'), self.pkg),
+ ])
+ return True
+ # update the dynamic data
+ self.set_result_raise([
+ (kwargs.get('pkg'), self.pkg),
+ ])
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/ebuild/isebuild.py b/pym/repoman/modules/scan/ebuild/isebuild.py
index a8870c7..3e288a3 100644
--- a/pym/repoman/modules/scan/ebuild/isebuild.py
+++ b/pym/repoman/modules/scan/ebuild/isebuild.py
@@ -9,7 +9,6 @@ from _emerge.RootConfig import RootConfig
from repoman._portage import portage
from portage import os
-from portage.util.futures import InvalidStateError
from repoman.qa_data import no_exec, allvars
from repoman.modules.scan.scanbase import ScanBase
@@ -65,24 +64,15 @@ class IsEbuild(ScanBase):
try:
myaux = dict(zip(allvars, self.portdb.aux_get(cpv, allvars)))
except KeyError:
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
+ self.set_result_pass([(fuse, False)])
self.qatracker.add_error("ebuild.syntax", os.path.join(xpkg, y))
continue
except IOError:
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
+ self.set_result_pass([(fuse, False)])
self.qatracker.add_error("ebuild.output", os.path.join(xpkg, y))
continue
if not portage.eapi_is_supported(myaux["EAPI"]):
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
+ self.set_result_pass([(fuse, False)])
self.qatracker.add_error("EAPI.unsupported", os.path.join(xpkg, y))
continue
pkgs[pf] = Package(
@@ -96,12 +86,12 @@ class IsEbuild(ScanBase):
# metadata leads to false positives for several checks, and false
# positives confuse users.
self.continue_ = True
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
-
- return {'continue': self.continue_, 'pkgs': pkgs}
+ self.set_result_pass([(can_force, False)])
+ # set our updated data
+ self.set_result_raise([
+ (kwargs.get('pkgs'), pkgs),
+ ])
+ return self.continue_
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/ebuild/multicheck.py b/pym/repoman/modules/scan/ebuild/multicheck.py
index 1d68227..ed7556d 100644
--- a/pym/repoman/modules/scan/ebuild/multicheck.py
+++ b/pym/repoman/modules/scan/ebuild/multicheck.py
@@ -31,8 +31,8 @@ class MultiCheck(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
- pkg = kwargs.get('pkg')
+ ebuild = kwargs.get('ebuild').result()
+ pkg = kwargs.get('pkg').result()
try:
# All ebuilds should have utf_8 encoding.
f = io.open(
diff --git a/pym/repoman/modules/scan/eclasses/live.py b/pym/repoman/modules/scan/eclasses/live.py
index 81953af..e5bb7dc 100644
--- a/pym/repoman/modules/scan/eclasses/live.py
+++ b/pym/repoman/modules/scan/eclasses/live.py
@@ -25,9 +25,11 @@ class LiveEclassChecks(ScanBase):
@returns: dictionary, including {live_ebuild}
'''
- return {'continue': False,
- 'live_ebuild': LIVE_ECLASSES.intersection(
- kwargs.get('ebuild').inherited)}
+ # update the dynamic data
+ dyn_live = kwargs.get('live_ebuild')
+ dyn_live.update(LIVE_ECLASSES.intersection(
+ kwargs.get('ebuild').inherited))
+ return False
def check(self, **kwargs):
'''Ebuilds that inherit a "Live" eclass (darcs, subversion, git, cvs,
@@ -41,15 +43,15 @@ class LiveEclassChecks(ScanBase):
@param global_pmaskdict: A global dictionary of all the masks.
@returns: dictionary
'''
- pkg = kwargs.get("pkg")
+ pkg = kwargs.get("pkg").result()
package = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
keywords = ebuild.keywords
if not (kwargs.get('live_ebuild') and
self.repo_settings.repo_config.name == "gentoo"):
- return {'continue': False}
+ return False
is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-")
bad_stable_keywords = list(filter(is_stable, keywords))
@@ -62,7 +64,7 @@ class LiveEclassChecks(ScanBase):
good_keywords_exist = len(bad_stable_keywords) < len(keywords)
if good_keywords_exist and not self._has_global_mask(pkg, self.pmaskdict):
self.qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
- return {'continue': False}
+ return False
@staticmethod
def _has_global_mask(pkg, global_pmaskdict):
diff --git a/pym/repoman/modules/scan/eclasses/ruby.py b/pym/repoman/modules/scan/eclasses/ruby.py
index aa2232a..92b9649 100644
--- a/pym/repoman/modules/scan/eclasses/ruby.py
+++ b/pym/repoman/modules/scan/eclasses/ruby.py
@@ -25,8 +25,8 @@ class RubyEclassChecks(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary
'''
- pkg = kwargs.get('pkg')
- ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg').result()
+ ebuild = kwargs.get('ebuild').result()
is_inherited = lambda eclass: eclass in pkg.inherited
is_old_ruby_eclass_inherited = filter(
is_inherited, self.old_ruby_eclasses)
@@ -40,7 +40,7 @@ class RubyEclassChecks(ScanBase):
"IUSE.rubydeprecated",
(ebuild.relative_path + ": Deprecated ruby target: %s")
% myruby)
- return {'continue': False}
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/fetch/fetches.py b/pym/repoman/modules/scan/fetch/fetches.py
index 6bdcf23..f6adece 100644
--- a/pym/repoman/modules/scan/fetch/fetches.py
+++ b/pym/repoman/modules/scan/fetch/fetches.py
@@ -130,7 +130,9 @@ class FetchChecks(ScanBase):
self.qatracker.add_error(
"file.name",
"%s/files/%s: char '%s'" % (checkdir, y, y[index]))
- return {'continue': False, 'src_uri_error': self._src_uri_error}
+ # update the dynamic data
+ self.set_result_pass([(kwargs.get('src_uri_error'), self._src_uri_error)])
+ return False
def digests(self, checkdir):
'''Returns the freshly loaded digests
diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 196feb4..ec48bb6 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -26,7 +26,7 @@ class KeywordChecks(ScanBase):
def prepare(self, **kwargs):
'''Prepare the checks for the next package.'''
self.slot_keywords = {}
- return {'continue': False}
+ return False
def check(self, **kwargs):
'''Perform the check.
@@ -40,9 +40,9 @@ class KeywordChecks(ScanBase):
@param live_ebuild: A boolean that determines if this is a live ebuild.
@returns: dictionary
'''
- pkg = kwargs.get('pkg')
+ pkg = kwargs.get('pkg').result()
xpkg =kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
changed = kwargs.get('changed')
live_ebuild = kwargs.get('live_ebuild')
@@ -57,7 +57,7 @@ class KeywordChecks(ScanBase):
self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
self.slot_keywords[pkg.slot].update(ebuild.archs)
- return {'continue': False}
+ return False
@staticmethod
def _isKeywordStable(keyword):
diff --git a/pym/repoman/modules/scan/manifest/manifests.py b/pym/repoman/modules/scan/manifest/manifests.py
index 6f44f8d..2b8d7af 100644
--- a/pym/repoman/modules/scan/manifest/manifests.py
+++ b/pym/repoman/modules/scan/manifest/manifests.py
@@ -88,14 +88,14 @@ class Manifests(ScanBase):
portage.writemsg_stdout(
" %s::%s\n" % (pf, distfile))
# continue, skip remaining main loop code
- return {'continue': True}
+ return True
elif failed:
sys.exit(1)
if not self.generated_manifest:
self.digest_check(xpkg, checkdir)
if self.options.mode == 'manifest-check':
- return {'continue': True}
- return {'continue': False}
+ return True
+ return False
def create_manifest(self, checkdir, fetchlist_dict):
'''Creates a Manifest file
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 1e690bf..af9771b 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -21,7 +21,7 @@ module_spec = {
'mod_kwargs': ['repo_settings', 'qatracker', 'options', 'metadata_dtd',
],
'func_kwargs': {'xpkg': None, 'checkdir': None, 'checkdirlist': None,
- 'repolevel': None, 'muselist': 'set',
+ 'repolevel': None, 'muselist': 'Future',
},
},
'ebuild-metadata': {
diff --git a/pym/repoman/modules/scan/metadata/description.py b/pym/repoman/modules/scan/metadata/description.py
index 8059888..8bce8d8 100644
--- a/pym/repoman/modules/scan/metadata/description.py
+++ b/pym/repoman/modules/scan/metadata/description.py
@@ -21,8 +21,8 @@ class DescriptionChecks(ScanBase):
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
'''
- ebuild = kwargs.get('ebuild')
- pkg = kwargs.get('pkg')
+ ebuild = kwargs.get('ebuild').result()
+ pkg = kwargs.get('pkg').result()
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
@@ -30,7 +30,7 @@ class DescriptionChecks(ScanBase):
"%s: DESCRIPTION is %d characters (max %d)" %
(ebuild.relative_path, len(
pkg._metadata['DESCRIPTION']), max_desc_len))
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index ca748de..38b13d5 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -20,7 +20,7 @@ class EbuildMetadata(ScanBase):
self.qatracker = kwargs.get('qatracker')
def invalidchar(self, **kwargs):
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
continue
@@ -31,10 +31,10 @@ class EbuildMetadata(ScanBase):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
- return {'continue': False}
+ return False
def missing(self, **kwargs):
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
for pos, missing_var in enumerate(missingvars):
if not ebuild.metadata.get(missing_var):
if kwargs.get('catdir') == "virtual" and \
@@ -45,22 +45,22 @@ class EbuildMetadata(ScanBase):
myqakey = missingvars[pos] + ".missing"
self.qatracker.add_error(myqakey, '%s/%s.ebuild'
% (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
- return {'continue': False}
+ return False
def old_virtual(self, **kwargs):
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
- return {'continue': False}
+ return False
def virtual(self, **kwargs):
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
if kwargs.get('catdir') == "virtual":
for var in ("HOMEPAGE", "LICENSE"):
if ebuild.metadata.get(var):
myqakey = var + ".virtual"
self.qatracker.add_error(myqakey, ebuild.relative_path)
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/license.py b/pym/repoman/modules/scan/metadata/license.py
index cccc998..b08834a 100644
--- a/pym/repoman/modules/scan/metadata/license.py
+++ b/pym/repoman/modules/scan/metadata/license.py
@@ -26,9 +26,9 @@ class LicenseChecks(ScanBase):
@param y_ebuild: Ebuild which we check (string).
'''
xpkg = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
- if not kwargs.get('badlicsyntax'):
+ if not self.get_result(kwargs.get('badlicsyntax'), False):
# Parse the LICENSE variable, remove USE conditions and flatten it.
licenses = portage.dep.use_reduce(
ebuild.metadata["LICENSE"], matchall=1, flat=True)
@@ -43,7 +43,7 @@ class LicenseChecks(ScanBase):
elif lic in self.repo_metadata['lic_deprecated']:
self.qatracker.add_error("LICENSE.deprecated",
"%s: %s" % (ebuild.relative_path, lic))
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 030cbca..242c923 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -73,7 +73,11 @@ class PkgMetadata(ScanBase):
self.musedict = {}
if self.options.mode in ['manifest']:
- return {'continue': False, 'muselist': frozenset(self.musedict)}
+ # update the dynamic data
+ self.set_result_raise([
+ (kwargs.get('muselist'), frozenset(self.musedict))
+ ])
+ return False
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
@@ -184,7 +188,11 @@ class PkgMetadata(ScanBase):
if not self.xmllint.check(checkdir, repolevel):
self.qatracker.add_error("metadata.bad", xpkg + "/metadata.xml")
del metadata_bad
- return {'continue': False, 'muselist': frozenset(self.musedict)}
+ # update the dynamic data
+ self.set_result_raise([
+ (kwargs.get('muselist'), frozenset(self.musedict))
+ ])
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/restrict.py b/pym/repoman/modules/scan/metadata/restrict.py
index 25bf56e..044cc2a 100644
--- a/pym/repoman/modules/scan/metadata/restrict.py
+++ b/pym/repoman/modules/scan/metadata/restrict.py
@@ -21,7 +21,7 @@ class RestrictChecks(ScanBase):
def check(self, **kwargs):
xpkg = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
myrestrict = None
@@ -41,7 +41,7 @@ class RestrictChecks(ScanBase):
for mybad in mybadrestrict:
self.qatracker.add_error("RESTRICT.invalid",
"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mybad))
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
index a6ff589..0184d78 100644
--- a/pym/repoman/modules/scan/metadata/unused.py
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -23,12 +23,9 @@ class UnusedCheck(ScanBase):
@param validity_future: Future instance
'''
xpkg = kwargs.get('xpkg')
- muselist = kwargs.get('muselist')
+ muselist = kwargs.get('muselist').result()
used_useflags = kwargs.get('used_useflags')
- try:
- valid_state = kwargs['validity_future'].result()
- except InvalidStateError:
- valid_state = True
+ valid_state = self.get_result(kwargs['validity_future'], True)
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if valid_state:
@@ -37,7 +34,7 @@ class UnusedCheck(ScanBase):
"metadata.warning",
"%s/metadata.xml: unused local USE-description: '%s'"
% (xpkg, myflag))
- return {'continue': False}
+ return False
@property
def runInFinal(self):
diff --git a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
index f467ea4..8e3d250 100644
--- a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
+++ b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
@@ -33,9 +33,9 @@ class ThirdPartyMirrors(ScanBase):
@param src_uri_error: boolean
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
- if kwargs.get('src_uri_error'):
- return {'continue': True}
+ ebuild = kwargs.get('ebuild').result()
+ if self.get_result(kwargs.get('src_uri_error'), False):
+ return True
for uri in portage.dep.use_reduce(
ebuild.metadata["SRC_URI"], matchall=True, is_src_uri=True,
eapi=ebuild.eapi, flat=True):
@@ -52,7 +52,7 @@ class ThirdPartyMirrors(ScanBase):
"SRC_URI.mirror",
"%s: '%s' found in thirdpartymirrors, use '%s'" % (
ebuild.relative_path, mirror, new_uri))
- return {'continue': False}
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/options/options.py b/pym/repoman/modules/scan/options/options.py
index 2fabdba..443f01b 100644
--- a/pym/repoman/modules/scan/options/options.py
+++ b/pym/repoman/modules/scan/options/options.py
@@ -20,8 +20,8 @@ class Options(ScanBase):
# The dep_check() calls are the most expensive QA test. If --force
# is enabled, there's no point in wasting time on these since the
# user is intent on forcing the commit anyway.
- return {'continue': True}
- return {'continue': False}
+ return True
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/scanbase.py b/pym/repoman/modules/scan/scanbase.py
index 9821c57..740092e 100644
--- a/pym/repoman/modules/scan/scanbase.py
+++ b/pym/repoman/modules/scan/scanbase.py
@@ -1,5 +1,7 @@
# -*- coding:utf-8 -*-
+from portage.util.futures import InvalidStateError
+
class ScanBase(object):
'''Skeleton class for performing a scan for one or more items
@@ -30,9 +32,43 @@ class ScanBase(object):
# The continue attribute will default to False if not returned.
# This will allow the loop to continue with the next check in the list.
# Include any additional dynamic data that needs to be added or updated.
- return {'continue': False}
+ return False # used as a continue True/False value
"""
+ @staticmethod
+ def set_result_pass(items):
+ '''Set Future instance results, pass on InvalidStateError
+
+ @param items: iterable of key, value tuples
+ '''
+ for key, value in items:
+ try:
+ key.set_result(value)
+ except InvalidStateError:
+ pass
+
+ @staticmethod
+ def set_result_raise(items):
+ '''Set Future instance results, raises an exception on InvalidStateError
+
+ @param items: iterable of key, value tuples
+ '''
+ for key, value in items:
+ key.set_result(value)
+
+ def get_result(self, future, unset_value=None):
+ '''Returns a Future result, or the unset value passed in
+
+ @param future: The Future instance being queried
+ @param unset_value:
+ @returns: Future result
+ '''
+ try:
+ result = future.result()
+ except InvalidStateError:
+ result = unset_value
+ return result
+
@property
def runInPkgs(self):
'''Package level scans'''
diff --git a/pym/repoman/modules/scan/status/vcsstatus.py b/pym/repoman/modules/scan/status/vcsstatus.py
index cf2298e..cadc5c0 100644
--- a/pym/repoman/modules/scan/status/vcsstatus.py
+++ b/pym/repoman/modules/scan/status/vcsstatus.py
@@ -31,7 +31,11 @@ class VCSStatus(ScanBase):
xpkg = kwargs.get('xpkg')
if self.check_not_added:
self.vcs_settings.status.check(checkdir, checkdir_relative, xpkg)
- return {'continue': False, 'eadded': self.vcs_settings.status.eadded}
+ # update the dynamic data
+ self.set_result_pass([
+ (kwargs.get('eadded'), self.vcs_settings.status.eadded),
+ ])
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/use/use_flags.py b/pym/repoman/modules/scan/use/use_flags.py
index b76ed70..70f7583 100644
--- a/pym/repoman/modules/scan/use/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -38,11 +38,11 @@ class USEFlagChecks(ScanBase):
@param muselist: Local USE flags of the package
@returns: dictionary, including {ebuild_UsedUseFlags, used_useflags}
'''
- pkg = kwargs.get('pkg')
+ pkg = kwargs.get('pkg').result()
package = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
- localUseFlags = kwargs.get('muselist')
+ localUseFlags = kwargs.get('muselist').result()
# reset state variables for the run
self.useFlags = []
self.defaultUseFlags = []
@@ -50,9 +50,14 @@ class USEFlagChecks(ScanBase):
self._checkGlobal(pkg)
self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
self._checkRequiredUSE(pkg, ebuild)
+ # update the dynamic data
used_useflags = kwargs.get('used_useflags').union(self.usedUseFlags)
- return {'continue': False, 'ebuild_UsedUseFlags': self.usedUseFlags,
- 'used_useflags': used_useflags}
+ dyn_ebuild_used = kwargs.get('ebuild_UsedUseFlags')
+ dyn_ebuild_used.update(self.usedUseFlags)
+ dyn_used = kwargs.get('used_useflags')
+ dyn_used.update(used_useflags)
+ return False
+
def _checkGlobal(self, pkg):
for myflag in pkg._metadata["IUSE"].split():
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 5ac519e..3d2c69c 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -28,6 +28,8 @@ MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
# initial development debug info
logging.debug("module_names: %s", MODULE_NAMES)
+DATA_TYPES = {'dict': dict, 'Future': Future, 'list': list, 'set': set}
+
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -177,6 +179,9 @@ class Scanner(object):
chain(self.changed.changed, self.changed.new, self.changed.removed),
self.repolevel, self.reposplit, self.categories))
+ self.pkgs = None
+ self.eadded = False
+
# Create our kwargs dict here to initialize the plugins with
self.kwargs = {
"repo_settings": self.repo_settings,
@@ -215,6 +220,28 @@ class Scanner(object):
kwargs[key] = self.kwargs[key]
return kwargs
+ @staticmethod
+ def set_func_kwargs(mod, dynamic_data=None):
+ '''Updates the dynamic_data dictionary with any new key, value pairs.
+ Creates a limited set of kwargs to pass to the modulefunctions to run
+
+ @param mod: module name string
+ @param dynamic_data: dictionary structure
+ @returns: dictionary
+ '''
+ func_kwargs = MODULE_CONTROLLER.modules[mod]['func_kwargs']
+ # determine new keys
+ required = set(func_kwargs.viewkeys())
+ exist = set(dynamic_data.viewkeys())
+ new = exist.difference(required)
+ # update dynamic_data with initialized entries
+ for key in new:
+ dynamic_data[key] = DATA_TYPES[func_kwargs['key']]()
+ kwargs = {}
+ for key in required:
+ kwargs[key] = dynamic_data[key]
+ return kwargs
+
def scan_pkgs(self, can_force):
for xpkg in self.effective_scanlist:
xpkg_continue = False
@@ -252,8 +279,8 @@ class Scanner(object):
do_it, functions = self.modules[mod].runInPkgs
if do_it:
for func in functions:
- rdata = func(**dynamic_data)
- if rdata.get('continue', False):
+ _continue = func(**self.set_func_kwargs(mod, dynamic_data))
+ if _continue:
# If we can't access all the metadata then it's totally unsafe to
# commit since there's no way to generate a correct Manifest.
# Do not try to do any more QA checks on this package since missing
@@ -261,7 +288,6 @@ class Scanner(object):
# positives confuse users.
xpkg_continue = True
break
- dynamic_data.update(rdata)
if xpkg_continue:
continue
@@ -313,8 +339,8 @@ class Scanner(object):
if do_it:
for func in functions:
logging.debug("\tRunning function: %s", func)
- rdata = func(**dynamic_data)
- if rdata.get('continue', False):
+ _continue = func(**self.set_func_kwargs(mod, dynamic_data))
+ if _continue:
# If we can't access all the metadata then it's totally unsafe to
# commit since there's no way to generate a correct Manifest.
# Do not try to do any more QA checks on this package since missing
@@ -323,9 +349,6 @@ class Scanner(object):
y_ebuild_continue = True
# logging.debug("\t>>> Continuing")
break
- # logging.debug("rdata: %s", rdata)
- dynamic_data.update(rdata)
- # logging.debug("dynamic_data: %s", dynamic_data)
if y_ebuild_continue:
continue
@@ -347,14 +370,11 @@ class Scanner(object):
if do_it:
for func in functions:
logging.debug("\tRunning function: %s", func)
- rdata = func(**dynamic_data)
- if rdata.get('continue', False):
+ _continue = func(**self.set_func_kwargs(mod, dynamic_data))
+ if _continue:
xpkg_complete = True
# logging.debug("\t>>> Continuing")
break
- # logging.debug("rdata: %s", rdata)
- dynamic_data.update(rdata)
- # logging.debug("dynamic_data: %s", dynamic_data)
if xpkg_complete:
return
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/repoman/modules/scan/arches/, pym/repoman/modules/scan/, ...
2016-04-25 15:32 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/depend/, pym/repoman/modules/scan/arches/, Brian Dolbec
@ 2016-04-29 17:24 ` Brian Dolbec
0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2016-04-29 17:24 UTC (permalink / raw
To: gentoo-commits
commit: aea571e7b772f4c1cf23399dc6e685a123d6982f
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 18 07:25:17 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 15:28:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=aea571e7
WIP: repoman: convert all modules to the new data transfer system
Use Future instances for all non-pointer type variables modified by the modules.
Create set_result_pass() and set_result_raise() in ScanBase to reduce code duplication.
Create a get_result() in ScanBase which returns either a result or an unset_value rather
than raise an InvalidStateError.
pym/repoman/modules/scan/arches/arches.py | 7 +++-
pym/repoman/modules/scan/depend/__init__.py | 8 ++--
pym/repoman/modules/scan/depend/depend.py | 19 ++++++---
pym/repoman/modules/scan/depend/unknown.py | 10 ++---
pym/repoman/modules/scan/directories/files.py | 2 +-
pym/repoman/modules/scan/directories/mtime.py | 6 +--
pym/repoman/modules/scan/eapi/eapi.py | 4 +-
pym/repoman/modules/scan/ebuild/__init__.py | 2 +-
pym/repoman/modules/scan/ebuild/ebuild.py | 31 +++++++++------
pym/repoman/modules/scan/ebuild/isebuild.py | 28 +++++--------
pym/repoman/modules/scan/ebuild/multicheck.py | 4 +-
pym/repoman/modules/scan/eclasses/live.py | 16 ++++----
pym/repoman/modules/scan/eclasses/ruby.py | 6 +--
pym/repoman/modules/scan/fetch/fetches.py | 4 +-
pym/repoman/modules/scan/keywords/keywords.py | 8 ++--
pym/repoman/modules/scan/manifest/manifests.py | 6 +--
pym/repoman/modules/scan/metadata/__init__.py | 2 +-
pym/repoman/modules/scan/metadata/description.py | 6 +--
.../modules/scan/metadata/ebuild_metadata.py | 16 ++++----
pym/repoman/modules/scan/metadata/license.py | 6 +--
pym/repoman/modules/scan/metadata/pkgmetadata.py | 12 +++++-
pym/repoman/modules/scan/metadata/restrict.py | 4 +-
pym/repoman/modules/scan/metadata/unused.py | 9 ++---
.../modules/scan/mirrors/thirdpartymirrors.py | 8 ++--
pym/repoman/modules/scan/options/options.py | 4 +-
pym/repoman/modules/scan/scanbase.py | 38 +++++++++++++++++-
pym/repoman/modules/scan/status/vcsstatus.py | 6 ++-
pym/repoman/modules/scan/use/use_flags.py | 15 ++++---
pym/repoman/scanner.py | 46 ++++++++++++++++------
29 files changed, 207 insertions(+), 126 deletions(-)
diff --git a/pym/repoman/modules/scan/arches/arches.py b/pym/repoman/modules/scan/arches/arches.py
index 90ec04d..8bc7a24 100644
--- a/pym/repoman/modules/scan/arches/arches.py
+++ b/pym/repoman/modules/scan/arches/arches.py
@@ -23,7 +23,7 @@ class ArchChecks(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary, including arches set
'''
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
if self.options.ignore_arches:
arches = [[
self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],
@@ -67,7 +67,10 @@ class ArchChecks(ScanBase):
# Use an empty profile for checking dependencies of
# packages that have empty KEYWORDS.
arches.add(('**', '**', ('**',)))
- return {'continue': False, 'arches': arches}
+ # update the dynamic data
+ dyn_arches = kwargs.get('arches')
+ dyn_arches.update(arches)
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index a2b8534..735604d 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -21,7 +21,7 @@ module_spec = {
'mod_kwargs': ['qatracker', 'portdb'
],
'func_kwargs': {'ebuild': None, 'pkg': None, 'unknown_pkgs': 'set',
- 'type_list': [], 'badlicsyntax': 'Future',
+ 'type_list': 'list', 'badlicsyntax': 'Future',
'baddepsyntax': 'Future',
},
},
@@ -37,8 +37,8 @@ module_spec = {
'repo_settings', 'include_arches', 'caches',
'repoman_incrementals', 'env', 'have', 'dev_keywords'
],
- 'func_kwargs': {'arches': 'set', 'ebuild': None, 'pkg': None,
- 'unknown_pkgs': 'set', 'baddepsyntax': 'Future',
+ 'func_kwargs': {'arches': None, 'ebuild': None, 'pkg': None,
+ 'unknown_pkgs': None, 'baddepsyntax': None,
},
},
'unknown-module': {
@@ -52,7 +52,7 @@ module_spec = {
'mod_kwargs': ['qatracker',
],
'func_kwargs': {'ebuild': None, 'unknown_pkgs': 'set',
- 'baddepsyntax': 'Future',
+ 'baddepsyntax': None,
},
},
}
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index eaafc95..0efe5de 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -26,11 +26,10 @@ class DependChecks(ScanBase):
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
- @returns: dictionary including {unknown_pkgs, type_list,
- badlicsyntax, baddepsyntax}
+ @returns: boolean
'''
- ebuild = kwargs.get('ebuild')
- pkg = kwargs.get('pkg')
+ ebuild = kwargs.get('ebuild').result()
+ pkg = kwargs.get('pkg').result()
unknown_pkgs = set()
@@ -144,8 +143,16 @@ class DependChecks(ScanBase):
badlicsyntax = badlicsyntax > 0
#badprovsyntax = badprovsyntax > 0
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
- 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
+ # update the dynamic data
+ dyn_unknown = kwargs.get('unknown_pkgs')
+ dyn_unknown.update(unknown_pkgs)
+ dyn_type_list = kwargs.get('type_list')
+ dyn_type_list.extend(type_list)
+ self.set_result_pass([
+ (kwargs.get('badlicsyntax'), badlicsyntax),
+ (kwargs.get('baddepsyntax'), baddepsyntax),
+ ])
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
index 3aa7c79..9e8f7f8 100644
--- a/pym/repoman/modules/scan/depend/unknown.py
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -16,13 +16,13 @@ class DependUnknown(ScanBase):
def check(self, **kwargs):
'''Perform unknown dependancy checks
- @param ebuild: Ebuild which we check (object).
- @param baddepsyntax: boolean
+ @param ebuild: Future.result == Ebuild which we check (object).
+ @param baddepsyntax: Future.result == boolean
@param unknown_pkgs: set of tuples (type, atom.unevaluated_atom)
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
- baddepsyntax = kwargs.get('baddepsyntax')
+ ebuild = kwargs.get('ebuild').result()
+ baddepsyntax = self.get_result(kwargs.get('baddepsyntax'), False)
unknown_pkgs = kwargs.get('unknown_pkgs')
if not baddepsyntax and unknown_pkgs:
@@ -33,7 +33,7 @@ class DependUnknown(ScanBase):
self.qatracker.add_error(
"dependency.unknown", "%s: %s: %s"
% (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
- return {'continue': False}
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/directories/files.py b/pym/repoman/modules/scan/directories/files.py
index a394658..94a0791 100644
--- a/pym/repoman/modules/scan/directories/files.py
+++ b/pym/repoman/modules/scan/directories/files.py
@@ -86,7 +86,7 @@ class FileChecks(ScanBase):
finally:
if f is not None:
f.close()
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py
index 56a7f05..6c667df 100644
--- a/pym/repoman/modules/scan/directories/mtime.py
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -15,14 +15,14 @@ class MtimeChecks(ScanBase):
@param changed: dictionary instance
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
changed = kwargs.get('changed')
- pkg = kwargs.get('pkg')
+ pkg = kwargs.get('pkg').result()
if not self.vcs_settings.vcs_preserves_mtime:
if ebuild.ebuild_path not in changed.new_ebuilds and \
ebuild.ebuild_path not in changed.ebuilds:
pkg.mtime = None
- return {'continue': False}
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/eapi/eapi.py b/pym/repoman/modules/scan/eapi/eapi.py
index fad1c18..18bab3d 100644
--- a/pym/repoman/modules/scan/eapi/eapi.py
+++ b/pym/repoman/modules/scan/eapi/eapi.py
@@ -23,11 +23,11 @@ class EAPIChecks(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
if not self._checkBanned(ebuild):
self._checkDeprecated(ebuild)
- return {'continue': False}
+ return False
def _checkBanned(self, ebuild):
if self.repo_settings.repo_config.eapi_is_banned(ebuild.eapi):
diff --git a/pym/repoman/modules/scan/ebuild/__init__.py b/pym/repoman/modules/scan/ebuild/__init__.py
index eb9098c..ea21ece 100644
--- a/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/pym/repoman/modules/scan/ebuild/__init__.py
@@ -21,7 +21,7 @@ module_spec = {
'mod_kwargs': ['portdb', 'qatracker', 'repo_settings'
],
'func_kwargs': {'checkdirlist': 'list', 'checkdir': None, 'xpkg': None,
- 'validity_fuse': None, 'can_force': 'Future', 'pkgs': 'dict',
+ 'validity_fuse': None, 'can_force': None, 'pkgs': 'dict',
},
},
'ebuild-module': {
diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py b/pym/repoman/modules/scan/ebuild/ebuild.py
index 67eee3f..b015985 100644
--- a/pym/repoman/modules/scan/ebuild/ebuild.py
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py
@@ -8,7 +8,6 @@ from repoman.modules.scan.scanbase import ScanBase
# import our initialized portage instance
from repoman._portage import portage
from portage import os
-from portage.util.futures import InvalidStateError
pv_toolong_re = re.compile(r'[0-9]{19,}')
@@ -86,7 +85,9 @@ class Ebuild(ScanBase):
# ebuild not added to vcs
self.qatracker.add_error(
"ebuild.notadded", self.xpkg + "/" + self.y_ebuild + ".ebuild")
- return {'continue': False, 'ebuild': self}
+ # update the dynamic data
+ self.set_result_raise([('ebuild', self)])
+ return False
def set_pkg_data(self, **kwargs):
'''Sets some classwide data needed for some of the checks
@@ -100,7 +101,7 @@ class Ebuild(ScanBase):
self.inherited = self.pkg.inherited
self.keywords = self.metadata["KEYWORDS"].split()
self.archs = set(kw.lstrip("~") for kw in self.keywords if not kw.startswith("-"))
- return {'continue': False}
+ return False
def bad_split_check(self, **kwargs):
'''Checks for bad category/package splits.
@@ -117,13 +118,13 @@ class Ebuild(ScanBase):
if is_pv_toolong or is_pv_toolong2:
self.qatracker.add_error(
"ebuild.invalidname", self.xpkg + "/" + self.y_ebuild + ".ebuild")
- return {'continue': True}
+ return True
elif myesplit[0] != pkgdir:
print(pkgdir, myesplit[0])
self.qatracker.add_error(
"ebuild.namenomatch", self.xpkg + "/" + self.y_ebuild + ".ebuild")
- return {'continue': True}
- return {'continue': False}
+ return True
+ return False
def pkg_invalid(self, **kwargs):
'''Sets some pkg info and checks for invalid packages
@@ -136,12 +137,18 @@ class Ebuild(ScanBase):
for k, msgs in self.pkg.invalid.items():
for msg in msgs:
self.qatracker.add_error(k, "%s: %s" % (self.relative_path, msg))
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
- return {'continue': True, 'pkg': self.pkg}
- return {'continue': False, 'pkg': self.pkg}
+ # update the dynamic data
+ self.set_result_pass([
+ (fuse, False),])
+ self.set_result_raise([
+ (kwargs.get('pkg'), self.pkg),
+ ])
+ return True
+ # update the dynamic data
+ self.set_result_raise([
+ (kwargs.get('pkg'), self.pkg),
+ ])
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/ebuild/isebuild.py b/pym/repoman/modules/scan/ebuild/isebuild.py
index a8870c7..3e288a3 100644
--- a/pym/repoman/modules/scan/ebuild/isebuild.py
+++ b/pym/repoman/modules/scan/ebuild/isebuild.py
@@ -9,7 +9,6 @@ from _emerge.RootConfig import RootConfig
from repoman._portage import portage
from portage import os
-from portage.util.futures import InvalidStateError
from repoman.qa_data import no_exec, allvars
from repoman.modules.scan.scanbase import ScanBase
@@ -65,24 +64,15 @@ class IsEbuild(ScanBase):
try:
myaux = dict(zip(allvars, self.portdb.aux_get(cpv, allvars)))
except KeyError:
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
+ self.set_result_pass([(fuse, False)])
self.qatracker.add_error("ebuild.syntax", os.path.join(xpkg, y))
continue
except IOError:
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
+ self.set_result_pass([(fuse, False)])
self.qatracker.add_error("ebuild.output", os.path.join(xpkg, y))
continue
if not portage.eapi_is_supported(myaux["EAPI"]):
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
+ self.set_result_pass([(fuse, False)])
self.qatracker.add_error("EAPI.unsupported", os.path.join(xpkg, y))
continue
pkgs[pf] = Package(
@@ -96,12 +86,12 @@ class IsEbuild(ScanBase):
# metadata leads to false positives for several checks, and false
# positives confuse users.
self.continue_ = True
- try:
- fuse.set_result(False)
- except InvalidStateError:
- pass
-
- return {'continue': self.continue_, 'pkgs': pkgs}
+ self.set_result_pass([(can_force, False)])
+ # set our updated data
+ self.set_result_raise([
+ (kwargs.get('pkgs'), pkgs),
+ ])
+ return self.continue_
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/ebuild/multicheck.py b/pym/repoman/modules/scan/ebuild/multicheck.py
index 1d68227..ed7556d 100644
--- a/pym/repoman/modules/scan/ebuild/multicheck.py
+++ b/pym/repoman/modules/scan/ebuild/multicheck.py
@@ -31,8 +31,8 @@ class MultiCheck(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
- pkg = kwargs.get('pkg')
+ ebuild = kwargs.get('ebuild').result()
+ pkg = kwargs.get('pkg').result()
try:
# All ebuilds should have utf_8 encoding.
f = io.open(
diff --git a/pym/repoman/modules/scan/eclasses/live.py b/pym/repoman/modules/scan/eclasses/live.py
index 81953af..e5bb7dc 100644
--- a/pym/repoman/modules/scan/eclasses/live.py
+++ b/pym/repoman/modules/scan/eclasses/live.py
@@ -25,9 +25,11 @@ class LiveEclassChecks(ScanBase):
@returns: dictionary, including {live_ebuild}
'''
- return {'continue': False,
- 'live_ebuild': LIVE_ECLASSES.intersection(
- kwargs.get('ebuild').inherited)}
+ # update the dynamic data
+ dyn_live = kwargs.get('live_ebuild')
+ dyn_live.update(LIVE_ECLASSES.intersection(
+ kwargs.get('ebuild').inherited))
+ return False
def check(self, **kwargs):
'''Ebuilds that inherit a "Live" eclass (darcs, subversion, git, cvs,
@@ -41,15 +43,15 @@ class LiveEclassChecks(ScanBase):
@param global_pmaskdict: A global dictionary of all the masks.
@returns: dictionary
'''
- pkg = kwargs.get("pkg")
+ pkg = kwargs.get("pkg").result()
package = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
keywords = ebuild.keywords
if not (kwargs.get('live_ebuild') and
self.repo_settings.repo_config.name == "gentoo"):
- return {'continue': False}
+ return False
is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-")
bad_stable_keywords = list(filter(is_stable, keywords))
@@ -62,7 +64,7 @@ class LiveEclassChecks(ScanBase):
good_keywords_exist = len(bad_stable_keywords) < len(keywords)
if good_keywords_exist and not self._has_global_mask(pkg, self.pmaskdict):
self.qatracker.add_error("LIVEVCS.unmasked", ebuild.relative_path)
- return {'continue': False}
+ return False
@staticmethod
def _has_global_mask(pkg, global_pmaskdict):
diff --git a/pym/repoman/modules/scan/eclasses/ruby.py b/pym/repoman/modules/scan/eclasses/ruby.py
index aa2232a..92b9649 100644
--- a/pym/repoman/modules/scan/eclasses/ruby.py
+++ b/pym/repoman/modules/scan/eclasses/ruby.py
@@ -25,8 +25,8 @@ class RubyEclassChecks(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary
'''
- pkg = kwargs.get('pkg')
- ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg').result()
+ ebuild = kwargs.get('ebuild').result()
is_inherited = lambda eclass: eclass in pkg.inherited
is_old_ruby_eclass_inherited = filter(
is_inherited, self.old_ruby_eclasses)
@@ -40,7 +40,7 @@ class RubyEclassChecks(ScanBase):
"IUSE.rubydeprecated",
(ebuild.relative_path + ": Deprecated ruby target: %s")
% myruby)
- return {'continue': False}
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/fetch/fetches.py b/pym/repoman/modules/scan/fetch/fetches.py
index 6bdcf23..f6adece 100644
--- a/pym/repoman/modules/scan/fetch/fetches.py
+++ b/pym/repoman/modules/scan/fetch/fetches.py
@@ -130,7 +130,9 @@ class FetchChecks(ScanBase):
self.qatracker.add_error(
"file.name",
"%s/files/%s: char '%s'" % (checkdir, y, y[index]))
- return {'continue': False, 'src_uri_error': self._src_uri_error}
+ # update the dynamic data
+ self.set_result_pass([(kwargs.get('src_uri_error'), self._src_uri_error)])
+ return False
def digests(self, checkdir):
'''Returns the freshly loaded digests
diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index 196feb4..ec48bb6 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -26,7 +26,7 @@ class KeywordChecks(ScanBase):
def prepare(self, **kwargs):
'''Prepare the checks for the next package.'''
self.slot_keywords = {}
- return {'continue': False}
+ return False
def check(self, **kwargs):
'''Perform the check.
@@ -40,9 +40,9 @@ class KeywordChecks(ScanBase):
@param live_ebuild: A boolean that determines if this is a live ebuild.
@returns: dictionary
'''
- pkg = kwargs.get('pkg')
+ pkg = kwargs.get('pkg').result()
xpkg =kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
changed = kwargs.get('changed')
live_ebuild = kwargs.get('live_ebuild')
@@ -57,7 +57,7 @@ class KeywordChecks(ScanBase):
self._checkForMaskLikeKeywords(xpkg, y_ebuild, ebuild.keywords)
self.slot_keywords[pkg.slot].update(ebuild.archs)
- return {'continue': False}
+ return False
@staticmethod
def _isKeywordStable(keyword):
diff --git a/pym/repoman/modules/scan/manifest/manifests.py b/pym/repoman/modules/scan/manifest/manifests.py
index 6f44f8d..2b8d7af 100644
--- a/pym/repoman/modules/scan/manifest/manifests.py
+++ b/pym/repoman/modules/scan/manifest/manifests.py
@@ -88,14 +88,14 @@ class Manifests(ScanBase):
portage.writemsg_stdout(
" %s::%s\n" % (pf, distfile))
# continue, skip remaining main loop code
- return {'continue': True}
+ return True
elif failed:
sys.exit(1)
if not self.generated_manifest:
self.digest_check(xpkg, checkdir)
if self.options.mode == 'manifest-check':
- return {'continue': True}
- return {'continue': False}
+ return True
+ return False
def create_manifest(self, checkdir, fetchlist_dict):
'''Creates a Manifest file
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 1e690bf..af9771b 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -21,7 +21,7 @@ module_spec = {
'mod_kwargs': ['repo_settings', 'qatracker', 'options', 'metadata_dtd',
],
'func_kwargs': {'xpkg': None, 'checkdir': None, 'checkdirlist': None,
- 'repolevel': None, 'muselist': 'set',
+ 'repolevel': None, 'muselist': 'Future',
},
},
'ebuild-metadata': {
diff --git a/pym/repoman/modules/scan/metadata/description.py b/pym/repoman/modules/scan/metadata/description.py
index 8059888..8bce8d8 100644
--- a/pym/repoman/modules/scan/metadata/description.py
+++ b/pym/repoman/modules/scan/metadata/description.py
@@ -21,8 +21,8 @@ class DescriptionChecks(ScanBase):
@param pkg: Package in which we check (object).
@param ebuild: Ebuild which we check (object).
'''
- ebuild = kwargs.get('ebuild')
- pkg = kwargs.get('pkg')
+ ebuild = kwargs.get('ebuild').result()
+ pkg = kwargs.get('pkg').result()
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
@@ -30,7 +30,7 @@ class DescriptionChecks(ScanBase):
"%s: DESCRIPTION is %d characters (max %d)" %
(ebuild.relative_path, len(
pkg._metadata['DESCRIPTION']), max_desc_len))
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index ca748de..38b13d5 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -20,7 +20,7 @@ class EbuildMetadata(ScanBase):
self.qatracker = kwargs.get('qatracker')
def invalidchar(self, **kwargs):
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
continue
@@ -31,10 +31,10 @@ class EbuildMetadata(ScanBase):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
- return {'continue': False}
+ return False
def missing(self, **kwargs):
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
for pos, missing_var in enumerate(missingvars):
if not ebuild.metadata.get(missing_var):
if kwargs.get('catdir') == "virtual" and \
@@ -45,22 +45,22 @@ class EbuildMetadata(ScanBase):
myqakey = missingvars[pos] + ".missing"
self.qatracker.add_error(myqakey, '%s/%s.ebuild'
% (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
- return {'continue': False}
+ return False
def old_virtual(self, **kwargs):
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
- return {'continue': False}
+ return False
def virtual(self, **kwargs):
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
if kwargs.get('catdir') == "virtual":
for var in ("HOMEPAGE", "LICENSE"):
if ebuild.metadata.get(var):
myqakey = var + ".virtual"
self.qatracker.add_error(myqakey, ebuild.relative_path)
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/license.py b/pym/repoman/modules/scan/metadata/license.py
index cccc998..b08834a 100644
--- a/pym/repoman/modules/scan/metadata/license.py
+++ b/pym/repoman/modules/scan/metadata/license.py
@@ -26,9 +26,9 @@ class LicenseChecks(ScanBase):
@param y_ebuild: Ebuild which we check (string).
'''
xpkg = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
- if not kwargs.get('badlicsyntax'):
+ if not self.get_result(kwargs.get('badlicsyntax'), False):
# Parse the LICENSE variable, remove USE conditions and flatten it.
licenses = portage.dep.use_reduce(
ebuild.metadata["LICENSE"], matchall=1, flat=True)
@@ -43,7 +43,7 @@ class LicenseChecks(ScanBase):
elif lic in self.repo_metadata['lic_deprecated']:
self.qatracker.add_error("LICENSE.deprecated",
"%s: %s" % (ebuild.relative_path, lic))
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 030cbca..242c923 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -73,7 +73,11 @@ class PkgMetadata(ScanBase):
self.musedict = {}
if self.options.mode in ['manifest']:
- return {'continue': False, 'muselist': frozenset(self.musedict)}
+ # update the dynamic data
+ self.set_result_raise([
+ (kwargs.get('muselist'), frozenset(self.musedict))
+ ])
+ return False
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
@@ -184,7 +188,11 @@ class PkgMetadata(ScanBase):
if not self.xmllint.check(checkdir, repolevel):
self.qatracker.add_error("metadata.bad", xpkg + "/metadata.xml")
del metadata_bad
- return {'continue': False, 'muselist': frozenset(self.musedict)}
+ # update the dynamic data
+ self.set_result_raise([
+ (kwargs.get('muselist'), frozenset(self.musedict))
+ ])
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/restrict.py b/pym/repoman/modules/scan/metadata/restrict.py
index 25bf56e..044cc2a 100644
--- a/pym/repoman/modules/scan/metadata/restrict.py
+++ b/pym/repoman/modules/scan/metadata/restrict.py
@@ -21,7 +21,7 @@ class RestrictChecks(ScanBase):
def check(self, **kwargs):
xpkg = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
myrestrict = None
@@ -41,7 +41,7 @@ class RestrictChecks(ScanBase):
for mybad in mybadrestrict:
self.qatracker.add_error("RESTRICT.invalid",
"%s/%s.ebuild: %s" % (xpkg, y_ebuild, mybad))
- return {'continue': False}
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
index a6ff589..0184d78 100644
--- a/pym/repoman/modules/scan/metadata/unused.py
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -23,12 +23,9 @@ class UnusedCheck(ScanBase):
@param validity_future: Future instance
'''
xpkg = kwargs.get('xpkg')
- muselist = kwargs.get('muselist')
+ muselist = kwargs.get('muselist').result()
used_useflags = kwargs.get('used_useflags')
- try:
- valid_state = kwargs['validity_future'].result()
- except InvalidStateError:
- valid_state = True
+ valid_state = self.get_result(kwargs['validity_future'], True)
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if valid_state:
@@ -37,7 +34,7 @@ class UnusedCheck(ScanBase):
"metadata.warning",
"%s/metadata.xml: unused local USE-description: '%s'"
% (xpkg, myflag))
- return {'continue': False}
+ return False
@property
def runInFinal(self):
diff --git a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
index f467ea4..8e3d250 100644
--- a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
+++ b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
@@ -33,9 +33,9 @@ class ThirdPartyMirrors(ScanBase):
@param src_uri_error: boolean
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild')
- if kwargs.get('src_uri_error'):
- return {'continue': True}
+ ebuild = kwargs.get('ebuild').result()
+ if self.get_result(kwargs.get('src_uri_error'), False):
+ return True
for uri in portage.dep.use_reduce(
ebuild.metadata["SRC_URI"], matchall=True, is_src_uri=True,
eapi=ebuild.eapi, flat=True):
@@ -52,7 +52,7 @@ class ThirdPartyMirrors(ScanBase):
"SRC_URI.mirror",
"%s: '%s' found in thirdpartymirrors, use '%s'" % (
ebuild.relative_path, mirror, new_uri))
- return {'continue': False}
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/options/options.py b/pym/repoman/modules/scan/options/options.py
index 2fabdba..443f01b 100644
--- a/pym/repoman/modules/scan/options/options.py
+++ b/pym/repoman/modules/scan/options/options.py
@@ -20,8 +20,8 @@ class Options(ScanBase):
# The dep_check() calls are the most expensive QA test. If --force
# is enabled, there's no point in wasting time on these since the
# user is intent on forcing the commit anyway.
- return {'continue': True}
- return {'continue': False}
+ return True
+ return False
@property
def runInEbuilds(self):
diff --git a/pym/repoman/modules/scan/scanbase.py b/pym/repoman/modules/scan/scanbase.py
index 9821c57..740092e 100644
--- a/pym/repoman/modules/scan/scanbase.py
+++ b/pym/repoman/modules/scan/scanbase.py
@@ -1,5 +1,7 @@
# -*- coding:utf-8 -*-
+from portage.util.futures import InvalidStateError
+
class ScanBase(object):
'''Skeleton class for performing a scan for one or more items
@@ -30,9 +32,43 @@ class ScanBase(object):
# The continue attribute will default to False if not returned.
# This will allow the loop to continue with the next check in the list.
# Include any additional dynamic data that needs to be added or updated.
- return {'continue': False}
+ return False # used as a continue True/False value
"""
+ @staticmethod
+ def set_result_pass(items):
+ '''Set Future instance results, pass on InvalidStateError
+
+ @param items: iterable of key, value tuples
+ '''
+ for key, value in items:
+ try:
+ key.set_result(value)
+ except InvalidStateError:
+ pass
+
+ @staticmethod
+ def set_result_raise(items):
+ '''Set Future instance results, raises an exception on InvalidStateError
+
+ @param items: iterable of key, value tuples
+ '''
+ for key, value in items:
+ key.set_result(value)
+
+ def get_result(self, future, unset_value=None):
+ '''Returns a Future result, or the unset value passed in
+
+ @param future: The Future instance being queried
+ @param unset_value:
+ @returns: Future result
+ '''
+ try:
+ result = future.result()
+ except InvalidStateError:
+ result = unset_value
+ return result
+
@property
def runInPkgs(self):
'''Package level scans'''
diff --git a/pym/repoman/modules/scan/status/vcsstatus.py b/pym/repoman/modules/scan/status/vcsstatus.py
index cf2298e..cadc5c0 100644
--- a/pym/repoman/modules/scan/status/vcsstatus.py
+++ b/pym/repoman/modules/scan/status/vcsstatus.py
@@ -31,7 +31,11 @@ class VCSStatus(ScanBase):
xpkg = kwargs.get('xpkg')
if self.check_not_added:
self.vcs_settings.status.check(checkdir, checkdir_relative, xpkg)
- return {'continue': False, 'eadded': self.vcs_settings.status.eadded}
+ # update the dynamic data
+ self.set_result_pass([
+ (kwargs.get('eadded'), self.vcs_settings.status.eadded),
+ ])
+ return False
@property
def runInPkgs(self):
diff --git a/pym/repoman/modules/scan/use/use_flags.py b/pym/repoman/modules/scan/use/use_flags.py
index b76ed70..70f7583 100644
--- a/pym/repoman/modules/scan/use/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -38,11 +38,11 @@ class USEFlagChecks(ScanBase):
@param muselist: Local USE flags of the package
@returns: dictionary, including {ebuild_UsedUseFlags, used_useflags}
'''
- pkg = kwargs.get('pkg')
+ pkg = kwargs.get('pkg').result()
package = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild')
+ ebuild = kwargs.get('ebuild').result()
y_ebuild = kwargs.get('y_ebuild')
- localUseFlags = kwargs.get('muselist')
+ localUseFlags = kwargs.get('muselist').result()
# reset state variables for the run
self.useFlags = []
self.defaultUseFlags = []
@@ -50,9 +50,14 @@ class USEFlagChecks(ScanBase):
self._checkGlobal(pkg)
self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
self._checkRequiredUSE(pkg, ebuild)
+ # update the dynamic data
used_useflags = kwargs.get('used_useflags').union(self.usedUseFlags)
- return {'continue': False, 'ebuild_UsedUseFlags': self.usedUseFlags,
- 'used_useflags': used_useflags}
+ dyn_ebuild_used = kwargs.get('ebuild_UsedUseFlags')
+ dyn_ebuild_used.update(self.usedUseFlags)
+ dyn_used = kwargs.get('used_useflags')
+ dyn_used.update(used_useflags)
+ return False
+
def _checkGlobal(self, pkg):
for myflag in pkg._metadata["IUSE"].split():
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 5ac519e..3d2c69c 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -28,6 +28,8 @@ MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
# initial development debug info
logging.debug("module_names: %s", MODULE_NAMES)
+DATA_TYPES = {'dict': dict, 'Future': Future, 'list': list, 'set': set}
+
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -177,6 +179,9 @@ class Scanner(object):
chain(self.changed.changed, self.changed.new, self.changed.removed),
self.repolevel, self.reposplit, self.categories))
+ self.pkgs = None
+ self.eadded = False
+
# Create our kwargs dict here to initialize the plugins with
self.kwargs = {
"repo_settings": self.repo_settings,
@@ -215,6 +220,28 @@ class Scanner(object):
kwargs[key] = self.kwargs[key]
return kwargs
+ @staticmethod
+ def set_func_kwargs(mod, dynamic_data=None):
+ '''Updates the dynamic_data dictionary with any new key, value pairs.
+ Creates a limited set of kwargs to pass to the modulefunctions to run
+
+ @param mod: module name string
+ @param dynamic_data: dictionary structure
+ @returns: dictionary
+ '''
+ func_kwargs = MODULE_CONTROLLER.modules[mod]['func_kwargs']
+ # determine new keys
+ required = set(func_kwargs.viewkeys())
+ exist = set(dynamic_data.viewkeys())
+ new = exist.difference(required)
+ # update dynamic_data with initialized entries
+ for key in new:
+ dynamic_data[key] = DATA_TYPES[func_kwargs['key']]()
+ kwargs = {}
+ for key in required:
+ kwargs[key] = dynamic_data[key]
+ return kwargs
+
def scan_pkgs(self, can_force):
for xpkg in self.effective_scanlist:
xpkg_continue = False
@@ -252,8 +279,8 @@ class Scanner(object):
do_it, functions = self.modules[mod].runInPkgs
if do_it:
for func in functions:
- rdata = func(**dynamic_data)
- if rdata.get('continue', False):
+ _continue = func(**self.set_func_kwargs(mod, dynamic_data))
+ if _continue:
# If we can't access all the metadata then it's totally unsafe to
# commit since there's no way to generate a correct Manifest.
# Do not try to do any more QA checks on this package since missing
@@ -261,7 +288,6 @@ class Scanner(object):
# positives confuse users.
xpkg_continue = True
break
- dynamic_data.update(rdata)
if xpkg_continue:
continue
@@ -313,8 +339,8 @@ class Scanner(object):
if do_it:
for func in functions:
logging.debug("\tRunning function: %s", func)
- rdata = func(**dynamic_data)
- if rdata.get('continue', False):
+ _continue = func(**self.set_func_kwargs(mod, dynamic_data))
+ if _continue:
# If we can't access all the metadata then it's totally unsafe to
# commit since there's no way to generate a correct Manifest.
# Do not try to do any more QA checks on this package since missing
@@ -323,9 +349,6 @@ class Scanner(object):
y_ebuild_continue = True
# logging.debug("\t>>> Continuing")
break
- # logging.debug("rdata: %s", rdata)
- dynamic_data.update(rdata)
- # logging.debug("dynamic_data: %s", dynamic_data)
if y_ebuild_continue:
continue
@@ -347,14 +370,11 @@ class Scanner(object):
if do_it:
for func in functions:
logging.debug("\tRunning function: %s", func)
- rdata = func(**dynamic_data)
- if rdata.get('continue', False):
+ _continue = func(**self.set_func_kwargs(mod, dynamic_data))
+ if _continue:
xpkg_complete = True
# logging.debug("\t>>> Continuing")
break
- # logging.debug("rdata: %s", rdata)
- dynamic_data.update(rdata)
- # logging.debug("dynamic_data: %s", dynamic_data)
if xpkg_complete:
return
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-29 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-25 15:32 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/depend/, pym/repoman/modules/scan/arches/, Brian Dolbec
2016-04-29 17:24 ` [gentoo-commits] proj/portage:master commit in: pym/repoman/modules/scan/arches/, pym/repoman/modules/scan/, Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox