This repository is referenced by the COPR build system for rpraab/Polybar, which packages polybar as an RPM.
This exercise was intended to introduce me to the RPM ecosytem. Polybar was a good target since multiple spec files already exist on COPR for this software.
This being said, I do believe I made some improvements over existing packages (such as downloading sources from the github archives rather than the tarball release, which in theory need not match the original sources). I also compiled the source with all optional modules enabled, included the documentation in the install.
At present, I have only enabled Fedora version 30 on x86_64 machines as a build target.
The most helpful resource I found was "RPM Packaging Guide", produced by the Redhat Developer Program.
Besides documentation for the .spec
file format, the most helpful element of
the documentation was at the begining of the document: steps for local testing.
- Install the rpm devtools
sudo dnf install rpmdevtools rpm-build
- Set up the build directories expected by the tool (they will be placed in your home directory. This only needs to be done once.)
rpmdev-setuptree
- Prep the spec file (downloads sources):
spectool -g -R <spec_file>
- Try the build on your local architecture (note, build dependencies must be manually met first)
rpmbuild -ba <spec_file>
These instructions are referenced from fedoraproject.org.
- Install mock and add yourself to the mock group.
sudo dnf install mock fedpkg
sudo usermod -a -G mock $USER
- Build the source RPM with rpmbuild (install and setup in steps 1 and 2 above) and lint it for errors. Replace "f30" with your target release.
rpmbuild -bs <specfile>
cp <specfile> ~/rpmbuild/SRPMS
fedpkg --path ~/rpmbuild/SRPMS --release f30 lint
- "rebuild" from the source-rpm using mock, where the package name will
have been assigned (and printed in the stdout message) by rpmbuild in the last
step. Mock will default to your current distro version and architecture as the
build target unless given an alternative with the
-r
flag. Enabling the ccache plugin will speed up the debug cycle of repeatedly rebuilding after the first run.
cd ~/rpmbuild/SRPMS
mock --enable-plugin ccache <package-name.src.rpm>
- If you make it here without errors, you should be good to go for using the COPR build system.
The online tutorial was straightforward, and in particular the screenshot tutorial was very easy to follow.
In the future, I want to remember that using webhooks is possible for triggering automatic builds.