1 |
commit: 44d6f11f37970a60ac2e4d7252180d96793e02d3 |
2 |
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 1 15:08:28 2017 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 1 15:12:05 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=44d6f11f |
7 |
|
8 |
repoman: Warn about stale CVS keywords in ebuild header bug 610954 |
9 |
|
10 |
See Gentoo Council decision on 28 February 2017: |
11 |
https://bugs.gentoo.org/611234 |
12 |
|
13 |
X-Gentoo-bug: 610954 |
14 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=610954 |
15 |
|
16 |
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org> |
17 |
|
18 |
repoman/pym/repoman/modules/scan/ebuild/checks.py | 11 +++++++---- |
19 |
repoman/pym/repoman/modules/scan/ebuild/errors.py | 6 ++++-- |
20 |
2 files changed, 11 insertions(+), 6 deletions(-) |
21 |
|
22 |
diff --git a/repoman/pym/repoman/modules/scan/ebuild/checks.py b/repoman/pym/repoman/modules/scan/ebuild/checks.py |
23 |
index 6d239c894..7a29af145 100644 |
24 |
--- a/repoman/pym/repoman/modules/scan/ebuild/checks.py |
25 |
+++ b/repoman/pym/repoman/modules/scan/ebuild/checks.py |
26 |
@@ -1,6 +1,6 @@ |
27 |
# -*- coding:utf-8 -*- |
28 |
# repoman: Checks |
29 |
-# Copyright 2007-2014 Gentoo Foundation |
30 |
+# Copyright 2007-2017 Gentoo Foundation |
31 |
# Distributed under the terms of the GNU General Public License v2 |
32 |
|
33 |
"""This module contains functions used in Repoman to ascertain the quality |
34 |
@@ -89,7 +89,8 @@ class EbuildHeader(LineCheck): |
35 |
gentoo_license = ( |
36 |
'# Distributed under the terms' |
37 |
' of the GNU General Public License v2') |
38 |
- id_header = '# $Id$' |
39 |
+ id_header_re = re.compile(r'.*\$(Id|Header)(:.*)?\$.*') |
40 |
+ blank_line_re = re.compile(r'^$') |
41 |
ignore_comment = False |
42 |
|
43 |
def new(self, pkg): |
44 |
@@ -108,8 +109,10 @@ class EbuildHeader(LineCheck): |
45 |
return errors.COPYRIGHT_ERROR |
46 |
elif num == 1 and line.rstrip('\n') != self.gentoo_license: |
47 |
return errors.LICENSE_ERROR |
48 |
- #elif num == 2 and line.rstrip('\n') != self.id_header: |
49 |
- # return errors.ID_HEADER_ERROR |
50 |
+ elif num == 2 and self.id_header_re.match(line): |
51 |
+ return errors.ID_HEADER_ERROR |
52 |
+ elif num == 2 and not self.blank_line_re.match(line): |
53 |
+ return errors.NO_BLANK_LINE_ERROR |
54 |
|
55 |
|
56 |
class EbuildWhitespace(LineCheck): |
57 |
|
58 |
diff --git a/repoman/pym/repoman/modules/scan/ebuild/errors.py b/repoman/pym/repoman/modules/scan/ebuild/errors.py |
59 |
index 3090de0d1..8387e35e6 100644 |
60 |
--- a/repoman/pym/repoman/modules/scan/ebuild/errors.py |
61 |
+++ b/repoman/pym/repoman/modules/scan/ebuild/errors.py |
62 |
@@ -1,6 +1,6 @@ |
63 |
# -*- coding:utf-8 -*- |
64 |
# repoman: Error Messages |
65 |
-# Copyright 2007-2013 Gentoo Foundation |
66 |
+# Copyright 2007-2017 Gentoo Foundation |
67 |
# Distributed under the terms of the GNU General Public License v2 |
68 |
|
69 |
from __future__ import unicode_literals |
70 |
@@ -10,7 +10,9 @@ COPYRIGHT_ERROR = ( |
71 |
LICENSE_ERROR = ( |
72 |
'Invalid Gentoo/GPL License on line: %d') |
73 |
ID_HEADER_ERROR = ( |
74 |
- 'Malformed Id header on line: %d') |
75 |
+ 'Stale CVS header on line: %d') |
76 |
+NO_BLANK_LINE_ERROR = ( |
77 |
+ 'Non-blank line after header on line: %d') |
78 |
LEADING_SPACES_ERROR = ( |
79 |
'Ebuild contains leading spaces on line: %d') |
80 |
TRAILING_WHITESPACE_ERROR = ( |