It was time for another set of exploration. I've always wanted to try something with the packaging tools. Today I set about to learning packaging in fedora since I mostly use it as my daily driver - stable enough and quite bleeding edge too.

What is packaging ?

It deals with the process of creation and maintenance of software so that it can be easily installed, updated, or removed from your computer. You see there is VLC, Firefox, git, etc. They are all open source projects. They primarily release the code. Its the duty of the OS maintainers to make sure that their users can easily get these software. So if you are using Ubuntu, people employed by Canonical (and volunteers too) take the pain of downloading the source code from all these projects, compile it, generate binaries and store it in a standard location where all you users can just come and fetch.

This collection of software is called a repository. When you add a ppa to your ubuntu system, you are adding a third-party made repository to your computer. In Fedora, the similar one is a copr repo. In Arch Linux, it is known as AUR. The official repositories are configuration through a standard file in your computer. In ubuntu, its /etc/apt/sources.list. In fedora, it can be /etc/yum.repos.d/<whatever>.repo, and so on.

Okay, so what ?

Why should you care about it? Lets say you found that some shiny new software is available for download, but its just not present in the official fedora repositories for whatever reason it be. If you are faint hearted, you can just get done with doing a standard configure, make and make install. Now you have the software ready. Happy. But then a week later, it has a new update! So you will do the make thing again to install it.

For how long will you do this ? What if there was a way in which you do some magic, and you will keep getting the updated packages automagically?

And thats possible! That is why you should care about learning packaging! You can create a configuration file which tells how to build the package from source, pointing to the official release links. Upload this configuration to a public build server of your favorite distro, and if everything went well, you will have your packages ready for installation! With some more configuration, you can auto build your packages whenever there is an update in the official source code repository!

Packaging Tools

I will talk with respect to Fedora since that is what I use mostly. Fedora uses RPM format for its packages. It is an acronym for Redhat Package Manager. The package rpmdevtools contain a collection of scripts which aid package management in Fedora. There are even more tools. You can install all of them together by installing a group:

sudo dnf groupinstall "RPM Development Tools"

Most important file in an RPM file is the spec. For example, for the package kernel, there is a file kernel.spec which defines how the package is to be build. For creating a new package, your job will be to create the spec file for your project. An example tutorial is available for building the GNU Hello World program.

Once you have populated your spec file, use the rpmbuild command to create the source RPM using:

rpmbuild -bs file.spec

You can even try building the actual compiled RPM file which can be installed directly on to your system, but in case you dont have a fast system to build it, leave that job to the dedicated servers your OS provides. I prefer to user Copr for quick experiments. You just need to upload your SRPM to the website and wait for it to do the job!


This just gives a big picture of the process. Be sure to read the offical wikis!

My first experiment with fedora packaging which motivated me to write this post, is available here. It is a tweaked version of Linux Kernel that provides more responsiveness. It is ideal for desktop use case. Its popular name is linux-ck, and it authored by a brilliant kernel hacker by name Con Kolivas