public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/
@ 2016-01-06  4:21 Brian Dolbec
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2016-01-06  4:21 UTC (permalink / raw
  To: gentoo-commits

commit:     77ace9803734d2ba6761f17770a41af5bf7eb870
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  4 04:44:05 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan  6 04:08:24 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=77ace980

repoman: Create new EncodingCheck class plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 +++++
 pym/repoman/modules/scan/directories/encoding.py | 41 ++++++++++++++++++++++++
 pym/repoman/scanner.py                           | 21 +-----------
 3 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index b9daef0..548d393 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'encoding-module': {
+			'name': "encoding",
+			'class': "EncodingCheck",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/modules/scan/directories/encoding.py b/pym/repoman/modules/scan/directories/encoding.py
new file mode 100644
index 0000000..0985e16
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/encoding.py
@@ -0,0 +1,41 @@
+
+import io
+
+from portage import _encodings
+from portage import _unicode_encode
+
+from repoman.checks.ebuilds.checks import run_checks
+
+
+class EncodingCheck(object):
+
+	def __init__(self, **kwargs):
+		self.qatracker = kwargs.get('qatracker')
+
+	def check(self, **kwargs):
+		ebuild = kwargs.get('ebuild')
+		pkg = kwargs.get('pkg')
+		try:
+			# All ebuilds should have utf_8 encoding.
+			f = io.open(
+				_unicode_encode(ebuild.full_path, encoding=_encodings['fs'],
+					errors='strict'),
+				mode='r', encoding=_encodings['repo.content'])
+			try:
+				for check_name, e in run_checks(f, pkg):
+					self.qatracker.add_error(
+						check_name, ebuild.relative_path + ': %s' % e)
+			finally:
+				f.close()
+		except UnicodeDecodeError:
+			# A file.UTF8 failure will have already been recorded.
+			pass
+		return {'continue': False}
+
+	@property
+	def runInPkgs(self):
+		return (False, [])
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 7640dca..b6d2441 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -3,7 +3,6 @@
 from __future__ import print_function, unicode_literals
 
 import copy
-import io
 import logging
 from itertools import chain
 from pprint import pformat
@@ -13,11 +12,8 @@ from _emerge.Package import Package
 import portage
 from portage import normalize_path
 from portage import os
-from portage import _encodings
-from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
-from repoman.checks.ebuilds.checks import run_checks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -295,7 +291,7 @@ class Scanner(object):
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
 				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
-				('mtime', 'MtimeChecks'),
+				('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -327,21 +323,6 @@ class Scanner(object):
 			print("**** finished plugin loop, continuing...")
 
 			# Syntax Checks
-			try:
-				# All ebuilds should have utf_8 encoding.
-				f = io.open(
-					_unicode_encode(
-						dynamic_data['ebuild'].full_path, encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['repo.content'])
-				try:
-					for check_name, e in run_checks(f, dynamic_data['pkg']):
-						self.qatracker.add_error(
-							check_name, dynamic_data['ebuild'].relative_path + ': %s' % e)
-				finally:
-					f.close()
-			except UnicodeDecodeError:
-				# A file.UTF8 failure will have already been recorded above.
-				pass
 
 			if self.options.force:
 				# The dep_check() calls are the most expensive QA test. If --force


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/
@ 2016-01-10  3:26 Brian Dolbec
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2016-01-10  3:26 UTC (permalink / raw
  To: gentoo-commits

commit:     bc1957a35580c12d100b1d7aec02e671bd770e8f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 23:23:52 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:52 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=bc1957a3

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 ++++++++
 pym/repoman/modules/scan/directories/mtime.py    | 24 ++++++++++++++++++++++++
 pym/repoman/scanner.py                           |  5 +----
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index 7fe9f0e..b9daef0 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'mtime-module': {
+			'name': "mtime",
+			'class': "MtimeChecks",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 0000000..e113cdd
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,24 @@
+
+
+class MtimeChecks(object):
+
+	def __init__(self, **kwargs):
+		self.vcs_settings = kwargs.get('vcs_settings')
+
+	def check(self, **kwargs):
+		ebuild = kwargs.get('ebuild')
+		changed = kwargs.get('changed')
+		pkg = kwargs.get('pkg')
+		if not self.vcs_settings.vcs_preserves_mtime:
+			if ebuild.ebuild_path not in changed.new_ebuilds and \
+					ebuild.ebuild_path not in changed.ebuilds:
+				pkg.mtime = None
+		return {'continue': False}
+
+	@property
+	def runInPkgs(self):
+		return (False, [])
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 8657c73..b00dbd9 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -293,6 +293,7 @@ class Scanner(object):
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
 				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
+				('mtime', 'MtimeChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -321,10 +322,6 @@ class Scanner(object):
 				continue
 
 			# Syntax Checks
-			if not self.vcs_settings.vcs_preserves_mtime:
-				if dynamic_data['ebuild'].ebuild_path not in self.changed.new_ebuilds and \
-					dynamic_data['ebuild'].ebuild_path not in self.changed.ebuilds:
-					dynamic_data['pkg'].mtime = None
 			try:
 				# All ebuilds should have utf_8 encoding.
 				f = io.open(


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/
@ 2016-01-10 20:17 Brian Dolbec
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
  To: gentoo-commits

commit:     afb256c55cadb6c033b3c1721b672bda2b46c46f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  4 04:44:05 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=afb256c5

repoman: Create new EncodingCheck class plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 +++++
 pym/repoman/modules/scan/directories/encoding.py | 41 ++++++++++++++++++++++++
 pym/repoman/scanner.py                           | 21 +-----------
 3 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index b9daef0..548d393 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'encoding-module': {
+			'name': "encoding",
+			'class': "EncodingCheck",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/modules/scan/directories/encoding.py b/pym/repoman/modules/scan/directories/encoding.py
new file mode 100644
index 0000000..0985e16
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/encoding.py
@@ -0,0 +1,41 @@
+
+import io
+
+from portage import _encodings
+from portage import _unicode_encode
+
+from repoman.checks.ebuilds.checks import run_checks
+
+
+class EncodingCheck(object):
+
+	def __init__(self, **kwargs):
+		self.qatracker = kwargs.get('qatracker')
+
+	def check(self, **kwargs):
+		ebuild = kwargs.get('ebuild')
+		pkg = kwargs.get('pkg')
+		try:
+			# All ebuilds should have utf_8 encoding.
+			f = io.open(
+				_unicode_encode(ebuild.full_path, encoding=_encodings['fs'],
+					errors='strict'),
+				mode='r', encoding=_encodings['repo.content'])
+			try:
+				for check_name, e in run_checks(f, pkg):
+					self.qatracker.add_error(
+						check_name, ebuild.relative_path + ': %s' % e)
+			finally:
+				f.close()
+		except UnicodeDecodeError:
+			# A file.UTF8 failure will have already been recorded.
+			pass
+		return {'continue': False}
+
+	@property
+	def runInPkgs(self):
+		return (False, [])
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b00dbd9..ac77d1f 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -3,7 +3,6 @@
 from __future__ import print_function, unicode_literals
 
 import copy
-import io
 import logging
 from itertools import chain
 from pprint import pformat
@@ -13,11 +12,8 @@ from _emerge.Package import Package
 import portage
 from portage import normalize_path
 from portage import os
-from portage import _encodings
-from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
-from repoman.checks.ebuilds.checks import run_checks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -293,7 +289,7 @@ class Scanner(object):
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
 				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
-				('mtime', 'MtimeChecks'),
+				('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -322,21 +318,6 @@ class Scanner(object):
 				continue
 
 			# Syntax Checks
-			try:
-				# All ebuilds should have utf_8 encoding.
-				f = io.open(
-					_unicode_encode(
-						dynamic_data['ebuild'].full_path, encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['repo.content'])
-				try:
-					for check_name, e in run_checks(f, dynamic_data['pkg']):
-						self.qatracker.add_error(
-							check_name, dynamic_data['ebuild'].relative_path + ': %s' % e)
-				finally:
-					f.close()
-			except UnicodeDecodeError:
-				# A file.UTF8 failure will have already been recorded above.
-				pass
 
 			if self.options.force:
 				# The dep_check() calls are the most expensive QA test. If --force


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/
@ 2016-01-10 20:17 Brian Dolbec
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
  To: gentoo-commits

commit:     ed9f7a5e850c9954ea5cacec332c30807e0cbd6b
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 23:23:52 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=ed9f7a5e

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 ++++++++
 pym/repoman/modules/scan/directories/mtime.py    | 24 ++++++++++++++++++++++++
 pym/repoman/scanner.py                           |  5 +----
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index 7fe9f0e..b9daef0 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -18,6 +18,14 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'mtime-module': {
+			'name': "mtime",
+			'class': "MtimeChecks",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 0000000..e113cdd
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,24 @@
+
+
+class MtimeChecks(object):
+
+	def __init__(self, **kwargs):
+		self.vcs_settings = kwargs.get('vcs_settings')
+
+	def check(self, **kwargs):
+		ebuild = kwargs.get('ebuild')
+		changed = kwargs.get('changed')
+		pkg = kwargs.get('pkg')
+		if not self.vcs_settings.vcs_preserves_mtime:
+			if ebuild.ebuild_path not in changed.new_ebuilds and \
+					ebuild.ebuild_path not in changed.ebuilds:
+				pkg.mtime = None
+		return {'continue': False}
+
+	@property
+	def runInPkgs(self):
+		return (False, [])
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 8657c73..b00dbd9 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -293,6 +293,7 @@ class Scanner(object):
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
 				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
+				('mtime', 'MtimeChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -321,10 +322,6 @@ class Scanner(object):
 				continue
 
 			# Syntax Checks
-			if not self.vcs_settings.vcs_preserves_mtime:
-				if dynamic_data['ebuild'].ebuild_path not in self.changed.new_ebuilds and \
-					dynamic_data['ebuild'].ebuild_path not in self.changed.ebuilds:
-					dynamic_data['pkg'].mtime = None
 			try:
 				# All ebuilds should have utf_8 encoding.
 				f = io.open(


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/
@ 2016-01-11  6:31 Brian Dolbec
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2016-01-11  6:31 UTC (permalink / raw
  To: gentoo-commits

commit:     8e9f84c6bf729204cbeecbd28fe0c26e340ac79f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  4 04:44:05 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:37 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=8e9f84c6

repoman: Create new EncodingCheck class plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 +++++
 pym/repoman/modules/scan/directories/encoding.py | 41 ++++++++++++++++++++++++
 pym/repoman/scanner.py                           | 21 +-----------
 3 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index b9daef0..548d393 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'encoding-module': {
+			'name': "encoding",
+			'class': "EncodingCheck",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/modules/scan/directories/encoding.py b/pym/repoman/modules/scan/directories/encoding.py
new file mode 100644
index 0000000..0985e16
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/encoding.py
@@ -0,0 +1,41 @@
+
+import io
+
+from portage import _encodings
+from portage import _unicode_encode
+
+from repoman.checks.ebuilds.checks import run_checks
+
+
+class EncodingCheck(object):
+
+	def __init__(self, **kwargs):
+		self.qatracker = kwargs.get('qatracker')
+
+	def check(self, **kwargs):
+		ebuild = kwargs.get('ebuild')
+		pkg = kwargs.get('pkg')
+		try:
+			# All ebuilds should have utf_8 encoding.
+			f = io.open(
+				_unicode_encode(ebuild.full_path, encoding=_encodings['fs'],
+					errors='strict'),
+				mode='r', encoding=_encodings['repo.content'])
+			try:
+				for check_name, e in run_checks(f, pkg):
+					self.qatracker.add_error(
+						check_name, ebuild.relative_path + ': %s' % e)
+			finally:
+				f.close()
+		except UnicodeDecodeError:
+			# A file.UTF8 failure will have already been recorded.
+			pass
+		return {'continue': False}
+
+	@property
+	def runInPkgs(self):
+		return (False, [])
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b00dbd9..ac77d1f 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -3,7 +3,6 @@
 from __future__ import print_function, unicode_literals
 
 import copy
-import io
 import logging
 from itertools import chain
 from pprint import pformat
@@ -13,11 +12,8 @@ from _emerge.Package import Package
 import portage
 from portage import normalize_path
 from portage import os
-from portage import _encodings
-from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
-from repoman.checks.ebuilds.checks import run_checks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -293,7 +289,7 @@ class Scanner(object):
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
 				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
-				('mtime', 'MtimeChecks'),
+				('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -322,21 +318,6 @@ class Scanner(object):
 				continue
 
 			# Syntax Checks
-			try:
-				# All ebuilds should have utf_8 encoding.
-				f = io.open(
-					_unicode_encode(
-						dynamic_data['ebuild'].full_path, encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['repo.content'])
-				try:
-					for check_name, e in run_checks(f, dynamic_data['pkg']):
-						self.qatracker.add_error(
-							check_name, dynamic_data['ebuild'].relative_path + ': %s' % e)
-				finally:
-					f.close()
-			except UnicodeDecodeError:
-				# A file.UTF8 failure will have already been recorded above.
-				pass
 
 			if self.options.force:
 				# The dep_check() calls are the most expensive QA test. If --force


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/
@ 2016-01-11  8:01 Brian Dolbec
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2016-01-11  8:01 UTC (permalink / raw
  To: gentoo-commits

commit:     a2506c7546748772709947ef8c19d5b8946010bd
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  4 04:44:05 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:18 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=a2506c75

repoman: Create new EncodingCheck class plugin

 pym/repoman/modules/scan/directories/__init__.py |  8 +++++
 pym/repoman/modules/scan/directories/encoding.py | 41 ++++++++++++++++++++++++
 pym/repoman/scanner.py                           | 21 +-----------
 3 files changed, 50 insertions(+), 20 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index b9daef0..548d393 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -26,6 +26,14 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'encoding-module': {
+			'name': "encoding",
+			'class': "EncodingCheck",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/modules/scan/directories/encoding.py b/pym/repoman/modules/scan/directories/encoding.py
new file mode 100644
index 0000000..0985e16
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/encoding.py
@@ -0,0 +1,41 @@
+
+import io
+
+from portage import _encodings
+from portage import _unicode_encode
+
+from repoman.checks.ebuilds.checks import run_checks
+
+
+class EncodingCheck(object):
+
+	def __init__(self, **kwargs):
+		self.qatracker = kwargs.get('qatracker')
+
+	def check(self, **kwargs):
+		ebuild = kwargs.get('ebuild')
+		pkg = kwargs.get('pkg')
+		try:
+			# All ebuilds should have utf_8 encoding.
+			f = io.open(
+				_unicode_encode(ebuild.full_path, encoding=_encodings['fs'],
+					errors='strict'),
+				mode='r', encoding=_encodings['repo.content'])
+			try:
+				for check_name, e in run_checks(f, pkg):
+					self.qatracker.add_error(
+						check_name, ebuild.relative_path + ': %s' % e)
+			finally:
+				f.close()
+		except UnicodeDecodeError:
+			# A file.UTF8 failure will have already been recorded.
+			pass
+		return {'continue': False}
+
+	@property
+	def runInPkgs(self):
+		return (False, [])
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index b00dbd9..ac77d1f 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -3,7 +3,6 @@
 from __future__ import print_function, unicode_literals
 
 import copy
-import io
 import logging
 from itertools import chain
 from pprint import pformat
@@ -13,11 +12,8 @@ from _emerge.Package import Package
 import portage
 from portage import normalize_path
 from portage import os
-from portage import _encodings
-from portage import _unicode_encode
 from portage.dep import Atom
 from portage.output import green
-from repoman.checks.ebuilds.checks import run_checks
 from repoman.modules.commit import repochecks
 from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
 from repoman.repos import repo_metadata
@@ -293,7 +289,7 @@ class Scanner(object):
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
 				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
-				('mtime', 'MtimeChecks'),
+				('mtime', 'MtimeChecks'), ('encoding', 'EncodingCheck'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -322,21 +318,6 @@ class Scanner(object):
 				continue
 
 			# Syntax Checks
-			try:
-				# All ebuilds should have utf_8 encoding.
-				f = io.open(
-					_unicode_encode(
-						dynamic_data['ebuild'].full_path, encoding=_encodings['fs'], errors='strict'),
-					mode='r', encoding=_encodings['repo.content'])
-				try:
-					for check_name, e in run_checks(f, dynamic_data['pkg']):
-						self.qatracker.add_error(
-							check_name, dynamic_data['ebuild'].relative_path + ': %s' % e)
-				finally:
-					f.close()
-			except UnicodeDecodeError:
-				# A file.UTF8 failure will have already been recorded above.
-				pass
 
 			if self.options.force:
 				# The dep_check() calls are the most expensive QA test. If --force


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/
@ 2016-01-23  1:42 Brian Dolbec
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2016-01-23  1:42 UTC (permalink / raw
  To: gentoo-commits

commit:     fa18c717e961e4c1660a24fc04fd82f529e297d3
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 23:23:52 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 01:33:12 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa18c717

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  9 +++++++++
 pym/repoman/modules/scan/directories/mtime.py    | 24 ++++++++++++++++++++++++
 pym/repoman/scanner.py                           |  5 +----
 3 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index bcc6eca..ec18d30 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'mtime-module': {
+			'name': "mtime",
+			'sourcefile': "mtime",
+			'class': "MtimeChecks",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 0000000..e113cdd
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,24 @@
+
+
+class MtimeChecks(object):
+
+	def __init__(self, **kwargs):
+		self.vcs_settings = kwargs.get('vcs_settings')
+
+	def check(self, **kwargs):
+		ebuild = kwargs.get('ebuild')
+		changed = kwargs.get('changed')
+		pkg = kwargs.get('pkg')
+		if not self.vcs_settings.vcs_preserves_mtime:
+			if ebuild.ebuild_path not in changed.new_ebuilds and \
+					ebuild.ebuild_path not in changed.ebuilds:
+				pkg.mtime = None
+		return {'continue': False}
+
+	@property
+	def runInPkgs(self):
+		return (False, [])
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 8657c73..b00dbd9 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -293,6 +293,7 @@ class Scanner(object):
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
 				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
+				('mtime', 'MtimeChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -321,10 +322,6 @@ class Scanner(object):
 				continue
 
 			# Syntax Checks
-			if not self.vcs_settings.vcs_preserves_mtime:
-				if dynamic_data['ebuild'].ebuild_path not in self.changed.new_ebuilds and \
-					dynamic_data['ebuild'].ebuild_path not in self.changed.ebuilds:
-					dynamic_data['pkg'].mtime = None
 			try:
 				# All ebuilds should have utf_8 encoding.
 				f = io.open(


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

* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/
@ 2016-03-07 21:53 Brian Dolbec
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dolbec @ 2016-03-07 21:53 UTC (permalink / raw
  To: gentoo-commits

commit:     dd2be6987e095001bb23280f2d76cfe0122822c2
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan  3 23:23:52 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Mar  7 21:20:55 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=dd2be698

repoman: Migrate code to a new MtimeChecks class in directories plugin

 pym/repoman/modules/scan/directories/__init__.py |  9 +++++++++
 pym/repoman/modules/scan/directories/mtime.py    | 20 ++++++++++++++++++++
 pym/repoman/scanner.py                           |  5 +----
 3 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/pym/repoman/modules/scan/directories/__init__.py b/pym/repoman/modules/scan/directories/__init__.py
index bcc6eca..ec18d30 100644
--- a/pym/repoman/modules/scan/directories/__init__.py
+++ b/pym/repoman/modules/scan/directories/__init__.py
@@ -19,6 +19,15 @@ module_spec = {
 			'func_kwargs': {
 			},
 		},
+		'mtime-module': {
+			'name': "mtime",
+			'sourcefile': "mtime",
+			'class': "MtimeChecks",
+			'description': doc,
+			'functions': ['check'],
+			'func_kwargs': {
+			},
+		},
 	}
 }
 

diff --git a/pym/repoman/modules/scan/directories/mtime.py b/pym/repoman/modules/scan/directories/mtime.py
new file mode 100644
index 0000000..e25b553
--- /dev/null
+++ b/pym/repoman/modules/scan/directories/mtime.py
@@ -0,0 +1,20 @@
+
+
+class MtimeChecks(object):
+
+	def __init__(self, **kwargs):
+		self.vcs_settings = kwargs.get('vcs_settings')
+
+	def check(self, **kwargs):
+		ebuild = kwargs.get('ebuild')
+		changed = kwargs.get('changed')
+		pkg = kwargs.get('pkg')
+		if not self.vcs_settings.vcs_preserves_mtime:
+			if ebuild.ebuild_path not in changed.new_ebuilds and \
+					ebuild.ebuild_path not in changed.ebuilds:
+				pkg.mtime = None
+		return {'continue': False}
+
+	@property
+	def runInEbuilds(self):
+		return (True, [self.check])

diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 92e2abd..308b440 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -294,6 +294,7 @@ class Scanner(object):
 				('arches', 'ArchChecks'), ('depend', 'DependChecks'),
 				('use_flags', 'USEFlagChecks'), ('ruby', 'RubyEclassChecks'),
 				('license', 'LicenseChecks'), ('restrict', 'RestrictChecks'),
+				('mtime', 'MtimeChecks'),
 				]:
 				if mod[0]:
 					mod_class = MODULE_CONTROLLER.get_class(mod[0])
@@ -322,10 +323,6 @@ class Scanner(object):
 				continue
 
 			# Syntax Checks
-			if not self.vcs_settings.vcs_preserves_mtime:
-				if dynamic_data['ebuild'].ebuild_path not in self.changed.new_ebuilds and \
-					dynamic_data['ebuild'].ebuild_path not in self.changed.ebuilds:
-					dynamic_data['pkg'].mtime = None
 			try:
 				# All ebuilds should have utf_8 encoding.
 				f = io.open(


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

end of thread, other threads:[~2016-03-07 21:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-06  4:21 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/directories/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2016-01-10  3:26 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-11  6:31 Brian Dolbec
2016-01-11  8:01 Brian Dolbec
2016-01-23  1:42 Brian Dolbec
2016-03-07 21:53 Brian Dolbec

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