This post will get you through all the steps needed for doing RPM packaging.
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
- Start reading from: Fedora packager’s guide
- Some macros come from
redhat-rpm-config
andfedora-rpm-macros
.
$ sudo rpm -ql redhat-rpm-config-45-1.fc25.noarch
- To see all macros on the system:
$ rpm --showrc
- Koji - fedora build system
fedora
usesfedpkg
for doing builds, whilerpmbuild
is forCentOS
- 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:
- Yum and RPM Tricks https://wiki.centos.org/TipsAndTricks/YumAndRPM
- Creating RPM Packages with Fedora https://fedoraproject.org/wiki/How_to_create_an_RPM_package
- Inside the Spec File, Directives For the
%files
list http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html - How to get sponsored into the packager group https://fedoraproject.org/wiki/How_to_get_sponsored_into_the_packager_group
- Doing local builds help from adb-utils repo
- Using Mock to test package builds https://fedoraproject.org/wiki/Using_Mock_to_test_package_builds
- Packaging:RPMMacros https://fedoraproject.org/wiki/Packaging:RPMMacros?rd=Packaging/RPMMacros
- Tweet about using
rpmdev-extract