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/gentoo_header/
@ 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:     1860017190fa9e8800d44f3e916271036fa233da
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:01:04 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=18600171

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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

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

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/gentoo_header/
@ 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:     0dc0e940b61a5e0103147b0d8ae5fb2bebc624b0
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:01:04 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 16:13:14 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0dc0e940

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/gentoo_header/
@ 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:     177bcbbbb02be197a7b002e3d3bce86c686b8e3c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:01:04 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Nov 26 17:32:18 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=177bcbbb

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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

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

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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

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

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/gentoo_header/
@ 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:     727c92c218a886f4d1fdcf69b68013c6600bb248
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:01:04 2017 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 29 20:43:38 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=727c92c2

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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

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

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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

* [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/gentoo_header/
@ 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:     df1266a0fb757057658e5bea56a003ca0e5d5d7f
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 01:01:04 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Mar 30 03:51:17 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=df1266a0

repoman: New linechecks module, gentoo_header

 .../modules/linechecks/gentoo_header/__init__.py   | 21 ++++++++++
 .../modules/linechecks/gentoo_header/header.py     | 49 ++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
new file mode 100644
index 000000000..b80a83ecf
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Gentoo-header plug-in module for repoman LineChecks.
+Performs header checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'do',
+	'description': doc,
+	'provides':{
+		'header-check': {
+			'name': "gentooheader",
+			'sourcefile': "header",
+			'class': "EbuildHeader",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
new file mode 100644
index 000000000..4b75fc4b5
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/gentoo_header/header.py
@@ -0,0 +1,49 @@
+
+import re
+import time
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildHeader(LineCheck):
+	"""Ensure ebuilds have proper headers
+		Copyright header errors
+		CVS header errors
+		License header errors
+
+	Args:
+		modification_year - Year the ebuild was last modified
+	"""
+
+	repoman_check_name = 'ebuild.badheader'
+
+	gentoo_copyright = r'^# Copyright ((1999|2\d\d\d)-)?%s Gentoo Foundation$'
+	gentoo_license = (
+		'# Distributed under the terms'
+		' of the GNU General Public License v2')
+	id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*')
+	blank_line_re = re.compile(r'^$')
+	ignore_comment = False
+
+	def new(self, pkg):
+		if pkg.mtime is None:
+			self.modification_year = r'2\d\d\d'
+		else:
+			self.modification_year = str(time.gmtime(pkg.mtime)[0])
+		self.gentoo_copyright_re = re.compile(
+			self.gentoo_copyright % self.modification_year)
+
+	def check(self, num, line):
+		if num > 2:
+			return
+		elif num == 0:
+			if not self.gentoo_copyright_re.match(line):
+				return self.errors['COPYRIGHT_ERROR']
+		elif num == 1 and line.rstrip('\n') != self.gentoo_license:
+			return self.errors['LICENSE_ERROR']
+		elif num == 2 and self.id_header_re.match(line):
+			return self.errors['ID_HEADER_ERROR']
+		elif num == 2 and not self.blank_line_re.match(line):
+			return self.errors['NO_BLANK_LINE_ERROR']
+
+


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