File: 12-setups.txt

package info (click to toggle)
debmake-doc 1.17-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 24,612 kB
  • sloc: makefile: 768; sh: 690; ansic: 114; python: 99; sed: 16
file content (247 lines) | stat: -rw-r--r-- 9,477 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
The *build-essential* package must be installed in the build environment.

The *devscripts* package should be installed in the maintainer environment.

Although this is not necessarily an absolute requirement, it is a good idea to install and set up all of the popular set of packages mentioned in this chapter in the maintainer environment.  This enables us to share the common baseline working environment.
.
Please install the tools mentioned in the https://www.debian.org/doc/manuals/developers-reference/tools.html[Overview of Debian Maintainer Tools] in the ``Debian Developer's Reference'', as needed, too.

CAUTION: Tool setups presented here are only meant as an example and may not be up-to-date with the latest packages on the system.  Debian development is a moving target.  Please make sure to read the pertinent documentation and update the configuration as needed.

[[email-setup]]
=== Email address

Various Debian maintenance tools recognize your email address and name to use by the shell environment variables *$DEBEMAIL* and *$DEBFULLNAME*.

Let's setup these packages by adding the following lines to *\~/.bashrc* footnote:[This assumes you are using Bash as your login shell. If you use some other login shell such as Z shell, use their corresponding configuration files instead of *~/.bashrc*.].

.Add to the *~/.bashrc* file
----
DEBEMAIL="your.email.address@example.org"
DEBFULLNAME="Firstname Lastname"
export DEBEMAIL DEBFULLNAME
----

[[mc-setup]]
=== mc

The *mc* command offers very easy ways to manage files.  It can open the binary *deb* file to check its content by pressing the Enter key over the binary *deb* file.  It uses the *dpkg-deb* command as its back-end.  Let's set it up to support easy *chdir* as follows.

.Add to the *~/.bashrc* file
----
# mc related
if [ -f /usr/lib/mc/mc.sh ]; then
  . /usr/lib/mc/mc.sh
fi
----

[[git-setup]]
=== git

Nowadays, the *git* command is the essential tool to manage the source tree with history.

The global user configuration for the *git* command such as your name and email address can be set in *~/.gitconfig* as follows.

----
$ git config --global user.name "Name Surname"
$ git config --global user.email yourname@example.com
----

If you are too accustomed to the CVS or Subversion commands, you may wish to set several command aliases as follows.

----
$ git config --global alias.ci "commit -a"
$ git config --global alias.co checkout
----

You can check your global configuration as follows.

----
$ git config --global --list
----

TIP: It is essential to use some GUI git tools like *gitk* or *gitg* to work effectively with the history of the git repository.

[[quilt-setup]]
=== quilt

