* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-06 4:21 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-06 4:21 UTC (permalink / raw
To: gentoo-commits
commit: 64d73922bcc8e9baba8f561a0aaab9cc3ffe9ec0
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 20:38:11 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 6 04:08:22 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=64d73922
repoman: New DependChecks plugin
Migrate code from _scan_ebuilds to the plugin system
pym/repoman/modules/scan/depend/__init__.py | 23 +++++
pym/repoman/modules/scan/depend/depend.py | 132 ++++++++++++++++++++++++++++
pym/repoman/scanner.py | 120 ++-----------------------
3 files changed, 162 insertions(+), 113 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 0000000..73d3f8f
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'depend',
+ 'description': doc,
+ 'provides':{
+ 'depend-module': {
+ 'name': "depend",
+ 'class': "DependChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
+ }
+}
+
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 0000000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+
+ unknown_pkgs = set()
+
+ inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+ "java-pkg-opt-2" in ebuild.inherited,
+ inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+ # operator_tokens = set(["||", "(", ")"])
+ type_list, badsyntax = [], []
+ for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+ mydepstr = ebuild.metadata[mytype]
+
+ buildtime = mytype in Package._buildtime_keys
+ runtime = mytype in Package._runtime_keys
+ token_class = None
+ if mytype.endswith("DEPEND"):
+ token_class = portage.dep.Atom
+
+ try:
+ atoms = portage.dep.use_reduce(
+ mydepstr, matchall=1, flat=True,
+ is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+ except portage.exception.InvalidDependString as e:
+ atoms = None
+ badsyntax.append(str(e))
+
+ if atoms and mytype.endswith("DEPEND"):
+ if runtime and \
+ "test?" in mydepstr.split():
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ "%s: 'test?' USE conditional in %s" %
+ (ebuild.relative_path, mytype))
+
+ for atom in atoms:
+ if atom == "||":
+ continue
+
+ is_blocker = atom.blocker
+
+ # Skip dependency.unknown for blockers, so that we
+ # don't encourage people to remove necessary blockers,
+ # as discussed in bug 382407. We use atom.without_use
+ # due to bug 525376.
+ if not is_blocker and \
+ not self.portdb.xmatch("match-all", atom.without_use) and \
+ not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ if kwargs.get('catdir') != "virtual":
+ if not is_blocker and \
+ atom.cp in suspect_virtual:
+ self.qatracker.add_error(
+ 'virtual.suspect', ebuild.relative_path +
+ ": %s: consider using '%s' instead of '%s'" %
+ (mytype, suspect_virtual[atom.cp], atom))
+ if not is_blocker and \
+ atom.cp.startswith("perl-core/"):
+ self.qatracker.add_error('dependency.perlcore',
+ ebuild.relative_path +
+ ": %s: please use '%s' instead of '%s'" %
+ (mytype,
+ atom.replace("perl-core/","virtual/perl-"),
+ atom))
+
+ if buildtime and \
+ not is_blocker and \
+ not inherited_java_eclass and \
+ atom.cp == "virtual/jdk":
+ self.qatracker.add_error(
+ 'java.eclassesnotused', ebuild.relative_path)
+ elif buildtime and \
+ not is_blocker and \
+ not inherited_wxwidgets_eclass and \
+ atom.cp == "x11-libs/wxGTK":
+ self.qatracker.add_error(
+ 'wxwidgets.eclassnotused',
+ "%s: %ss on x11-libs/wxGTK without inheriting"
+ " wxwidgets.eclass" % (ebuild.relative_path, mytype))
+ elif runtime:
+ if not is_blocker and \
+ atom.cp in suspect_rdepend:
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ ebuild.relative_path + ": '%s'" % atom)
+
+ if atom.operator == "~" and \
+ portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+ qacat = 'dependency.badtilde'
+ self.qatracker.add_error(
+ qacat, "%s: %s uses the ~ operator"
+ " with a non-zero revision: '%s'" %
+ (ebuild.relative_path, mytype, atom))
+
+ check_missingslot(atom, mytype, ebuild.eapi, self.portdb, self.qatracker,
+ ebuild.relative_path, ebuild.metadata)
+
+ type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+ for m, b in zip(type_list, badsyntax):
+ if m.endswith("DEPEND"):
+ qacat = "dependency.syntax"
+ else:
+ qacat = m + ".syntax"
+ self.qatracker.add_error(
+ qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 67af85b..4b0b251 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -18,12 +18,10 @@ from portage import _unicode_encode
from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
-from repoman.check_missingslot import check_missingslot
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
-from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
from repoman.repos import repo_metadata
from repoman.modules.scan.scan import scan
from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -301,7 +299,7 @@ class Scanner(object):
('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
- ('arches', 'ArchChecks'),
+ ('arches', 'ArchChecks'), ('depend', 'DependChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -332,118 +330,14 @@ class Scanner(object):
print("**** finished plugin loop, continuing...")
- unknown_pkgs = set()
baddepsyntax = False
badlicsyntax = False
badprovsyntax = False
# catpkg = catdir + "/" + y_ebuild
- inherited_java_eclass = "java-pkg-2" in dynamic_data['ebuild'].inherited or \
- "java-pkg-opt-2" in dynamic_data['ebuild'].inherited,
- inherited_wxwidgets_eclass = "wxwidgets" in dynamic_data['ebuild'].inherited
- # operator_tokens = set(["||", "(", ")"])
- type_list, badsyntax = [], []
- for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
- mydepstr = dynamic_data['ebuild'].metadata[mytype]
-
- buildtime = mytype in Package._buildtime_keys
- runtime = mytype in Package._runtime_keys
- token_class = None
- if mytype.endswith("DEPEND"):
- token_class = portage.dep.Atom
-
- try:
- atoms = portage.dep.use_reduce(
- mydepstr, matchall=1, flat=True,
- is_valid_flag=dynamic_data['pkg'].iuse.is_valid_flag, token_class=token_class)
- except portage.exception.InvalidDependString as e:
- atoms = None
- badsyntax.append(str(e))
-
- if atoms and mytype.endswith("DEPEND"):
- if runtime and \
- "test?" in mydepstr.split():
- self.qatracker.add_error(
- mytype + '.suspect',
- "%s: 'test?' USE conditional in %s" %
- (dynamic_data['ebuild'].relative_path, mytype))
-
- for atom in atoms:
- if atom == "||":
- continue
-
- is_blocker = atom.blocker
-
- # Skip dependency.unknown for blockers, so that we
- # don't encourage people to remove necessary blockers,
- # as discussed in bug 382407. We use atom.without_use
- # due to bug 525376.
- if not is_blocker and \
- not self.portdb.xmatch("match-all", atom.without_use) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
- if dynamic_data['catdir'] != "virtual":
- if not is_blocker and \
- atom.cp in suspect_virtual:
- self.qatracker.add_error(
- 'virtual.suspect', dynamic_data['ebuild'].relative_path +
- ": %s: consider using '%s' instead of '%s'" %
- (mytype, suspect_virtual[atom.cp], atom))
- if not is_blocker and \
- atom.cp.startswith("perl-core/"):
- self.qatracker.add_error('dependency.perlcore',
- dynamic_data['ebuild'].relative_path +
- ": %s: please use '%s' instead of '%s'" %
- (mytype,
- atom.replace("perl-core/","virtual/perl-"),
- atom))
-
- if buildtime and \
- not is_blocker and \
- not inherited_java_eclass and \
- atom.cp == "virtual/jdk":
- self.qatracker.add_error(
- 'java.eclassesnotused', dynamic_data['ebuild'].relative_path)
- elif buildtime and \
- not is_blocker and \
- not inherited_wxwidgets_eclass and \
- atom.cp == "x11-libs/wxGTK":
- self.qatracker.add_error(
- 'wxwidgets.eclassnotused',
- "%s: %ss on x11-libs/wxGTK without inheriting"
- " wxwidgets.eclass" % (dynamic_data['ebuild'].relative_path, mytype))
- elif runtime:
- if not is_blocker and \
- atom.cp in suspect_rdepend:
- self.qatracker.add_error(
- mytype + '.suspect',
- dynamic_data['ebuild'].relative_path + ": '%s'" % atom)
-
- if atom.operator == "~" and \
- portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
- qacat = 'dependency.badtilde'
- self.qatracker.add_error(
- qacat, "%s: %s uses the ~ operator"
- " with a non-zero revision: '%s'" %
- (dynamic_data['ebuild'].relative_path, mytype, atom))
-
- check_missingslot(atom, mytype, dynamic_data['ebuild'].eapi, self.portdb, self.qatracker,
- dynamic_data['ebuild'].relative_path, dynamic_data['ebuild'].metadata)
-
- type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
- for m, b in zip(type_list, badsyntax):
- if m.endswith("DEPEND"):
- qacat = "dependency.syntax"
- else:
- qacat = m + ".syntax"
- self.qatracker.add_error(
- qacat, "%s: %s: %s" % (dynamic_data['ebuild'].relative_path, m, b))
-
- badlicsyntax = len([z for z in type_list if z == "LICENSE"])
- badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
- baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
+ badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
+ baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
@@ -609,7 +503,7 @@ class Scanner(object):
# aren't counted for *DEPEND.bad, so we
# ignore them here.
if not atom.blocker:
- unknown_pkgs.discard(
+ dynamic_data['unknown_pkgs'].discard(
(mytype, atom.unevaluated_atom))
if not prof.sub_path:
@@ -654,9 +548,9 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and unknown_pkgs:
+ if not baddepsyntax and dynamic_data['unknown_pkgs']:
type_map = {}
- for mytype, atom in unknown_pkgs:
+ for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
for mytype, atoms in type_map.items():
self.qatracker.add_error(
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-10 3:26 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-10 3:26 UTC (permalink / raw
To: gentoo-commits
commit: 8b9af1c3a77cee700a7c8ea33ffef96718418a19
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:09:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8b9af1c3
repoman: Create a new DependUnknown plugin class
pym/repoman/modules/scan/depend/__init__.py | 8 ++++++++
pym/repoman/modules/scan/depend/unknown.py | 30 +++++++++++++++++++++++++++++
pym/repoman/scanner.py | 10 +---------
3 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..65555b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unknown-module': {
+ 'name': "unknown",
+ 'class': "DependUnknown",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 0000000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ if not baddepsyntax and unknown_pkgs:
+ type_map = {}
+ for mytype, atom in unknown_pkgs:
+ type_map.setdefault(mytype, set()).add(atom)
+ for mytype, atoms in type_map.items():
+ self.qatracker.add_error(
+ "dependency.unknown", "%s: %s: %s"
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index be971db..89eaa57 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -289,6 +289,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'),
# Options.is_forced() is used to bypass further checks
('options', 'Options'), ('profile', 'ProfileDependsChecks'),
+ ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -316,15 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
- type_map = {}
- for mytype, atom in dynamic_data['unknown_pkgs']:
- type_map.setdefault(mytype, set()).add(atom)
- for mytype, atoms in type_map.items():
- self.qatracker.add_error(
- "dependency.unknown", "%s: %s: %s"
- % (dynamic_data['ebuild'].relative_path, mytype, ", ".join(sorted(atoms))))
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if dynamic_data['allvalid']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-10 20:17 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
To: gentoo-commits
commit: 36952e7f42d5aa84d58b41c6fb99d94a9876af28
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 20:38:11 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=36952e7f
repoman: New DependChecks plugin
Migrate code from _scan_ebuilds to the plugin system
pym/repoman/modules/scan/depend/__init__.py | 23 +++++
pym/repoman/modules/scan/depend/depend.py | 132 ++++++++++++++++++++++++++++
pym/repoman/scanner.py | 119 ++-----------------------
3 files changed, 162 insertions(+), 112 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 0000000..73d3f8f
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'depend',
+ 'description': doc,
+ 'provides':{
+ 'depend-module': {
+ 'name': "depend",
+ 'class': "DependChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
+ }
+}
+
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 0000000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+
+ unknown_pkgs = set()
+
+ inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+ "java-pkg-opt-2" in ebuild.inherited,
+ inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+ # operator_tokens = set(["||", "(", ")"])
+ type_list, badsyntax = [], []
+ for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+ mydepstr = ebuild.metadata[mytype]
+
+ buildtime = mytype in Package._buildtime_keys
+ runtime = mytype in Package._runtime_keys
+ token_class = None
+ if mytype.endswith("DEPEND"):
+ token_class = portage.dep.Atom
+
+ try:
+ atoms = portage.dep.use_reduce(
+ mydepstr, matchall=1, flat=True,
+ is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+ except portage.exception.InvalidDependString as e:
+ atoms = None
+ badsyntax.append(str(e))
+
+ if atoms and mytype.endswith("DEPEND"):
+ if runtime and \
+ "test?" in mydepstr.split():
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ "%s: 'test?' USE conditional in %s" %
+ (ebuild.relative_path, mytype))
+
+ for atom in atoms:
+ if atom == "||":
+ continue
+
+ is_blocker = atom.blocker
+
+ # Skip dependency.unknown for blockers, so that we
+ # don't encourage people to remove necessary blockers,
+ # as discussed in bug 382407. We use atom.without_use
+ # due to bug 525376.
+ if not is_blocker and \
+ not self.portdb.xmatch("match-all", atom.without_use) and \
+ not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ if kwargs.get('catdir') != "virtual":
+ if not is_blocker and \
+ atom.cp in suspect_virtual:
+ self.qatracker.add_error(
+ 'virtual.suspect', ebuild.relative_path +
+ ": %s: consider using '%s' instead of '%s'" %
+ (mytype, suspect_virtual[atom.cp], atom))
+ if not is_blocker and \
+ atom.cp.startswith("perl-core/"):
+ self.qatracker.add_error('dependency.perlcore',
+ ebuild.relative_path +
+ ": %s: please use '%s' instead of '%s'" %
+ (mytype,
+ atom.replace("perl-core/","virtual/perl-"),
+ atom))
+
+ if buildtime and \
+ not is_blocker and \
+ not inherited_java_eclass and \
+ atom.cp == "virtual/jdk":
+ self.qatracker.add_error(
+ 'java.eclassesnotused', ebuild.relative_path)
+ elif buildtime and \
+ not is_blocker and \
+ not inherited_wxwidgets_eclass and \
+ atom.cp == "x11-libs/wxGTK":
+ self.qatracker.add_error(
+ 'wxwidgets.eclassnotused',
+ "%s: %ss on x11-libs/wxGTK without inheriting"
+ " wxwidgets.eclass" % (ebuild.relative_path, mytype))
+ elif runtime:
+ if not is_blocker and \
+ atom.cp in suspect_rdepend:
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ ebuild.relative_path + ": '%s'" % atom)
+
+ if atom.operator == "~" and \
+ portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+ qacat = 'dependency.badtilde'
+ self.qatracker.add_error(
+ qacat, "%s: %s uses the ~ operator"
+ " with a non-zero revision: '%s'" %
+ (ebuild.relative_path, mytype, atom))
+
+ check_missingslot(atom, mytype, ebuild.eapi, self.portdb, self.qatracker,
+ ebuild.relative_path, ebuild.metadata)
+
+ type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+ for m, b in zip(type_list, badsyntax):
+ if m.endswith("DEPEND"):
+ qacat = "dependency.syntax"
+ else:
+ qacat = m + ".syntax"
+ self.qatracker.add_error(
+ qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7b07a95..7f770c3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,13 +19,11 @@ from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.check_missingslot import check_missingslot
from repoman.checks.ebuilds.use_flags import USEFlagChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
-from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
from repoman.repos import repo_metadata
from repoman.modules.scan.scan import scan
from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -301,7 +299,7 @@ class Scanner(object):
('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
- ('arches', 'ArchChecks'),
+ ('arches', 'ArchChecks'), ('depend', 'DependChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -358,112 +356,9 @@ class Scanner(object):
badprovsyntax = False
# catpkg = catdir + "/" + y_ebuild
- inherited_java_eclass = "java-pkg-2" in dynamic_data['ebuild'].inherited or \
- "java-pkg-opt-2" in dynamic_data['ebuild'].inherited,
- inherited_wxwidgets_eclass = "wxwidgets" in dynamic_data['ebuild'].inherited
- # operator_tokens = set(["||", "(", ")"])
- type_list, badsyntax = [], []
- for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
- mydepstr = dynamic_data['ebuild'].metadata[mytype]
-
- buildtime = mytype in Package._buildtime_keys
- runtime = mytype in Package._runtime_keys
- token_class = None
- if mytype.endswith("DEPEND"):
- token_class = portage.dep.Atom
-
- try:
- atoms = portage.dep.use_reduce(
- mydepstr, matchall=1, flat=True,
- is_valid_flag=dynamic_data['pkg'].iuse.is_valid_flag, token_class=token_class)
- except portage.exception.InvalidDependString as e:
- atoms = None
- badsyntax.append(str(e))
-
- if atoms and mytype.endswith("DEPEND"):
- if runtime and \
- "test?" in mydepstr.split():
- self.qatracker.add_error(
- mytype + '.suspect',
- "%s: 'test?' USE conditional in %s" %
- (dynamic_data['ebuild'].relative_path, mytype))
-
- for atom in atoms:
- if atom == "||":
- continue
-
- is_blocker = atom.blocker
-
- # Skip dependency.unknown for blockers, so that we
- # don't encourage people to remove necessary blockers,
- # as discussed in bug 382407. We use atom.without_use
- # due to bug 525376.
- if not is_blocker and \
- not self.portdb.xmatch("match-all", atom.without_use) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
- if dynamic_data['catdir'] != "virtual":
- if not is_blocker and \
- atom.cp in suspect_virtual:
- self.qatracker.add_error(
- 'virtual.suspect', dynamic_data['ebuild'].relative_path +
- ": %s: consider using '%s' instead of '%s'" %
- (mytype, suspect_virtual[atom.cp], atom))
- if not is_blocker and \
- atom.cp.startswith("perl-core/"):
- self.qatracker.add_error('dependency.perlcore',
- dynamic_data['ebuild'].relative_path +
- ": %s: please use '%s' instead of '%s'" %
- (mytype,
- atom.replace("perl-core/","virtual/perl-"),
- atom))
-
- if buildtime and \
- not is_blocker and \
- not inherited_java_eclass and \
- atom.cp == "virtual/jdk":
- self.qatracker.add_error(
- 'java.eclassesnotused', dynamic_data['ebuild'].relative_path)
- elif buildtime and \
- not is_blocker and \
- not inherited_wxwidgets_eclass and \
- atom.cp == "x11-libs/wxGTK":
- self.qatracker.add_error(
- 'wxwidgets.eclassnotused',
- "%s: %ss on x11-libs/wxGTK without inheriting"
- " wxwidgets.eclass" % (dynamic_data['ebuild'].relative_path, mytype))
- elif runtime:
- if not is_blocker and \
- atom.cp in suspect_rdepend:
- self.qatracker.add_error(
- mytype + '.suspect',
- dynamic_data['ebuild'].relative_path + ": '%s'" % atom)
-
- if atom.operator == "~" and \
- portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
- qacat = 'dependency.badtilde'
- self.qatracker.add_error(
- qacat, "%s: %s uses the ~ operator"
- " with a non-zero revision: '%s'" %
- (dynamic_data['ebuild'].relative_path, mytype, atom))
-
- check_missingslot(atom, mytype, dynamic_data['ebuild'].eapi, self.portdb, self.qatracker,
- dynamic_data['ebuild'].relative_path, dynamic_data['ebuild'].metadata)
-
- type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
- for m, b in zip(type_list, badsyntax):
- if m.endswith("DEPEND"):
- qacat = "dependency.syntax"
- else:
- qacat = m + ".syntax"
- self.qatracker.add_error(
- qacat, "%s: %s: %s" % (dynamic_data['ebuild'].relative_path, m, b))
-
- badlicsyntax = len([z for z in type_list if z == "LICENSE"])
- badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
- baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
+ badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
+ baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
@@ -626,7 +521,7 @@ class Scanner(object):
# aren't counted for *DEPEND.bad, so we
# ignore them here.
if not atom.blocker:
- unknown_pkgs.discard(
+ dynamic_data['unknown_pkgs'].discard(
(mytype, atom.unevaluated_atom))
if not prof.sub_path:
@@ -671,9 +566,9 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and unknown_pkgs:
+ if not baddepsyntax and dynamic_data['unknown_pkgs']:
type_map = {}
- for mytype, atom in unknown_pkgs:
+ for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
for mytype, atoms in type_map.items():
self.qatracker.add_error(
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-10 20:17 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
To: gentoo-commits
commit: 3942a053d591d077ed1fc69cbf44ee14d1ada7a0
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3942a053
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d42fd33..6d5416b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,26 +324,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -449,7 +433,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -539,7 +523,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-11 6:31 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-11 6:31 UTC (permalink / raw
To: gentoo-commits
commit: 593ee3f398b7a49a6e3377475a05e21d0925da99
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:35 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=593ee3f3
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d42fd33..6d5416b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,26 +324,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -449,7 +433,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -539,7 +523,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-11 6:31 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-11 6:31 UTC (permalink / raw
To: gentoo-commits
commit: 40475b12719c76ce6176c72587f8d976362a7042
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:38 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=40475b12
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 8 ++
pym/repoman/modules/scan/depend/profile.py | 211 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 227 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 73d3f8f..2dac94b 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index a047237..be971db 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -194,6 +185,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -291,7 +288,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -319,170 +316,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-11 8:01 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-11 8:01 UTC (permalink / raw
To: gentoo-commits
commit: 33a8449a6cc138d37b7fef6b360c12f6741388b1
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:17 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=33a8449a
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d42fd33..6d5416b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,26 +324,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -449,7 +433,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -539,7 +523,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-11 8:01 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-11 8:01 UTC (permalink / raw
To: gentoo-commits
commit: 11881204d878ead02c3d02635f8c047d5e8c3877
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:09:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:19 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=11881204
repoman: Create a new DependUnknown plugin class
pym/repoman/modules/scan/depend/__init__.py | 8 ++++++++
pym/repoman/modules/scan/depend/unknown.py | 30 +++++++++++++++++++++++++++++
pym/repoman/scanner.py | 10 +---------
3 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..65555b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unknown-module': {
+ 'name': "unknown",
+ 'class': "DependUnknown",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 0000000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ if not baddepsyntax and unknown_pkgs:
+ type_map = {}
+ for mytype, atom in unknown_pkgs:
+ type_map.setdefault(mytype, set()).add(atom)
+ for mytype, atoms in type_map.items():
+ self.qatracker.add_error(
+ "dependency.unknown", "%s: %s: %s"
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index be971db..89eaa57 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -289,6 +289,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'),
# Options.is_forced() is used to bypass further checks
('options', 'Options'), ('profile', 'ProfileDependsChecks'),
+ ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -316,15 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
- type_map = {}
- for mytype, atom in dynamic_data['unknown_pkgs']:
- type_map.setdefault(mytype, set()).add(atom)
- for mytype, atoms in type_map.items():
- self.qatracker.add_error(
- "dependency.unknown", "%s: %s: %s"
- % (dynamic_data['ebuild'].relative_path, mytype, ", ".join(sorted(atoms))))
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if dynamic_data['allvalid']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-18 19:23 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
To: gentoo-commits
commit: 435bde48afe0926e4e4d3e9671d6378954053c21
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 20:38:11 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 19:20:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=435bde48
repoman: New DependChecks plugin
Migrate code from _scan_ebuilds to the plugin system
pym/repoman/modules/scan/depend/__init__.py | 23 +++++
pym/repoman/modules/scan/depend/depend.py | 132 ++++++++++++++++++++++++++++
pym/repoman/scanner.py | 119 ++-----------------------
3 files changed, 162 insertions(+), 112 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 0000000..73d3f8f
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'depend',
+ 'description': doc,
+ 'provides':{
+ 'depend-module': {
+ 'name': "depend",
+ 'class': "DependChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
+ }
+}
+
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 0000000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+
+ unknown_pkgs = set()
+
+ inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+ "java-pkg-opt-2" in ebuild.inherited,
+ inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+ # operator_tokens = set(["||", "(", ")"])
+ type_list, badsyntax = [], []
+ for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+ mydepstr = ebuild.metadata[mytype]
+
+ buildtime = mytype in Package._buildtime_keys
+ runtime = mytype in Package._runtime_keys
+ token_class = None
+ if mytype.endswith("DEPEND"):
+ token_class = portage.dep.Atom
+
+ try:
+ atoms = portage.dep.use_reduce(
+ mydepstr, matchall=1, flat=True,
+ is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+ except portage.exception.InvalidDependString as e:
+ atoms = None
+ badsyntax.append(str(e))
+
+ if atoms and mytype.endswith("DEPEND"):
+ if runtime and \
+ "test?" in mydepstr.split():
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ "%s: 'test?' USE conditional in %s" %
+ (ebuild.relative_path, mytype))
+
+ for atom in atoms:
+ if atom == "||":
+ continue
+
+ is_blocker = atom.blocker
+
+ # Skip dependency.unknown for blockers, so that we
+ # don't encourage people to remove necessary blockers,
+ # as discussed in bug 382407. We use atom.without_use
+ # due to bug 525376.
+ if not is_blocker and \
+ not self.portdb.xmatch("match-all", atom.without_use) and \
+ not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ if kwargs.get('catdir') != "virtual":
+ if not is_blocker and \
+ atom.cp in suspect_virtual:
+ self.qatracker.add_error(
+ 'virtual.suspect', ebuild.relative_path +
+ ": %s: consider using '%s' instead of '%s'" %
+ (mytype, suspect_virtual[atom.cp], atom))
+ if not is_blocker and \
+ atom.cp.startswith("perl-core/"):
+ self.qatracker.add_error('dependency.perlcore',
+ ebuild.relative_path +
+ ": %s: please use '%s' instead of '%s'" %
+ (mytype,
+ atom.replace("perl-core/","virtual/perl-"),
+ atom))
+
+ if buildtime and \
+ not is_blocker and \
+ not inherited_java_eclass and \
+ atom.cp == "virtual/jdk":
+ self.qatracker.add_error(
+ 'java.eclassesnotused', ebuild.relative_path)
+ elif buildtime and \
+ not is_blocker and \
+ not inherited_wxwidgets_eclass and \
+ atom.cp == "x11-libs/wxGTK":
+ self.qatracker.add_error(
+ 'wxwidgets.eclassnotused',
+ "%s: %ss on x11-libs/wxGTK without inheriting"
+ " wxwidgets.eclass" % (ebuild.relative_path, mytype))
+ elif runtime:
+ if not is_blocker and \
+ atom.cp in suspect_rdepend:
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ ebuild.relative_path + ": '%s'" % atom)
+
+ if atom.operator == "~" and \
+ portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+ qacat = 'dependency.badtilde'
+ self.qatracker.add_error(
+ qacat, "%s: %s uses the ~ operator"
+ " with a non-zero revision: '%s'" %
+ (ebuild.relative_path, mytype, atom))
+
+ check_missingslot(atom, mytype, ebuild.eapi, self.portdb, self.qatracker,
+ ebuild.relative_path, ebuild.metadata)
+
+ type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+ for m, b in zip(type_list, badsyntax):
+ if m.endswith("DEPEND"):
+ qacat = "dependency.syntax"
+ else:
+ qacat = m + ".syntax"
+ self.qatracker.add_error(
+ qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7b07a95..7f770c3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,13 +19,11 @@ from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.check_missingslot import check_missingslot
from repoman.checks.ebuilds.use_flags import USEFlagChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
-from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
from repoman.repos import repo_metadata
from repoman.modules.scan.scan import scan
from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -301,7 +299,7 @@ class Scanner(object):
('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
- ('arches', 'ArchChecks'),
+ ('arches', 'ArchChecks'), ('depend', 'DependChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -358,112 +356,9 @@ class Scanner(object):
badprovsyntax = False
# catpkg = catdir + "/" + y_ebuild
- inherited_java_eclass = "java-pkg-2" in dynamic_data['ebuild'].inherited or \
- "java-pkg-opt-2" in dynamic_data['ebuild'].inherited,
- inherited_wxwidgets_eclass = "wxwidgets" in dynamic_data['ebuild'].inherited
- # operator_tokens = set(["||", "(", ")"])
- type_list, badsyntax = [], []
- for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
- mydepstr = dynamic_data['ebuild'].metadata[mytype]
-
- buildtime = mytype in Package._buildtime_keys
- runtime = mytype in Package._runtime_keys
- token_class = None
- if mytype.endswith("DEPEND"):
- token_class = portage.dep.Atom
-
- try:
- atoms = portage.dep.use_reduce(
- mydepstr, matchall=1, flat=True,
- is_valid_flag=dynamic_data['pkg'].iuse.is_valid_flag, token_class=token_class)
- except portage.exception.InvalidDependString as e:
- atoms = None
- badsyntax.append(str(e))
-
- if atoms and mytype.endswith("DEPEND"):
- if runtime and \
- "test?" in mydepstr.split():
- self.qatracker.add_error(
- mytype + '.suspect',
- "%s: 'test?' USE conditional in %s" %
- (dynamic_data['ebuild'].relative_path, mytype))
-
- for atom in atoms:
- if atom == "||":
- continue
-
- is_blocker = atom.blocker
-
- # Skip dependency.unknown for blockers, so that we
- # don't encourage people to remove necessary blockers,
- # as discussed in bug 382407. We use atom.without_use
- # due to bug 525376.
- if not is_blocker and \
- not self.portdb.xmatch("match-all", atom.without_use) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
- if dynamic_data['catdir'] != "virtual":
- if not is_blocker and \
- atom.cp in suspect_virtual:
- self.qatracker.add_error(
- 'virtual.suspect', dynamic_data['ebuild'].relative_path +
- ": %s: consider using '%s' instead of '%s'" %
- (mytype, suspect_virtual[atom.cp], atom))
- if not is_blocker and \
- atom.cp.startswith("perl-core/"):
- self.qatracker.add_error('dependency.perlcore',
- dynamic_data['ebuild'].relative_path +
- ": %s: please use '%s' instead of '%s'" %
- (mytype,
- atom.replace("perl-core/","virtual/perl-"),
- atom))
-
- if buildtime and \
- not is_blocker and \
- not inherited_java_eclass and \
- atom.cp == "virtual/jdk":
- self.qatracker.add_error(
- 'java.eclassesnotused', dynamic_data['ebuild'].relative_path)
- elif buildtime and \
- not is_blocker and \
- not inherited_wxwidgets_eclass and \
- atom.cp == "x11-libs/wxGTK":
- self.qatracker.add_error(
- 'wxwidgets.eclassnotused',
- "%s: %ss on x11-libs/wxGTK without inheriting"
- " wxwidgets.eclass" % (dynamic_data['ebuild'].relative_path, mytype))
- elif runtime:
- if not is_blocker and \
- atom.cp in suspect_rdepend:
- self.qatracker.add_error(
- mytype + '.suspect',
- dynamic_data['ebuild'].relative_path + ": '%s'" % atom)
-
- if atom.operator == "~" and \
- portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
- qacat = 'dependency.badtilde'
- self.qatracker.add_error(
- qacat, "%s: %s uses the ~ operator"
- " with a non-zero revision: '%s'" %
- (dynamic_data['ebuild'].relative_path, mytype, atom))
-
- check_missingslot(atom, mytype, dynamic_data['ebuild'].eapi, self.portdb, self.qatracker,
- dynamic_data['ebuild'].relative_path, dynamic_data['ebuild'].metadata)
-
- type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
- for m, b in zip(type_list, badsyntax):
- if m.endswith("DEPEND"):
- qacat = "dependency.syntax"
- else:
- qacat = m + ".syntax"
- self.qatracker.add_error(
- qacat, "%s: %s: %s" % (dynamic_data['ebuild'].relative_path, m, b))
-
- badlicsyntax = len([z for z in type_list if z == "LICENSE"])
- badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
- baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
+ badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
+ baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
@@ -626,7 +521,7 @@ class Scanner(object):
# aren't counted for *DEPEND.bad, so we
# ignore them here.
if not atom.blocker:
- unknown_pkgs.discard(
+ dynamic_data['unknown_pkgs'].discard(
(mytype, atom.unevaluated_atom))
if not prof.sub_path:
@@ -671,9 +566,9 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and unknown_pkgs:
+ if not baddepsyntax and dynamic_data['unknown_pkgs']:
type_map = {}
- for mytype, atom in unknown_pkgs:
+ for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
for mytype, atoms in type_map.items():
self.qatracker.add_error(
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-18 19:23 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
To: gentoo-commits
commit: d2905f81b0563ffd4b8188a52a966b525a506c1c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:09:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 19:20:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d2905f81
repoman: Create a new DependUnknown plugin class
pym/repoman/modules/scan/depend/__init__.py | 8 ++++++++
pym/repoman/modules/scan/depend/unknown.py | 30 +++++++++++++++++++++++++++++
pym/repoman/scanner.py | 10 +---------
3 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..65555b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unknown-module': {
+ 'name': "unknown",
+ 'class': "DependUnknown",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 0000000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ if not baddepsyntax and unknown_pkgs:
+ type_map = {}
+ for mytype, atom in unknown_pkgs:
+ type_map.setdefault(mytype, set()).add(atom)
+ for mytype, atoms in type_map.items():
+ self.qatracker.add_error(
+ "dependency.unknown", "%s: %s: %s"
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index be971db..89eaa57 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -289,6 +289,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'),
# Options.is_forced() is used to bypass further checks
('options', 'Options'), ('profile', 'ProfileDependsChecks'),
+ ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -316,15 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
- type_map = {}
- for mytype, atom in dynamic_data['unknown_pkgs']:
- type_map.setdefault(mytype, set()).add(atom)
- for mytype, atoms in type_map.items():
- self.qatracker.add_error(
- "dependency.unknown", "%s: %s: %s"
- % (dynamic_data['ebuild'].relative_path, mytype, ", ".join(sorted(atoms))))
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if dynamic_data['allvalid']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-18 19:23 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
To: gentoo-commits
commit: e7ca910fb8be063d2311508b337d299418ade1f5
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 19:20:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e7ca910f
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d42fd33..6d5416b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,26 +324,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -449,7 +433,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -539,7 +523,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-21 18:30 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-21 18:30 UTC (permalink / raw
To: gentoo-commits
commit: 99e8897840c8db6d689280cdb3c0d987fc92023a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 02:53:44 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=99e88978
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 8 ++
pym/repoman/modules/scan/depend/profile.py | 211 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 227 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 73d3f8f..2dac94b 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index cb2a7c0..9223876 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -194,6 +185,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -291,7 +288,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -319,170 +316,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-21 18:30 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-21 18:30 UTC (permalink / raw
To: gentoo-commits
commit: 4bcbd3453979a3d990c6a46ed91caaa4192a6856
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:09:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 02:53:44 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4bcbd345
repoman: Create a new DependUnknown plugin class
pym/repoman/modules/scan/depend/__init__.py | 8 ++++++++
pym/repoman/modules/scan/depend/unknown.py | 30 +++++++++++++++++++++++++++++
pym/repoman/scanner.py | 10 +---------
3 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..65555b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unknown-module': {
+ 'name': "unknown",
+ 'class': "DependUnknown",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 0000000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ if not baddepsyntax and unknown_pkgs:
+ type_map = {}
+ for mytype, atom in unknown_pkgs:
+ type_map.setdefault(mytype, set()).add(atom)
+ for mytype, atoms in type_map.items():
+ self.qatracker.add_error(
+ "dependency.unknown", "%s: %s: %s"
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 9223876..1cd37d0 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -289,6 +289,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
('options', 'Options'), ('profile', 'ProfileDependsChecks'),
+ ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -316,15 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
- type_map = {}
- for mytype, atom in dynamic_data['unknown_pkgs']:
- type_map.setdefault(mytype, set()).add(atom)
- for mytype, atoms in type_map.items():
- self.qatracker.add_error(
- "dependency.unknown", "%s: %s: %s"
- % (dynamic_data['ebuild'].relative_path, mytype, ", ".join(sorted(atoms))))
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if dynamic_data['allvalid']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-21 18:30 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-21 18:30 UTC (permalink / raw
To: gentoo-commits
commit: 2e7f4b895207199f68c3c02738449bbd8c3046ff
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 00:35:22 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2e7f4b89
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d42fd33..6d5416b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,26 +324,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -449,7 +433,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -539,7 +523,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-21 19:42 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-21 19:42 UTC (permalink / raw
To: gentoo-commits
commit: b4cadb2b68ec222fe0f749e9009ee36337132788
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 19:28:19 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b4cadb2b
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 8 ++
pym/repoman/modules/scan/depend/profile.py | 211 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 227 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 73d3f8f..2dac94b 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index cb2a7c0..9223876 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -194,6 +185,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -291,7 +288,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -319,170 +316,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: b257d099474945c58709843708a857cf749bfc4a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 20:38:11 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:11 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b257d099
repoman: New DependChecks plugin
Migrate code from _scan_ebuilds to the plugin system
pym/repoman/modules/scan/depend/__init__.py | 23 +++++
pym/repoman/modules/scan/depend/depend.py | 132 ++++++++++++++++++++++++++++
pym/repoman/scanner.py | 119 ++-----------------------
3 files changed, 162 insertions(+), 112 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 0000000..73d3f8f
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'depend',
+ 'description': doc,
+ 'provides':{
+ 'depend-module': {
+ 'name': "depend",
+ 'class': "DependChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
+ }
+}
+
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 0000000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+
+ unknown_pkgs = set()
+
+ inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+ "java-pkg-opt-2" in ebuild.inherited,
+ inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+ # operator_tokens = set(["||", "(", ")"])
+ type_list, badsyntax = [], []
+ for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+ mydepstr = ebuild.metadata[mytype]
+
+ buildtime = mytype in Package._buildtime_keys
+ runtime = mytype in Package._runtime_keys
+ token_class = None
+ if mytype.endswith("DEPEND"):
+ token_class = portage.dep.Atom
+
+ try:
+ atoms = portage.dep.use_reduce(
+ mydepstr, matchall=1, flat=True,
+ is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+ except portage.exception.InvalidDependString as e:
+ atoms = None
+ badsyntax.append(str(e))
+
+ if atoms and mytype.endswith("DEPEND"):
+ if runtime and \
+ "test?" in mydepstr.split():
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ "%s: 'test?' USE conditional in %s" %
+ (ebuild.relative_path, mytype))
+
+ for atom in atoms:
+ if atom == "||":
+ continue
+
+ is_blocker = atom.blocker
+
+ # Skip dependency.unknown for blockers, so that we
+ # don't encourage people to remove necessary blockers,
+ # as discussed in bug 382407. We use atom.without_use
+ # due to bug 525376.
+ if not is_blocker and \
+ not self.portdb.xmatch("match-all", atom.without_use) and \
+ not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ if kwargs.get('catdir') != "virtual":
+ if not is_blocker and \
+ atom.cp in suspect_virtual:
+ self.qatracker.add_error(
+ 'virtual.suspect', ebuild.relative_path +
+ ": %s: consider using '%s' instead of '%s'" %
+ (mytype, suspect_virtual[atom.cp], atom))
+ if not is_blocker and \
+ atom.cp.startswith("perl-core/"):
+ self.qatracker.add_error('dependency.perlcore',
+ ebuild.relative_path +
+ ": %s: please use '%s' instead of '%s'" %
+ (mytype,
+ atom.replace("perl-core/","virtual/perl-"),
+ atom))
+
+ if buildtime and \
+ not is_blocker and \
+ not inherited_java_eclass and \
+ atom.cp == "virtual/jdk":
+ self.qatracker.add_error(
+ 'java.eclassesnotused', ebuild.relative_path)
+ elif buildtime and \
+ not is_blocker and \
+ not inherited_wxwidgets_eclass and \
+ atom.cp == "x11-libs/wxGTK":
+ self.qatracker.add_error(
+ 'wxwidgets.eclassnotused',
+ "%s: %ss on x11-libs/wxGTK without inheriting"
+ " wxwidgets.eclass" % (ebuild.relative_path, mytype))
+ elif runtime:
+ if not is_blocker and \
+ atom.cp in suspect_rdepend:
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ ebuild.relative_path + ": '%s'" % atom)
+
+ if atom.operator == "~" and \
+ portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+ qacat = 'dependency.badtilde'
+ self.qatracker.add_error(
+ qacat, "%s: %s uses the ~ operator"
+ " with a non-zero revision: '%s'" %
+ (ebuild.relative_path, mytype, atom))
+
+ check_missingslot(atom, mytype, ebuild.eapi, self.portdb, self.qatracker,
+ ebuild.relative_path, ebuild.metadata)
+
+ type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+ for m, b in zip(type_list, badsyntax):
+ if m.endswith("DEPEND"):
+ qacat = "dependency.syntax"
+ else:
+ qacat = m + ".syntax"
+ self.qatracker.add_error(
+ qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7b07a95..7f770c3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,13 +19,11 @@ from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.check_missingslot import check_missingslot
from repoman.checks.ebuilds.use_flags import USEFlagChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
-from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
from repoman.repos import repo_metadata
from repoman.modules.scan.scan import scan
from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -301,7 +299,7 @@ class Scanner(object):
('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
- ('arches', 'ArchChecks'),
+ ('arches', 'ArchChecks'), ('depend', 'DependChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -358,112 +356,9 @@ class Scanner(object):
badprovsyntax = False
# catpkg = catdir + "/" + y_ebuild
- inherited_java_eclass = "java-pkg-2" in dynamic_data['ebuild'].inherited or \
- "java-pkg-opt-2" in dynamic_data['ebuild'].inherited,
- inherited_wxwidgets_eclass = "wxwidgets" in dynamic_data['ebuild'].inherited
- # operator_tokens = set(["||", "(", ")"])
- type_list, badsyntax = [], []
- for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
- mydepstr = dynamic_data['ebuild'].metadata[mytype]
-
- buildtime = mytype in Package._buildtime_keys
- runtime = mytype in Package._runtime_keys
- token_class = None
- if mytype.endswith("DEPEND"):
- token_class = portage.dep.Atom
-
- try:
- atoms = portage.dep.use_reduce(
- mydepstr, matchall=1, flat=True,
- is_valid_flag=dynamic_data['pkg'].iuse.is_valid_flag, token_class=token_class)
- except portage.exception.InvalidDependString as e:
- atoms = None
- badsyntax.append(str(e))
-
- if atoms and mytype.endswith("DEPEND"):
- if runtime and \
- "test?" in mydepstr.split():
- self.qatracker.add_error(
- mytype + '.suspect',
- "%s: 'test?' USE conditional in %s" %
- (dynamic_data['ebuild'].relative_path, mytype))
-
- for atom in atoms:
- if atom == "||":
- continue
-
- is_blocker = atom.blocker
-
- # Skip dependency.unknown for blockers, so that we
- # don't encourage people to remove necessary blockers,
- # as discussed in bug 382407. We use atom.without_use
- # due to bug 525376.
- if not is_blocker and \
- not self.portdb.xmatch("match-all", atom.without_use) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
- if dynamic_data['catdir'] != "virtual":
- if not is_blocker and \
- atom.cp in suspect_virtual:
- self.qatracker.add_error(
- 'virtual.suspect', dynamic_data['ebuild'].relative_path +
- ": %s: consider using '%s' instead of '%s'" %
- (mytype, suspect_virtual[atom.cp], atom))
- if not is_blocker and \
- atom.cp.startswith("perl-core/"):
- self.qatracker.add_error('dependency.perlcore',
- dynamic_data['ebuild'].relative_path +
- ": %s: please use '%s' instead of '%s'" %
- (mytype,
- atom.replace("perl-core/","virtual/perl-"),
- atom))
-
- if buildtime and \
- not is_blocker and \
- not inherited_java_eclass and \
- atom.cp == "virtual/jdk":
- self.qatracker.add_error(
- 'java.eclassesnotused', dynamic_data['ebuild'].relative_path)
- elif buildtime and \
- not is_blocker and \
- not inherited_wxwidgets_eclass and \
- atom.cp == "x11-libs/wxGTK":
- self.qatracker.add_error(
- 'wxwidgets.eclassnotused',
- "%s: %ss on x11-libs/wxGTK without inheriting"
- " wxwidgets.eclass" % (dynamic_data['ebuild'].relative_path, mytype))
- elif runtime:
- if not is_blocker and \
- atom.cp in suspect_rdepend:
- self.qatracker.add_error(
- mytype + '.suspect',
- dynamic_data['ebuild'].relative_path + ": '%s'" % atom)
-
- if atom.operator == "~" and \
- portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
- qacat = 'dependency.badtilde'
- self.qatracker.add_error(
- qacat, "%s: %s uses the ~ operator"
- " with a non-zero revision: '%s'" %
- (dynamic_data['ebuild'].relative_path, mytype, atom))
-
- check_missingslot(atom, mytype, dynamic_data['ebuild'].eapi, self.portdb, self.qatracker,
- dynamic_data['ebuild'].relative_path, dynamic_data['ebuild'].metadata)
-
- type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
- for m, b in zip(type_list, badsyntax):
- if m.endswith("DEPEND"):
- qacat = "dependency.syntax"
- else:
- qacat = m + ".syntax"
- self.qatracker.add_error(
- qacat, "%s: %s: %s" % (dynamic_data['ebuild'].relative_path, m, b))
-
- badlicsyntax = len([z for z in type_list if z == "LICENSE"])
- badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
- baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
+ badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
+ baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
@@ -626,7 +521,7 @@ class Scanner(object):
# aren't counted for *DEPEND.bad, so we
# ignore them here.
if not atom.blocker:
- unknown_pkgs.discard(
+ dynamic_data['unknown_pkgs'].discard(
(mytype, atom.unevaluated_atom))
if not prof.sub_path:
@@ -671,9 +566,9 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and unknown_pkgs:
+ if not baddepsyntax and dynamic_data['unknown_pkgs']:
type_map = {}
- for mytype, atom in unknown_pkgs:
+ for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
for mytype, atoms in type_map.items():
self.qatracker.add_error(
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: 835b1837ec2406f666c00b70799c10f2f7616f88
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:12 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=835b1837
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index d42fd33..6d5416b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,26 +324,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -449,7 +433,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -539,7 +523,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: bc0f134f0a6ce2bbbbd39806947cd903689d7e73
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:14 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=bc0f134f
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 8 ++
pym/repoman/modules/scan/depend/profile.py | 211 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 227 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 73d3f8f..2dac94b 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index cb2a7c0..9223876 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -194,6 +185,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -291,7 +288,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -319,170 +316,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: a654b5a760b288303f1435cc760d331e38ccb17b
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:09:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:14 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a654b5a7
repoman: Create a new DependUnknown plugin class
pym/repoman/modules/scan/depend/__init__.py | 8 ++++++++
pym/repoman/modules/scan/depend/unknown.py | 30 +++++++++++++++++++++++++++++
pym/repoman/scanner.py | 10 +---------
3 files changed, 39 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index 2dac94b..65555b4 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unknown-module': {
+ 'name': "unknown",
+ 'class': "DependUnknown",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 0000000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ if not baddepsyntax and unknown_pkgs:
+ type_map = {}
+ for mytype, atom in unknown_pkgs:
+ type_map.setdefault(mytype, set()).add(atom)
+ for mytype, atoms in type_map.items():
+ self.qatracker.add_error(
+ "dependency.unknown", "%s: %s: %s"
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 9223876..1cd37d0 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -289,6 +289,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
('options', 'Options'), ('profile', 'ProfileDependsChecks'),
+ ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -316,15 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
- type_map = {}
- for mytype, atom in dynamic_data['unknown_pkgs']:
- type_map.setdefault(mytype, set()).add(atom)
- for mytype, atoms in type_map.items():
- self.qatracker.add_error(
- "dependency.unknown", "%s: %s: %s"
- % (dynamic_data['ebuild'].relative_path, mytype, ", ".join(sorted(atoms))))
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if dynamic_data['allvalid']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-23 1:42 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-23 1:42 UTC (permalink / raw
To: gentoo-commits
commit: 985d6011a1f7d3d79ee3119e7d6b64fe92ce6eb3
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 20:38:11 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 01:28:28 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=985d6011
repoman: New DependChecks class plugin
Migrate code from _scan_ebuilds to the plugin system
pym/repoman/modules/scan/depend/__init__.py | 24 +++++
pym/repoman/modules/scan/depend/depend.py | 132 ++++++++++++++++++++++++++++
pym/repoman/scanner.py | 119 ++-----------------------
3 files changed, 163 insertions(+), 112 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 0000000..ebc716c
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,24 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'depend',
+ 'description': doc,
+ 'provides':{
+ 'depend-module': {
+ 'name': "depend",
+ 'sourcefile': "depend",
+ 'class': "DependChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
+ }
+}
+
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 0000000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+
+ unknown_pkgs = set()
+
+ inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+ "java-pkg-opt-2" in ebuild.inherited,
+ inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+ # operator_tokens = set(["||", "(", ")"])
+ type_list, badsyntax = [], []
+ for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+ mydepstr = ebuild.metadata[mytype]
+
+ buildtime = mytype in Package._buildtime_keys
+ runtime = mytype in Package._runtime_keys
+ token_class = None
+ if mytype.endswith("DEPEND"):
+ token_class = portage.dep.Atom
+
+ try:
+ atoms = portage.dep.use_reduce(
+ mydepstr, matchall=1, flat=True,
+ is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+ except portage.exception.InvalidDependString as e:
+ atoms = None
+ badsyntax.append(str(e))
+
+ if atoms and mytype.endswith("DEPEND"):
+ if runtime and \
+ "test?" in mydepstr.split():
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ "%s: 'test?' USE conditional in %s" %
+ (ebuild.relative_path, mytype))
+
+ for atom in atoms:
+ if atom == "||":
+ continue
+
+ is_blocker = atom.blocker
+
+ # Skip dependency.unknown for blockers, so that we
+ # don't encourage people to remove necessary blockers,
+ # as discussed in bug 382407. We use atom.without_use
+ # due to bug 525376.
+ if not is_blocker and \
+ not self.portdb.xmatch("match-all", atom.without_use) and \
+ not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ if kwargs.get('catdir') != "virtual":
+ if not is_blocker and \
+ atom.cp in suspect_virtual:
+ self.qatracker.add_error(
+ 'virtual.suspect', ebuild.relative_path +
+ ": %s: consider using '%s' instead of '%s'" %
+ (mytype, suspect_virtual[atom.cp], atom))
+ if not is_blocker and \
+ atom.cp.startswith("perl-core/"):
+ self.qatracker.add_error('dependency.perlcore',
+ ebuild.relative_path +
+ ": %s: please use '%s' instead of '%s'" %
+ (mytype,
+ atom.replace("perl-core/","virtual/perl-"),
+ atom))
+
+ if buildtime and \
+ not is_blocker and \
+ not inherited_java_eclass and \
+ atom.cp == "virtual/jdk":
+ self.qatracker.add_error(
+ 'java.eclassesnotused', ebuild.relative_path)
+ elif buildtime and \
+ not is_blocker and \
+ not inherited_wxwidgets_eclass and \
+ atom.cp == "x11-libs/wxGTK":
+ self.qatracker.add_error(
+ 'wxwidgets.eclassnotused',
+ "%s: %ss on x11-libs/wxGTK without inheriting"
+ " wxwidgets.eclass" % (ebuild.relative_path, mytype))
+ elif runtime:
+ if not is_blocker and \
+ atom.cp in suspect_rdepend:
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ ebuild.relative_path + ": '%s'" % atom)
+
+ if atom.operator == "~" and \
+ portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+ qacat = 'dependency.badtilde'
+ self.qatracker.add_error(
+ qacat, "%s: %s uses the ~ operator"
+ " with a non-zero revision: '%s'" %
+ (ebuild.relative_path, mytype, atom))
+
+ check_missingslot(atom, mytype, ebuild.eapi, self.portdb, self.qatracker,
+ ebuild.relative_path, ebuild.metadata)
+
+ type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+ for m, b in zip(type_list, badsyntax):
+ if m.endswith("DEPEND"):
+ qacat = "dependency.syntax"
+ else:
+ qacat = m + ".syntax"
+ self.qatracker.add_error(
+ qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7b07a95..7f770c3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,13 +19,11 @@ from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.check_missingslot import check_missingslot
from repoman.checks.ebuilds.use_flags import USEFlagChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
-from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
from repoman.repos import repo_metadata
from repoman.modules.scan.scan import scan
from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -301,7 +299,7 @@ class Scanner(object):
('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
- ('arches', 'ArchChecks'),
+ ('arches', 'ArchChecks'), ('depend', 'DependChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -358,112 +356,9 @@ class Scanner(object):
badprovsyntax = False
# catpkg = catdir + "/" + y_ebuild
- inherited_java_eclass = "java-pkg-2" in dynamic_data['ebuild'].inherited or \
- "java-pkg-opt-2" in dynamic_data['ebuild'].inherited,
- inherited_wxwidgets_eclass = "wxwidgets" in dynamic_data['ebuild'].inherited
- # operator_tokens = set(["||", "(", ")"])
- type_list, badsyntax = [], []
- for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
- mydepstr = dynamic_data['ebuild'].metadata[mytype]
-
- buildtime = mytype in Package._buildtime_keys
- runtime = mytype in Package._runtime_keys
- token_class = None
- if mytype.endswith("DEPEND"):
- token_class = portage.dep.Atom
-
- try:
- atoms = portage.dep.use_reduce(
- mydepstr, matchall=1, flat=True,
- is_valid_flag=dynamic_data['pkg'].iuse.is_valid_flag, token_class=token_class)
- except portage.exception.InvalidDependString as e:
- atoms = None
- badsyntax.append(str(e))
-
- if atoms and mytype.endswith("DEPEND"):
- if runtime and \
- "test?" in mydepstr.split():
- self.qatracker.add_error(
- mytype + '.suspect',
- "%s: 'test?' USE conditional in %s" %
- (dynamic_data['ebuild'].relative_path, mytype))
-
- for atom in atoms:
- if atom == "||":
- continue
-
- is_blocker = atom.blocker
-
- # Skip dependency.unknown for blockers, so that we
- # don't encourage people to remove necessary blockers,
- # as discussed in bug 382407. We use atom.without_use
- # due to bug 525376.
- if not is_blocker and \
- not self.portdb.xmatch("match-all", atom.without_use) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
- if dynamic_data['catdir'] != "virtual":
- if not is_blocker and \
- atom.cp in suspect_virtual:
- self.qatracker.add_error(
- 'virtual.suspect', dynamic_data['ebuild'].relative_path +
- ": %s: consider using '%s' instead of '%s'" %
- (mytype, suspect_virtual[atom.cp], atom))
- if not is_blocker and \
- atom.cp.startswith("perl-core/"):
- self.qatracker.add_error('dependency.perlcore',
- dynamic_data['ebuild'].relative_path +
- ": %s: please use '%s' instead of '%s'" %
- (mytype,
- atom.replace("perl-core/","virtual/perl-"),
- atom))
-
- if buildtime and \
- not is_blocker and \
- not inherited_java_eclass and \
- atom.cp == "virtual/jdk":
- self.qatracker.add_error(
- 'java.eclassesnotused', dynamic_data['ebuild'].relative_path)
- elif buildtime and \
- not is_blocker and \
- not inherited_wxwidgets_eclass and \
- atom.cp == "x11-libs/wxGTK":
- self.qatracker.add_error(
- 'wxwidgets.eclassnotused',
- "%s: %ss on x11-libs/wxGTK without inheriting"
- " wxwidgets.eclass" % (dynamic_data['ebuild'].relative_path, mytype))
- elif runtime:
- if not is_blocker and \
- atom.cp in suspect_rdepend:
- self.qatracker.add_error(
- mytype + '.suspect',
- dynamic_data['ebuild'].relative_path + ": '%s'" % atom)
-
- if atom.operator == "~" and \
- portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
- qacat = 'dependency.badtilde'
- self.qatracker.add_error(
- qacat, "%s: %s uses the ~ operator"
- " with a non-zero revision: '%s'" %
- (dynamic_data['ebuild'].relative_path, mytype, atom))
-
- check_missingslot(atom, mytype, dynamic_data['ebuild'].eapi, self.portdb, self.qatracker,
- dynamic_data['ebuild'].relative_path, dynamic_data['ebuild'].metadata)
-
- type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
- for m, b in zip(type_list, badsyntax):
- if m.endswith("DEPEND"):
- qacat = "dependency.syntax"
- else:
- qacat = m + ".syntax"
- self.qatracker.add_error(
- qacat, "%s: %s: %s" % (dynamic_data['ebuild'].relative_path, m, b))
-
- badlicsyntax = len([z for z in type_list if z == "LICENSE"])
- badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
- baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
+ badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
+ baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
@@ -626,7 +521,7 @@ class Scanner(object):
# aren't counted for *DEPEND.bad, so we
# ignore them here.
if not atom.blocker:
- unknown_pkgs.discard(
+ dynamic_data['unknown_pkgs'].discard(
(mytype, atom.unevaluated_atom))
if not prof.sub_path:
@@ -671,9 +566,9 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and unknown_pkgs:
+ if not baddepsyntax and dynamic_data['unknown_pkgs']:
type_map = {}
- for mytype, atom in unknown_pkgs:
+ for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
for mytype, atoms in type_map.items():
self.qatracker.add_error(
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-23 1:42 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-23 1:42 UTC (permalink / raw
To: gentoo-commits
commit: 3a9da2c96c9b30c2406405ceb0f527b1c779e404
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 01:36:20 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3a9da2c9
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 9 ++
pym/repoman/modules/scan/depend/profile.py | 211 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 228 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index ebc716c..cddb7f1 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'sourcefile': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index cb2a7c0..9223876 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -194,6 +185,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -291,7 +288,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -319,170 +316,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-27 23:15 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
To: gentoo-commits
commit: df0b6b385eb583a1f9d8d99f5e11c19818366922
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:23 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=df0b6b38
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 335590b..bec943d 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,26 +327,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -452,7 +436,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -542,7 +526,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-27 23:15 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
To: gentoo-commits
commit: 5127cf5187ac4e4f757a9e0036cb5f6ef4d63950
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:25 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5127cf51
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 9 ++
pym/repoman/modules/scan/depend/profile.py | 211 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 228 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index ebc716c..cddb7f1 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'sourcefile': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 50e9752..bd337fc 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -197,6 +188,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -294,7 +291,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -322,170 +319,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-27 23:15 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
To: gentoo-commits
commit: 25876bd8133fefab2c47457d8f89e78f1086370d
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:09:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:25 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=25876bd8
repoman: Create a new DependUnknown plugin class
pym/repoman/modules/scan/depend/__init__.py | 9 +++++++++
pym/repoman/modules/scan/depend/unknown.py | 30 +++++++++++++++++++++++++++++
pym/repoman/scanner.py | 10 +---------
3 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index cddb7f1..9fd7970 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -28,6 +28,15 @@ module_spec = {
'func_desc': {
},
},
+ 'unknown-module': {
+ 'name': "unknown",
+ 'sourcefile': "unknown",
+ 'class': "DependUnknown",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 0000000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ if not baddepsyntax and unknown_pkgs:
+ type_map = {}
+ for mytype, atom in unknown_pkgs:
+ type_map.setdefault(mytype, set()).add(atom)
+ for mytype, atoms in type_map.items():
+ self.qatracker.add_error(
+ "dependency.unknown", "%s: %s: %s"
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index bd337fc..4472f88 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -292,6 +292,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
('options', 'Options'), ('profile', 'ProfileDependsChecks'),
+ ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -319,15 +320,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
- type_map = {}
- for mytype, atom in dynamic_data['unknown_pkgs']:
- type_map.setdefault(mytype, set()).add(atom)
- for mytype, atoms in type_map.items():
- self.qatracker.add_error(
- "dependency.unknown", "%s: %s: %s"
- % (dynamic_data['ebuild'].relative_path, mytype, ", ".join(sorted(atoms))))
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if dynamic_data['allvalid']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-29 5:01 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-29 5:01 UTC (permalink / raw
To: gentoo-commits
commit: bae6413a2eaca04c260bdf31723f4f6a15f2503e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:52:58 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=bae6413a
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 335590b..bec943d 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,26 +327,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -452,7 +436,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -542,7 +526,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-29 5:01 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-29 5:01 UTC (permalink / raw
To: gentoo-commits
commit: 233e41281dad36653b568b0b1dc35bc156dcac1c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:52:59 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=233e4128
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 9 ++
pym/repoman/modules/scan/depend/profile.py | 211 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 228 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index ebc716c..cddb7f1 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'sourcefile': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..91c52cc
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,211 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 50e9752..bd337fc 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -197,6 +188,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -294,7 +291,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -322,170 +319,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-30 8:00 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-30 8:00 UTC (permalink / raw
To: gentoo-commits
commit: bba3caf93818dbe175d4104f2eafe5179d646435
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 07:50:19 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=bba3caf9
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 5c35519..804a3f2 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,26 +327,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -452,7 +436,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -542,7 +526,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-30 8:00 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-30 8:00 UTC (permalink / raw
To: gentoo-commits
commit: 5c902e7d714087284f1ed68f80b588eaf2a00617
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 20:38:11 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 07:50:17 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5c902e7d
repoman: New DependChecks class plugin
Migrate code from _scan_ebuilds to the plugin system.
pym/repoman/modules/scan/depend/__init__.py | 24 +++++
pym/repoman/modules/scan/depend/depend.py | 132 ++++++++++++++++++++++++++++
pym/repoman/scanner.py | 119 ++-----------------------
3 files changed, 163 insertions(+), 112 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
new file mode 100644
index 0000000..ebc716c
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -0,0 +1,24 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman.
+Performs Dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'depend',
+ 'description': doc,
+ 'provides':{
+ 'depend-module': {
+ 'name': "depend",
+ 'sourcefile': "depend",
+ 'class': "DependChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
+ }
+}
+
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
new file mode 100644
index 0000000..8a0ff48
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -0,0 +1,132 @@
+
+from _emerge.Package import Package
+
+from repoman.check_missingslot import check_missingslot
+# import our initialized portage instance
+from repoman._portage import portage
+from repoman.qa_data import suspect_virtual, suspect_rdepend
+
+
+class DependChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+
+ unknown_pkgs = set()
+
+ inherited_java_eclass = "java-pkg-2" in ebuild.inherited or \
+ "java-pkg-opt-2" in ebuild.inherited,
+ inherited_wxwidgets_eclass = "wxwidgets" in ebuild.inherited
+ # operator_tokens = set(["||", "(", ")"])
+ type_list, badsyntax = [], []
+ for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
+ mydepstr = ebuild.metadata[mytype]
+
+ buildtime = mytype in Package._buildtime_keys
+ runtime = mytype in Package._runtime_keys
+ token_class = None
+ if mytype.endswith("DEPEND"):
+ token_class = portage.dep.Atom
+
+ try:
+ atoms = portage.dep.use_reduce(
+ mydepstr, matchall=1, flat=True,
+ is_valid_flag=pkg.iuse.is_valid_flag, token_class=token_class)
+ except portage.exception.InvalidDependString as e:
+ atoms = None
+ badsyntax.append(str(e))
+
+ if atoms and mytype.endswith("DEPEND"):
+ if runtime and \
+ "test?" in mydepstr.split():
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ "%s: 'test?' USE conditional in %s" %
+ (ebuild.relative_path, mytype))
+
+ for atom in atoms:
+ if atom == "||":
+ continue
+
+ is_blocker = atom.blocker
+
+ # Skip dependency.unknown for blockers, so that we
+ # don't encourage people to remove necessary blockers,
+ # as discussed in bug 382407. We use atom.without_use
+ # due to bug 525376.
+ if not is_blocker and \
+ not self.portdb.xmatch("match-all", atom.without_use) and \
+ not atom.cp.startswith("virtual/"):
+ unknown_pkgs.add((mytype, atom.unevaluated_atom))
+
+ if kwargs.get('catdir') != "virtual":
+ if not is_blocker and \
+ atom.cp in suspect_virtual:
+ self.qatracker.add_error(
+ 'virtual.suspect', ebuild.relative_path +
+ ": %s: consider using '%s' instead of '%s'" %
+ (mytype, suspect_virtual[atom.cp], atom))
+ if not is_blocker and \
+ atom.cp.startswith("perl-core/"):
+ self.qatracker.add_error('dependency.perlcore',
+ ebuild.relative_path +
+ ": %s: please use '%s' instead of '%s'" %
+ (mytype,
+ atom.replace("perl-core/","virtual/perl-"),
+ atom))
+
+ if buildtime and \
+ not is_blocker and \
+ not inherited_java_eclass and \
+ atom.cp == "virtual/jdk":
+ self.qatracker.add_error(
+ 'java.eclassesnotused', ebuild.relative_path)
+ elif buildtime and \
+ not is_blocker and \
+ not inherited_wxwidgets_eclass and \
+ atom.cp == "x11-libs/wxGTK":
+ self.qatracker.add_error(
+ 'wxwidgets.eclassnotused',
+ "%s: %ss on x11-libs/wxGTK without inheriting"
+ " wxwidgets.eclass" % (ebuild.relative_path, mytype))
+ elif runtime:
+ if not is_blocker and \
+ atom.cp in suspect_rdepend:
+ self.qatracker.add_error(
+ mytype + '.suspect',
+ ebuild.relative_path + ": '%s'" % atom)
+
+ if atom.operator == "~" and \
+ portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
+ qacat = 'dependency.badtilde'
+ self.qatracker.add_error(
+ qacat, "%s: %s uses the ~ operator"
+ " with a non-zero revision: '%s'" %
+ (ebuild.relative_path, mytype, atom))
+
+ check_missingslot(atom, mytype, ebuild.eapi, self.portdb, self.qatracker,
+ ebuild.relative_path, ebuild.metadata)
+
+ type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
+
+ for m, b in zip(type_list, badsyntax):
+ if m.endswith("DEPEND"):
+ qacat = "dependency.syntax"
+ else:
+ qacat = m + ".syntax"
+ self.qatracker.add_error(
+ qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7a1433a..40aafcc 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -19,13 +19,11 @@ from portage.dep import Atom
from portage.output import green
from repoman.checks.ebuilds.checks import run_checks
from repoman.checks.ebuilds.eclasses.ruby import RubyEclassChecks
-from repoman.check_missingslot import check_missingslot
from repoman.checks.ebuilds.use_flags import USEFlagChecks
from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
-from repoman.qa_data import missingvars, suspect_virtual, suspect_rdepend
from repoman.repos import repo_metadata
from repoman.modules.scan.scan import scan
from repoman.modules.vcs.vcs import vcs_files_to_cps
@@ -304,7 +302,7 @@ class Scanner(object):
('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata'),
('thirdpartymirrors', 'ThirdPartyMirrors'),
('description', 'DescriptionChecks'), (None, 'KeywordChecks'),
- ('arches', 'ArchChecks'),
+ ('arches', 'ArchChecks'), ('depend', 'DependChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -361,112 +359,9 @@ class Scanner(object):
badprovsyntax = False
# catpkg = catdir + "/" + y_ebuild
- inherited_java_eclass = "java-pkg-2" in dynamic_data['ebuild'].inherited or \
- "java-pkg-opt-2" in dynamic_data['ebuild'].inherited,
- inherited_wxwidgets_eclass = "wxwidgets" in dynamic_data['ebuild'].inherited
- # operator_tokens = set(["||", "(", ")"])
- type_list, badsyntax = [], []
- for mytype in Package._dep_keys + ("LICENSE", "PROPERTIES", "PROVIDE"):
- mydepstr = dynamic_data['ebuild'].metadata[mytype]
-
- buildtime = mytype in Package._buildtime_keys
- runtime = mytype in Package._runtime_keys
- token_class = None
- if mytype.endswith("DEPEND"):
- token_class = portage.dep.Atom
-
- try:
- atoms = portage.dep.use_reduce(
- mydepstr, matchall=1, flat=True,
- is_valid_flag=dynamic_data['pkg'].iuse.is_valid_flag, token_class=token_class)
- except portage.exception.InvalidDependString as e:
- atoms = None
- badsyntax.append(str(e))
-
- if atoms and mytype.endswith("DEPEND"):
- if runtime and \
- "test?" in mydepstr.split():
- self.qatracker.add_error(
- mytype + '.suspect',
- "%s: 'test?' USE conditional in %s" %
- (dynamic_data['ebuild'].relative_path, mytype))
-
- for atom in atoms:
- if atom == "||":
- continue
-
- is_blocker = atom.blocker
-
- # Skip dependency.unknown for blockers, so that we
- # don't encourage people to remove necessary blockers,
- # as discussed in bug 382407. We use atom.without_use
- # due to bug 525376.
- if not is_blocker and \
- not self.portdb.xmatch("match-all", atom.without_use) and \
- not atom.cp.startswith("virtual/"):
- unknown_pkgs.add((mytype, atom.unevaluated_atom))
-
- if dynamic_data['catdir'] != "virtual":
- if not is_blocker and \
- atom.cp in suspect_virtual:
- self.qatracker.add_error(
- 'virtual.suspect', dynamic_data['ebuild'].relative_path +
- ": %s: consider using '%s' instead of '%s'" %
- (mytype, suspect_virtual[atom.cp], atom))
- if not is_blocker and \
- atom.cp.startswith("perl-core/"):
- self.qatracker.add_error('dependency.perlcore',
- dynamic_data['ebuild'].relative_path +
- ": %s: please use '%s' instead of '%s'" %
- (mytype,
- atom.replace("perl-core/","virtual/perl-"),
- atom))
-
- if buildtime and \
- not is_blocker and \
- not inherited_java_eclass and \
- atom.cp == "virtual/jdk":
- self.qatracker.add_error(
- 'java.eclassesnotused', dynamic_data['ebuild'].relative_path)
- elif buildtime and \
- not is_blocker and \
- not inherited_wxwidgets_eclass and \
- atom.cp == "x11-libs/wxGTK":
- self.qatracker.add_error(
- 'wxwidgets.eclassnotused',
- "%s: %ss on x11-libs/wxGTK without inheriting"
- " wxwidgets.eclass" % (dynamic_data['ebuild'].relative_path, mytype))
- elif runtime:
- if not is_blocker and \
- atom.cp in suspect_rdepend:
- self.qatracker.add_error(
- mytype + '.suspect',
- dynamic_data['ebuild'].relative_path + ": '%s'" % atom)
-
- if atom.operator == "~" and \
- portage.versions.catpkgsplit(atom.cpv)[3] != "r0":
- qacat = 'dependency.badtilde'
- self.qatracker.add_error(
- qacat, "%s: %s uses the ~ operator"
- " with a non-zero revision: '%s'" %
- (dynamic_data['ebuild'].relative_path, mytype, atom))
-
- check_missingslot(atom, mytype, dynamic_data['ebuild'].eapi, self.portdb, self.qatracker,
- dynamic_data['ebuild'].relative_path, dynamic_data['ebuild'].metadata)
-
- type_list.extend([mytype] * (len(badsyntax) - len(type_list)))
-
- for m, b in zip(type_list, badsyntax):
- if m.endswith("DEPEND"):
- qacat = "dependency.syntax"
- else:
- qacat = m + ".syntax"
- self.qatracker.add_error(
- qacat, "%s: %s: %s" % (dynamic_data['ebuild'].relative_path, m, b))
-
- badlicsyntax = len([z for z in type_list if z == "LICENSE"])
- badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
- baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
+ badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
+ baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
badlicsyntax = badlicsyntax > 0
badprovsyntax = badprovsyntax > 0
@@ -629,7 +524,7 @@ class Scanner(object):
# aren't counted for *DEPEND.bad, so we
# ignore them here.
if not atom.blocker:
- unknown_pkgs.discard(
+ dynamic_data['unknown_pkgs'].discard(
(mytype, atom.unevaluated_atom))
if not prof.sub_path:
@@ -674,9 +569,9 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and unknown_pkgs:
+ if not baddepsyntax and dynamic_data['unknown_pkgs']:
type_map = {}
- for mytype, atom in unknown_pkgs:
+ for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
for mytype, atoms in type_map.items():
self.qatracker.add_error(
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-30 8:00 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-30 8:00 UTC (permalink / raw
To: gentoo-commits
commit: 10c025076814bab93b655bca5557d4c8a717408e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:09:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 07:50:20 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=10c02507
repoman: Create a new DependUnknown plugin class
pym/repoman/modules/scan/depend/__init__.py | 9 +++++++++
pym/repoman/modules/scan/depend/unknown.py | 30 +++++++++++++++++++++++++++++
pym/repoman/scanner.py | 10 +---------
3 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index cddb7f1..9fd7970 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -28,6 +28,15 @@ module_spec = {
'func_desc': {
},
},
+ 'unknown-module': {
+ 'name': "unknown",
+ 'sourcefile': "unknown",
+ 'class': "DependUnknown",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 0000000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ if not baddepsyntax and unknown_pkgs:
+ type_map = {}
+ for mytype, atom in unknown_pkgs:
+ type_map.setdefault(mytype, set()).add(atom)
+ for mytype, atoms in type_map.items():
+ self.qatracker.add_error(
+ "dependency.unknown", "%s: %s: %s"
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 48b60a4..1e61eb6 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -290,6 +290,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
('options', 'Options'), ('profile', 'ProfileDependsChecks'),
+ ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -317,15 +318,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
- type_map = {}
- for mytype, atom in dynamic_data['unknown_pkgs']:
- type_map.setdefault(mytype, set()).add(atom)
- for mytype, atoms in type_map.items():
- self.qatracker.add_error(
- "dependency.unknown", "%s: %s: %s"
- % (dynamic_data['ebuild'].relative_path, mytype, ", ".join(sorted(atoms))))
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if dynamic_data['allvalid']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-31 20:03 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-31 20:03 UTC (permalink / raw
To: gentoo-commits
commit: 19c812ef2693b64f381869cb7f6ef7e00de218a7
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 20:25:22 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=19c812ef
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 8a0ff48..7f1d007 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInPkgs(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1a2de05..467e6e1 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,26 +327,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -452,7 +436,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -542,7 +526,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-01-31 20:03 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-01-31 20:03 UTC (permalink / raw
To: gentoo-commits
commit: 5147b295030ec2b30fa18297bb715d20a05ddd0c
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:09:33 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 20:25:23 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5147b295
repoman: Create a new DependUnknown plugin class
pym/repoman/modules/scan/depend/__init__.py | 9 +++++++++
pym/repoman/modules/scan/depend/unknown.py | 30 +++++++++++++++++++++++++++++
pym/repoman/scanner.py | 10 +---------
3 files changed, 40 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index cddb7f1..9fd7970 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -28,6 +28,15 @@ module_spec = {
'func_desc': {
},
},
+ 'unknown-module': {
+ 'name': "unknown",
+ 'sourcefile': "unknown",
+ 'class': "DependUnknown",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/unknown.py b/pym/repoman/modules/scan/depend/unknown.py
new file mode 100644
index 0000000..61d51b9
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/unknown.py
@@ -0,0 +1,30 @@
+# -*- coding:utf-8 -*-
+
+
+class DependUnknown(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ if not baddepsyntax and unknown_pkgs:
+ type_map = {}
+ for mytype, atom in unknown_pkgs:
+ type_map.setdefault(mytype, set()).add(atom)
+ for mytype, atoms in type_map.items():
+ self.qatracker.add_error(
+ "dependency.unknown", "%s: %s: %s"
+ % (ebuild.relative_path, mytype, ", ".join(sorted(atoms))))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b82cefb..ca1de5f 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -290,6 +290,7 @@ class Scanner(object):
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
('options', 'Options'), ('profile', 'ProfileDependsChecks'),
+ ('unknown', 'DependUnknown'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -317,15 +318,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
- type_map = {}
- for mytype, atom in dynamic_data['unknown_pkgs']:
- type_map.setdefault(mytype, set()).add(atom)
- for mytype, atoms in type_map.items():
- self.qatracker.add_error(
- "dependency.unknown", "%s: %s: %s"
- % (dynamic_data['ebuild'].relative_path, mytype, ", ".join(sorted(atoms))))
-
# check if there are unused local USE-descriptions in metadata.xml
# (unless there are any invalids, to avoid noise)
if dynamic_data['allvalid']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-03-07 21:53 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-03-07 21:53 UTC (permalink / raw
To: gentoo-commits
commit: 4b25757dc8ebc42e276b07aa190a21682963a35a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Mar 7 21:21:18 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4b25757d
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 9 ++
pym/repoman/modules/scan/depend/profile.py | 207 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 224 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index ebc716c..cddb7f1 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'sourcefile': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..db63b1c
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,207 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 2625de4..b82cefb 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -197,6 +188,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -292,7 +289,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -320,170 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-03-11 0:41 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-03-11 0:41 UTC (permalink / raw
To: gentoo-commits
commit: c321436d447ba568f295968c0cfbb47c12de03d8
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 10 23:47:35 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c321436d
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 4cb8709..2f90eee 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInEbuilds(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index cb1f42f..1086a75 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,26 +327,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -452,7 +436,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -542,7 +526,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-03-11 0:41 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-03-11 0:41 UTC (permalink / raw
To: gentoo-commits
commit: 54b46224d6ce576e7c3c17aaef6083bd6c1e4a72
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 10 23:47:35 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=54b46224
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 9 ++
pym/repoman/modules/scan/depend/profile.py | 207 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 224 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index ebc716c..cddb7f1 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'sourcefile': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..db63b1c
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,207 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 88eaa4b..c1f5751 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -197,6 +188,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -292,7 +289,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -320,170 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-03-12 18:10 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
To: gentoo-commits
commit: 9d952e139ebccbed765c7ce9516cb10d9ce99432
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 21:19:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 17:57:37 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9d952e13
repoman: Migrate some additional Dependency code to the plugin
pym/repoman/modules/scan/depend/depend.py | 13 ++++++++++++-
pym/repoman/scanner.py | 22 +++-------------------
2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/depend.py b/pym/repoman/modules/scan/depend/depend.py
index 4cb8709..2f90eee 100644
--- a/pym/repoman/modules/scan/depend/depend.py
+++ b/pym/repoman/modules/scan/depend/depend.py
@@ -1,3 +1,5 @@
+# -*- coding:utf-8 -*-
+
from _emerge.Package import Package
@@ -121,7 +123,16 @@ class DependChecks(object):
qacat = m + ".syntax"
self.qatracker.add_error(
qacat, "%s: %s: %s" % (ebuild.relative_path, m, b))
- return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list}
+
+ # data required for some other tests
+ badlicsyntax = len([z for z in type_list if z == "LICENSE"])
+ badprovsyntax = len([z for z in type_list if z == "PROVIDE"])
+ baddepsyntax = len(type_list) != badlicsyntax + badprovsyntax
+ badlicsyntax = badlicsyntax > 0
+ #badprovsyntax = badprovsyntax > 0
+
+ return {'continue': False, 'unknown_pkgs': unknown_pkgs, 'type_list': type_list,
+ 'badlicsyntax': badlicsyntax, 'baddepsyntax': baddepsyntax}
@property
def runInEbuilds(self):
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index cb1f42f..1086a75 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,26 +327,10 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
- self.liveeclasscheck.check(
- dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
-
- unknown_pkgs = set()
- baddepsyntax = False
- badlicsyntax = False
- badprovsyntax = False
- # catpkg = catdir + "/" + y_ebuild
-
- badlicsyntax = len([z for z in dynamic_data['type_list'] if z == "LICENSE"])
- badprovsyntax = len([z for z in dynamic_data['type_list'] if z == "PROVIDE"])
- baddepsyntax = len(dynamic_data['type_list']) != badlicsyntax + badprovsyntax
- badlicsyntax = badlicsyntax > 0
- badprovsyntax = badprovsyntax > 0
-
used_useflags = used_useflags.union(dynamic_data['ebuild_UsedUseFlags'])
# license checks
- if not badlicsyntax:
+ if not dynamic_data['badlicsyntax']:
self.licensecheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
self.restrictcheck.check(dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild)
@@ -452,7 +436,7 @@ class Scanner(object):
dep_settings.usemask = dep_settings._use_manager.getUseMask(
dynamic_data['pkg'], stable=dep_settings._parent_stable)
- if not baddepsyntax:
+ if not dynamic_data['baddepsyntax']:
ismasked = not dynamic_data['ebuild'].archs or \
dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
@@ -542,7 +526,7 @@ class Scanner(object):
% (dynamic_data['ebuild'].relative_path, mytype, keyword,
prof, pformat(atoms, indent=6)))
- if not baddepsyntax and dynamic_data['unknown_pkgs']:
+ if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
type_map.setdefault(mytype, set()).add(atom)
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/
@ 2016-03-12 18:10 Brian Dolbec
0 siblings, 0 replies; 36+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
To: gentoo-commits
commit: 227a0f19a000a39a419ac9abf6677536e05f6cb6
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 07:57:36 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 17:57:38 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=227a0f19
repoman: Move the large depency checks loop to a new plugin ProfileDependsChecks class
pym/repoman/modules/scan/depend/__init__.py | 9 ++
pym/repoman/modules/scan/depend/profile.py | 207 ++++++++++++++++++++++++++++
pym/repoman/repos.py | 1 +
pym/repoman/scanner.py | 181 +-----------------------
4 files changed, 224 insertions(+), 174 deletions(-)
diff --git a/pym/repoman/modules/scan/depend/__init__.py b/pym/repoman/modules/scan/depend/__init__.py
index ebc716c..cddb7f1 100644
--- a/pym/repoman/modules/scan/depend/__init__.py
+++ b/pym/repoman/modules/scan/depend/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
'func_desc': {
},
},
+ 'profile-module': {
+ 'name': "profile",
+ 'sourcefile': "profile",
+ 'class': "ProfileDependsChecks",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/depend/profile.py b/pym/repoman/modules/scan/depend/profile.py
new file mode 100644
index 0000000..db63b1c
--- /dev/null
+++ b/pym/repoman/modules/scan/depend/profile.py
@@ -0,0 +1,207 @@
+# -*- coding:utf-8 -*-
+
+
+import copy
+from pprint import pformat
+
+from _emerge.Package import Package
+
+# import our initialized portage instance
+from repoman._portage import portage
+from portage.dep import Atom
+
+
+def sort_key(item):
+ return item[2].sub_path
+
+
+class ProfileDependsChecks(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+ self.portdb = kwargs.get('portdb')
+ self.profiles = kwargs.get('profiles')
+ self.options = kwargs.get('options')
+ self.repo_settings = kwargs.get('repo_settings')
+ self.include_arches = kwargs.get('include_arches')
+ self.caches = kwargs.get('caches')
+ self.repoman_incrementals = kwargs.get('repoman_incrementals')
+ self.env = kwargs.get('env')
+ self.have = kwargs.get('have')
+ self.dev_keywords = kwargs.get('dev_keywords')
+
+ def check(self, **kwargs):
+ arches = kwargs.get('arches')
+ ebuild = kwargs.get('ebuild')
+ pkg = kwargs.get('pkg')
+ baddepsyntax = kwargs.get('baddepsyntax')
+ unknown_pkgs = kwargs.get('unknown_pkgs')
+
+ relevant_profiles = []
+ for keyword, arch, groups in arches:
+ if arch not in self.profiles:
+ # A missing profile will create an error further down
+ # during the KEYWORDS verification.
+ continue
+
+ if self.include_arches is not None:
+ if arch not in self.include_arches:
+ continue
+
+ relevant_profiles.extend(
+ (keyword, groups, prof) for prof in self.profiles[arch])
+
+ relevant_profiles.sort(key=sort_key)
+
+ for keyword, groups, prof in relevant_profiles:
+
+ is_stable_profile = prof.status == "stable"
+ is_dev_profile = prof.status == "dev" and \
+ self.options.include_dev
+ is_exp_profile = prof.status == "exp" and \
+ self.options.include_exp_profiles == 'y'
+ if not (is_stable_profile or is_dev_profile or is_exp_profile):
+ continue
+
+ dep_settings = self.caches['arch'].get(prof.sub_path)
+ if dep_settings is None:
+ dep_settings = portage.config(
+ config_profile_path=prof.abs_path,
+ config_incrementals=self.repoman_incrementals,
+ config_root=self.repo_settings.config_root,
+ local_config=False,
+ _unmatched_removal=self.options.unmatched_removal,
+ env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
+ dep_settings.categories = self.repo_settings.repoman_settings.categories
+ if self.options.without_mask:
+ dep_settings._mask_manager_obj = \
+ copy.deepcopy(dep_settings._mask_manager)
+ dep_settings._mask_manager._pmaskdict.clear()
+ self.caches['arch'][prof.sub_path] = dep_settings
+
+ xmatch_cache_key = (prof.sub_path, tuple(groups))
+ xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
+ if xcache is None:
+ self.portdb.melt()
+ self.portdb.freeze()
+ xcache = self.portdb.xcache
+ xcache.update(self.caches['shared_xmatch'])
+ self.caches['arch_xmatch'][xmatch_cache_key] = xcache
+
+ self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
+ self.portdb.settings = dep_settings
+ self.portdb.xcache = xcache
+
+ dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
+ # just in case, prevent config.reset() from nuking these.
+ dep_settings.backup_changes("ACCEPT_KEYWORDS")
+
+ # This attribute is used in dbapi._match_use() to apply
+ # use.stable.{mask,force} settings based on the stable
+ # status of the parent package. This is required in order
+ # for USE deps of unstable packages to be resolved correctly,
+ # since otherwise use.stable.{mask,force} settings of
+ # dependencies may conflict (see bug #456342).
+ dep_settings._parent_stable = dep_settings._isStable(pkg)
+
+ # Handle package.use*.{force,mask) calculation, for use
+ # in dep_check.
+ dep_settings.useforce = dep_settings._use_manager.getUseForce(
+ pkg, stable=dep_settings._parent_stable)
+ dep_settings.usemask = dep_settings._use_manager.getUseMask(
+ pkg, stable=dep_settings._parent_stable)
+
+ if not baddepsyntax:
+ ismasked = not ebuild.archs or \
+ pkg.cpv not in self.portdb.xmatch("match-visible",
+ Atom("%s::%s" % (pkg.cp, self.repo_settings.repo_config.name)))
+ if ismasked:
+ if not self.have['pmasked']:
+ self.have['pmasked'] = bool(dep_settings._getMaskAtom(
+ pkg.cpv, ebuild.metadata))
+ if self.options.ignore_masked:
+ continue
+ # we are testing deps for a masked package; give it some lee-way
+ suffix = "masked"
+ matchmode = "minimum-all-ignore-profile"
+ else:
+ suffix = ""
+ matchmode = "minimum-visible"
+
+ if not self.have['dev_keywords']:
+ self.have['dev_keywords'] = \
+ bool(self.dev_keywords.intersection(ebuild.keywords))
+
+ if prof.status == "dev":
+ suffix = suffix + "indev"
+
+ for mytype in Package._dep_keys:
+
+ mykey = "dependency.bad" + suffix
+ myvalue = ebuild.metadata[mytype]
+ if not myvalue:
+ continue
+
+ success, atoms = portage.dep_check(
+ myvalue, self.portdb, dep_settings,
+ use="all", mode=matchmode, trees=self.repo_settings.trees)
+
+ if success:
+ if atoms:
+
+ # Don't bother with dependency.unknown for
+ # cases in which *DEPEND.bad is triggered.
+ for atom in atoms:
+ # dep_check returns all blockers and they
+ # aren't counted for *DEPEND.bad, so we
+ # ignore them here.
+ if not atom.blocker:
+ unknown_pkgs.discard(
+ (mytype, atom.unevaluated_atom))
+
+ if not prof.sub_path:
+ # old-style virtuals currently aren't
+ # resolvable with empty profile, since
+ # 'virtuals' mappings are unavailable
+ # (it would be expensive to search
+ # for PROVIDE in all ebuilds)
+ atoms = [
+ atom for atom in atoms if not (
+ atom.cp.startswith('virtual/')
+ and not self.portdb.cp_list(atom.cp))]
+
+ # we have some unsolvable deps
+ # remove ! deps, which always show up as unsatisfiable
+ atoms = [
+ str(atom.unevaluated_atom)
+ for atom in atoms if not atom.blocker]
+
+ # if we emptied out our list, continue:
+ if not atoms:
+ continue
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ else:
+ if self.options.output_style in ['column']:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s) %s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, repr(atoms)))
+ else:
+ self.qatracker.add_error(mykey,
+ "%s: %s: %s(%s)\n%s"
+ % (ebuild.relative_path, mytype, keyword,
+ prof, pformat(atoms, indent=6)))
+ return {'continue': False}
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/repos.py b/pym/repoman/repos.py
index a34f785..39f53c1 100644
--- a/pym/repoman/repos.py
+++ b/pym/repoman/repos.py
@@ -28,6 +28,7 @@ class RepoSettings(object):
self, config_root, portdir, portdir_overlay,
repoman_settings=None, vcs_settings=None, options=None,
qawarnings=None):
+ self.config_root = config_root
self.repoman_settings = repoman_settings
self.vcs_settings = vcs_settings
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 88eaa4b..c1f5751 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -2,17 +2,12 @@
from __future__ import print_function, unicode_literals
-import copy
import logging
from itertools import chain
-from pprint import pformat
-
-from _emerge.Package import Package
import portage
from portage import normalize_path
from portage import os
-from portage.dep import Atom
from portage.output import green
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
@@ -33,10 +28,6 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-def sort_key(item):
- return item[2].sub_path
-
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -197,6 +188,12 @@ class Scanner(object):
"checks": self.checks,
"repo_metadata": self.repo_metadata,
"profiles": self.profiles,
+ "include_arches": self.include_arches,
+ "caches": self.caches,
+ "repoman_incrementals": self.repoman_incrementals,
+ "env": self.env,
+ "have": self.have,
+ "dev_keywords": self.dev_keywords,
}
# initialize the plugin checks here
self.modules = {}
@@ -292,7 +289,7 @@ class Scanner(object):
('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
('mtime', 'MtimeChecks'), ('multicheck', 'MultiCheck'),
# Options.is_forced() is used to bypass further checks
- ('options', 'Options'),
+ ('options', 'Options'), ('profile', 'ProfileDependsChecks'),
]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -320,170 +317,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- relevant_profiles = []
- for keyword, arch, groups in dynamic_data['arches']:
- if arch not in self.profiles:
- # A missing profile will create an error further down
- # during the KEYWORDS verification.
- continue
-
- if self.include_arches is not None:
- if arch not in self.include_arches:
- continue
-
- relevant_profiles.extend(
- (keyword, groups, prof) for prof in self.profiles[arch])
-
- relevant_profiles.sort(key=sort_key)
-
- for keyword, groups, prof in relevant_profiles:
-
- is_stable_profile = prof.status == "stable"
- is_dev_profile = prof.status == "dev" and \
- self.options.include_dev
- is_exp_profile = prof.status == "exp" and \
- self.options.include_exp_profiles == 'y'
- if not (is_stable_profile or is_dev_profile or is_exp_profile):
- continue
-
- dep_settings = self.caches['arch'].get(prof.sub_path)
- if dep_settings is None:
- dep_settings = portage.config(
- config_profile_path=prof.abs_path,
- config_incrementals=self.repoman_incrementals,
- config_root=self.config_root,
- local_config=False,
- _unmatched_removal=self.options.unmatched_removal,
- env=self.env, repositories=self.repo_settings.repoman_settings.repositories)
- dep_settings.categories = self.repo_settings.repoman_settings.categories
- if self.options.without_mask:
- dep_settings._mask_manager_obj = \
- copy.deepcopy(dep_settings._mask_manager)
- dep_settings._mask_manager._pmaskdict.clear()
- self.caches['arch'][prof.sub_path] = dep_settings
-
- xmatch_cache_key = (prof.sub_path, tuple(groups))
- xcache = self.caches['arch_xmatch'].get(xmatch_cache_key)
- if xcache is None:
- self.portdb.melt()
- self.portdb.freeze()
- xcache = self.portdb.xcache
- xcache.update(self.caches['shared_xmatch'])
- self.caches['arch_xmatch'][xmatch_cache_key] = xcache
-
- self.repo_settings.trees[self.repo_settings.root]["porttree"].settings = dep_settings
- self.portdb.settings = dep_settings
- self.portdb.xcache = xcache
-
- dep_settings["ACCEPT_KEYWORDS"] = " ".join(groups)
- # just in case, prevent config.reset() from nuking these.
- dep_settings.backup_changes("ACCEPT_KEYWORDS")
-
- # This attribute is used in dbapi._match_use() to apply
- # use.stable.{mask,force} settings based on the stable
- # status of the parent package. This is required in order
- # for USE deps of unstable packages to be resolved correctly,
- # since otherwise use.stable.{mask,force} settings of
- # dependencies may conflict (see bug #456342).
- dep_settings._parent_stable = dep_settings._isStable(dynamic_data['pkg'])
-
- # Handle package.use*.{force,mask) calculation, for use
- # in dep_check.
- dep_settings.useforce = dep_settings._use_manager.getUseForce(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
- dep_settings.usemask = dep_settings._use_manager.getUseMask(
- dynamic_data['pkg'], stable=dep_settings._parent_stable)
-
- if not dynamic_data['baddepsyntax']:
- ismasked = not dynamic_data['ebuild'].archs or \
- dynamic_data['pkg'].cpv not in self.portdb.xmatch("match-visible",
- Atom("%s::%s" % (dynamic_data['pkg'].cp, self.repo_settings.repo_config.name)))
- if ismasked:
- if not self.have['pmasked']:
- self.have['pmasked'] = bool(dep_settings._getMaskAtom(
- dynamic_data['pkg'].cpv, dynamic_data['pkg']._metadata))
- if self.options.ignore_masked:
- continue
- # we are testing deps for a masked package; give it some lee-way
- suffix = "masked"
- matchmode = "minimum-all-ignore-profile"
- else:
- suffix = ""
- matchmode = "minimum-visible"
-
- if not self.have['dev_keywords']:
- self.have['dev_keywords'] = \
- bool(self.dev_keywords.intersection(dynamic_data['ebuild'].keywords))
-
- if prof.status == "dev":
- suffix = suffix + "indev"
-
- for mytype in Package._dep_keys:
-
- mykey = "dependency.bad" + suffix
- myvalue = dynamic_data['ebuild'].metadata[mytype]
- if not myvalue:
- continue
-
- success, atoms = portage.dep_check(
- myvalue, self.portdb, dep_settings,
- use="all", mode=matchmode, trees=self.repo_settings.trees)
-
- if success:
- if atoms:
-
- # Don't bother with dependency.unknown for
- # cases in which *DEPEND.bad is triggered.
- for atom in atoms:
- # dep_check returns all blockers and they
- # aren't counted for *DEPEND.bad, so we
- # ignore them here.
- if not atom.blocker:
- dynamic_data['unknown_pkgs'].discard(
- (mytype, atom.unevaluated_atom))
-
- if not prof.sub_path:
- # old-style virtuals currently aren't
- # resolvable with empty profile, since
- # 'virtuals' mappings are unavailable
- # (it would be expensive to search
- # for PROVIDE in all ebuilds)
- atoms = [
- atom for atom in atoms if not (
- atom.cp.startswith('virtual/')
- and not self.portdb.cp_list(atom.cp))]
-
- # we have some unsolvable deps
- # remove ! deps, which always show up as unsatisfiable
- atoms = [
- str(atom.unevaluated_atom)
- for atom in atoms if not atom.blocker]
-
- # if we emptied out our list, continue:
- if not atoms:
- continue
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
- else:
- if self.options.output_style in ['column']:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s) %s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, repr(atoms)))
- else:
- self.qatracker.add_error(mykey,
- "%s: %s: %s(%s)\n%s"
- % (dynamic_data['ebuild'].relative_path, mytype, keyword,
- prof, pformat(atoms, indent=6)))
-
if not dynamic_data['baddepsyntax'] and dynamic_data['unknown_pkgs']:
type_map = {}
for mytype, atom in dynamic_data['unknown_pkgs']:
^ permalink raw reply related [flat|nested] 36+ messages in thread
end of thread, other threads:[~2016-03-12 18:10 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-10 20:17 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/depend/ Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2016-03-12 18:10 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-11 0:41 Brian Dolbec
2016-03-11 0:41 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-29 5:01 Brian Dolbec
2016-01-29 5:01 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-23 1:42 Brian Dolbec
2016-01-23 1:42 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-21 19:42 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-11 8:01 Brian Dolbec
2016-01-11 8:01 Brian Dolbec
2016-01-11 6:31 Brian Dolbec
2016-01-11 6:31 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 3:26 Brian Dolbec
2016-01-06 4:21 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox