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

commit:     bbe75657cc32aeb402a6ff78eba7bd05a3c87424
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  5 18:17:15 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue Dec  5 18:28:34 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=bbe75657

repoman linechecks/config.py: Move the errors loading to a new /usr/share/repoman/linechecks directory

This new directory can be installed to by third party add on modules that extend the checks.
We can also in future use these file to get loaclized translations.

 repoman/cnf/linechecks/linechecks.yaml           | 35 ++++++++++++++++++++++++
 repoman/pym/repoman/modules/linechecks/config.py | 21 ++++++++++++--
 2 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/repoman/cnf/linechecks/linechecks.yaml b/repoman/cnf/linechecks/linechecks.yaml
new file mode 100644
index 000000000..634381e80
--- /dev/null
+++ b/repoman/cnf/linechecks/linechecks.yaml
@@ -0,0 +1,35 @@
+---
+# linecheck_help.yaml
+
+# Repoman API version (do not edit)
+version: 1
+# minimum
+repoman_version: 2.3.3
+
+# configuration file for the LineCheck plugins run via the multicheck
+# scan module
+errors:
+    COPYRIGHT_ERROR: 'Invalid Gentoo Copyright on line: %d'
+    LICENSE_ERROR: 'Invalid Gentoo/GPL License on line: %d'
+    ID_HEADER_ERROR: 'Stale CVS header on line: %d'
+    NO_BLANK_LINE_ERROR: 'Non-blank line after header on line: %d'
+    LEADING_SPACES_ERROR: 'Ebuild contains leading spaces on line: %d'
+    TRAILING_WHITESPACE_ERROR: 'Trailing whitespace error on line: %d'
+    READONLY_ASSIGNMENT_ERROR: 'Ebuild contains assignment to read-only variable on line: %d'
+    MISSING_QUOTES_ERROR: 'Unquoted Variable on line: %d'
+    NESTED_DIE_ERROR: 'Ebuild calls die in a subshell on line: %d'
+    PATCHES_ERROR: 'PATCHES is not a bash array on line: %d'
+    REDUNDANT_CD_S_ERROR: 'Ebuild has redundant cd ${S} statement on line: %d'
+    EMAKE_PARALLEL_DISABLED: 'Upstream parallel compilation bug (ebuild calls emake -j1 on line: %d)'
+    EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS: 'Upstream parallel compilation bug (MAKEOPTS=-j1 on line: %d)'
+    DEPRECATED_BINDNOW_FLAGS: 'Deprecated bindnow-flags call on line: %d'
+    EAPI_DEFINED_AFTER_INHERIT: 'EAPI defined after inherit on line: %d'
+    NO_AS_NEEDED: 'Upstream asneeded linking bug (no-as-needed on line: %d)'
+    PRESERVE_OLD_LIB: 'Ebuild calls deprecated preserve_old_lib on line: %d'
+    BUILT_WITH_USE: 'built_with_use on line: %d'
+    NO_OFFSET_WITH_HELPERS: 'Helper function is used with D, ROOT, ED, EROOT or EPREFIX on line: %d'
+    SANDBOX_ADDPREDICT: 'Ebuild calls addpredict on line: %d'
+    USEQ_ERROR: 'Ebuild calls deprecated useq function on line: %d'
+    HASQ_ERROR: 'Ebuild calls deprecated hasq function on line: %d'
+    URI_HTTPS: 'Ebuild uses http:// but should use https:// on line: %d'
+

diff --git a/repoman/pym/repoman/modules/linechecks/config.py b/repoman/pym/repoman/modules/linechecks/config.py
index 52a9a786b..be58c799c 100644
--- a/repoman/pym/repoman/modules/linechecks/config.py
+++ b/repoman/pym/repoman/modules/linechecks/config.py
@@ -14,6 +14,8 @@ import os
 import yaml
 from copy import deepcopy
 
+from repoman import _not_installed
+from repoman import _portage
 from portage.util import stack_lists
 from repoman.config import load_config
 
@@ -42,8 +44,7 @@ class LineChecksConfig(object):
 		@param configpaths: ordered list of filepaths to load
 		'''
 		self.repo_settings = repo_settings
-		self.infopaths = [os.path.join(path, 'linechecks.yaml') for path in self.repo_settings.masters_list]
-		logging.debug("LineChecksConfig; configpaths: %s", self.infopaths)
+		self.infopaths = None
 		self.info_config = None
 		self._config = None
 		self.usex_supported_eapis = None
@@ -54,18 +55,32 @@ class LineChecksConfig(object):
 		self.eclass_info = {}
 		self.eclass_info_experimental_inherit = {}
 		self.errors = {}
+		self.set_infopaths()
 		self.load_checks_info()
 
+	def set_infopaths(self):
+		if _not_installed:
+			cnfdir = os.path.realpath(os.path.join(os.path.dirname(
+				os.path.dirname(os.path.dirname(os.path.dirname(
+				os.path.dirname(__file__))))), 'cnf/linechecks'))
+		else:
+			cnfdir = os.path.join(_portage.portage.const.EPREFIX, 'usr/share/repoman/linechecks')
+		repomanpaths = [os.path.join(cnfdir, _file_) for _file_ in os.listdir(cnfdir)]
+		logging.debug("LineChecksConfig; repomanpaths: %s", repomanpaths)
+		repopaths = [os.path.join(path, 'linechecks.yaml') for path in self.repo_settings.masters_list]
+		self.infopaths = repomanpaths + repopaths
+		logging.debug("LineChecksConfig; configpaths: %s", self.infopaths)
 
 	def load_checks_info(self, infopaths=None):
 		'''load the config files in order
 
-		@param configpaths: ordered list of filepaths to load
+		@param infopaths: ordered list of filepaths to load
 		'''
 		if infopaths:
 			self.infopaths = infopaths
 		elif not self.infopaths:
 			logging.error("LineChecksConfig; Error: No linechecks.yaml files defined")
+
 		configs = load_config(self.infopaths, 'yaml', self.repo_settings.repoman_settings.valid_versions)
 		if configs == {}:
 			logging.error("LineChecksConfig: Failed to load a valid 'linechecks.yaml' file at paths: %s", self.infopaths)


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

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

commit:     4ad8650172a071de1a3778f10680f74bd191dec9
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  5 18:17:15 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Dec  6 00:13:28 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4ad86501

repoman linechecks/config.py: Move the errors loading to a new /usr/share/repoman/linechecks directory

This new directory can be installed to by third party add on modules that extend the checks.
We can also in future use these file to get loaclized translations.

 repoman/cnf/linechecks/linechecks.yaml           | 35 ++++++++++++++++++++++++
 repoman/pym/repoman/modules/linechecks/config.py | 19 +++++++++++--
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/repoman/cnf/linechecks/linechecks.yaml b/repoman/cnf/linechecks/linechecks.yaml
new file mode 100644
index 000000000..634381e80
--- /dev/null
+++ b/repoman/cnf/linechecks/linechecks.yaml
@@ -0,0 +1,35 @@
+---
+# linecheck_help.yaml
+
+# Repoman API version (do not edit)
+version: 1
+# minimum
+repoman_version: 2.3.3
+
+# configuration file for the LineCheck plugins run via the multicheck
+# scan module
+errors:
+    COPYRIGHT_ERROR: 'Invalid Gentoo Copyright on line: %d'
+    LICENSE_ERROR: 'Invalid Gentoo/GPL License on line: %d'
+    ID_HEADER_ERROR: 'Stale CVS header on line: %d'
+    NO_BLANK_LINE_ERROR: 'Non-blank line after header on line: %d'
+    LEADING_SPACES_ERROR: 'Ebuild contains leading spaces on line: %d'
+    TRAILING_WHITESPACE_ERROR: 'Trailing whitespace error on line: %d'
+    READONLY_ASSIGNMENT_ERROR: 'Ebuild contains assignment to read-only variable on line: %d'
+    MISSING_QUOTES_ERROR: 'Unquoted Variable on line: %d'
+    NESTED_DIE_ERROR: 'Ebuild calls die in a subshell on line: %d'
+    PATCHES_ERROR: 'PATCHES is not a bash array on line: %d'
+    REDUNDANT_CD_S_ERROR: 'Ebuild has redundant cd ${S} statement on line: %d'
+    EMAKE_PARALLEL_DISABLED: 'Upstream parallel compilation bug (ebuild calls emake -j1 on line: %d)'
+    EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS: 'Upstream parallel compilation bug (MAKEOPTS=-j1 on line: %d)'
+    DEPRECATED_BINDNOW_FLAGS: 'Deprecated bindnow-flags call on line: %d'
+    EAPI_DEFINED_AFTER_INHERIT: 'EAPI defined after inherit on line: %d'
+    NO_AS_NEEDED: 'Upstream asneeded linking bug (no-as-needed on line: %d)'
+    PRESERVE_OLD_LIB: 'Ebuild calls deprecated preserve_old_lib on line: %d'
+    BUILT_WITH_USE: 'built_with_use on line: %d'
+    NO_OFFSET_WITH_HELPERS: 'Helper function is used with D, ROOT, ED, EROOT or EPREFIX on line: %d'
+    SANDBOX_ADDPREDICT: 'Ebuild calls addpredict on line: %d'
+    USEQ_ERROR: 'Ebuild calls deprecated useq function on line: %d'
+    HASQ_ERROR: 'Ebuild calls deprecated hasq function on line: %d'
+    URI_HTTPS: 'Ebuild uses http:// but should use https:// on line: %d'
+

diff --git a/repoman/pym/repoman/modules/linechecks/config.py b/repoman/pym/repoman/modules/linechecks/config.py
index 9190b18cf..96a27ac49 100644
--- a/repoman/pym/repoman/modules/linechecks/config.py
+++ b/repoman/pym/repoman/modules/linechecks/config.py
@@ -15,6 +15,7 @@ from copy import deepcopy
 
 from repoman._portage import portage
 from repoman.config import load_config
+from repoman import _not_installed
 
 # Avoid a circular import issue in py2.7
 portage.proxy.lazyimport.lazyimport(globals(),
@@ -46,8 +47,7 @@ class LineChecksConfig(object):
 		@param configpaths: ordered list of filepaths to load
 		'''
 		self.repo_settings = repo_settings
