How I use the COPR to build and host rpms for CentOS and Fedora
Introduction
For about a year now, I have been using the Fedora Project's public Cool Other Packages Repository (copr) to build and host rpms for my Fedora and CentOS GNU/Linux installations. This post documents the process I use to take an upstream package, build the packages for the different chroots, and host them for download.
The process
No local tools are required, other than the source control software, normally git.
Select the upstream package
My example will use FreeFileSync, which is a great program and it's quick to compile. Additionally, because the upstream provides only a zip file, I am using my collaborative Opensource Tracking repo for the tarball which dpkg seemed to require and I gave up investigating how to get it to use a zip file as a source.
Prepare the spec file and additional artifacts
My spec file, patches, and additional items for building FreeFileSync on Fedora are on my gitlab page. This topic today is not intended to show you how to use rpmbuild, which is a deep and useful topic.
Add a package to copr
With the rpm sources available on the Internet, we're ready to work in the copr environment.
Create a project
A project can host a single package or many. Also useful to note, that a spec
file can produce more than one rpm. So for the copr, a "package" can include
either a single rpm artifact or multiple. For example, a libssl.spec will
probably produce a libssl-devel, libssl, and libss-docs rpms. You would only
have to set up the libssl.spec, and any produced rpms will just be handled
automatically. So, on the main page of COPR, select "New Project."
Name the project
and include any long-form text you care to share. The build options, farther
down the page, are important. You can always change these options later, so
don't feel that you have to be extremely careful right now. Select the chroot
arch environments you want to build the rpms for.
The
external repositories section is really nice. If you need the packages from
your favorite Internet yum repo, you can paste the baseurl values here.
Create a new package
In your shiny new project, you will want to add some packages! Select the
Packages tab, and then "New package."
Plug
in the relevant information. For FreeFileSync, my rpmbuild input artifacts are
at https://gitlab.com/bgstack15/stackrpms.git, with a committish (I love
that term!) of "freefilesync-bump" which is the dev tree I use for testing the
latest version of FreeFileSync. The subdir for just the freefilesync package,
in my entire git tree, is freefilesync/. I've got a lot of other spec files in
there, but the copr can look in just one dir, which is pretty great. Use the
"rpkg" option, based on the git source. I don't actually know how the other
methods work, and the rpkg has always been good enough for git-hosted spec
files for me.
If the package needs to be excluded from certain architectures,
there's a blacklist field you can use. Save the package settings.
Trigger a build
On the package list, find the new package and select "Rebuild."
You can
choose which chroots to use, and the checkboxes are pre-populated with your
defaults and blacklist. My freefilesync package has some unresolvable build
dependencies on EL6, so I have excluded those.
Also, specifically, FreeFileSync needed some very custom dependencies co build
on EL7-- some higher versions of libs like curl and openssl, so it's a complex
dependency tree so either include
copr://bgstack15/FreeFileSync
in your project's external repository list.
Comments