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/portage/
@ 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:     8182cd235e8f246676825d05c389c9d0a96fa77c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 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=8182cd23

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/
@ 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:     0c847b8470903b896bc4bb06ae8184987b1f6719
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jul 15 02:25:45 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0c847b84

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/
@ 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:     656a979fc092abdffff1ce68b5eb26faadbdad41
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 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=656a979f

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/
@ 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:     7a51d6b3bfbb18e8bd2ae5c8f7b749e361c5aa8d
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 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=7a51d6b3

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/
@ 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:     cfcba8722c375e4402069882b89cf4bab384812a
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Dec  5 18:24:49 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cfcba872

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/
@ 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:     b6243511e8294226837e75a5449960c649ad258e
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 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=b6243511

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/
@ 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:     266089a5eb062d276c8792c8aa6f1be03b9270a6
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 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=266089a5

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/
@ 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:     ee1a1b4621b2a276d228014a57d4a25ca90575b0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 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=ee1a1b46

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/
@ 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:     3ea468dde4de8ec14c9da1dd6d522a31cc443851
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:04:00 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=3ea468dd

repoman: New linechecks module, portage

 .../repoman/modules/linechecks/portage/__init__.py | 27 ++++++++++++++++
 .../repoman/modules/linechecks/portage/internal.py | 37 ++++++++++++++++++++++
 2 files changed, 64 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/portage/__init__.py b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
new file mode 100644
index 000000000..d390c6054
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Portage plug-in module for repoman LineChecks.
+Performs checks for internal portage variable usage in ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'internal-check': {
+			'name': "portageinternal",
+			'sourcefile': "internal",
+			'class': "PortageInternal",
+			'description': doc,
+		},
+		'portageinternalvariableassignment-check': {
+			'name': "portageinternalvariableassignment",
+			'sourcefile': "internal",
+			'class': "PortageInternalVariableAssignment",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/portage/internal.py b/repoman/pym/repoman/modules/linechecks/portage/internal.py
new file mode 100644
index 000000000..869337221
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/portage/internal.py
@@ -0,0 +1,37 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class PortageInternal(LineCheck):
+	repoman_check_name = 'portage.internal'
+	ignore_comment = True
+	# Match when the command is preceded only by leading whitespace or a shell
+	# operator such as (, {, |, ||, or &&. This prevents false positives in
+	# things like elog messages, as reported in bug #413285.
+
+	internal_portage_func_or_var = (
+		'ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib')
+	re = re.compile(
+		r'^(\s*|.*[|&{(]+\s*)\b(%s)\b' % internal_portage_func_or_var)
+
+	def check(self, num, line):
+		"""Run the check on line and return error if there is one"""
+		m = self.re.match(line)
+		if m is not None:
+			return ("'%s'" % m.group(2)) + " called on line: %d"
+
+
+class PortageInternalVariableAssignment(LineCheck):
+	repoman_check_name = 'portage.internal'
+	internal_assignment = re.compile(
+		r'\s*(export\s+)?(EXTRA_ECONF|EXTRA_EMAKE)\+?=')
+
+	def check(self, num, line):
+		match = self.internal_assignment.match(line)
+		e = None
+		if match is not None:
+			e = 'Assignment to variable %s' % match.group(2)
+			e += ' on line: %d'
+		return e


^ 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-07-15  2:08 [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/portage/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2017-07-15  2:29 Brian Dolbec
2017-09-11 21:43 Brian Dolbec
2017-11-26 17:46 Brian Dolbec
2017-12-05 18:32 Brian Dolbec
2017-12-06  0:16 Brian Dolbec
2018-03-29 21:35 Brian Dolbec
2018-03-30  0:48 Brian Dolbec
2018-03-30  5:20 Zac Medico

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