Enhance README

- add python3-toml and python3-pyxdg as install requirements
- typo and structure
This commit is contained in:
Kristýna Streitová 2019-08-15 13:17:48 +02:00
parent 7983c17929
commit 7d243ba485
1 changed files with 32 additions and 26 deletions

View File

@ -5,46 +5,52 @@
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/rpm-software-management/rpmlint.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rpm-software-management/rpmlint/context:python) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/rpm-software-management/rpmlint.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/rpm-software-management/rpmlint/context:python)
[![Coverage Status](https://coveralls.io/repos/github/rpm-software-management/rpmlint/badge.svg?branch=master)](https://coveralls.io/github/rpm-software-management/rpmlint?branch=master) [![Coverage Status](https://coveralls.io/repos/github/rpm-software-management/rpmlint/badge.svg?branch=master)](https://coveralls.io/github/rpm-software-management/rpmlint?branch=master)
rpmlint is a tool for checking common errors in rpm packages. `rpmlint` is a tool for checking common errors in RPM packages.
rpmlint can be used to test individual packages before uploading or to check `rpmlint` can be used to test individual packages before uploading or to check
an entire distribution. an entire distribution.
rpmlint can check binary rpms, source rpms, and plain specfiles, but all `rpmlint` can check binary RPMs, source RPMs, and plain specfiles, but all
checks do not apply to all argument types. checks do not apply to all argument types.
For best check coverage, run rpmlint on source rpms instead of For best check coverage, run `rpmlint` on source RPMs instead of
plain specfiles. plain specfiles.
The idea for rpmlint is from the lintian tool of the Debian project. 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 All the checks reside in `rpmlint/checks` folder. Feel free to provide new
checks and suggestions at: checks and suggestions at:
https://github.com/rpm-software-management/rpmlint https://github.com/rpm-software-management/rpmlint
## Install ## Install
For installation on your machine you will need following packages: For installation on your machine you will need the following packages:
Mandatory
- Python 3.6 or newer - Python 3.6 or newer
- Python setuptoools - Python setuptoools, python3-toml, python3-pyxdg
- rpm and its python bindings - rpm and its python bindings
- readelf, cpio, gzip, bzip and xz - readelf, cpio, gzip, bzip and xz
- libmagic and its python bindings (optional)
- groff and gtbl (optional) Optional
- enchant and its python bindings (optional) - libmagic and its python bindings
- appstream-util, part of appstream-glib (optional) - groff and gtbl
- enchant and its python bindings
- appstream-util, part of appstream-glib
## Testing ## Testing
If you want to test the rpmlint when developing best is to use docker ### Docker
to provide the enviroment for you. There are various distribution 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. dockerfiles in `test/` folder.
Ie. if you want to test on latest openSUSE you can test using following commands: 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 build -t opensusetw -f test/Dockerfile-opensusetw .`
`docker run -v $(pwd):/usr/src/rpmlint/ opensusetw python3 setup.py test` `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 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. have all the required modules as listed on the Install section above.
You will also need `pytest` and `pytest-cov` and `pytest-flake8`. You will also need `pytest` and `pytest-cov` and `pytest-flake8`.
@ -53,24 +59,24 @@ If all the dependencies are present you can just execute tests using:
`python3 setup.py test` `python3 setup.py test`
Or even pick one of the tests using pytest: Or even pick one of the tests using `pytest`:
`python3 -m pytest test/test_config.py` `python3 -m pytest test/test_config.py`
## Bugfixing and contributing ## Bugfixing and contributing
Any help of course welcome but honestly most probable cause for your visit 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 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 :) it is marking something as correct while it should not either :)
Now there is easy way how to fix that. Our testsuite simply needs an Now there is an easy way how to fix that. Our testsuite simply needs an
extension to take the above problem into the account. extension to take the above problem into the account.
Primarily we just need the offending rpm file (best the smallest you can 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 find or we would soon take few GB to take a checkout) and some basic
expectation of what should happen. expectation of what should happen.
Now lets look on an example workflow: ### Example workflow
1) I have rpmfile that should report unreadable zip file 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` 2) I store this file in git under `test/binary/texlive-codepage-doc-2018.151.svn21126-38.1.noarch.rpm`
@ -88,23 +94,23 @@ def test_zip2(tmpdir, package, zipcheck):
As you can see it is not so hard and with each added test we get better 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 coverage on what is really expected from rpmlint and avoid naughty regressions
in a long run. in the long run.
## Configuration ## Configuration
If you want to change configuration options or the list of checks you can If you want to change configuration options or the list of checks you can
use following locations: use the following locations:
`/etc/xdg/rpmlint/*config` `/etc/xdg/rpmlint/*config`
`$XDG_CONFIG_HOME/rpmlint/*config` `$XDG_CONFIG_HOME/rpmlint/*config`
Configuration itself is a toml file where for some basic inspiration The configuration itself is a `toml` file where for some basic inspiration
you can check up `rpmlint/configdefaults.toml` which specifies format/defaults. you can check up `rpmlint/configdefaults.toml` which specifies format/defaults.
Additional option to control rpmlint behaviour is addition of rpmlintrc file Additional option to control `rpmlint` behaviour is the addition of `rpmlintrc` file
which uses old syntax for compatibility with old rpmlint releases, yet which uses old syntax for compatibility with old `rpmlint` releases, yet
it can be normal toml file if you wish: it can be normal `toml` file if you wish:
`setBadness('check', 0)` `setBadness('check', 0)`