Go to file
Kristýna Streitová 7d243ba485 Enhance README
- add python3-toml and python3-pyxdg as install requirements
- typo and structure
2019-08-15 13:17:48 +02:00
rpmlint Add new check: linked-against-opt-library 2019-08-14 14:17:19 +02:00
test Add new check: linked-against-opt-library 2019-08-14 14:17:19 +02:00
tools Fix flake8 quotes warnings in genrate-isocodes.py 2018-07-31 17:27:00 +02:00
.coveragerc Add coveragerc explaining where to find the data on docker, vs reality 2019-07-12 22:12:21 +02:00
.dockerignore Adjust the docker script to run the setuptools 2018-07-12 14:46:13 +02:00
.editorconfig *: Move indentation etc settings to .editorconfig 2016-08-24 13:32:30 +03:00
.gitignore Ignore vim swap files 2019-07-04 11:57:05 +02:00
.travis.yml Keep running standalone flake8 too as pytest variant does not check non-tested files 2019-07-29 16:22:51 +02:00
COPYING Update GPL-2.0 with the current text from GNU, whitespace fixes. 2018-08-21 16:11:55 +02:00
MANIFEST.in Make sure setup.py install and sdist actually work 2019-07-29 16:22:51 +02:00
Makefile Add back Makefile generating the isocodes 2018-07-12 14:46:13 +02:00
README.md Enhance README 2019-08-15 13:17:48 +02:00
setup.cfg Have tests verbose by default 2019-07-15 13:46:52 +02:00
setup.py Make sure setup.py install and sdist actually work 2019-07-29 16:22:51 +02:00

README.md

rpmlint

Build Status Total alerts Language grade: Python Coverage Status

rpmlint is a tool for checking common errors in RPM packages. rpmlint can be used to test individual packages before uploading or to check an entire distribution.

rpmlint can check binary RPMs, source RPMs, and plain specfiles, but all checks do not apply to all argument types. For best check coverage, run rpmlint on source RPMs instead of plain specfiles.

The idea for rpmlint is from the lintian tool of the Debian project. All the checks reside in rpmlint/checks folder. Feel free to provide new checks and suggestions at:

https://github.com/rpm-software-management/rpmlint

Install

For installation on your machine you will need the following packages:

Mandatory

  • Python 3.6 or newer
  • Python setuptoools, python3-toml, python3-pyxdg
  • rpm and its python bindings
  • readelf, cpio, gzip, bzip and xz

Optional

  • libmagic and its python bindings
  • groff and gtbl
  • enchant and its python bindings
  • appstream-util, part of appstream-glib

Testing

Docker

If you want to test the rpmlint when developing best is to use docker to provide the environment for you. There are various distribution dockerfiles in test/ folder.

I.e. if you want to test on the latest openSUSE you can test using the following commands:

docker build -t opensusetw -f test/Dockerfile-opensusetw .

docker run -v $(pwd):/usr/src/rpmlint/ opensusetw python3 setup.py test

Directly

Another option is to run the tests on your system directly. If you have all the required modules as listed on the Install section above. You will also need pytest and pytest-cov and pytest-flake8.

If all the dependencies are present you can just execute tests using:

python3 setup.py test

Or even pick one of the tests using pytest:

python3 -m pytest test/test_config.py

Bugfixing and contributing

Any help is, of course, welcome but honestly most probable cause for your visit here is that rpmlint is marking something as invalid while it shouldn't or it is marking something as correct while it should not either :)

Now there is an easy way how to fix that. Our testsuite simply needs an extension to take the above problem into the account.

Primarily we just need the offending rpm file (best the smallest you can find or we would soon take few GB to take a checkout) and some basic expectation of what should happen.

Example workflow

  1. I have rpmfile that should report unreadable zip file
  2. I store this file in git under test/binary/texlive-codepage-doc-2018.151.svn21126-38.1.noarch.rpm
  3. Now I need to figure out what check should test this, in this case test_zip.py
  4. For the testing I will have to devise a small function that validates my expectations:
@pytest.mark.parametrize('package', ['binary/texlive-codepage-doc'])
def test_zip2(tmpdir, package, zipcheck):
    output, test = zipcheck
    test.check(get_tested_package(package, tmpdir))
    out = output.print_results(output.results)
    assert 'W: unable-to-read-zip' in out

As you can see it is not so hard and with each added test we get better coverage on what is really expected from rpmlint and avoid naughty regressions in the long run.

Configuration

If you want to change configuration options or the list of checks you can use the following locations:

/etc/xdg/rpmlint/*config

$XDG_CONFIG_HOME/rpmlint/*config

The configuration itself is a toml file where for some basic inspiration you can check up rpmlint/configdefaults.toml which specifies format/defaults.

Additional option to control rpmlint behaviour is the addition of rpmlintrc file which uses old syntax for compatibility with old rpmlint releases, yet it can be normal toml file if you wish:

setBadness('check', 0)

addFilter('test-i-ignore')