From 26bff102b966994de349629944d312663a54f6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 27 Apr 2013 19:37:05 +0200 Subject: [PATCH 2/2] repoman: check for ${D}foo and ${ROOT}foo paths. That is, require ${D}/foo and ${ROOT}/foo. --- pym/repoman/checks.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index d9ce985..84ae474 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -833,6 +833,18 @@ class RootCheckTrailingSlash(LineCheck): if match: return "${ROOT} check should handle empty ROOT on line: %d" +class PathTrailingSlash(LineCheck): + """Check ebuild for paths assuming that ${D} and ${ROOT} end with + a trailing slash.""" + repoman_check_name = 'ebuild.minorsyn' + slashcheck_re = re.compile(r'(\${?(?:D|ROOT)}?["\']?)([a-z]+)') + + def check(self, num, line): + match = self.slashcheck_re.search(line) + if match: + return '%s should be %s/%s' % (match.group(0), + match.group(1), match.group(2)) + ' on line: %d' + _base_check_classes = (InheritEclass, LineCheck, PhaseCheck) _constant_checks = tuple(chain((v() for k, v in globals().items() if isinstance(v, type) and issubclass(v, LineCheck) and v not in _base_check_classes), -- 1.8.2.1