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/phases/
@ 2017-07-15  2:08 Brian Dolbec
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Dolbec @ 2017-07-15  2:08 UTC (permalink / raw
  To: gentoo-commits

commit:     02e9290a239b966fcab16156f5ad29c6e8b7ed94
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jul 15 02:08:28 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=02e9290a

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

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

commit:     b57fc8a0c1f608aebbec5e22fcda25c236f71b72
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 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=b57fc8a0

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/phases/
@ 2017-09-11 21:43 Brian Dolbec
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Dolbec @ 2017-09-11 21:43 UTC (permalink / raw
  To: gentoo-commits

commit:     a5f301f50d4172dd1db16b916c4ef62727ba01bc
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 16:13:15 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a5f301f5

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/phases/
@ 2017-11-26 17:46 Brian Dolbec
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Dolbec @ 2017-11-26 17:46 UTC (permalink / raw
  To: gentoo-commits

commit:     813b76bc1fc9704e5ed2e2d816072862c10cbfce
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Nov 26 17:32:19 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=813b76bc

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/phases/
@ 2017-12-05 18:32 Brian Dolbec
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Dolbec @ 2017-12-05 18:32 UTC (permalink / raw
  To: gentoo-commits

commit:     9d15953ea3e4d59dd17d286066df5f9945c0af19
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Dec  5 18:24:48 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=9d15953e

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/phases/
@ 2017-12-06  0:16 Brian Dolbec
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Dolbec @ 2017-12-06  0:16 UTC (permalink / raw
  To: gentoo-commits

commit:     1f71fd1c7ddb9e0a05db678e8b127716f00432ff
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Dec  6 00:13:27 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=1f71fd1c

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/phases/
@ 2018-03-29 21:35 Brian Dolbec
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Dolbec @ 2018-03-29 21:35 UTC (permalink / raw
  To: gentoo-commits

commit:     b05011a66a3f3275d81f0042fe5825fbec09985e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 29 20:43:39 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b05011a6

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/phases/
@ 2018-03-30  0:48 Brian Dolbec
  0 siblings, 0 replies; 9+ messages in thread
From: Brian Dolbec @ 2018-03-30  0:48 UTC (permalink / raw
  To: gentoo-commits

commit:     2500cb29f76c26df359ec3bca92cca36aec3a364
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 00:43:45 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2500cb29

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/phases/
  2018-03-30  4:23 [gentoo-commits] proj/portage:master " Zac Medico
@ 2018-03-30  5:20 ` Zac Medico
  0 siblings, 0 replies; 9+ messages in thread
From: Zac Medico @ 2018-03-30  5:20 UTC (permalink / raw
  To: gentoo-commits

commit:     e464717923ee7bf37c75a0587a8643a569d65068
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:03:33 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 03:51:18 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e4647179

repoman: New linechecks module, phases

 .../repoman/modules/linechecks/phases/__init__.py  | 34 +++++++++++
 .../pym/repoman/modules/linechecks/phases/phase.py | 71 ++++++++++++++++++++++
 2 files changed, 105 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/phases/__init__.py b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
new file mode 100644
index 000000000..476443b25
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/__init__.py
@@ -0,0 +1,34 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Phases plug-in module for repoman LineChecks.
+Performs phase dependant checks on ebuilds using a PhaseCheck base class.
+"""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'emakeparallel-check': {
+			'name': "emakeparallel",
+			'sourcefile': "phase",
+			'class': "EMakeParallelDisabled",
+			'description': doc,
+		},
+		'srccompileeconf-check': {
+			'name': "srccompileeconf",
+			'sourcefile': "phase",
+			'class': "SrcCompileEconf",
+			'description': doc,
+		},
+		'srcunpackpatches-check': {
+			'name': "srcunpackpatches",
+			'sourcefile': "phase",
+			'class': "SrcUnpackPatches",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/phases/phase.py b/repoman/pym/repoman/modules/linechecks/phases/phase.py
new file mode 100644
index 000000000..acc3a1e1d
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/phases/phase.py
@@ -0,0 +1,71 @@
+
+import re
+
+from portage.eapi import eapi_has_src_prepare_and_src_configure
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PhaseCheck(LineCheck):
+	""" basic class for function detection """
+
+	func_end_re = re.compile(r'^\}$')
+	phases_re = re.compile('(%s)' % '|'.join((
+		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
+		'src_configure', 'src_compile', 'src_test', 'src_install',
+		'pkg_preinst', 'pkg_postinst', 'pkg_prerm', 'pkg_postrm',
+		'pkg_config')))
+	in_phase = ''
+
+	def check(self, num, line):
+		m = self.phases_re.match(line)
+		if m is not None:
+			self.in_phase = m.group(1)
+		if self.in_phase != '' and self.func_end_re.match(line) is not None:
+			self.in_phase = ''
+
+		return self.phase_check(num, line)
+
+	def phase_check(self, num, line):
+		""" override this function for your checks """
+		pass
+
+
+class EMakeParallelDisabled(PhaseCheck):
+	"""Check for emake -j1 calls which disable parallelization."""
+	repoman_check_name = 'upstream.workaround'
+	re = re.compile(r'^\s*emake\s+.*-j\s*1\b')
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile' or self.in_phase == 'src_install':
+			if self.re.match(line):
+				return self.errors['EMAKE_PARALLEL_DISABLED']
+
+
+class SrcCompileEconf(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	configure_re = re.compile(r'\s(econf|./configure)')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_compile':
+			m = self.configure_re.match(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_configure from line: %d"
+
+
+class SrcUnpackPatches(PhaseCheck):
+	repoman_check_name = 'ebuild.minorsyn'
+	src_prepare_tools_re = re.compile(r'\s(e?patch|sed)\s')
+
+	def check_eapi(self, eapi):
+		return eapi_has_src_prepare_and_src_configure(eapi)
+
+	def phase_check(self, num, line):
+		if self.in_phase == 'src_unpack':
+			m = self.src_prepare_tools_re.search(line)
+			if m is not None:
+				return ("'%s'" % m.group(1)) + \
+					" call should be moved to src_prepare from line: %d"


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

end of thread, other threads:[~2018-03-30  5:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-06  0:16 [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/phases/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2018-03-30  4:23 [gentoo-commits] proj/portage:master " Zac Medico
2018-03-30  5:20 ` [gentoo-commits] proj/portage:repoman " Zac Medico
2018-03-30  0:48 Brian Dolbec
2018-03-29 21:35 Brian Dolbec
2017-12-05 18:32 Brian Dolbec
2017-11-26 17:46 Brian Dolbec
2017-09-11 21:43 Brian Dolbec
2017-07-15  2:29 Brian Dolbec
2017-07-15  2:08 Brian Dolbec

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