commit: 7b3ccaa509959f2b61902aef6e21fb22301f9ba5
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 00:18:32 2017 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jul 15 02:08:27 2017 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7b3ccaa5
repoman: New linechecks module, depend
.../repoman/modules/linechecks/depend/__init__.py | 21 ++++++++++++
.../repoman/modules/linechecks/depend/implicit.py | 39 ++++++++++++++++++++++
2 files changed, 60 insertions(+)
diff --git a/repoman/pym/repoman/modules/linechecks/depend/__init__.py
b/repoman/pym/repoman/modules/linechecks/depend/__init__.py
new file mode 100644
index 000000000..e564948c5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/depend/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Depend plug-in module for repoman LineChecks.
+Performs dependency checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'depend',
+ 'description': doc,
+ 'provides':{
+ 'implicit-check': {
+ 'name': "implicitdepend",
+ 'sourcefile': "implicit",
+ 'class': "ImplicitRuntimeDeps",
+ 'description': doc,
+ },
+ }
+}
+
diff --git a/repoman/pym/repoman/modules/linechecks/depend/implicit.py
b/repoman/pym/repoman/modules/linechecks/depend/implicit.py
new file mode 100644
index 000000000..f7b458b68
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/depend/implicit.py
@@ -0,0 +1,39 @@
+
+import re
+
+from portage.eapi import eapi_has_implicit_rdepend
+from repoman.modules.linechecks.base import LineCheck
+
+
+class ImplicitRuntimeDeps(LineCheck):
+ """
+ Detect the case where DEPEND is set and RDEPEND is unset in the ebuild,
+ since this triggers implicit RDEPEND=$DEPEND assignment (prior to EAPI
4).
+ """
+
+ repoman_check_name = 'RDEPEND.implicit'
+ _assignment_re = re.compile(r'^\s*(R?DEPEND)\+?=')
+
+ def new(self, pkg):
+ self._rdepend = False
+ self._depend = False
+
+ def check_eapi(self, eapi):
+ # Beginning with EAPI 4, there is no
+ # implicit RDEPEND=$DEPEND assignment
+ # to be concerned with.
+ return eapi_has_implicit_rdepend(eapi)
+
+ def check(self, num, line):
+ if not self._rdepend:
+ m = self._assignment_re.match(line)
+ if m is None:
+ pass
+ elif m.group(1) == "RDEPEND":
+ self._rdepend = True
+ elif m.group(1) == "DEPEND":
+ self._depend = True
+
+ def end(self):
+ if self._depend and not self._rdepend:
+ yield 'RDEPEND is not explicitly assigned'