aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-07-15 00:18:32 +0000
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:16 -0700
commita29c7f469a11739a77030bdc7a6f9dbc40e70511 (patch)
tree5b3f1c2fadca6ada0dcbb4a1a96ac8e1c76894cb
parentrepoman: New linechecks module, assignment (diff)
downloadportage-a29c7f469a11739a77030bdc7a6f9dbc40e70511.tar.gz
portage-a29c7f469a11739a77030bdc7a6f9dbc40e70511.tar.bz2
portage-a29c7f469a11739a77030bdc7a6f9dbc40e70511.zip
repoman: New linechecks module, depend
-rw-r--r--repoman/pym/repoman/modules/linechecks/depend/__init__.py21
-rw-r--r--repoman/pym/repoman/modules/linechecks/depend/implicit.py39
2 files changed, 60 insertions, 0 deletions
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'