* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/keywords/, pym/repoman/modules/scan/metadata/, ...
@ 2016-04-25 3:09 Brian Dolbec
0 siblings, 0 replies; only message in thread
From: Brian Dolbec @ 2016-04-25 3:09 UTC (permalink / raw
To: gentoo-commits
commit: d0454110c604d328777f3391854299a449e66f89
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 25 01:15:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 03:05:50 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d0454110
repoman: Convert all pointer type dynamic_data to the new ExtendedFuture class
pym/repoman/main.py | 13 ++---
pym/repoman/modules/scan/arches/__init__.py | 4 +-
pym/repoman/modules/scan/arches/arches.py | 5 +-
pym/repoman/modules/scan/depend/__init__.py | 22 +++++--
pym/repoman/modules/scan/depend/depend.py | 15 +++--
pym/repoman/modules/scan/depend/profile.py | 10 ++--
pym/repoman/modules/scan/depend/unknown.py | 6 +-
pym/repoman/modules/scan/directories/__init__.py | 12 +++-
pym/repoman/modules/scan/directories/files.py | 2 +-
pym/repoman/modules/scan/directories/mtime.py | 4 +-
pym/repoman/modules/scan/eapi/__init__.py | 3 +-
pym/repoman/modules/scan/eapi/eapi.py | 2 +-
pym/repoman/modules/scan/ebuild/__init__.py | 29 ++++++---
pym/repoman/modules/scan/ebuild/ebuild.py | 18 +++---
pym/repoman/modules/scan/ebuild/isebuild.py | 17 ++----
pym/repoman/modules/scan/ebuild/multicheck.py | 4 +-
pym/repoman/modules/scan/eclasses/__init__.py | 12 +++-
pym/repoman/modules/scan/eclasses/live.py | 11 ++--
pym/repoman/modules/scan/eclasses/ruby.py | 4 +-
pym/repoman/modules/scan/fetch/__init__.py | 9 ++-
pym/repoman/modules/scan/fetch/fetches.py | 3 +-
pym/repoman/modules/scan/keywords/__init__.py | 9 ++-
pym/repoman/modules/scan/keywords/keywords.py | 6 +-
pym/repoman/modules/scan/manifest/__init__.py | 4 +-
pym/repoman/modules/scan/metadata/__init__.py | 39 +++++++++----
pym/repoman/modules/scan/metadata/description.py | 4 +-
.../modules/scan/metadata/ebuild_metadata.py | 11 ++--
pym/repoman/modules/scan/metadata/license.py | 4 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 12 ++--
pym/repoman/modules/scan/metadata/restrict.py | 2 +-
pym/repoman/modules/scan/metadata/unused.py | 6 +-
pym/repoman/modules/scan/mirrors/__init__.py | 4 +-
.../modules/scan/mirrors/thirdpartymirrors.py | 5 +-
pym/repoman/modules/scan/scanbase.py | 36 ------------
pym/repoman/modules/scan/status/__init__.py | 7 ++-
pym/repoman/modules/scan/status/vcsstatus.py | 5 +-
pym/repoman/modules/scan/use/__init__.py | 10 +++-
pym/repoman/modules/scan/use/use_flags.py | 10 +---
pym/repoman/scanner.py | 68 +++++++++++++++++-----
39 files changed, 255 insertions(+), 192 deletions(-)
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 62c3c2c..2009a44 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -22,8 +22,8 @@ import portage.repository.config
from portage.output import create_color_func, nocolor
from portage.output import ConsoleStyleFile, StyleWriter
from portage.util import formatter
-from portage.util.futures import (
- Future,
+from portage.util.futures.extendedfutures import (
+ ExtendedFuture,
InvalidStateError,
)
@@ -79,7 +79,7 @@ def repoman_main(argv):
# Set this to False when an extraordinary issue (generally
# something other than a QA issue) makes it impossible to
# commit (like if Manifest generation fails).
- can_force = Future()
+ can_force = ExtendedFuture(True)
portdir, portdir_overlay, mydir = utilities.FindPortdir(repoman_settings)
if portdir is None:
@@ -174,14 +174,9 @@ def repoman_main(argv):
qa_output = qa_output.getvalue()
qa_output = qa_output.splitlines(True)
- try:
- can_force = can_force.result()
- except InvalidStateError:
- can_force = True
-
# output the results
actions = Actions(repo_settings, options, scanner, vcs_settings)
- if actions.inform(can_force, result):
+ if actions.inform(can_force.get(), result):
# perform any other actions
actions.perform(qa_output)
diff --git a/pym/repoman/modules/scan/arches/__init__.py b/pym/repoman/modules/scan/arches/__init__.py
index e4a4806..d66be1e 100644
--- a/pym/repoman/modules/scan/arches/__init__.py
+++ b/pym/repoman/modules/scan/arches/__init__.py
@@ -20,7 +20,9 @@ module_spec = {
},
'mod_kwargs': ['options', 'repo_settings', 'profiles'
],
- 'func_kwargs': {'ebuild': None, 'arches': 'set',
+ 'func_kwargs': {
+ 'arches': ('Future', 'set'),
+ 'ebuild': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/arches/arches.py b/pym/repoman/modules/scan/arches/arches.py
index 6e1c17d..b86848d 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').result()
+ ebuild = kwargs.get('ebuild').get()
if self.options.ignore_arches:
arches = [[
self.repo_settings.repoman_settings["ARCH"], self.repo_settings.repoman_settings["ARCH"],
@@ -69,8 +69,7 @@ class ArchChecks(ScanBase):
arches.add(('**', '**', ('**',)))
# update the dynamic data
dyn_arches = kwargs.get('arches')
- dyn_arches.clear()
- dyn_arches.update(arches)
+ dyn_arches.set(arches)
return False
@property
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index cf5b415..27c803d 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -20,8 +20,12 @@ module_spec = {
},
'mod_kwargs': ['qatracker', 'portdb'
],
- 'func_kwargs': {'ebuild': None, 'pkg': None, 'unknown_pkgs': 'set',
- 'badlicsyntax': 'Future', 'baddepsyntax': 'Future',
+ 'func_kwargs': {
+ 'baddepsyntax': ('Future', False),
+ 'badlicsyntax': ('Future', False),
+ 'ebuild': (None, None),
+ 'pkg': (None, None),
+ 'unknown_pkgs': ('Future', 'UNSET'),
},
},
'profile-module': {
@@ -36,8 +40,12 @@ module_spec = {
'repo_settings', 'include_arches', 'caches',
'repoman_incrementals', 'env', 'have', 'dev_keywords'
],
- 'func_kwargs': {'arches': None, 'ebuild': None, 'pkg': None,
- 'unknown_pkgs': None, 'baddepsyntax': None,
+ 'func_kwargs': {
+ 'arches': (None, None),
+ 'baddepsyntax': (None, None),
+ 'ebuild': (None, None),
+ 'pkg': (None, None),
+ 'unknown_pkgs': (None, None),
},
},
'unknown-module': {
@@ -50,8 +58,10 @@ module_spec = {
},
'mod_kwargs': ['qatracker',
],
- 'func_kwargs': {'ebuild': None, 'unknown_pkgs': 'set',
- 'baddepsyntax': None,
+ 'func_kwargs': {
+ 'baddepsyntax': (None, None),
+ 'ebuild': (None, None),
+ 'unknown_pkgs': ('Future', 'UNSET'),
},
},
}
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index cd1fb33..44a21e9 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -28,8 +28,8 @@ class DependChecks(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: boolean
'''
- ebuild = kwargs.get('ebuild').result()
- pkg = kwargs.get('pkg').result()
+ ebuild = kwargs.get('ebuild').get()
+ pkg = kwargs.get('pkg').get()
unknown_pkgs = set()
@@ -145,12 +145,11 @@ class DependChecks(ScanBase):
# update the dynamic data
dyn_unknown = kwargs.get('unknown_pkgs')
- dyn_unknown.clear()
- dyn_unknown.update(unknown_pkgs)
- self.set_result_pass([
- (kwargs.get('badlicsyntax'), badlicsyntax),
- (kwargs.get('baddepsyntax'), baddepsyntax),
- ])
+ dyn_unknown.set(unknown_pkgs)
+ dyn_badlicsyntax = kwargs.get('badlicsyntax')
+ dyn_badlicsyntax.set(badlicsyntax, ignore_InvalidState=True)
+ dyn_baddepsyntax = kwargs.get('baddepsyntax')
+ dyn_baddepsyntax.set(baddepsyntax, ignore_InvalidState=True)
return False
@property
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
index b4ec8ca..8fc7721 100644
--- a/pym/repoman/modules/scan/depend/profile.py
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -56,11 +56,11 @@ class ProfileDependsChecks(ScanBase):
@param unknown_pkgs: set of tuples (type, atom.unevaluated_atom)
@returns: dictionary
'''
- arches = kwargs.get('arches')
- ebuild = kwargs.get('ebuild').result()
- pkg = kwargs.get('pkg').result()
- baddepsyntax = self.get_result(kwargs.get('baddepsyntax'), False)
- unknown_pkgs = kwargs.get('unknown_pkgs')
+ arches = kwargs.get('arches').get()
+ ebuild = kwargs.get('ebuild').get()
+ pkg = kwargs.get('pkg').get()
+ baddepsyntax = kwargs.get('baddepsyntax').get()
+ unknown_pkgs = kwargs.get('unknown_pkgs').get()
relevant_profiles = []
for keyword, arch, groups in arches:
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
index 9e8f7f8..6667d4f 100644
--- a/pym/repoman/modules/scan/depend/unknown.py
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -21,9 +21,9 @@ class DependUnknown(ScanBase):
@param unknown_pkgs: set of tuples (type, atom.unevaluated_atom)
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild').result()
- baddepsyntax = self.get_result(kwargs.get('baddepsyntax'), False)
- unknown_pkgs = kwargs.get('unknown_pkgs')
+ ebuild = kwargs.get('ebuild').get()
+ baddepsyntax = kwargs.get('baddepsyntax').get()
+ unknown_pkgs = kwargs.get('unknown_pkgs').get()
if not baddepsyntax and unknown_pkgs:
type_map = {}
diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index 0193843..47834cb 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -20,8 +20,11 @@ module_spec = {
},
'mod_kwargs': ['portdb', 'qatracker', 'repo_settings', 'vcs_settings',
],
- 'func_kwargs': {'checkdir': None, 'checkdirlist': None,
- 'checkdir_relative': None, 'changed': None,
+ 'func_kwargs': {
+ 'changed': (None, None),
+ 'checkdir': (None, None),
+ 'checkdirlist': (None, None),
+ 'checkdir_relative': (None, None),
},
},
'mtime-module': {
@@ -34,7 +37,10 @@ module_spec = {
},
'mod_kwargs': ['vcs_settings',
],
- 'func_kwargs': {'ebuild': None, 'changed': None, 'pkg': None,
+ 'func_kwargs': {
+ 'changed': (None, None),
+ 'ebuild': (None, None),
+ 'pkg': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/directories/files.py b/pym/repoman/modules/scan/directories/files.py
index 94a0791..2aed264 100644
--- a/pym/repoman/modules/scan/directories/files.py
+++ b/pym/repoman/modules/scan/directories/files.py
@@ -39,7 +39,7 @@ class FileChecks(ScanBase):
@returns: dictionary
'''
checkdir = kwargs.get('checkdir')
- checkdirlist = kwargs.get('checkdirlist')
+ checkdirlist = kwargs.get('checkdirlist').get()
checkdir_relative = kwargs.get('checkdir_relative')
changed = kwargs.get('changed').changed
new = kwargs.get('changed').new
diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py
index 6c667df..134a86b 100644
--- a/pym/repoman/modules/scan/directories/mtime.py
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -15,9 +15,9 @@ class MtimeChecks(ScanBase):
@param changed: dictionary instance
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
changed = kwargs.get('changed')
- pkg = kwargs.get('pkg').result()
+ pkg = kwargs.get('pkg').get()
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:
diff --git a/pym/repoman/modules/scan/eapi/__init__.py b/pym/repoman/modules/scan/eapi/__init__.py
index 376e79a..4c3dd6e 100644
--- a/pym/repoman/modules/scan/eapi/__init__.py
+++ b/pym/repoman/modules/scan/eapi/__init__.py
@@ -20,7 +20,8 @@ module_spec = {
},
'mod_kwargs': ['qatracker', 'repo_settings'
],
- 'func_kwargs': {'ebuild': None,
+ 'func_kwargs': {
+ 'ebuild': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/eapi/eapi.py b/pym/repoman/modules/scan/eapi/eapi.py
index 18bab3d..1d4ad5a 100644
--- a/pym/repoman/modules/scan/eapi/eapi.py
+++ b/pym/repoman/modules/scan/eapi/eapi.py
@@ -23,7 +23,7 @@ class EAPIChecks(ScanBase):
@param ebuild: Ebuild which we check (object).
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
if not self._checkBanned(ebuild):
self._checkDeprecated(ebuild)
diff --git a/pym/repoman/modules/scan/ebuild/__init__.py b/pym/repoman/modules/scan/ebuild/__init__.py
index efb2feb..b243314 100644
--- a/pym/repoman/modules/scan/ebuild/__init__.py
+++ b/pym/repoman/modules/scan/ebuild/__init__.py
@@ -20,8 +20,13 @@ module_spec = {
},
'mod_kwargs': ['portdb', 'qatracker', 'repo_settings'
],
- 'func_kwargs': {'checkdirlist': 'list', 'checkdir': None, 'xpkg': None,
- 'validity_future': 'Future', 'can_force': None, 'pkgs': 'dict',
+ 'func_kwargs': {
+ 'can_force': (None, None),
+ 'checkdir': (None, None),
+ 'checkdirlist': (None, None),
+ 'pkgs': ('Future', 'dict'),
+ 'validity_future': ('Future', True),
+ 'xpkg': (None, None),
},
},
'ebuild-module': {
@@ -34,10 +39,18 @@ module_spec = {
},
'mod_kwargs': ['qatracker', 'repo_settings', 'vcs_settings', 'checks',
],
- 'func_kwargs': {'xpkg': None, 'y_ebuild': None, 'changed': None,
- 'changelog_modified': None, 'pkg': 'Future', 'pkgs': None,
- 'ebuild': 'Future', 'validity_future': None, 'pkgdir': None,
- 'repolevel': None, 'catdir': None,
+ 'func_kwargs': {
+ 'catdir': (None, None),
+ 'changed': (None, None),
+ 'changelog_modified': (None, None),
+ 'ebuild': ('Future', 'UNSET'),
+ 'pkg': ('Future', 'UNSET'),
+ 'pkgdir': (None, None),
+ 'pkgs': (None, None),
+ 'repolevel': (None, None),
+ 'validity_future': (None, None),
+ 'xpkg': (None, None),
+ 'y_ebuild': (None, None),
},
},
'multicheck-module': {
@@ -50,7 +63,9 @@ module_spec = {
},
'mod_kwargs': ['qatracker', 'options'
],
- 'func_kwargs': {'ebuild': None, 'pkg': None,
+ 'func_kwargs': {
+ 'ebuild': (None, None),
+ 'pkg': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py b/pym/repoman/modules/scan/ebuild/ebuild.py
index b02cdcd..92b1ea4 100644
--- a/pym/repoman/modules/scan/ebuild/ebuild.py
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py
@@ -86,7 +86,8 @@ class Ebuild(ScanBase):
self.qatracker.add_error(
"ebuild.notadded", self.xpkg + "/" + self.y_ebuild + ".ebuild")
# update the dynamic data
- self.set_result_raise([(kwargs.get('ebuild'), self)])
+ dyn_ebuild = kwargs.get('ebuild')
+ dyn_ebuild.set(self)
return False
def set_pkg_data(self, **kwargs):
@@ -95,7 +96,8 @@ class Ebuild(ScanBase):
@param pkgs: the dynamic list of ebuilds
@returns: dictionary
'''
- self.pkg = kwargs.get('pkgs')[self.y_ebuild]
+ pkgs = kwargs.get('pkgs').get()
+ self.pkg = pkgs[self.y_ebuild]
self.metadata = self.pkg._metadata
self.eapi = self.metadata["EAPI"]
self.inherited = self.pkg.inherited
@@ -133,21 +135,17 @@ class Ebuild(ScanBase):
@returns: dictionary, including {pkg object}
'''
fuse = kwargs.get('validity_future')
+ dyn_pkg = kwargs.get('pkg')
if self.pkg.invalid:
for k, msgs in self.pkg.invalid.items():
for msg in msgs:
self.qatracker.add_error(k, "%s: %s" % (self.relative_path, msg))
# update the dynamic data
- self.set_result_pass([
- (fuse, False),])
- self.set_result_raise([
- (kwargs.get('pkg'), self.pkg),
- ])
+ fuse.set(False, ignore_InvalidState=True)
+ dyn_pkg.set(self.pkg)
return True
# update the dynamic data
- self.set_result_raise([
- (kwargs.get('pkg'), self.pkg),
- ])
+ dyn_pkg.set(self.pkg)
return False
@property
diff --git a/pym/repoman/modules/scan/ebuild/isebuild.py b/pym/repoman/modules/scan/ebuild/isebuild.py
index 24680e2..7277ad0 100644
--- a/pym/repoman/modules/scan/ebuild/isebuild.py
+++ b/pym/repoman/modules/scan/ebuild/isebuild.py
@@ -39,7 +39,7 @@ class IsEbuild(ScanBase):
@param validity_future: Future instance
@returns: dictionary, including {pkgs, can_force}
'''
- checkdirlist = kwargs.get('checkdirlist')
+ checkdirlist = kwargs.get('checkdirlist').get()
checkdir = kwargs.get('checkdir')
xpkg = kwargs.get('xpkg')
fuse = kwargs.get('validity_future')
@@ -65,15 +65,15 @@ class IsEbuild(ScanBase):
try:
myaux = dict(zip(allvars, self.portdb.aux_get(cpv, allvars)))
except KeyError:
- self.set_result_pass([(fuse, False)])
+ fuse.set(False, ignore_InvalidState=True)
self.qatracker.add_error("ebuild.syntax", os.path.join(xpkg, y))
continue
except IOError:
- self.set_result_pass([(fuse, False)])
+ fuse.set(False, ignore_InvalidState=True)
self.qatracker.add_error("ebuild.output", os.path.join(xpkg, y))
continue
if not portage.eapi_is_supported(myaux["EAPI"]):
- self.set_result_pass([(fuse, False)])
+ fuse.set(False, ignore_InvalidState=True)
self.qatracker.add_error("EAPI.unsupported", os.path.join(xpkg, y))
continue
pkgs[pf] = Package(
@@ -87,15 +87,10 @@ class IsEbuild(ScanBase):
# metadata leads to false positives for several checks, and false
# positives confuse users.
self.continue_ = True
- self.set_result_pass([(can_force, False)])
+ can_force.set(False, ignore_InvalidState=True)
# set our updated data
dyn_pkgs = kwargs.get('pkgs')
- # clear() sets it to None,
- # we don't want to kill the pointer reference
- # just set it back to an empty dict()
- for key in list(dyn_pkgs):
- dyn_pkgs.pop(key)
- dyn_pkgs.update(pkgs)
+ dyn_pkgs.set(pkgs)
return self.continue_
@property
diff --git a/pym/repoman/modules/scan/ebuild/multicheck.py b/pym/repoman/modules/scan/ebuild/multicheck.py
index ed7556d..9e36e2a 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').result()
- pkg = kwargs.get('pkg').result()
+ ebuild = kwargs.get('ebuild').get()
+ pkg = kwargs.get('pkg').get()
try:
# All ebuilds should have utf_8 encoding.
f = io.open(
diff --git a/pym/repoman/modules/scan/eclasses/__init__.py b/pym/repoman/modules/scan/eclasses/__init__.py
index 7be954c..63bb86f 100644
--- a/pym/repoman/modules/scan/eclasses/__init__.py
+++ b/pym/repoman/modules/scan/eclasses/__init__.py
@@ -20,8 +20,12 @@ module_spec = {
},
'mod_kwargs': ['qatracker', 'repo_metadata', 'repo_settings',
],
- 'func_kwargs': {'live_ebuild': 'set', 'pkg': None, 'xpkg': None,
- 'ebuild': None, 'y_ebuild': None,
+ 'func_kwargs': {
+ 'ebuild': (None, None),
+ 'live_ebuild': ('Future', 'UNSET'),
+ 'pkg': (None, None),
+ 'xpkg': (None, None),
+ 'y_ebuild': (None, None),
},
},
'ruby-module': {
@@ -34,7 +38,9 @@ module_spec = {
},
'mod_kwargs': ['qatracker'
],
- 'func_kwargs': {'pkg': None, 'ebuild': None,
+ 'func_kwargs': {
+ 'ebuild': (None, None),
+ 'pkg': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/eclasses/live.py b/pym/repoman/modules/scan/eclasses/live.py
index 85e829c..842cbab 100644
--- a/pym/repoman/modules/scan/eclasses/live.py
+++ b/pym/repoman/modules/scan/eclasses/live.py
@@ -25,11 +25,10 @@ class LiveEclassChecks(ScanBase):
@returns: dictionary, including {live_ebuild}
'''
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
# update the dynamic data
dyn_live = kwargs.get('live_ebuild')
- #dyn_live.clear()
- dyn_live.update(LIVE_ECLASSES.intersection(ebuild.inherited))
+ dyn_live.set(LIVE_ECLASSES.intersection(ebuild.inherited))
return False
def check(self, **kwargs):
@@ -46,12 +45,12 @@ class LiveEclassChecks(ScanBase):
'''
pkg = kwargs.get("pkg").result()
package = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
y_ebuild = kwargs.get('y_ebuild')
keywords = ebuild.keywords
+ live_ebuild = kwargs.get('live_ebuild').get()
- if not (kwargs.get('live_ebuild') and
- self.repo_settings.repo_config.name == "gentoo"):
+ if not live_ebuild and self.repo_settings.repo_config.name == "gentoo":
return False
is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-")
diff --git a/pym/repoman/modules/scan/eclasses/ruby.py b/pym/repoman/modules/scan/eclasses/ruby.py
index 92b9649..b350180 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').result()
- ebuild = kwargs.get('ebuild').result()
+ pkg = kwargs.get('pkg').get()
+ ebuild = kwargs.get('ebuild').get()
is_inherited = lambda eclass: eclass in pkg.inherited
is_old_ruby_eclass_inherited = filter(
is_inherited, self.old_ruby_eclasses)
diff --git a/pym/repoman/modules/scan/fetch/__init__.py b/pym/repoman/modules/scan/fetch/__init__.py
index 795eabf..1228435 100644
--- a/pym/repoman/modules/scan/fetch/__init__.py
+++ b/pym/repoman/modules/scan/fetch/__init__.py
@@ -20,9 +20,12 @@ module_spec = {
},
'mod_kwargs': ['portdb', 'qatracker', 'repo_settings', 'vcs_settings',
],
- 'func_kwargs': {'xpkg': None, 'checkdir': None,
- 'checkdir_relative': None, 'changed': None,
- 'src_uri_error': 'Future',
+ 'func_kwargs': {
+ 'changed': (None, None),
+ 'checkdir': (None, None),
+ 'checkdir_relative': (None, None),
+ 'src_uri_error': ('Future', 'UNSET'),
+ 'xpkg': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/fetch/fetches.py b/pym/repoman/modules/scan/fetch/fetches.py
index f6adece..ddbf6bd 100644
--- a/pym/repoman/modules/scan/fetch/fetches.py
+++ b/pym/repoman/modules/scan/fetch/fetches.py
@@ -131,7 +131,8 @@ class FetchChecks(ScanBase):
"file.name",
"%s/files/%s: char '%s'" % (checkdir, y, y[index]))
# update the dynamic data
- self.set_result_pass([(kwargs.get('src_uri_error'), self._src_uri_error)])
+ dyn_src_uri_error = kwargs.get('src_uri_error')
+ dyn_src_uri_error.set(self._src_uri_error)
return False
def digests(self, checkdir):
diff --git a/pym/repoman/modules/scan/keywords/__init__.py b/pym/repoman/modules/scan/keywords/__init__.py
index 2b3f6ca..1c424ca 100644
--- a/pym/repoman/modules/scan/keywords/__init__.py
+++ b/pym/repoman/modules/scan/keywords/__init__.py
@@ -20,8 +20,13 @@ module_spec = {
},
'mod_kwargs': ['qatracker', 'options', 'repo_metadata', 'profiles',
],
- 'func_kwargs': {'pkg': 'Future', 'xpkg': None, 'ebuild': 'Future',
- 'y_ebuild': None, 'changed': None, 'live_ebuild': 'set',
+ 'func_kwargs': {
+ 'changed': (None, None),
+ 'ebuild': ('Future', 'UNSET'),
+ 'live_ebuild': ('Future', 'UNSET'),
+ 'pkg': ('Future', 'UNSET'),
+ 'xpkg': None,
+ 'y_ebuild': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/keywords/keywords.py b/pym/repoman/modules/scan/keywords/keywords.py
index ec48bb6..af94c6f 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -40,12 +40,12 @@ class KeywordChecks(ScanBase):
@param live_ebuild: A boolean that determines if this is a live ebuild.
@returns: dictionary
'''
- pkg = kwargs.get('pkg').result()
+ pkg = kwargs.get('pkg').get()
xpkg =kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
y_ebuild = kwargs.get('y_ebuild')
changed = kwargs.get('changed')
- live_ebuild = kwargs.get('live_ebuild')
+ live_ebuild = kwargs.get('live_ebuild').get()
if not self.options.straight_to_stable:
self._checkAddedWithStableKeywords(
xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
diff --git a/pym/repoman/modules/scan/manifest/__init__.py b/pym/repoman/modules/scan/manifest/__init__.py
index bd9f8da..dca431b 100644
--- a/pym/repoman/modules/scan/manifest/__init__.py
+++ b/pym/repoman/modules/scan/manifest/__init__.py
@@ -20,7 +20,9 @@ module_spec = {
},
'mod_kwargs': ['options', 'portdb', 'qatracker', 'repo_settings',
],
- 'func_kwargs': {'checkdir': None, 'xpkg': None,
+ 'func_kwargs': {
+ 'checkdir': (None, None),
+ 'xpkg': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 9ccf377..98df9cf 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -20,8 +20,12 @@ module_spec = {
},
'mod_kwargs': ['repo_settings', 'qatracker', 'options', 'metadata_dtd',
],
- 'func_kwargs': {'xpkg': None, 'checkdir': None, 'checkdirlist': None,
- 'repolevel': None, 'muselist': 'Future',
+ 'func_kwargs': {
+ 'checkdir': (None, None),
+ 'checkdirlist': (None, None),
+ 'muselist': ('Future', 'set'),
+ 'repolevel': (None, None),
+ 'xpkg': (None, None),
},
},
'ebuild-metadata': {
@@ -34,8 +38,12 @@ module_spec = {
},
'mod_kwargs': ['qatracker',
],
- 'func_kwargs': {'ebuild': None, 'catdir': None, 'live_ebuild': None,
- 'xpkg': None, 'y_ebuild': None,
+ 'func_kwargs': {
+ 'catdir': (None, None),
+ 'ebuild': (None, None),
+ 'live_ebuild': (None, None),
+ 'xpkg': (None, None),
+ 'y_ebuild': (None, None),
},
},
'description-metadata': {
@@ -48,7 +56,9 @@ module_spec = {
},
'mod_kwargs': ['qatracker',
],
- 'func_kwargs': {'ebuild': None, 'pkg': 'Future',
+ 'func_kwargs': {
+ 'ebuild': (None, None),
+ 'pkg': ('Future', 'UNSET'),
},
},
'license-metadata': {
@@ -61,8 +71,11 @@ module_spec = {
},
'mod_kwargs': ['qatracker', 'repo_metadata',
],
- 'func_kwargs': {'xpkg': None, 'ebuild': None, 'y_ebuild': None,
- 'badlicsyntax': None,
+ 'func_kwargs': {
+ 'badlicsyntax': (None, None),
+ 'ebuild': (None, None),
+ 'xpkg': (None, None),
+ 'y_ebuild': (None, None),
},
},
'restrict-metadata': {
@@ -75,7 +88,10 @@ module_spec = {
},
'mod_kwargs': ['qatracker',
],
- 'func_kwargs': {'xpkg': None, 'ebuild': None, 'y_ebuild': None,
+ 'func_kwargs': {
+ 'ebuild': (None, None),
+ 'xpkg': (None, None),
+ 'y_ebuild': (None, None),
},
},
'unused-metadata': {
@@ -88,8 +104,11 @@ module_spec = {
},
'mod_kwargs': ['qatracker',
],
- 'func_kwargs': {'xpkg': None, 'muselist': None, 'used_useflags': None,
- 'validity_future': None,
+ 'func_kwargs': {
+ 'muselist': (None, None),
+ 'used_useflags': (None, None),
+ 'validity_future': (None, None),
+ 'xpkg': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/metadata/description.py b/pym/repoman/modules/scan/metadata/description.py
index 8bce8d8..79f62e1 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').result()
- pkg = kwargs.get('pkg').result()
+ ebuild = kwargs.get('ebuild').get()
+ pkg = kwargs.get('pkg').get()
# 14 is the length of DESCRIPTION=""
if len(pkg._metadata['DESCRIPTION']) > max_desc_len:
self.qatracker.add_error(
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 38b13d5..e239b47 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').result()
+ ebuild = kwargs.get('ebuild').get()
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
continue
@@ -34,13 +34,14 @@ class EbuildMetadata(ScanBase):
return False
def missing(self, **kwargs):
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
+ live_ebuild = kwargs.get('live_ebuild').get()
for pos, missing_var in enumerate(missingvars):
if not ebuild.metadata.get(missing_var):
if kwargs.get('catdir') == "virtual" and \
missing_var in ("HOMEPAGE", "LICENSE"):
continue
- if kwargs.get('live_ebuild') and missing_var == "KEYWORDS":
+ if live_ebuild and missing_var == "KEYWORDS":
continue
myqakey = missingvars[pos] + ".missing"
self.qatracker.add_error(myqakey, '%s/%s.ebuild'
@@ -48,13 +49,13 @@ class EbuildMetadata(ScanBase):
return False
def old_virtual(self, **kwargs):
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
return False
def virtual(self, **kwargs):
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
if kwargs.get('catdir') == "virtual":
for var in ("HOMEPAGE", "LICENSE"):
if ebuild.metadata.get(var):
diff --git a/pym/repoman/modules/scan/metadata/license.py b/pym/repoman/modules/scan/metadata/license.py
index b08834a..4a67c70 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').result()
+ ebuild = kwargs.get('ebuild').get()
y_ebuild = kwargs.get('y_ebuild')
- if not self.get_result(kwargs.get('badlicsyntax'), False):
+ if not kwargs.get('badlicsyntax').get():
# Parse the LICENSE variable, remove USE conditions and flatten it.
licenses = portage.dep.use_reduce(
ebuild.metadata["LICENSE"], matchall=1, flat=True)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 242c923..9216d77 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -68,15 +68,14 @@ class PkgMetadata(ScanBase):
'''
xpkg = kwargs.get('xpkg')
checkdir = kwargs.get('checkdir')
- checkdirlist = kwargs.get('checkdirlist')
+ checkdirlist = kwargs.get('checkdirlist').get()
repolevel = kwargs.get('repolevel')
self.musedict = {}
if self.options.mode in ['manifest']:
# update the dynamic data
- self.set_result_raise([
- (kwargs.get('muselist'), frozenset(self.musedict))
- ])
+ dyn_muselist = kwargs.get('muselist')
+ dyn_muselist.set(frozenset(self.musedict))
return False
# metadata.xml file check
@@ -189,9 +188,8 @@ class PkgMetadata(ScanBase):
self.qatracker.add_error("metadata.bad", xpkg + "/metadata.xml")
del metadata_bad
# update the dynamic data
- self.set_result_raise([
- (kwargs.get('muselist'), frozenset(self.musedict))
- ])
+ dyn_muselist = kwargs.get('muselist')
+ dyn_muselist.set(frozenset(self.musedict))
return False
@property
diff --git a/pym/repoman/modules/scan/metadata/restrict.py b/pym/repoman/modules/scan/metadata/restrict.py
index 044cc2a..0f9c5e5 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').result()
+ ebuild = kwargs.get('ebuild').get()
y_ebuild = kwargs.get('y_ebuild')
myrestrict = None
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
index fdca418..7733847 100644
--- a/pym/repoman/modules/scan/metadata/unused.py
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -1,8 +1,6 @@
from repoman.modules.scan.scanbase import ScanBase
-from portage.util.futures import InvalidStateError
-
class UnusedCheck(ScanBase):
'''Checks and reports any un-used metadata.xml use flag descriptions'''
@@ -23,9 +21,9 @@ class UnusedCheck(ScanBase):
@param validity_future: Future instance
'''
xpkg = kwargs.get('xpkg')
- muselist = self.get_result(kwargs.get('muselist'), set())
+ muselist = kwargs.get('muselist').get()
used_useflags = kwargs.get('used_useflags')
- valid_state = self.get_result(kwargs['validity_future'], True)
+ valid_state = kwargs.get('validity_future').get()
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if valid_state:
diff --git a/pym/repoman/modules/scan/mirrors/__init__.py b/pym/repoman/modules/scan/mirrors/__init__.py
index 1885dca..94ded6d 100644
--- a/pym/repoman/modules/scan/mirrors/__init__.py
+++ b/pym/repoman/modules/scan/mirrors/__init__.py
@@ -20,7 +20,9 @@ module_spec = {
},
'mod_kwargs': ['repo_settings', 'qatracker',
],
- 'func_kwargs': {'ebuild': None, 'src_uri_error': None,
+ 'func_kwargs': {
+ 'ebuild': (None, None),
+ 'src_uri_error': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
index 8e3d250..9118d59 100644
--- a/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
+++ b/pym/repoman/modules/scan/mirrors/thirdpartymirrors.py
@@ -33,8 +33,9 @@ class ThirdPartyMirrors(ScanBase):
@param src_uri_error: boolean
@returns: dictionary
'''
- ebuild = kwargs.get('ebuild').result()
- if self.get_result(kwargs.get('src_uri_error'), False):
+ ebuild = kwargs.get('ebuild').get()
+ src_uri_error = kwargs.get('src_uri_error').get()
+ if src_uri_error:
return True
for uri in portage.dep.use_reduce(
ebuild.metadata["SRC_URI"], matchall=True, is_src_uri=True,
diff --git a/pym/repoman/modules/scan/scanbase.py b/pym/repoman/modules/scan/scanbase.py
index 740092e..e5160d2 100644
--- a/pym/repoman/modules/scan/scanbase.py
+++ b/pym/repoman/modules/scan/scanbase.py
@@ -1,7 +1,5 @@
# -*- coding:utf-8 -*-
-from portage.util.futures import InvalidStateError
-
class ScanBase(object):
'''Skeleton class for performing a scan for one or more items
@@ -35,40 +33,6 @@ class ScanBase(object):
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/__init__.py b/pym/repoman/modules/scan/status/__init__.py
index f4683bb..5f30639 100644
--- a/pym/repoman/modules/scan/status/__init__.py
+++ b/pym/repoman/modules/scan/status/__init__.py
@@ -20,8 +20,11 @@ module_spec = {
},
'mod_kwargs': ['vcs_settings', 'checks',
],
- 'func_kwargs': {'checkdir': None, 'checkdir_relative': None,
- 'xpkg': None, 'eadded': 'Future',
+ 'func_kwargs': {
+ 'checkdir': (None, None),
+ 'checkdir_relative': (None, None),
+ 'eadded': ('Future', 'UNSET'),
+ 'xpkg': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/status/vcsstatus.py b/pym/repoman/modules/scan/status/vcsstatus.py
index cadc5c0..fd56560 100644
--- a/pym/repoman/modules/scan/status/vcsstatus.py
+++ b/pym/repoman/modules/scan/status/vcsstatus.py
@@ -32,9 +32,8 @@ class VCSStatus(ScanBase):
if self.check_not_added:
self.vcs_settings.status.check(checkdir, checkdir_relative, xpkg)
# update the dynamic data
- self.set_result_pass([
- (kwargs.get('eadded'), self.vcs_settings.status.eadded),
- ])
+ dyn_eadded = kwargs.get('eadded')
+ dyn_eadded.set(self.vcs_settings.status.eadded)
return False
@property
diff --git a/pym/repoman/modules/scan/use/__init__.py b/pym/repoman/modules/scan/use/__init__.py
index f157386..32da5d9 100644
--- a/pym/repoman/modules/scan/use/__init__.py
+++ b/pym/repoman/modules/scan/use/__init__.py
@@ -20,9 +20,13 @@ module_spec = {
},
'mod_kwargs': ['qatracker', 'uselist',
],
- 'func_kwargs': {'pkg': None, 'xpkg': None, 'ebuild': None,
- 'y_ebuild': None, 'muselist': None, 'ebuild_UsedUseFlags': 'set',
- 'used_useflags': None,
+ 'func_kwargs': {
+ 'ebuild': (None, None),
+ 'muselist': (None, None),
+ 'pkg': (None, None),
+ 'used_useflags': (None, None),
+ 'xpkg': (None, None),
+ 'y_ebuild': (None, None),
},
},
}
diff --git a/pym/repoman/modules/scan/use/use_flags.py b/pym/repoman/modules/scan/use/use_flags.py
index b2b1cc0..ae8cd0d 100644
--- a/pym/repoman/modules/scan/use/use_flags.py
+++ b/pym/repoman/modules/scan/use/use_flags.py
@@ -38,24 +38,20 @@ class USEFlagChecks(ScanBase):
@param muselist: Local USE flags of the package
@returns: dictionary, including {ebuild_UsedUseFlags, used_useflags}
'''
- pkg = kwargs.get('pkg').result()
+ pkg = kwargs.get('pkg').get()
package = kwargs.get('xpkg')
- ebuild = kwargs.get('ebuild').result()
+ ebuild = kwargs.get('ebuild').get()
y_ebuild = kwargs.get('y_ebuild')
- localUseFlags = self.get_result(kwargs.get('muselist'), set())
- dyn_ebuild_used = kwargs.get('ebuild_UsedUseFlags')
+ localUseFlags = kwargs.get('muselist').get()
dyn_used = kwargs.get('used_useflags')
# reset state variables for the run
self.useFlags = []
self.defaultUseFlags = []
self.usedUseFlags = set()
- dyn_ebuild_used.clear()
# perform the checks
self._checkGlobal(pkg)
self._checkMetadata(package, ebuild, y_ebuild, localUseFlags)
self._checkRequiredUSE(pkg, ebuild)
- # update the dynamic data
- dyn_ebuild_used.union(self.usedUseFlags)
dyn_used.update(self.usedUseFlags)
return False
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b3eeafd..c9b76a4 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -9,7 +9,7 @@ import portage
from portage import normalize_path
from portage import os
from portage.output import green
-from portage.util.futures.futures import Future
+from portage.util.futures.extendedfutures import ExtendedFuture
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
from repoman.repos import repo_metadata
@@ -28,7 +28,7 @@ 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}
+DATA_TYPES = {'dict': dict, 'Future': ExtendedFuture, 'list': list, 'set': set}
class Scanner(object):
@@ -203,6 +203,8 @@ class Scanner(object):
}
# initialize the plugin checks here
self.modules = {}
+ self.ext_futures = {}
+ self.pkg_level_futures = None
def set_kwargs(self, mod):
'''Creates a limited set of kwargs to pass to the module's __init__()
@@ -215,8 +217,7 @@ class Scanner(object):
kwargs[key] = self.kwargs[key]
return kwargs
- @staticmethod
- def set_func_kwargs(mod, dynamic_data=None):
+ def set_func_kwargs(self, 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
@@ -233,17 +234,49 @@ class Scanner(object):
for key in new:
logging.debug("set_func_kwargs(); adding: %s, %s",
key, func_kwargs[key])
- dynamic_data[key] = DATA_TYPES[func_kwargs[key]]()
+ logging.debug("set_func_kwargs(); adding: %s, %s",
+ key, func_kwargs[key])
+ if func_kwargs[key][0] in ['Future', 'ExtendedFuture']:
+ if key not in self.ext_futures:
+ logging.debug(
+ "Adding a new key: %s to the ExtendedFuture dict", key)
+ self.ext_futures[key] = func_kwargs[key]
+ self._set_future(dynamic_data, key, func_kwargs[key])
+ else: # builtin python data type
+ dynamic_data[key] = DATA_TYPES[func_kwargs[key][0]]()
kwargs = {}
for key in required:
kwargs[key] = dynamic_data[key]
return kwargs
def reset_futures(self, dynamic_data):
- for key in list(dynamic_data):
- #if key in ['ebuild', 'pkg']: # and isinstance(dynamic_data[key], Future):
- if isinstance(dynamic_data[key], Future) and key not in ['muselist']:
- dynamic_data[key] = Future()
+ '''Reset any Future data types
+
+ @param dynamic_data: dictionary
+ '''
+ for key in list(self.ext_futures):
+ if key not in self.pkg_level_futures:
+ self._set_future(dynamic_data, key, self.ext_futures[key])
+
+ @staticmethod
+ def _set_future(dynamic_data, key, data):
+ '''Set a dynamic_data key to a new ExtendedFuture instance
+
+ @param dynamic_data: dictionary
+ @param key: tuple of (dictionary-key, default-value)
+ '''
+ #print("***", key, data)
+ if data[0] in ['Future', 'ExtendedFuture']:
+ if data[1] in ['UNSET']:
+ #print("adding unset default")
+ dynamic_data[key] = ExtendedFuture()
+ else:
+ if data[1] in DATA_TYPES:
+ default = DATA_TYPES[data[1]]()
+ else:
+ default = data[1]
+ #print("adding default:", default)
+ dynamic_data[key] = ExtendedFuture(default)
def scan_pkgs(self, can_force):
for xpkg in self.effective_scanlist:
@@ -264,7 +297,7 @@ class Scanner(object):
checkdirlist = os.listdir(checkdir)
dynamic_data = {
- 'checkdirlist': checkdirlist,
+ 'checkdirlist': ExtendedFuture(checkdirlist),
'checkdir': checkdir,
'xpkg': xpkg,
'changed': self.changed,
@@ -273,12 +306,21 @@ class Scanner(object):
'repolevel': self.repolevel,
'catdir': catdir,
'pkgdir': pkgdir,
- 'validity_future': Future(),
+ 'pkgs': ExtendedFuture({}),
+ 'validity_future': ExtendedFuture(True),
'y_ebuild': None,
# this needs to be reset at the pkg level only,
# easiest is to just initialize it here
- 'muselist': Future(),
+ 'muselist': ExtendedFuture(set()),
+ 'src_uri_error': ExtendedFuture(),
}
+ self.pkg_level_futures = [
+ 'checkdirlist',
+ 'muselist',
+ 'pkgs',
+ 'src_uri_error',
+ 'validity_future',
+ ]
# need to set it up for ==> self.modules or some other ordered list
for mod in [('manifests', 'Manifests'), ('isebuild', 'IsEbuild'),
('keywords', 'KeywordChecks'), ('files', 'FileChecks'),
@@ -306,7 +348,7 @@ class Scanner(object):
continue
# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
- self.pkgs = dynamic_data['pkgs']
+ self.pkgs = dynamic_data['pkgs'].get()
ebuildlist = sorted(self.pkgs.values())
ebuildlist = [pkg.pf for pkg in ebuildlist]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-04-25 3:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-25 3:09 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/keywords/, pym/repoman/modules/scan/metadata/, Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox