Package Debian Package in Git-based Flow

Why

Git won the version control battle over the years. There are plenty of upstream projects are managing their source code with Git. Thus, Git flow is suggested if the upstream manages its source with Git for convenient integration between upstream and packaging source.

(How to Get the) Backgroud Knowledge

Please refer to the General information from Debian Wiki to get an overall picture regarding why and how to package a debian package with git. It will be great if we keep in our mind that the information from Wiki is usually distributed, non-systematic, and written in personal context. They are usually not tutorial or how-to guides but a mixed content of them (and many things!). That being said, do not attach on the mindset that "there should be one and only one approach to package". Instead, keep the mindset of "the three elements of a debian package (dsc, upstream source, debian directory" and "these different approaches always aim at the 3 elements" will help you not get lost.

By reading the guideline of the Debian Multimedia Team and its derivatives, I use them to build my mindset regarding how and why they choose and manipulate the tool, so I can build up the workflow making the most process to me. It does not mean we need to follow their steps fully. Each team has its own trade-off and context when using git flow. For example, using pristine-tar branch or not in JS, Ruby, and Golang team.

You may start the real work [here (not the only way): https://mentors.debian.net/intro-maintainers/] which contains a lot "relatively new/update-to-date" guides and the slide specific to "technical summary". It's very helpful to keep in mind if the guide you are reading is new/old guide.

Use gbp in Git Packaging Workflows

gbp is the tool that widely used when manipulating the git management flow of packaging. git-dpm is also another option, but not adopted by Debian Python Team. So let's talk about gbp currently.

Make sure you are using new-enough version of gbp so you can avoid bugs like this one when creating from scratch.

The Three Elements of a Debian Package

"Packaging" is essentially attaching metadata to describe how do we manipulate the upstream source code. The metadata of packaging is concentrated in debian directory. Keep this in mind for every manipulation of packaging.

A debian package contains the three elements of a debian package: - The upstream source. Conventionally a tarball, but in git management it could be a upstream git branch. - The packaging metadata a.k.a. debian directory. Conventionally it is a debian directory and will be released as a tarball as well (on Debian package distribution system) - The dsc a.k.a. descriptive file to describe how to combine the above two elements (and additional information).

Always keep in mind when working on debian packaging, we keep asking ourselves which element we are working on and which element is not ready.

Get Your Hand Dirty

Now your mindset to package a debian package is ready! I won't re-iterate the steps as a how-to guides or tutorial since there are plenty of informative pages in the reference session. I hope you enjoy the debian packaging with Git workflow.

Reference