From 42d434160f42050a1910a26b84b1990d66595ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 27 Apr 2013 19:27:10 +0200 Subject: [PATCH 1/2] repoman: check for $ROOT [=!]= / tests. That is, require $ROOT tests to handle empty ROOT. --- pym/repoman/checks.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pym/repoman/checks.py b/pym/repoman/checks.py index 8c0a301..d9ce985 100644 --- a/pym/repoman/checks.py +++ b/pym/repoman/checks.py @@ -822,6 +822,17 @@ class PortageInternalVariableAssignment(LineCheck): e += ' on line: %d' return e +class RootCheckTrailingSlash(LineCheck): + """Check ebuild for checks assuming ${ROOT} == /.""" + repoman_check_name = 'ebuild.minorsyn' + slashcheck_re = re.compile( + r'\[\[?\s+["\']?\${?ROOT}?["\']?\s+[=!]=\s+["\']?/["\']?\s+') + + def check(self, num, line): + match = self.slashcheck_re.search(line) + if match: + return "${ROOT} check should handle empty ROOT 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