The goal is to have a standardized, repeatable way to build packages via the git distributed version source control tool. Inspired by [[ https://dep-team.pages.debian.net/deps/dep14/ | DEP-14 ]]
== Description ==
[[ https://honk.sigxcpu.org/projects/git-buildpackage/manual-html/ | Git buildpackage ]], or gbp for short, is a tool to maintain Debian packages via git. Using git as the distributed version control system to store the data as well as packaging meta-data means that packages can be built directly from a git repository.
This page is dedicated to the use of gbp in PureOS but it should be applicable in any Debian-based distro.
== Installation ==
General packaging prerequisites;
```
sudo apt install build-essential devscripts
```
On PureOS, gbp is installed via this command;
```
sudo apt install git-buildpackage
```
== Terminology ==
If you're not familiar with Debian packaging it's likely a good idea to mention some terms we use in this document. Gbp builds packages from git branches. The branches used refer to specific artifacts, like the upstream tarball. The terms we'll refer to are;
| **Term** | **Meaning** |
| pristine tarball| the untouched source code stored as a binary tar archive.|
== Packaging workflow ==
== Pristine tar ==
In our example, we'll use tar to create a pristine tarball.
```
tar cvfJ stream-0.1.0.orig.tar.xz --exclude-vcs Stream/
```
== Build package ==
$ git-buildpackage --
== Uploading packages to the package repositories ==
# Uploading via dput
To upload packages to the PureOS archive via the dput tool, use the following `~/.dput.cf` snippet. Please note that your GPG key needs to be in the PureOS Keyring. Currently the policy for getting added to the keyring is ad hoc but a more formal policy is in the works.
```
[pureos-ftp]
fqdn = upload.pureos.net
method = ftp
incoming = ~/incoming/
login = anonymous
```
The upload might take about 20 minutes or so to be processed after the upload is fully complete.
See also [[ https://tracker.pureos.net/w/development/new_queue/ | NEW queue ]] and [[ https://tracker.pureos.net/w/development/pureos_archive_layout/ | archive layout ]]
If you want to get notification about any new upload that gets submitted to the archive, consider subscribing to the [[ https://lists.puri.sm/listinfo/pureos-changes | pureos-changes ]] mailinglist.
Please use source-only uploads (created by passing `-S -sa` to dpkg-buildpackage, e.g. by using `gbp` via `gbp buildpackage -S -sa`) if possible, and only upload binaries directly if absolutely necessary (e.g. for bootstrapping). The autobuild system of the Laniakea archive management system will usually build new packages pretty quickly.
Uploads targeted at the current development release of PureOS (currently `byzantium`) will automatically be redirected to `landing`, just like uploads to the `*-updates` suite of a stable release will automatically go to `*-proposed-updates` first.
# Uploading via git tag
Packages can also be uploaded by tagging them appropriately in git. Have a look at https://source.puri.sm/snippets/138
The flow of a package once accepted by the archive is the same.
# Tracing the package after the upload
* If the package didn't have any version in the archive before it will be held in [[development/NEW Queue]]
* If the package gets accepted a mail is sent to the [pureos-changes mailing list](https://lists.puri.sm/listinfo/pureos-changes)
* In case of a source package a build for the binary packages will be scheduled and put to the end of the [build queue](https://master.pureos.net/jobs/queue/1).
* If the package got built successfully it will [wait for migration](https://master.pureos.net/migrations/)
* The status of a package in a certain suite (including build logs can queried via `https://software.pureos.net/package/src/<suite>/<sourcepackage>`. Example: phosh's status in byzantium: https://software.pureos.net/package/src/byzantium/phosh
* Once the (suite dependent) migration period passes it will migrate to the target suite. The ultimate reference if a package is in a suite is the archive's package file at e.g. https://repo.pureos.net/pureos/dists/byzantium/main/binary-arm64/Packages.xz for arm64 packages in byzantium.
== gitlab-ci example =