rpm-tool is yet another tool to work with RPM files and RPM repositories. Key features:
- Fast repository index generator (yes, faster than createrepo and even createrepo_c)
- Provide RPM files metadata in easy-to-parse formats: YAML, JSON, and XML
- Support for other.xml.gz repodata
- Support for modules repositories index (new feature in Centos 8)
Note that *.sqlite.gz formats of repodata are deprecated since 2015 and will not be supported by utility.
cargo build --releaseFor backward compatibility with older systems, XML files are compressed in single thread. To build with parallel gzip enabled:
cargo build --release --features parallel-zipCurrently, the configuration file is minimalistic and self-documented.
All command line options are well self-documented. Below are a few examples with comments:
rpm-tool --help
rpm-tool rpm --help
rpm-tool rpm dump --help
rpm-tool repository --helprpm-tool rpm dump -f json /path/to/file.rpmrpm-tool repository generate --fileslists /path/to/repository/directory/Tool use already existing repodata to safely skip heavy operations like calculating checksums or even reading RPM file headers,
To effectively utilize CPU usage rpm-tool creates a thread pool, which is used to calculate checksums, read RPM headers, gzip resulting metadata, and so on. The pool size can be configured via config file, see repodata→concurrency.
rpm-tool repository add-files --fileslists --repository-path /path/to/repository/directory/ file1.rpm file2.rpmFull rescan of huge repository just to add a couple of new files doesn’t seem to be effective. In order to optimize such a frequent operation, sub-command “add-files” was added.
The tool can write a log to STDOUT instead of syslog. Just define the environment variable RUST_LOG with the desired log level:
RUST_LOG=info rpm-tool repository generate ...Here is benchmark results of indexing RPM repository. Repository had 1200 packages of total size 12GB. All files are cached in page cache before starting benchmark.
| createrepo_c | rpm-tool | |
|---|---|---|
| create index from scratch | 46 s | 24 s |
| add one new package | 34 s | 0.11 s |