Red Hat Bugzilla – Bug 1019204
SpecCheck is hardcoded to be the only check to run on spec files
Last modified: 2013-10-31 16:46:07 EDT
Although rpmlint comes with variety of checks and allows the user to configure whatever to run a certain check or not, when it comes to checking spec files, only SpecCheck is hardcoded to run.
Even if SpecCheck is disabled, it will be run on spec files. Even if other checks provide spec checks, and are enabled, they will not run on spec files.
This is certainly an upstream bug, however the upstream bug tracker at SourceForge won't let me file a bug.
We've been discussing this via e-mail with Michael Scherer and Ville Skyttä, however the discussion seems stalled. Other people are asking me about it, so this is created mainly for the reason of public discussion.
What I proposed:
Let all checks implement three methods:
* check_spec(self, pkg)
* check_binary(self, pkg)
* check_sources(self, pkg)
pkg should than contain some structures: spec_file, files, doc_files..., sources (without spec files)
If the check is not interested in a certain category is either doesn't implement the method or implement it doing nothing (pass).
All around rpmlint, where SpecCheck is called directly, all check_spec()s from allowed checks are called instead - similar to how runChecks() works but calling check_spec (and setting pkg.spec_file) instead of just check().
* when input is from stdin
* when input is a filename that ends with .spec
* when input is a directory and file in it ends with .spec
Later on, where runChecks() comes in game, we can keep the things as they are, but we have to be sure, that check() is only in AbstractCheck and it determines whenever to call certain methods form above list. E.g. something like this:
def check(self, pkg):
'''Determine what checks to run on what'''
if not pkg.isSource():
for fname, pkgfile in pkg.files().items():
printError(pkg, 'multiple-specfiles', spec_file, fname)
pkg.spec_file = fname
[This is just very rough draft]
And again: I'm willing to send patches, just give me blessing or speak against that approach.
since upstream bug tracker is now open for strangers, I've moved this thing there, where it belongs.