Packaging for dpkg with Open Build Service

1. Introduction
1.1. Motivation
1.2. Setting up git-buildpackage
1.3. Setting up OBS
2. Preparing required files
3. Pushing package to OBS
4. Using the repositories
4.1. Add the repo
4.2. Use the repo
5. See also

tropf

ABSTRACT

A little protocol on the steps I took to get my package into open build service to be used with ubuntu and debian.

1. Introduction

1.1. Motivation

I made smplxmpp, and I’d like to deliver it as package(s).

I consider packaging for debian as the biggest challenge, as it has a very large market share (and i also use it, though for more practical reasons). I created a package for smplxmpp, mainly following the steps outlined here and by using additional documentation I found all over the web. I will not spend too much time on explaining how to get your environment set up; this is fairly complicated and involves stuff like gpg etc.

1.2. Setting up git-buildpackage

I am using git-buildpackage. For an initial setup i followed this guide in the official docs.

To set up the created repo (that already contains the debian/ directory) at a new machine follow these steps:

# clone git repo
git clone https://codeberg.org/tropf/smplxmpp-deb
# configure git contact info
git config user.name "Rolf Pfeffertal"
git config user.email "floss@tropf.io"

# add upstream
git remote add upstream https://codeberg.org/tropf/smplxmpp


# setup git-pbuilder
# maybe prefix with DIST=$dist
sudo git-pbuilder create

To incoroperate upstream changes:

git fetch upstream
git merge $TAG
# maybe change --snapshot to --release
gbp dch --debian-branch=debian/sid --snapshot --auto debian/
# now adjust all the files
# and then check if everything builds
gbp buildpackage --git-ignore-new --git-pristine-tar --git-pristine-tar-commit --git-pbuilder --git-upstream-tag='v%(version)s' --git-debian-branch=debian/sid


# check package
# if ok commit
git add debian/
git commit -m "..."

1.3. Setting up OBS

Follow this guide.

Create a project on the openSUSE Build Service and enable under "Repositories" the targets you want to build for.

Set up osc.

2. Preparing required files

After you have all your sources ready to build a package, build it locally. I’ll use git buildpackage with pbuilder here:

gbp buildpackage --git-pristine-tar --git-pristine-tar-commit --git-pbuilder --git-upstream-tag='v%(version)s' --git-debian-branch=debian/sid

From the parent directory, we now need the files

3. Pushing package to OBS

Move these files into the directory of the package you created on obs. At this point you can test building you package. The location of the resulting files will be displayed on stdout.

osc build --local-package

After that commit & and push to obs.

osc addremove
osc st
# check output; if ok:
osc commit

osc commit is not local; it instantly pushes to OBS. This is not like git.

You should now see build processes in your project on OBS.

4. Using the repositories

This is an adaptation of this.

› You might have to wait for quite a while after your build jobs are finished before they are turned into a repo.

4.1. Add the repo

First get the repo URL by navigating in the OBS project to your distro and click the download icon or the link "go to download repository". I will use $URL here to refer to that repo URL. When visiting $URL in your browser you should see a bunch of files, including files like Release or Sources.

Add the repo and its key.

› You could use apt-key, but that is marked as deprecated.

# download key (.asc is important!!)
sudo wget -O /etc/apt/trusted.gpg.d/myproject.asc $URL/Release.key
# add repo
echo "deb $URL /" | sudo tee /etc/apt/sources.list.d/myproject.list

4.2. Use the repo

sudo apt update
sudo apt install mypackage

5. See also


04 December 2020
Home