aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bersenev <bay@hackerdom.ru>2014-02-17 17:55:51 +0600
committerAlexander Bersenev <bay@hackerdom.ru>2014-02-17 17:55:51 +0600
commit5a3f506c9ef1cfd78940b0509f10ef94b4434e29 (patch)
tree147c35a17a8bcd8ff467bb3063adab623da51fac /portage_with_autodep/pym/repoman/checks.py
parentfixed a deadlock (diff)
downloadautodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.tar.gz
autodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.tar.bz2
autodep-5a3f506c9ef1cfd78940b0509f10ef94b4434e29.zip
updated portage to 2.2.8-r1
Diffstat (limited to 'portage_with_autodep/pym/repoman/checks.py')
-rw-r--r--portage_with_autodep/pym/repoman/checks.py49
1 files changed, 35 insertions, 14 deletions
diff --git a/portage_with_autodep/pym/repoman/checks.py b/portage_with_autodep/pym/repoman/checks.py
index e7472df..77df603 100644
--- a/portage_with_autodep/pym/repoman/checks.py
+++ b/portage_with_autodep/pym/repoman/checks.py
@@ -1,5 +1,5 @@
# repoman: Checks
-# Copyright 2007, 2011 Gentoo Foundation
+# Copyright 2007-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
"""This module contains functions used in Repoman to ascertain the quality
@@ -8,6 +8,7 @@ and correctness of an ebuild."""
import re
import time
import repoman.errors as errors
+import portage
from portage.eapi import eapi_supports_prefix, eapi_has_implicit_rdepend, \
eapi_has_src_prepare_and_src_configure, eapi_has_dosed_dohard, \
eapi_exports_AA, eapi_exports_KV
@@ -77,6 +78,7 @@ class EbuildHeader(LineCheck):
# gentoo_license = re.compile(r'^# Distributed under the terms of the GNU General Public License v2$')
gentoo_license = '# Distributed under the terms of the GNU General Public License v2'
cvs_header = re.compile(r'^# \$Header: .*\$$')
+ ignore_comment = False
def new(self, pkg):
if pkg.mtime is None:
@@ -282,21 +284,35 @@ class EbuildUselessCdS(LineCheck):
self.check_next_line = True
class EapiDefinition(LineCheck):
- """ Check that EAPI is defined before inherits"""
+ """
+ Check that EAPI assignment conforms to PMS section 7.3.1
+ (first non-comment, non-blank line).
+ """
repoman_check_name = 'EAPI.definition'
-
- eapi_re = re.compile(r'^EAPI=')
- inherit_re = re.compile(r'^\s*inherit\s')
+ ignore_comment = True
+ _eapi_re = portage._pms_eapi_re
def new(self, pkg):
- self.inherit_line = None
+ self._cached_eapi = pkg.metadata['EAPI']
+ self._parsed_eapi = None
+ self._eapi_line_num = None
def check(self, num, line):
- if self.eapi_re.match(line) is not None:
- if self.inherit_line is not None:
- return errors.EAPI_DEFINED_AFTER_INHERIT
- elif self.inherit_re.match(line) is not None:
- self.inherit_line = line
+ if self._eapi_line_num is None and line.strip():
+ self._eapi_line_num = num + 1
+ m = self._eapi_re.match(line)
+ if m is not None:
+ self._parsed_eapi = m.group(2)
+
+ def end(self):
+ if self._parsed_eapi is None:
+ if self._cached_eapi != "0":
+ yield "valid EAPI assignment must occur on or before line: %s" % \
+ self._eapi_line_num
+ elif self._parsed_eapi != self._cached_eapi:
+ yield ("bash returned EAPI '%s' which does not match "
+ "assignment on line: %s") % \
+ (self._cached_eapi, self._eapi_line_num)
class EbuildPatches(LineCheck):
"""Ensure ebuilds use bash arrays for PATCHES to ensure white space safety"""
@@ -341,7 +357,7 @@ class NoOffsetWithHelpers(LineCheck):
repoman_check_name = 'variable.usedwithhelpers'
# Ignore matches in quoted strings like this:
# elog "installed into ${ROOT}usr/share/php5/apc/."
- re = re.compile(r'^[^#"\']*\b(dodir|dohard|exeinto|insinto|into)\s+"?\$\{?(D|ROOT|ED|EROOT|EPREFIX)\b.*')
+ re = re.compile(r'^[^#"\']*\b(docinto|docompress|dodir|dohard|exeinto|fowners|fperms|insinto|into)\s+"?\$\{?(D|ROOT|ED|EROOT|EPREFIX)\b.*')
error = errors.NO_OFFSET_WITH_HELPERS
class ImplicitRuntimeDeps(LineCheck):
@@ -384,6 +400,7 @@ class InheritDeprecated(LineCheck):
# deprecated eclass : new eclass (False if no new eclass)
deprecated_classes = {
+ "bash-completion": "bash-completion-r1",
"gems": "ruby-fakegem",
"git": "git-2",
"mozconfig-2": "mozconfig-3",
@@ -646,13 +663,17 @@ class Eapi4GoneVars(LineCheck):
class PortageInternal(LineCheck):
repoman_check_name = 'portage.internal'
- re = re.compile(r'[^#]*\b(ecompress|ecompressdir|prepall|prepalldocs|preplib)\b')
+ ignore_comment = True
+ # Match when the command is preceded only by leading whitespace or a shell
+ # operator such as (, {, |, ||, or &&. This prevents false postives in
+ # things like elog messages, as reported in bug #413285.
+ re = re.compile(r'^(\s*|.*[|&{(]+\s*)\b(ecompress|ecompressdir|env-update|prepall|prepalldocs|preplib)\b')
def check(self, num, line):
"""Run the check on line and return error if there is one"""
m = self.re.match(line)
if m is not None:
- return ("'%s'" % m.group(1)) + " called on line: %d"
+ return ("'%s'" % m.group(2)) + " called on line: %d"
_constant_checks = tuple((c() for c in (
EbuildHeader, EbuildWhitespace, EbuildBlankLine, EbuildQuote,