Manually building a distribution package

This is a complete example showing how I created a .deb package of a custom osmo-msc version.
The aim was to distribute a certain patch of osmo-msc without modifying the official Osmocom package feeds.

lxc container

For a clean build base, create a fresh debian 10 (buster) container.

on lxc host:

lxc-create -t download -n neels-deb10
lxc-start -n neels-deb10
lxc-attach -n neels-deb10

in neels-deb10 container:

apt install openssh-server
useradd -m -s /bin/bash neels
cd /home/neels/
mkdir .ssh
cd .ssh/
cat > authorized_keys
# paste my ssh pubkey, hit ctrl-D
cd ..
chown -R neels: .ssh
passwd neels
apt-get install sudo
gpasswd -a neels sudo
apt-get update
apt-get install wget gnupg git tig
sha256sum Release.key | grep b5e2c1df9ff80bc73dd00a0c153ef308e7ec643ddb859e69789fcd4a9b1893d3
apt-key add Release.key
rm Release.key
cat > /etc/apt/sources.list.d/osmocom-nightly.list <<END
deb ./
deb-src ./
apt-get update
apt-get install git-buildpackage libdistro-info-perl
apt-get build-depends osmo-msc

# exit the lcx-attach and log in via ssh
lxc-ls -f | grep neels-deb10
# neels-deb10        RUNNING 0         -,                         -                                      false
ssh neels@
# (logged into neels-deb10 container)

git clone git://
cd osmo-msc

# checkout the branch to put in the package
git checkout neels/mncc_codecs2

git config --global
git config --global "Neels Hofmeyr" 

# update the changelog and commit
gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch --new-version="1.6.1001" 
dch -r -m --distribution "unstable" "" 
git add debian/changelog
git commit -m "manual package 1.6.1 --> 1.6.1001" 

# to be able to tag a release, we need to sign it. Create a key to sign with.
gpg --generate-key
# Enter same name and email as with 'git config' above.

# Signing may require a bit of a dance to:
# a) get a text based pinentry:
sudo apt-get install pinentry-curses
# and b) get gpg to use the right tty
export GPG_TTY=$(tty)

# set the signed tag
git tag -s 1.6.1001 -f -m "manual package v1.6.1001 on $(date -I)." 

# this should show the tag:
git describe

# build the .deb package. packages are put in ../ (i.e. a dir above $CWD == osmo-msc)
dpkg-buildpackage -uc -us -tc
ls ../*.deb
Add picture from clipboard (Maximum size: 48.8 MB)