aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-07-15 00:19:12 +0000
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:17 -0700
commitc1b47b43913d6d3dd34e5d1db23c2078f688d273 (patch)
tree8ac7640974bef5c446420861cd30b3d227ce556c
parentrepoman: New linechecks module, depend (diff)
downloadportage-c1b47b43913d6d3dd34e5d1db23c2078f688d273.tar.gz
portage-c1b47b43913d6d3dd34e5d1db23c2078f688d273.tar.bz2
portage-c1b47b43913d6d3dd34e5d1db23c2078f688d273.zip
repoman: New linechecks module, deprecated
-rw-r--r--repoman/pym/repoman/modules/linechecks/deprecated/__init__.py46
-rw-r--r--repoman/pym/repoman/modules/linechecks/deprecated/deprecated.py32
-rw-r--r--repoman/pym/repoman/modules/linechecks/deprecated/inherit.py66
3 files changed, 144 insertions, 0 deletions
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