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
|
---
format: markdown
title: Debian Maintainership
...
## Reference
- [Official Policy Manual]([https://www.debian.org/doc/debian-policy/):
basically a style guide for how software should be packaged and how a Debian
operating system should work.
- [Packaging Tutorial](https://www.debian.org/doc/manuals/packaging-tutorial/packaging-tutorial.en.pdf):
this was a great getting-started resource for me: what files under `debian/`
do what, what automated tooling exists, how packaging has changed over time,
etc. "Hands on".
## Developer Machine Setup
Install pacakges:
sudo apt install build-essential ccache cdbs cowbuilder debhelper \
devscripts dgit dh-make distcc fakeroot git-buildpackage lintian \
pbuilder quilt sbuild schroot svn-buildpackage wdiff piuparts
I set the following user-wide environment variables:
QUILT_PATCHES="debian/patches"
DH_VERBOSE=1
DEB_BUILD_MAINT_OPTIONS="hardening=+all"
DEBFULLNAME=""
DEBEMAIL=""
Create a `cowbuilder` environment:
sudo cowbuilder --create # on new machines
sudo cowbuilder --update # ~regularly
sudo cowbuilder --build thing.dsc # do the build
## Basic Commands
Run from inside source directory, except apt-get commands:
apt-get source $PKG
dch -i # new debian/changelog entry w/ incremented version
dch "some task" # adds line to current changelog entry
uscan -v . # manually check for new package version
gbp import-orig --uscan # import new release via uscan (for gbp-developed packages)
lintian -EviIL +pedantic # after build
apt-get build-dep $PKG
dpkg-buildpackage -us -uc # just build a package on local machine (no sign)
# OR
debuild -us -uc # same as above + lintian? no color
sudo debi # install locally
debdiff pkg_1.0.deb pkg_1.0-1
dh_make -f ../something-1.0.tar.gz # does the renaming to .orig.tar.gz automatically
pdebuild --pbuilder cowbuilder
Patching:
edit-patch
## dgit
`dgit` is complicated! Mostly because it is flexible/powerful, works with a lot
of packaging workflows, and there is not a clear default workflow of packaging
in general or with `dgit`.
In particular dgit is mostly just about interfacing with debian project
infrastructure, not storing packaging info in git format. There are multiple
tools/workflows for the later (git-buildpackage ("gpb"), git-dpm, etc).
## Debian Helper (`dh`)
To override individual built targets, just define them in `debian/rules`.
Starting from scratch, when you have tarballs:
1. `mkdir` and `git init` an empty repo
2. `gbp import-orig --pristine-tar <tarball>`. You can filter files out here if
you need to, eg for policy/copyright reasons.
3. `dh_make -p $PKG_$VERSION` to start with defaults.
## Other Tasks
Mentors uploads (see [intro](https://mentors.debian.net/intro-maintainers)):
- setup a `~/.dput.cf`
- create a webface account
- upload with: `dput mentors SOMETHING.changes`
`pbuilder` for cross-platform/cross-arch builds (eg, armel, mips):
# setup ~/.pbuilderrc:
# https://jodal.no/2015/03/08/building-arm-debs-with-pbuilder/
sudo apt install qemu-user-static
sudo OS=debian DIST=stretch ARCH=armel pbuilder --create
then, each test build (slow!):
sudo OS=debian DIST=stretch ARCH=armel pdebuild
Running piuparts is simple (but slow):
sudo piuparts <pkg>.deb
Create a quick blank debug docker (faster than most other tools for creating
throw-away environments):
docker pull debian:sid
docker run -t -i debian:sid bash
# In container:
apt update
|