From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 2EABB139694 for ; Sat, 15 Jul 2017 02:08:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 44880E0E2D; Sat, 15 Jul 2017 02:08:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 19535E0E20 for ; Sat, 15 Jul 2017 02:08:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (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 1132C3418E3 for ; Sat, 15 Jul 2017 02:08:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1B2A074BB for ; Sat, 15 Jul 2017 02:08:47 +0000 (UTC) From: "Brian Dolbec" 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" Message-ID: <1500084507.9fc806a9a29433250fb593c5302874bbef74a0c6.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: 9fc806a9a29433250fb593c5302874bbef74a0c6 X-VCS-Branch: repoman Date: Sat, 15 Jul 2017 02:08:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 21b09de2-96cf-485e-a132-3fcb02dd60ee X-Archives-Hash: 2f2ab2c59ba1714fbc3e4fc3eb923b24 commit: 9fc806a9a29433250fb593c5302874bbef74a0c6 Author: Brian Dolbec gentoo org> AuthorDate: Sat Jul 15 00:19:12 2017 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sat Jul 15 02:08:27 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9fc806a9 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