-		self.infopaths = [os.path.join(path, 'linechecks.yaml') for path in self.repo_settings.masters_list]
-		logging.debug("LineChecksConfig; configpaths: %s", self.infopaths)
+		self.infopaths = None
 		self.info_config = None
 		self._config = None
 		self.usex_supported_eapis = None
@@ -58,8 +58,22 @@ class LineChecksConfig(object):
 		self.eclass_info = {}
 		self.eclass_info_experimental_inherit = {}
 		self.errors = {}
+		self.set_infopaths()
 		self.load_checks_info()
 
+	def set_infopaths(self):
+		if _not_installed:
+			cnfdir = os.path.realpath(os.path.join(os.path.dirname(
+				os.path.dirname(os.path.dirname(os.path.dirname(
+				os.path.dirname(__file__))))), 'cnf/linechecks'))
+		else:
+			cnfdir = os.path.join(portage.const.EPREFIX or '/', 'usr/share/repoman/linechecks')
+		repomanpaths = [os.path.join(cnfdir, _file_) for _file_ in os.listdir(cnfdir)]
+		logging.debug("LineChecksConfig; repomanpaths: %s", repomanpaths)
+		repopaths = [os.path.join(path, 'linechecks.yaml') for path in self.repo_settings.masters_list]
+		self.infopaths = repomanpaths + repopaths
+		logging.debug("LineChecksConfig; configpaths: %s", self.infopaths)
+
 	def load_checks_info(self, infopaths=None):
 		'''load the config files in order
 
@@ -69,6 +83,7 @@ class LineChecksConfig(object):
 			self.infopaths = infopaths
 		elif not self.infopaths:
 			logging.error("LineChecksConfig; Error: No linechecks.yaml files defined")
+
 		configs = load_config(self.infopaths, 'yaml', self.repo_settings.repoman_settings.valid_versions)
 		if configs == {}:
 			logging.error("LineChecksConfig: Failed to load a valid 'linechecks.yaml' file at paths: %s", self.infopaths)


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

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

commit:     563f121e6b4b21b56048a8d2e9b3e86569b87b96
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  5 18:17:15 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 29 21:26:13 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=563f121e

repoman linechecks/config.py: Move the errors loading to a new /usr/share/repoman/linechecks directory

This new directory can be installed to by third party add on modules that extend the checks.
We can also in future use these file to get loaclized translations.

 repoman/cnf/linechecks/linechecks.yaml           | 35 ++++++++++++++++++++++++
 repoman/pym/repoman/modules/linechecks/config.py | 19 +++++++++++--
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/repoman/cnf/linechecks/linechecks.yaml b/repoman/cnf/linechecks/linechecks.yaml
new file mode 100644
index 000000000..634381e80
--- /dev/null
+++ b/repoman/cnf/linechecks/linechecks.yaml
@@ -0,0 +1,35 @@
+---
+# linecheck_help.yaml
+
+# Repoman API version (do not edit)
+version: 1
+# minimum
+repoman_version: 2.3.3
+
+# configuration file for the LineCheck plugins run via the multicheck
+# scan module
+errors:
+    COPYRIGHT_ERROR: 'Invalid Gentoo Copyright on line: %d'
+    LICENSE_ERROR: 'Invalid Gentoo/GPL License on line: %d'
+    ID_HEADER_ERROR: 'Stale CVS header on line: %d'
+    NO_BLANK_LINE_ERROR: 'Non-blank line after header on line: %d'
+    LEADING_SPACES_ERROR: 'Ebuild contains leading spaces on line: %d'
+    TRAILING_WHITESPACE_ERROR: 'Trailing whitespace error on line: %d'
+    READONLY_ASSIGNMENT_ERROR: 'Ebuild contains assignment to read-only variable on line: %d'
+    MISSING_QUOTES_ERROR: 'Unquoted Variable on line: %d'
+    NESTED_DIE_ERROR: 'Ebuild calls die in a subshell on line: %d'
+    PATCHES_ERROR: 'PATCHES is not a bash array on line: %d'
+    REDUNDANT_CD_S_ERROR: 'Ebuild has redundant cd ${S} statement on line: %d'
+    EMAKE_PARALLEL_DISABLED: 'Upstream parallel compilation bug (ebuild calls emake -j1 on line: %d)'
+    EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS: 'Upstream parallel compilation bug (MAKEOPTS=-j1 on line: %d)'
+    DEPRECATED_BINDNOW_FLAGS: 'Deprecated bindnow-flags call on line: %d'
+    EAPI_DEFINED_AFTER_INHERIT: 'EAPI defined after inherit on line: %d'
+    NO_AS_NEEDED: 'Upstream asneeded linking bug (no-as-needed on line: %d)'
+    PRESERVE_OLD_LIB: 'Ebuild calls deprecated preserve_old_lib on line: %d'
+    BUILT_WITH_USE: 'built_with_use on line: %d'
+    NO_OFFSET_WITH_HELPERS: 'Helper function is used with D, ROOT, ED, EROOT or EPREFIX on line: %d'
+    SANDBOX_ADDPREDICT: 'Ebuild calls addpredict on line: %d'
+    USEQ_ERROR: 'Ebuild calls deprecated useq function on line: %d'
+    HASQ_ERROR: 'Ebuild calls deprecated hasq function on line: %d'
+    URI_HTTPS: 'Ebuild uses http:// but should use https:// on line: %d'
+

diff --git a/repoman/pym/repoman/modules/linechecks/config.py b/repoman/pym/repoman/modules/linechecks/config.py
index 9190b18cf..96a27ac49 100644
--- a/repoman/pym/repoman/modules/linechecks/config.py
+++ b/repoman/pym/repoman/modules/linechecks/config.py
@@ -15,6 +15,7 @@ from copy import deepcopy
 
 from repoman._portage import portage
 from repoman.config import load_config
+from repoman import _not_installed
 
 # Avoid a circular import issue in py2.7
 portage.proxy.lazyimport.lazyimport(globals(),
@@ -46,8 +47,7 @@ class LineChecksConfig(object):
 		@param configpaths: ordered list of filepaths to load
 		'''
 		self.repo_settings = repo_settings
