From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-986384-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id ED345138AE9
	for <garchives@archives.gentoo.org>; Sun, 26 Nov 2017 17:47:18 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id E3E04E0EA4;
	Sun, 26 Nov 2017 17:46:48 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id B6622E0EA4
	for <gentoo-commits@lists.gentoo.org>; Sun, 26 Nov 2017 17:46:48 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 033E633C4EE
	for <gentoo-commits@lists.gentoo.org>; Sun, 26 Nov 2017 17:46:47 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id BCF8FA85B
	for <gentoo-commits@lists.gentoo.org>; Sun, 26 Nov 2017 17:46:45 +0000 (UTC)
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" <dolsen@gentoo.org>
Message-ID: <1511717538.0db35995f2dec3cf647675b8f46be6f5383af5c1.dolsen@gentoo>
Subject: [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/deprecated/
X-VCS-Repository: proj/portage
X-VCS-Files: repoman/pym/repoman/modules/linechecks/deprecated/__init__.py repoman/pym/repoman/modules/linechecks/deprecated/deprecated.py repoman/pym/repoman/modules/linechecks/deprecated/inherit.py
X-VCS-Directories: repoman/pym/repoman/modules/linechecks/deprecated/
X-VCS-Committer: dolsen
X-VCS-Committer-Name: Brian Dolbec
X-VCS-Revision: 0db35995f2dec3cf647675b8f46be6f5383af5c1
X-VCS-Branch: repoman
Date: Sun, 26 Nov 2017 17:46:45 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 386f26c1-a6c1-48ad-978d-52a73fb9090b
X-Archives-Hash: 34fdc0d2a2c58206a77ebb83d6555598

commit:     0db35995f2dec3cf647675b8f46be6f5383af5c1
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 15 00:19:12 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=0db35995

repoman: New linechecks module, deprecated

 .../modules/linechecks/deprecated/__init__.py      | 46 +++++++++++++++
 .../modules/linechecks/deprecated/deprecated.py    | 32 +++++++++++
 .../modules/linechecks/deprecated/inherit.py       | 66 ++++++++++++++++++++++
 3 files changed, 144 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/deprecated/__init__.py b/repoman/pym/repoman/modules/linechecks/deprecated/__init__.py
new file mode 100644
index 000000000..8c5f61d49
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/deprecated/__init__.py
@@ -0,0 +1,46 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Deprecated plug-in module for repoman LineChecks.
+Performs miscelaneous deprecation checks on ebuilds not covered by
+specialty modules."""
+__doc__ = doc[:]
+
+
+module_spec = {
+	'name': 'deprecated',
+	'description': doc,
+	'provides':{
+		'useq-check': {
+			'name': "useq",
+			'sourcefile': "deprecated",
+			'class': "DeprecatedUseq",
+			'description': doc,
+		},
+		'hasq-check': {
+			'name': "hasq",
+			'sourcefile': "deprecated",
+			'class': "DeprecatedHasq",
+			'description': doc,
+		},
+		'preserve-check': {
+			'name': "preservelib",
+			'sourcefile': "deprecated",
+			'class': "PreserveOldLib",
+			'description': doc,
+		},
+		'bindnow-check': {
+			'name': "bindnow",
+			'sourcefile': "deprecated",
+			'class': "DeprecatedBindnowFlags",
+			'description': doc,
+		},
+		'inherit-check': {
+			'name': "inherit",
+			'sourcefile': "inherit",
+			'class': "InheritDeprecated",
+			'description': doc,
+		},
+	}
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/deprecated/deprecated.py b/repoman/pym/repoman/modules/linechecks/deprecated/deprecated.py
new file mode 100644
index 000000000..b33852e74
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/deprecated/deprecated.py
@@ -0,0 +1,32 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class DeprecatedUseq(LineCheck):
+	"""Checks for use of the deprecated useq function"""
+	repoman_check_name = 'ebuild.minorsyn'
+	re = re.compile(r'(^|.*\b)useq\b')
+	error = 'USEQ_ERROR'
+
+
+class DeprecatedHasq(LineCheck):
+	"""Checks for use of the deprecated hasq function"""
+	repoman_check_name = 'ebuild.minorsyn'
+	re = re.compile(r'(^|.*\b)hasq\b')
+	error = 'HASQ_ERROR'
+
+
+class PreserveOldLib(LineCheck):
+	"""Check for calls to the deprecated preserve_old_lib function."""
+	repoman_check_name = 'ebuild.minorsyn'
+	re = re.compile(r'.*preserve_old_lib')
+	error = 'PRESERVE_OLD_LIB'
+
+
+class DeprecatedBindnowFlags(LineCheck):
+	"""Check for calls to the deprecated bindnow-flags function."""
+	repoman_check_name = 'ebuild.minorsyn'
+	re = re.compile(r'.*\$\(bindnow-flags\)')
+	error = 'DEPRECATED_BINDNOW_FLAGS'

diff --git a/repoman/pym/repoman/modules/linechecks/deprecated/inherit.py b/repoman/pym/repoman/modules/linechecks/deprecated/inherit.py
new file mode 100644
index 000000000..8a20f22a4
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/deprecated/inherit.py
@@ -0,0 +1,66 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class InheritDeprecated(LineCheck):
+	"""Check if ebuild directly or indirectly inherits a deprecated eclass."""
+
+	repoman_check_name = 'inherit.deprecated'
+
+	# deprecated eclass : new eclass (False if no new eclass)
+	deprecated_eclasses = {
+		"base": False,
+		"bash-completion": "bash-completion-r1",
+		"boost-utils": False,
+		"clutter": "gnome2",
+		"confutils": False,
+		"distutils": "distutils-r1",
+		"games": False,
+		"gems": "ruby-fakegem",
+		"gpe": False,
+		"gst-plugins-bad": "gstreamer",
+		"gst-plugins-base": "gstreamer",
+		"gst-plugins-good": "gstreamer",
+		"gst-plugins-ugly": "gstreamer",
+		"gst-plugins10": "gstreamer",
+		"mono": "mono-env",
+		"python": "python-r1 / python-single-r1 / python-any-r1",
+		"ruby": "ruby-ng",
+		"x-modular": "xorg-2",
+	}
+
+	_inherit_re = re.compile(r'^\s*inherit\s(.*)$')
+
+	def new(self, pkg):
+		self._errors = []
+
+	def check(self, num, line):
+		direct_inherits = None
+		m = self._inherit_re.match(line)
+		if m is not None:
+			direct_inherits = m.group(1)
+			if direct_inherits:
+				direct_inherits = direct_inherits.split()
+
+		if not direct_inherits:
+			return
+
+		for eclass in direct_inherits:
+			replacement = self.deprecated_eclasses.get(eclass)
+			if replacement is None:
+				pass
+			elif replacement is False:
+				self._errors.append(
+					"please migrate from "
+					"'%s' (no replacement) on line: %d" % (eclass, num + 1))
+			else:
+				self._errors.append(
+					"please migrate from "
+					"'%s' to '%s' on line: %d" % (eclass, replacement, num + 1))
+
+	def end(self):
+		for error in self._errors:
+			yield error
+		del self._errors