OpenSUSE project kindly provides a public Open Build Service instance, which is a package build service for many popular distros, Debian including. This page describes the most simplified way to use it to build and publish binary packages from your custom source packages.
Contents
Motivations
If a particular software or some version of it is not available in official Debian repositories, it makes sense to create deb packages for it, so that it can be easily installed, updated and removed when needed. Such packages may be then published locally or on the internet as an apt repo as described in DebianRepository/Setup. This works fine for small trusted circles, but not for sharing packages to general public as it requires users to trust that a given rando from the internet did not alter the binary packages in any way between building from published sources and publishing. Reputable central package build services mitigate this problem by requiring source-only uploads from developers and performing builds on their controlled infrastructure.
Prerequisites
This document assumes that the reader is generally familiar with Debian packaging system and knows how to create or obtain & modify a source package consisting of *.orig.tar.gz upstream tarball, *.debian.tar.xz changes tarball and *.dsc summary trio (or duo in case of native packages).
The following documents are good resources on the subject:
Account setup
First check the service's code of conduct and if there are no obstacles, click Sign Up button near the top right corner and follow the onscreen instructions. The process is straightforward and requires only an email verification.
Organizational structure
The Open Build Service is a robust user/developer collaboration system, allowing for complex project dependency management, various workflows, version control and many others. The below description is just a small fraction of its capabilities, simplified as much as possible for the purpose of simple deb package publishing.
The Open Build Service is organized into a hierarchy (forest) of projects.
Each user has their own home project to which they have admin rights (creating sub-projects among others).
Each project may consist of several packages to which users with appropriate privileges may upload source package files in appropriate formats (orig.tar.gz + debian.tar.xz + dsc trio in case of Debian).
Each project has its own separate repository for each configured target distro where source and binary packages will be published in appropriate formats upon successful builds (as an apt repo in case of Debian).
Packages in a single project may depend on each other (by using Build-Depends: and Depends: fields in control files), but cycles are not allowed of course.
It is strongly recommended not to create packages in one's home project directly as it will become unmanageable pretty fast. Instead, a number of small (just a few packages), targeted sub-projects should be used.
Step-by-step publishing via the web UI
- Create a new project:
Click Your Home Project on the left pane, then click Subprojects tab in the project's top bar, then click Create Subproject that appeared on the left pane.
Enter some short yet meaningful subproject name (myproject will be used for the purpose of this example, but please be more inventive than this). You may fill other optional fields if you feel creative. Finally, click the green Accept button.
- Create target-distro repositories for your project:
Click Repositories tab in the project's top bar, then Add from a Distribution plus-icon and check the distros you want to build and publish your packages for.
Click Repositories tab again and for every distro's repo click its edit-icon in the bottom-right corner of its subwindow and check hardware architectures you want to build and publish your packages for.
- Add Packages to your project by repeating the below procedure for each package:
Click Overview tab in the project's top bar and then in Packages subwindow click Create Package plus-icon.
Enter a name for the package. It is recommended to use source package name (ie the value of Source: field in the control file). You may fill other optional fields if you feel creative. Finally, click the green Create button.
In Source Files subwindow click Add local files disk-icon and select your source package orig.tar.gz + debian.tar.xz + dsc trio (...or duo). This will enqueue builds for previously configured distro+arch combinations.
Additional tricks and workarounds
Download service
If the upstream tarball for a package you want to publish is already published in some other well-known repo (for example in cases when you just add some patches to existing packages), you can configure a download service in your package to fetch it directly from its primary location instead uploading it yourself. Apart from saving the round-trip to and from your computer, it gives users a better confidence, that the file was not modified.
Similarly if you want to copy some whole existing package to your project (for example if you need it as a dependency), you can configure the download service to fetch the whole source package orig.tar.gz + debian.tar.xz + dsc trio (...or duo).
To configure the download service, follow these steps for each remote file when creating or editing a package:
In Source Files subwindow click Add an empty file or service plus-icon.
- Enter a filename under which the downloaded file will be saved (may be left blank if the same as the original file).
- Enter the URL of the primary location of the file.
Click Add File. This will enqueue the download.
Resolving multiple choices for build dependencies
From the official User Guide: "In case multiple packages satisfy a dependency, the OBS system will complain about that situation. This is unlike like most package managing tools, which just pick one of the package. Because one of OBS' goal is to provide reproducible builds, it reports an error in this case instead of choosing a random package."
This will manifest as a failed build with a "unresolvable: have choice for <package>" message. To resolve it, add Pefer: directive in your project's config as described in the linked section of the User Guide by navigating to Project Config tab in the project's top bar.
Configuring apt sources
Once your packages are successfully built, users may add your repositories to their apt sources list. The general template for a sources.list entry is as below:
deb [signed-by=/etc/apt/keyrings/${USER}-obs.gpg] http://download.opensuse.org/repositories/home:/${USER}:/${PROJECT}/${DISTRO} /...where:
${USER} is the OBS username of the owner of the project (your username in this case).
${PROJECT} is the name you entered in step 2 of the publishing (myproject in the example).
${DISTRO} is the OBS name of the distro you want to configure apt source for. In case of stable Debian releases this is for example Debian_11, Debian_12 etc and then there is also Debian_Testing and Debian_Unstable.
If you want to be 100% sure not to make a typo in the URL part, you can navigate in the web UI to Repositories tab of the project and copy the link from the green download-icon in the bottom-right corner of the repository subwindow.
Repo signing keys are normally inherited from the owner's home project and may be obtained by navigating to Signing Keys tab of any of the owner's project (the green download-icon) or downloaded on the command line from an URL of the form https://build.opensuse.org/projects/home:${USER}/signing_keys/download?kind=gpg. It then needs to be saved at the path specified by signed-by attribute of the sources.list entry (/etc/apt/keyrings/${USER}-obs.gpg in the template above).