The *quilt* command offers a basic method for recording modifications. For the Debian packaging, it should be customized to record modifications in the *debian/patches/* directory instead of its default *patches/* directory.

In order to avoid changing the behavior of the *quilt* command itself, let's create an alias *dquilt* for the Debian packaging by adding the following lines to the *~/.bashrc* file. The second line provides the same shell completion feature of the *quilt* command to the *dquilt* command.

.Add to the *~/.bashrc* file
----
alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg"
. /usr/share/bash-completion/completions/quilt
complete -F _quilt_completion $_quilt_complete_opt dquilt
----

Then let's create *~/.quiltrc-dpkg* as follows.

----
d=.
while [ ! -d $d/debian -a `readlink -e $d` != / ];
    do d=$d/..; done
if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then
    # if in Debian packaging tree with unset $QUILT_PATCHES
    QUILT_PATCHES="debian/patches"
    QUILT_PATCH_OPTS="--reject-format=unified"
    QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
    QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
    QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:"
    QUILT_COLORS="${QUILT_COLORS}diff_ctx=35:diff_cctx=33"
    if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
fi
----

See *quilt*(1) and file:///usr/share/doc/quilt/quilt.html[How To Survive With Many Patches or Introduction to Quilt] on how to use the *quilt* command.

See <<alt-patch>> for example usages.

[[devscripts-setup]]
=== devscripts

The *debsign* command, included in the *devscripts* package, is used to sign the Debian package with your private GPG key.

The *debuild* command, included in the *devscripts* package, builds the binary package and checks it with the *lintian* command.  It is useful to have verbose outputs from the *lintian* command.

You can set these up in *~/.devscripts* as follows.

----
DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i -I -us -uc"
DEBUILD_LINTIAN_OPTS="-i -I --show-overrides"
DEBSIGN_KEYID="Your_GPG_keyID"
----

The *-i* and *-I* options in *DEBUILD_DPKG_BUILDPACKAGE_OPTS* for the *dpkg-source* command help rebuilding of Debian packages without extraneous contents (see <<build-noextra>>).

Currently, an RSA key with 4096 bits is a good idea.  See https://keyring.debian.org/creating-key.html[Creating a new GPG key].

[[sbuild-setup]]
=== sbuild

The *sbuild* package provides a clean room (*chroot*) build environment.  It
offers this efficiently with the help of *schroot* using the bind-mount feature
of the modern Linux kernel.

Since it is the same build environment as the Debian's
https://buildd.debian.org/[buildd] infrastructure, it is always up to date and
comes with full of useful features.

It can be customized to offer following features:

* The *schroot* package to boost the chroot creation speed.
* The *lintian* package to find bugs in the package.
* The *piuparts* package to find bugs in the package.
* The *autopkgtest* package to find bugs in the package.
* The *ccache* package to boost the *gcc* speed. (optional)
* The *libeatmydata1* package to boost the *dpkg* speed. (optional)
* The parallel *make* to boost the build speed. (optional)

Let's get started by following https://wiki.debian.org/sbuild .

----
$ sudo apt install sbuild piuparts autopkgtest lintian
$ adduser <your_user_name> sbuild
----

Logout and login to check you are a member of `sbuild` group using `id` command.

----
$ id
uid=1000(<yourname>) gid=1000(<yourname>) groups=...,132(sbuild)
----

Let's create the configuration file `~/.sbuildrc` in line with recent Debian
practice https://wiki.debian.org/SourceOnlyUpload as:

----
cat >~/.sbuildrc << 'EOF'
##############################################################################
# PACKAGE BUILD RELATED (source-only-upload as default)
##############################################################################
# -d
$distribution = 'unstable';
# -A
$build_arch_all = 1;
# -s
$build_source = 1;
# --source-only-changes
$source_only_changes = 1;
# -v
$verbose = 1;

##############################################################################
# POST-BUILD RELATED (turn off functionality by setting variables to 0)
##############################################################################
$run_lintian = 1;
$lintian_opts = ['-i', '-I'];
$run_piuparts = 1;
$piuparts_opts = ['--schroot', 'unstable-amd64-sbuild'];
$run_autopkgtest = 1;
$autopkgtest_root_args = '';
$autopkgtest_opts = [ '--', 'schroot', '%r-%a-sbuild' ];

##############################################################################
# PERL MAGIC
##############################################################################
1;
EOF
----

Following document assumes that sbuild is configured this way.

Edit this to your needs.  Post-build tests can be turned on and off by assigning 1 or 0 to the corresponding variables,

WARNING: The optional customization may cause negative effects.  In case of doubts, disable them.

NOTE: The parallel *make* may fail for some existing packages and may make the build log difficult to read.

[[gbp-setup]]
=== git-buildpackage

You may wish to set several global configurations in *~/.gbp.conf*

----
# Configuration file for "gbp <command>"

[DEFAULT]
# the default build command:
builder = sbuild
# use pristine-tar:
pristine-tar = True
# Use color when on a terminal, alternatives: on/true, off/false or auto
color = auto
----

TIP: The *gbp* command is the alias of the *git-buildpackage* command.

[[proxy]]
=== HTTP proxy

You should set up a local HTTP caching proxy to save the bandwidth for the Debian package repository access.  There are several choices:

* Specialized HTTP caching proxy using the *apt-cacher-ng* package.
* Generic HTTP caching proxy (*squid* package) configured by *squid-deb-proxy* package

In order to use this HTTP proxy without manual configuration adjustment, it's a good idea to install either `auto-apt-proxy` or `squid-deb-proxy-client` package to everywhere.

[[repropro]]
=== Private Debian repository

You can set up a private Debian package repository with the *reprepro* package.

[[vm]]
=== Virtual machines

For testing GUI application, it is good idea to have virtual machines. Install `virt-manager` and `qemu-kvm`.

Use of chroot and virtual machines allow us not to update the whole host PC to the latest unstable.

[[mDNS]]
=== Local network with virtual machines

In order to access virtual machines easily over the local network, setting up multicast DNS service discovery infrastructure by installing `avahi-utils` is a good idea.

For all running virtual machines and the host PC, we can use each host name appended with *.local* for SSH to access each other.