Add a rule that warns about make dependencies already listed as dependencies. Signed-off-by: Michael Straube <michael.straube@posteo.de> --- Namcap/rules/__init__.py | 1 + Namcap/rules/makedepends.py | 41 +++++++++++++++++++++++++++++++++++++ namcap-tags | 1 + 3 files changed, 43 insertions(+) create mode 100644 Namcap/rules/makedepends.py diff --git a/Namcap/rules/__init__.py b/Namcap/rules/__init__.py index e8775a0..dcc950f 100644 --- a/Namcap/rules/__init__.py +++ b/Namcap/rules/__init__.py @@ -59,6 +59,7 @@ from . import ( carch, extravars, invalidstartdir, + makedepends, makepkgfunctions, missingvars, pkginfo, diff --git a/Namcap/rules/makedepends.py b/Namcap/rules/makedepends.py new file mode 100644 index 0000000..48b1049 --- /dev/null +++ b/Namcap/rules/makedepends.py @@ -0,0 +1,41 @@ +# +# namcap rules - makedepends +# Copyright (C) 2018 Michael Straube <michael.straube@posteo.de> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +from Namcap.ruleclass import * + +class RedundantMakedepends(PkgbuildRule): + """ + This rule checks for make dependencies that are already + included as dependencies. + """ + name = "makedepends" + description = "Check for redundant make dependencies" + + def analyze(self, pkginfo, pkgbuild): + redundant_makedeps = [] + + if 'makedepends' in pkginfo and 'depends' in pkginfo: + for d in pkginfo["makedepends"]: + if d in pkginfo["depends"]: + redundant_makedeps.append(d) + + for i in redundant_makedeps: + self.warnings.append(("redundant-makedep %s", i)) + +# vim: set ts=4 sw=4 noet: diff --git a/namcap-tags b/namcap-tags index 2133c45..c253042 100644 --- a/namcap-tags +++ b/namcap-tags @@ -71,6 +71,7 @@ potential-non-fhs-man-page %s :: Potential non-FHS man page (%s) found. py-mtime-mtree-warning :: Found .py file unnoticeably newer than associated .pyc/pyo. py-mtime-tar-error :: Found .py file newer than associated .pyc/pyo. py-mtime-file-name %s :: Python script (%s) is newer than associated .pyc/pyo. +redundant-makedep %s :: Make dependency (%s) already included as dependency script-link-detected %s in %s :: Script link detected (%s) in file %s scrollkeeper-dir-exists %s :: Scrollkeeper directory exists (%s). Remember to not run scrollkeeper till post_{install,upgrade,remove}. site-ruby :: Found usr/lib/ruby/site_ruby in package, usr/lib/ruby/vendor_ruby should be used instead. -- 2.19.1