A Simple but Probably Inefficient way to use Git Build Package to make Pristine-Tar branches

Git Build Package was something that I always struggled with during my initial days with Debian and with some teams mandating the use of pristine-tars and Git Build Package’s documentation being all over the place, I had to learn a few things by doing it myself and finally learned how to use gbp and generate pristine-tar.

This guide assumes that you are a complete noob to gbp and are struggling with getting pristine-tar set up.

Firstly, create the debian packaging for your package and ensure that you aren’t getting any more lintian errors or warnings.

Steps

  1. Create a Blank repository on Salsa
  2. Create a gbp.conf in your debian folder and add the following config into it
[DEFAULT]
debian-branch = debian/master
upstream-branch = upstream
pristine-tar = True
sign-tags = True

3. Create the branches

debian/master and upstream using git branch

4. Run the following command and replace the version with the version of your package

$ gbp import-orig --pristine-tar ../python-uhi_1.0.0.orig.tar.gz --upstream-branch=upstream --debian-branch=debian/master

5. Create a tag for debian release using

gbp tag debian/1.0.0-1

6. Push the branches to Salsa using

gbp push

and this will create pristine-tars and a tagged debian and upstream branches

I made this guide only for myself to follow in the future but if its of some help to you, feel free to follow it.

How to install Python Library examples in a Debian Package

If you’re packaging Python Libraries into Debian, you’ll someday or the other encounter a lot of libraries using different files and folders such as tests and examples.

While tests are automatically handled by dh_python helper tools, examples are usually not and you’ll have to manually configure your setup to install python library examples, let me show you how.

For this, we need to create a new file inside the Debian folder called package.examples. Here, “package” refers to your package that will install the examples. Since we’re installing the examples of a python library, your file should be titled “python3-packagename.examples”.

Now all you have to do is just insert the directory of the examples folder into this file.

examples/*

That’s it. Now when you run sbuild or pbuilder again, it will automatically install the examples for you.