Anyone has a good workflow to compile custom RPMs?

,

Anyone has a good workflow for compiling a Fedora package from git? There’s a lot of ceremony involved the few times I tried (set up rpm tree, update spec, fedpkg, maybe try a COPR, argh…) and I often have a need to test a new patch from upstream.

I used to use Arch Linux and the process is about 2 orders of magnitude simpler. Download the PKGBUILD, replace the original unpacked source with a git repo, makepkg and install the package.

There’s a pipewire patch I’d like to test on Fedora and I wouldn’t even know how to get started, and funnily enough, I’ve created RPMs a dozen times, but it’s so convoluted I immediately forget. And spec files seem only to work with stable tarballs, and trying to get it to work off a git repo is not very well documented.

Lastly, there is a lot of documentation for very old versions of Fedora and it’s really hard to find something that’s up to date. Packaging RPMs seems to be a dark art nobody seems interested in simplifying… and it’s sad because I’d like to contribute to Fedora.

In a perfect world I’d have one script to

  • Download spec from src.fedoraproject.org
  • Modify the spec to point to a custom source
  • Build and create an RPM

But it doesn’t seem to exist.

Does anyone have a good, simple guide/script that can automate the process of building an RPM for an existing package, but from the upstream git repo? How do packagers deal with this stuff?

1 Like

It depends on what you’re trying to do.
If you want to create RPMs from scratch, the best source is here:

https://docs.fedoraproject.org/en-US/package-maintainers/Joining_the_Package_Maintainers/

If you’re not looking to join the Fedora packagers team, you can skip all the information about getting sponsored and just go through the tutorials:

https://docs.fedoraproject.org/en-US/package-maintainers/Packaging_Tutorial_GNU_Hello/

In the simplest case, one would:

Your new rpms will be in a results.. directory.

Now, if you want to use a Git snapshot instead of a release, you must change the “Source0” tag in the spec which specifies what the name of the source tarball is. You should be able to just download the new tar, and rebuild—unless other things have changed in the build process itself.

Here is a simpler tutorial on the spec file:

2 Likes