Gentoo Archives: gentoo-commits

From: Brian Dolbec <dolsen@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/do/
Date: Sun, 26 Nov 2017 17:47:13
Message-Id: 1511717538.34ba50bbdad52d0a8edb1ee6d3b31665fdba7a28.dolsen@gentoo
1 commit: 34ba50bbdad52d0a8edb1ee6d3b31665fdba7a28
2 Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 15 00:19:44 2017 +0000
4 Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 26 17:32:18 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=34ba50bb
7
8 repoman: New linechecks module, do
9
10 .../pym/repoman/modules/linechecks/do/__init__.py | 21 +++++++++++++++++++++
11 repoman/pym/repoman/modules/linechecks/do/dosym.py | 16 ++++++++++++++++
12 2 files changed, 37 insertions(+)
13
14 diff --git a/repoman/pym/repoman/modules/linechecks/do/__init__.py b/repoman/pym/repoman/modules/linechecks/do/__init__.py
15 new file mode 100644
16 index 000000000..a56204794
17 --- /dev/null
18 +++ b/repoman/pym/repoman/modules/linechecks/do/__init__.py
19 @@ -0,0 +1,21 @@
20 +# Copyright 2015-2016 Gentoo Foundation
21 +# Distributed under the terms of the GNU General Public License v2
22 +
23 +doc = """Do plug-in module for repoman LineChecks.
24 +Performs do* checks on ebuilds."""
25 +__doc__ = doc[:]
26 +
27 +
28 +module_spec = {
29 + 'name': 'do',
30 + 'description': doc,
31 + 'provides':{
32 + 'nonrelative-check': {
33 + 'name': "dosym",
34 + 'sourcefile': "dosym",
35 + 'class': "EbuildNonRelativeDosym",
36 + 'description': doc,
37 + },
38 + }
39 +}
40 +
41
42 diff --git a/repoman/pym/repoman/modules/linechecks/do/dosym.py b/repoman/pym/repoman/modules/linechecks/do/dosym.py
43 new file mode 100644
44 index 000000000..bab4dad03
45 --- /dev/null
46 +++ b/repoman/pym/repoman/modules/linechecks/do/dosym.py
47 @@ -0,0 +1,16 @@
48 +
49 +import re
50 +
51 +from repoman.modules.linechecks.base import LineCheck
52 +
53 +
54 +class EbuildNonRelativeDosym(LineCheck):
55 + """Check ebuild for dosym using absolute paths instead of relative."""
56 + repoman_check_name = 'ebuild.absdosym'
57 + regex = re.compile(
58 + r'^\s*dosym\s+["\']?(/(bin|etc|lib|opt|sbin|srv|usr|var)\S*)')
59 +
60 + def check(self, num, line):
61 + match = self.regex.match(line)
62 + if match:
63 + return "dosym '%s'... could use relative path" % (match.group(1), ) + " on line: %d"