public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/depend/
@ 2017-07-15  2:08 Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2017-07-15  2:08 UTC (permalink / raw
  To: gentoo-commits

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'


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/depend/
@ 2017-07-15  2:29 Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2017-07-15  2:29 UTC (permalink / raw
  To: gentoo-commits

commit:     bfb7f2160ff12dc4757e2dde898cae55f22ff144
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:25:44 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=bfb7f216

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'


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-15  2:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-15  2:08 [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/depend/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2017-07-15  2:29 Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox