Manually building a distribution package » History » Version 4
neels, 09/16/2020 11:22 PM
1 | 1 | neels | h1. Manually building a distribution package |
---|---|---|---|
2 | |||
3 | This is a complete example showing how I created a .deb package of a custom osmo-msc version. |
||
4 | The aim was to distribute a certain patch of osmo-msc without modifying the official Osmocom package feeds. |
||
5 | |||
6 | h2. lxc container |
||
7 | |||
8 | For a clean build base, create a fresh debian 10 (buster) container. |
||
9 | |||
10 | on lxc host: |
||
11 | |||
12 | <pre> |
||
13 | lxc-create -t download -n neels-deb10 |
||
14 | lxc-start -n neels-deb10 |
||
15 | lxc-attach -n neels-deb10 |
||
16 | </pre> |
||
17 | |||
18 | in neels-deb10 container: |
||
19 | |||
20 | <pre> |
||
21 | apt install openssh-server |
||
22 | useradd -m -s /bin/bash neels |
||
23 | cd /home/neels/ |
||
24 | mkdir .ssh |
||
25 | cd .ssh/ |
||
26 | cat > authorized_keys |
||
27 | # paste my ssh pubkey, hit ctrl-D |
||
28 | cd .. |
||
29 | chown -R neels: .ssh |
||
30 | passwd neels |
||
31 | apt-get install sudo |
||
32 | gpasswd -a neels sudo |
||
33 | apt-get update |
||
34 | apt-get install wget gnupg git tig |
||
35 | wget https://download.opensuse.org/repositories/network:/osmocom:/nightly/Debian_10/Release.key_ |
||
36 | sha256sum Release.key | grep b5e2c1df9ff80bc73dd00a0c153ef308e7ec643ddb859e69789fcd4a9b1893d3 |
||
37 | apt-key add Release.key |
||
38 | rm Release.key |
||
39 | cat > /etc/apt/sources.list.d/osmocom-nightly.list <<END |
||
40 | deb http://download.opensuse.org/repositories/network:/osmocom:/nightly/Debian_10/ ./ |
||
41 | deb-src http://download.opensuse.org/repositories/network:/osmocom:/nightly/Debian_10/ ./ |
||
42 | END |
||
43 | apt-get update |
||
44 | 3 | neels | apt-get install git-buildpackage libdistro-info-perl |
45 | 1 | neels | apt-get build-depends osmo-msc |
46 | |||
47 | 4 | neels | # exit the lcx-attach and log in via ssh |
48 | exit |
||
49 | </pre> |
||
50 | |||
51 | <pre> |
||
52 | lxc-ls -f | grep neels-deb10 |
||
53 | # neels-deb10 RUNNING 0 - 192.168.111.12, 192.168.111.240 - false |
||
54 | ssh neels@192.168.111.12 |
||
55 | # (logged into neels-deb10 container) |
||
56 | |||
57 | 1 | neels | git clone git://git.osmocom.org/osmo-msc |
58 | cd osmo-msc |
||
59 | 3 | neels | |
60 | # checkout the branch to put in the package |
||
61 | 1 | neels | git checkout neels/mncc_codecs2 |
62 | |||
63 | 3 | neels | # update the changelog and commit |
64 | gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch --new-version="1.6.1001" |
||
65 | dch -r -m --distribution "unstable" "" |
||
66 | git add debian/changelog |
||
67 | git commit -m "manual package 1.6.1 --> 1.6.1001" |
||
68 | |||
69 | # to be able to tag a release, we need to sign it. |
||
70 | # Signing may require a bit of a dance to a) get gpg to use the right tty and b) to get a text based pinentry: |
||
71 | sudo apt-get install pinentry-curses |
||
72 | export GPG_TTY=$(tty) |
||
73 | |||
74 | git tag -s 1.6.1001 -f -m "manual package v1.6.1001 on $(date -I)." |
||
75 | |||
76 | # this should show the tag: |
||
77 | git describe |
||
78 | |||
79 | # build the .deb package. packages are put in ../ (i.e. a dir above $CWD == osmo-msc) |
||
80 | 1 | neels | dpkg-buildpackage -uc -us -tc |
81 | </pre> |