Manually building a distribution package » History » Version 6
neels, 10/08/2020 09:53 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 | 6 | neels | wget https://download.opensuse.org/repositories/network:/osmocom:/nightly/Debian_10/Release.key |
36 | 1 | neels | 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 | 5 | neels | git config --global user.email nhofmeyr@sysmocom.de |
64 | git config --global user.name "Neels Hofmeyr" |
||
65 | |||
66 | 3 | neels | # update the changelog and commit |
67 | gbp dch --debian-tag='%(version)s' --auto --meta --git-author --multimaint-merge --ignore-branch --new-version="1.6.1001" |
||
68 | dch -r -m --distribution "unstable" "" |
||
69 | git add debian/changelog |
||
70 | 1 | neels | git commit -m "manual package 1.6.1 --> 1.6.1001" |
71 | |||
72 | 5 | neels | # to be able to tag a release, we need to sign it. Create a key to sign with. |
73 | gpg --generate-key |
||
74 | # Enter same name and email as with 'git config' above. |
||
75 | |||
76 | # Signing may require a bit of a dance to: |
||
77 | # a) get a text based pinentry: |
||
78 | 3 | neels | sudo apt-get install pinentry-curses |
79 | 5 | neels | # and b) get gpg to use the right tty |
80 | 1 | neels | export GPG_TTY=$(tty) |
81 | 3 | neels | |
82 | 5 | neels | # set the signed tag |
83 | 3 | neels | git tag -s 1.6.1001 -f -m "manual package v1.6.1001 on $(date -I)." |
84 | |||
85 | # this should show the tag: |
||
86 | git describe |
||
87 | |||
88 | 1 | neels | # build the .deb package. packages are put in ../ (i.e. a dir above $CWD == osmo-msc) |
89 | 3 | neels | dpkg-buildpackage -uc -us -tc |
90 | 5 | neels | ls ../*.deb |
91 | 1 | neels | </pre> |