Bug 1019204 - SpecCheck is hardcoded to be the only check to run on spec files
SpecCheck is hardcoded to be the only check to run on spec files
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: rpmlint (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Michael Scherer
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-15 05:44 EDT by Miro Hrončok
Modified: 2013-10-31 16:46 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-10-31 16:46:07 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Miro Hrončok 2013-10-15 05:44:33 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().

That is:

 * 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():
            self.check_binary(pkg)
            return
        for fname, pkgfile in pkg.files().items():
            if fname.endswith('.spec'):
                if pkg.spec_file:
                    printError(pkg, 'multiple-specfiles', spec_file, fname)
                else:
                    pkg.spec_file = fname
                    self.check_spec(pkg)
                    pkg.remove_from_sources(pkg.spec_file)
        self.check_sources(pkg)

[This is just very rough draft]

And again: I'm willing to send patches, just give me blessing or speak against that approach.
Comment 1 Miro Hrončok 2013-10-31 16:46:07 EDT
since upstream bug tracker is now open for strangers, I've moved this thing there, where it belongs.

https://sourceforge.net/p/rpmlint/tickets/24/

Note You need to log in before you can comment on or make changes to this bug.