-		self.infopaths = [os.path.join(path, 'linechecks.yaml') for path in self.repo_settings.masters_list]
-		logging.debug("LineChecksConfig; configpaths: %s", self.infopaths)
+		self.infopaths = None
 		self.info_config = None
 		self._config = None
 		self.usex_supported_eapis = None
@@ -58,8 +58,22 @@ class LineChecksConfig(object):
 		self.eclass_info = {}
 		self.eclass_info_experimental_inherit = {}
 		self.errors = {}
+		self.set_infopaths()
 		self.load_checks_info()
 
+	def set_infopaths(self):
+		if _not_installed:
+			cnfdir = os.path.realpath(os.path.join(os.path.dirname(
+				os.path.dirname(os.path.dirname(os.path.dirname(
+				os.path.dirname(__file__))))), 'cnf/linechecks'))
+		else:
+			cnfdir = os.path.join(portage.const.EPREFIX or '/', 'usr/share/repoman/linechecks')
+		repomanpaths = [os.path.join(cnfdir, _file_) for _file_ in os.listdir(cnfdir)]
+		logging.debug("LineChecksConfig; repomanpaths: %s", repomanpaths)
+		repopaths = [os.path.join(path, 'linechecks.yaml') for path in self.repo_settings.masters_list]
+		self.infopaths = repomanpaths + repopaths
+		logging.debug("LineChecksConfig; configpaths: %s", self.infopaths)
+
 	def load_checks_info(self, infopaths=None):
 		'''load the config files in order
 
@@ -69,6 +83,7 @@ class LineChecksConfig(object):
 			self.infopaths = infopaths
 		elif not self.infopaths:
 			logging.error("LineChecksConfig; Error: No linechecks.yaml files defined")
+
 		configs = load_config(self.infopaths, 'yaml', self.repo_settings.repoman_settings.valid_versions)
 		if configs == {}:
 			logging.error("LineChecksConfig: Failed to load a valid 'linechecks.yaml' file at paths: %s", self.infopaths)


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

end of thread, other threads:[~2018-03-29 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-29 21:35 [gentoo-commits] proj/portage:repoman commit in: repoman/cnf/linechecks/, repoman/pym/repoman/modules/linechecks/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2017-12-06  0:16 Brian Dolbec
2017-12-05 18:32 Brian Dolbec

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