rpm Notes

General notes about rpm packaging and references to upstream docs

Suraj Deshmukh

2 minute read

Setup of the system for building rpms

$ dnf -y install fedora-packager fedora-review
$ sudo usermod -a -G mock vagrant
$ fedora-packager-setup
$ kinit surajd@FEDORAPROJECT.ORG

My Notes

$ sudo rpm -ql redhat-rpm-config-45-1.fc25.noarch
  • To see all macros on the system:
$ rpm --showrc
  • Koji - fedora build system
  • fedora uses fedpkg for doing builds, while rpmbuild is for CentOS
  • To get general info about the package
$ rpm -qip ./x86_64/namaskar-1-1.fc25.x86_64.rpm

OR

$ less namaskar-1-1.fc25.src.rpm
  • To see what are the dependencies of the package
$ rpm -qp --requires ./noarch/namaskar-1-1.fc25.noarch.rpm
/bin/bash
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
  • To see what packages include your package as dependency
$ rpm -qp --provides ./noarch/namaskar-1-1.fc25.noarch.rpm
namaskar = 1-1.fc25
  • After you think the spec is ready and before you push it to build
$ fedpkg --release f25 lint
  • Doing local mock build
$ fedpkg --release f25 mockbuild
  • Doing build in fedora build system, koji
$ fedpkg --release f25 scratch-build --target f25 --srpm
  • Running fedora-review
$ fedpkg --release f25 srpm
$ fedora-review -n namaskar
  • Decompress a package, src.
$ rpm2cpio kompose-0.1.0-0.1.git8227684.el7.src.rpm | cpio -ivdm

OR

$ rpmdev-extract kompose-0.4.0-0.1.git4e3300c.fc27.x86_64.rpm
  • Various ways to query package: src.
  • To download source as mentioned in the Source0 tag, use:
$ spectool -g kompose.spec
  • To validate the rpmspec if it is error free
$ rpmlint kompose.spec

Ref:

comments powered by Disqus