Setting up rpmbuild

Two different things get mixed together here. The rpmdevtools package installs helper commands under /usr/bin. rpmdev-setuptree only creates a directory layout under ~/rpmbuild and a couple of macros in ~/.rpmmacros. It does not install those binaries.

Commands

On current Fedora / RHEL 8+ / Rocky / Alma, the package manager is dnf (yum is a wrapper). You also need rpm-build to actually build:

sudo dnf install -y rpmdevtools rpm-build
rpmdev-setuptree

Optional extras (default %_tmppath is already /var/tmp; you only need a private tmp if you cannot write there):

mkdir -p ~/rpmbuild/tmp
printf '%sn' '%_tmppath %{_topdir}/tmp' '%packager YourName' >> ~/.rpmmacros

What rpmdevtools installs (not the tree)

Exact names move between rpmdevtools releases. Typical tools: rpmdev-setuptree, rpmdev-newspec, rpmdev-bumpspec, rpmdev-wipetree, rpmdev-extract, rpmdev-diff, rpmdev-vercmp, spectool. List yours with:

rpm -ql rpmdevtools | grep /usr/bin

Directory tree under ~/rpmbuild

~/rpmbuild
|-- BUILD
|-- BUILDROOT   # created by rpmbuild itself on current rpm
|-- RPMS
|-- SOURCES
|-- SPECS
|-- SRPMS
`-- tmp         # only if you added it

What the directories are for

PathMacroFunction
~/rpmbuild%_topdirRoot of the per-user build tree.
~/rpmbuild/BUILD%_builddirUnpacked sources and compile tree.
~/rpmbuild/BUILDROOT%_buildrootdirFake install root used during %install.
~/rpmbuild/RPMS%_rpmdirBuilt binary RPMs, under arch subdirs (x86_64, noarch, …).
~/rpmbuild/SOURCES%_sourcedirTarballs, patches, and other Source/Patch files from the spec.
~/rpmbuild/SPECS%_specdirThe .spec file.
~/rpmbuild/SRPMS%_srcrpmdirSource RPMs from rpmbuild -bs / -ba.
~/rpmbuild/tmp%_tmppathOnly if you overrode the default /var/tmp.

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.