* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/modules/scan/eclasses/, ...
@ 2016-04-28 5:13 Brian Dolbec
0 siblings, 0 replies; only message in thread
From: Brian Dolbec @ 2016-04-28 5:13 UTC (permalink / raw
To: gentoo-commits
commit: 1521249252e81eb4eff9c37f498b51c52199592d
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 28 05:11:57 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Apr 28 05:11:57 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=15212492
repoman: Move the LiveEclasses.is_live() to the Ebuild class
This removes another dynaic_data variable.
It also belongs with the ebuild eclass as a primary source for that type of data.
pym/repoman/modules/scan/ebuild/ebuild.py | 9 +++++++++
pym/repoman/modules/scan/eclasses/__init__.py | 1 -
pym/repoman/modules/scan/eclasses/live.py | 22 +++-------------------
pym/repoman/modules/scan/keywords/__init__.py | 1 -
pym/repoman/modules/scan/keywords/keywords.py | 8 +++-----
pym/repoman/modules/scan/metadata/__init__.py | 1 -
.../modules/scan/metadata/ebuild_metadata.py | 3 +--
7 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/pym/repoman/modules/scan/ebuild/ebuild.py b/pym/repoman/modules/scan/ebuild/ebuild.py
index c247a7f..0277aa9 100644
--- a/pym/repoman/modules/scan/ebuild/ebuild.py
+++ b/pym/repoman/modules/scan/ebuild/ebuild.py
@@ -13,6 +13,7 @@ from repoman.qa_data import no_exec, allvars
# import our initialized portage instance
from repoman._portage import portage
from portage import os
+from portage.const import LIVE_ECLASSES
pv_toolong_re = re.compile(r'[0-9]{19,}')
@@ -220,6 +221,14 @@ class Ebuild(ScanBase):
return self.continue_
@property
+ def is_live(self):
+ '''Test if the ebuild inherits a live eclass
+
+ @returns: boolean
+ '''
+ return set(LIVE_ECLASSES.intersection(self.inherited))
+
+ @property
def runInPkgs(self):
'''Package level scans'''
return (True, [self.check_isebuild])
diff --git a/pym/repoman/modules/scan/eclasses/__init__.py b/pym/repoman/modules/scan/eclasses/__init__.py
index 63bb86f..78d46e4 100644
--- a/pym/repoman/modules/scan/eclasses/__init__.py
+++ b/pym/repoman/modules/scan/eclasses/__init__.py
@@ -22,7 +22,6 @@ module_spec = {
],
'func_kwargs': {
'ebuild': (None, None),
- 'live_ebuild': ('Future', 'UNSET'),
'pkg': (None, None),
'xpkg': (None, None),
'y_ebuild': (None, None),
diff --git a/pym/repoman/modules/scan/eclasses/live.py b/pym/repoman/modules/scan/eclasses/live.py
index 842cbab..1ce33c0 100644
--- a/pym/repoman/modules/scan/eclasses/live.py
+++ b/pym/repoman/modules/scan/eclasses/live.py
@@ -6,8 +6,6 @@ Performs Live eclass checks
from repoman._portage import portage
from repoman.modules.scan.scanbase import ScanBase
-from portage.const import LIVE_ECLASSES
-
class LiveEclassChecks(ScanBase):
'''Performs checks for the usage of Live eclasses in ebuilds'''
@@ -20,27 +18,14 @@ class LiveEclassChecks(ScanBase):
self.pmaskdict = kwargs.get('repo_metadata')['pmaskdict']
self.repo_settings = kwargs.get('repo_settings')
- def is_live(self, **kwargs):
- '''Test if the ebuild inherits a live eclass
-
- @returns: dictionary, including {live_ebuild}
- '''
- ebuild = kwargs.get('ebuild').get()
- # update the dynamic data
- dyn_live = kwargs.get('live_ebuild')
- dyn_live.set(LIVE_ECLASSES.intersection(ebuild.inherited))
- return False
-
def check(self, **kwargs):
'''Ebuilds that inherit a "Live" eclass (darcs, subversion, git, cvs,
etc..) should not be allowed to be marked stable
@param pkg: Package in which we check (object).
- @param package: Package in which we check (string).
+ @param xpkg: Package in which we check (string).
@param ebuild: Ebuild which we check (object).
@param y_ebuild: Ebuild which we check (string).
- @param keywords: The keywords of the ebuild.
- @param global_pmaskdict: A global dictionary of all the masks.
@returns: dictionary
'''
pkg = kwargs.get("pkg").result()
@@ -48,9 +33,8 @@ class LiveEclassChecks(ScanBase):
ebuild = kwargs.get('ebuild').get()
y_ebuild = kwargs.get('y_ebuild')
keywords = ebuild.keywords
- live_ebuild = kwargs.get('live_ebuild').get()
- if not live_ebuild and self.repo_settings.repo_config.name == "gentoo":
+ if not ebuild.is_live and self.repo_settings.repo_config.name == "gentoo":
return False
is_stable = lambda kw: not kw.startswith("~") and not kw.startswith("-")
@@ -79,4 +63,4 @@ class LiveEclassChecks(ScanBase):
@property
def runInEbuilds(self):
'''Ebuild level scans'''
- return (True, [self.is_live, self.check])
+ return (True, [self.check])
diff --git a/pym/repoman/modules/scan/keywords/__init__.py b/pym/repoman/modules/scan/keywords/__init__.py
index 1c424ca..2223927 100644
--- a/pym/repoman/modules/scan/keywords/__init__.py
+++ b/pym/repoman/modules/scan/keywords/__init__.py
@@ -23,7 +23,6 @@ module_spec = {
'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 af94c6f..c3c8058 100644
--- a/pym/repoman/modules/scan/keywords/keywords.py
+++ b/pym/repoman/modules/scan/keywords/keywords.py
@@ -37,7 +37,6 @@ class KeywordChecks(ScanBase):
@param y_ebuild: Ebuild which we check (string).
@param ebuild_archs: Just the architectures (no prefixes) of the ebuild.
@param changed: Changes instance
- @param live_ebuild: A boolean that determines if this is a live ebuild.
@returns: dictionary
'''
pkg = kwargs.get('pkg').get()
@@ -45,12 +44,11 @@ class KeywordChecks(ScanBase):
ebuild = kwargs.get('ebuild').get()
y_ebuild = kwargs.get('y_ebuild')
changed = kwargs.get('changed')
- live_ebuild = kwargs.get('live_ebuild').get()
if not self.options.straight_to_stable:
self._checkAddedWithStableKeywords(
xpkg, ebuild, y_ebuild, ebuild.keywords, changed)
- self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs, live_ebuild)
+ self._checkForDroppedKeywords(pkg, ebuild, ebuild.archs)
self._checkForInvalidKeywords(ebuild, xpkg, y_ebuild)
@@ -77,11 +75,11 @@ class KeywordChecks(ScanBase):
(package, y_ebuild, " ".join(stable_keywords)))
def _checkForDroppedKeywords(
- self, pkg, ebuild, ebuild_archs, live_ebuild):
+ self, pkg, ebuild, ebuild_archs):
previous_keywords = self.slot_keywords.get(pkg.slot)
if previous_keywords is None:
self.slot_keywords[pkg.slot] = set()
- elif ebuild_archs and "*" not in ebuild_archs and not live_ebuild:
+ elif ebuild_archs and "*" not in ebuild_archs and not ebuild.is_live:
dropped_keywords = previous_keywords.difference(ebuild_archs)
if dropped_keywords:
self.qatracker.add_error(
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index b090d6b..b656d7a 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -45,7 +45,6 @@ module_spec = {
'func_kwargs': {
'catdir': (None, None),
'ebuild': (None, None),
- 'live_ebuild': (None, None),
'xpkg': (None, None),
'y_ebuild': (None, None),
},
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index e239b47..bbccedf 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -35,13 +35,12 @@ class EbuildMetadata(ScanBase):
def missing(self, **kwargs):
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 live_ebuild and missing_var == "KEYWORDS":
+ if ebuild.is_live and missing_var == "KEYWORDS":
continue
myqakey = missingvars[pos] + ".missing"
self.qatracker.add_error(myqakey, '%s/%s.ebuild'
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-04-28 5:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28 5:13 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/, pym/repoman/modules/scan/eclasses/, Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox