• Stars
    star
    128
  • Rank 279,424 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created about 9 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tool for checking common errors in rpm packages

rpmlint

Build and Test Build and Test 2 build result repology

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.8 or newer
  • python3-setuptools, python3-tomli (for python3 < 3.11), python3-tomli-w, python3-pyxdg, python3-pybeam
  • rpm and its python bindings
  • binutils, cpio, gzip, bzip, xz and zstd

Optional, for running the test suite:

  • devscripts
  • dash
  • a 32-bit glibc if on a 64-bit architecture
  • desktop-file-utils
  • libmagic and its python bindings
  • enchant and its python bindings, along with en_US and cs_CZ dictionaries
  • appstream-util, part of appstream-glib

rpmlint is part of most distributions and as an user you can simply

dnf install rpmlint

Testing

You will need to have all the required modules as listed on the Install section above. You will also need pytest,pytest-cov and pytest-xdist, which you can install individually or by running pip install -e ".[test]".

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

python3 -m pytest

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.

Preferable approach for binary packages is to create artificial testcase (to keep binaries small and trivial). We are currently using OBS to produce binaries: https://build.opensuse.org/project/show/devel:openSUSE:Factory:rpmlint:tests

For a sample package see: https://build.opensuse.org/package/show/devel:openSUSE:Factory:rpmlint:tests/non-position-independent-exec

Configuration

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

/etc/xdg/rpmlint/*toml

$XDG_CONFIG_HOME/rpmlint/*toml

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

One can also include additional configuration files (or directories) by using the --config option. Note that all TOML configuration values are merged and not overridden. So e.g. values in a list are concatenated. If you need an override, use *.override.*toml configuration file, where all defined values are selected as default.

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')

The location of rpmlintrc can be set using --rpmlintrc option. Or it can load any *.rpmlintrc or *-rpmlintrc that are located in the same folder as check RPM file (or a specfile). Note the auto-loading happens only when one RPM file (or a specfile) is used. The best practice is to store the name in $PACKAGE_NAME.rpmlintrc.

setBadness overrides a default badness for a given check and addFilter ignores all errors that match the given regular expression (one cannot filter out errors that are listed in BlockedFilters in a configuration file).

More Repositories

1

dnf

Package manager based on libdnf and libsolv. Replaces YUM.
Python
1,226
star
2

rpm

The RPM package manager
C
494
star
3

mock

Mock is a tool for a reproducible build of RPM packages.
Python
381
star
4

tito

A tool for managing rpm based git projects.
Python
378
star
5

dnf5

Next-generation RPM package management system
C++
233
star
6

microdnf

Lightweight implementation of dnf in C
C
216
star
7

libdnf

Package management library.
C++
182
star
8

yum

[DEPRECATED] YUM package manager
Python
125
star
9

dnf-plugins-core

Core DNF Plugins
Python
108
star
10

createrepo_c

C implementation of the createrepo.
C
96
star
11

hawkey

This is hawkey, library providing simplified C and Python API to libsolv. Hawkey project is obsoleted.
C
88
star
12

librepo

A library providing C and Python (libcURL like) API for downloading packages and linux repository metadata in rpm-md format
C
74
star
13

dnf-plugins-extras

repository for DNF community plugins
Python
65
star
14

modulemd-tools

Collection of tools for parsing and generating modulemd YAML files
Python
49
star
15

popt

C library for parsing command line parameters
C
49
star
16

yum-utils

[DEPRECATED] A collection of utilities, plugins and examples related to the YUM package manager
Python
34
star
17

librpm.rs

Rust bindings to the RPM Package Manager libraries (librpm, librpmbuild, librpmsign)
Rust
31
star
18

libcomps

Libcomps is alternative for yum.comps library. It's written in pure C as library and there's bindings for python2 and python3.
C
29
star
19

distribution-gpg-keys

Collection of GPG keys used in Linux Distributions
Python
28
star
20

spec-cleaner

spec-cleaner
Python
28
star
21

createrepo

Python
27
star
22

dnf-plugin-system-upgrade

A DNF plugin for system upgrades (moved to dnf-plugins-extras!)
Python
24
star
23

deltarpm

C
21
star
24

ci-dnf-stack

CI tests for the dnf stack
Gherkin
14
star
25

rpm-sequoia

An OpenPGP backend for rpm using Sequoia PGP
Rust
14
star
26

urlgrabber

Python
14
star
27

drpm

C
10
star
28

rpm-web

RPM web content
Python
10
star
29

fakeuname

Small library that overrides uname() system call to return configured fake kernel release.
C
7
star
30

rpm-gitoverlay

Manage an overlay repository of RPMs from upstream git
Python
7
star
31

fedora-distro-aliases

Aliases for active Fedora releases
Python
5
star
32

maximum-rpm

Maximum RPM
Shell
4
star
33

opensuse-distro-aliases

Aliases for active openSUSE releases
Python
4
star
34

yum-metadata-parser

C
4
star
35

rpm-extras

Shell
3
star
36

python-rpm-packaging

Tools for packaging Python projects with rpm
Python
3
star
37

dnf-URPM

URPM* tool suite implemented on top of DNF
Python
3
star
38

librhsm

C
3
star
39

rpm-metadata

Documentation of the RPM MetaData (rpm-md) format
XSLT
3
star
40

libdnf-l10n

Repository for syncing translations of the libdnf component with weblate.
Python
2
star
41

dnf-plugins-core-l10n

Repository for syncing translations of the dnf-plugins-core component with weblate.
Python
2
star
42

yum-docs

Legacy repository for Yum documentation
2
star
43

libpkgmanifest

Library for working with RPM manifests
C++
2
star
44

perl-rpm-packaging

Tools for packaging Perl projects with rpm
Perl
1
star
45

perl-RPM4

Perl module to access and manipulate RPM files
Perl
1
star
46

rpmconstant

Small library to find constants in rpm headers
C
1
star
47

dnf-l10n

Repository for syncing translations of the dnf component with weblate.
1
star
48

dnf-plugins-extras-l10n

Repository for syncing translations of the dnf-plugins-extras component with weblate.
Python
1
star
49

popt-l10n

Popt translations
CMake
1
star
50

libdnf-plugin-template

Template for libdnf plugin
C
1
star
51

dnf5-l10n

This repo is for synchronization of dnf5 translations with translate.fedoraproject.org
1
star
52

test-repo

A repository for testing DNF Bot and CI. Unfortunately a personal repo is not good enough for that.
1
star
53

mock-test-data

Place to store big binary blobs for the purpose of mock integration testing (shallow clone expected from here)
Python
1
star
54

libparch

Handle architectures for packaging purposes
C
1
star
55

yum-updatesd

yum-updatesd
Python
1
star
56

rpm-l10n

Rpm translations
CMake
1
star
57

org-admin

Adminsitrative requests for the rpm-software-management organization
1
star
58

rpm-software-management.github.io

Blog of the Software Management (DNF, RPM, YUM) teams.
HTML
1
star
59

rpmpgp_legacy

RPM legacy OpenPGP parser
C
1
star
60

R-rpm-macros

Macros and scripts for packaging software in R
R
1
star