commit: 44d6f11f37970a60ac2e4d7252180d96793e02d3 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> AuthorDate: Wed Mar 1 15:08:28 2017 +0000 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> CommitDate: Wed Mar 1 15:12:05 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=44d6f11f
repoman: Warn about stale CVS keywords in ebuild header bug 610954 See Gentoo Council decision on 28 February 2017: https://bugs.gentoo.org/611234 X-Gentoo-bug: 610954 X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=610954 Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org> repoman/pym/repoman/modules/scan/ebuild/checks.py | 11 +++++++---- repoman/pym/repoman/modules/scan/ebuild/errors.py | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py b/repoman/pym/repoman/modules/scan/ebuild/checks.py index 6d239c894..7a29af145 100644 --- a/repoman/pym/repoman/modules/scan/ebuild/checks.py +++ b/repoman/pym/repoman/modules/scan/ebuild/checks.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- # repoman: Checks -# Copyright 2007-2014 Gentoo Foundation +# Copyright 2007-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 """This module contains functions used in Repoman to ascertain the quality @@ -89,7 +89,8 @@ class EbuildHeader(LineCheck): gentoo_license = ( '# Distributed under the terms' ' of the GNU General Public License v2') - id_header = '# $Id$' + id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*') + blank_line_re = re.compile(r'^$') ignore_comment = False def new(self, pkg): @@ -108,8 +109,10 @@ class EbuildHeader(LineCheck): return errors.COPYRIGHT_ERROR elif num == 1 and line.rstrip('\n') != self.gentoo_license: return errors.LICENSE_ERROR - #elif num == 2 and line.rstrip('\n') != self.id_header: - # return errors.ID_HEADER_ERROR + elif num == 2 and self.id_header_re.match(line): + return errors.ID_HEADER_ERROR + elif num == 2 and not self.blank_line_re.match(line): + return errors.NO_BLANK_LINE_ERROR class EbuildWhitespace(LineCheck): diff --git a/repoman/pym/repoman/modules/scan/ebuild/errors.py b/repoman/pym/repoman/modules/scan/ebuild/errors.py index 3090de0d1..8387e35e6 100644 --- a/repoman/pym/repoman/modules/scan/ebuild/errors.py +++ b/repoman/pym/repoman/modules/scan/ebuild/errors.py @@ -1,6 +1,6 @@ # -*- coding:utf-8 -*- # repoman: Error Messages -# Copyright 2007-2013 Gentoo Foundation +# Copyright 2007-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import unicode_literals @@ -10,7 +10,9 @@ COPYRIGHT_ERROR = ( LICENSE_ERROR = ( 'Invalid Gentoo/GPL License on line: %d') ID_HEADER_ERROR = ( - 'Malformed Id header on line: %d') + 'Stale CVS header on line: %d') +NO_BLANK_LINE_ERROR = ( + 'Non-blank line after header on line: %d') LEADING_SPACES_ERROR = ( 'Ebuild contains leading spaces on line: %d') TRAILING_WHITESPACE_ERROR = (