Commit 750ca753 authored by Vermeeren's avatar Vermeeren

readme: greatly improve setup doc

Based upon what I have been using locally for a while now.
parent 6c7ef31b
......@@ -89,26 +89,99 @@ private key. To force signing with your own OpenPGP identity or key fingerprint
add the below to `~/.devscripts`.
```shell
DEBUILD_DPKG_BUILDPACKAGE_OPTS='-sa -i -I'
DEBUILD_LINTIAN_OPTS='-i -I --show-overrides'
DEBSIGN_MAINT='Firstname Lastname'
```
### cowbuilder / pbuilder
Install `cowbuilder` and/or `pbuilder`, `cowbuilder` is recommended as it is
more efficient.
more efficient. Also install `eatmydata` to speed up building by disabling
`fsync()` et al during building.
Finally set the default build options and distribution in `/etc/pbuilderrc`.
Option `-sa` forces creation of the source `.orig.tar.gz`.
```shell
# Local
DEBBUILDOPTS=-sa
DEBBUILDOPTS='-sa -i -I'
DISTRIBUTION=buster
EATMYDATA=yes
EXTRAPACKAGES=lintian
HOOKDIR=/var/cache/pbuilder/hooks
PDEBUILD_PBUILDER=cowbuilder
```
Now add hook files, so lintian runs after building and you get a shell when an
errors occurs.
File `/var/cache/pbuilder/hooks/B90lintian`
```shell
#!/bin/sh
set -e
apt-get -y --allow-downgrades install lintian
echo "+++ lintian output +++"
su -c "lintian -i -I --show-overrides /tmp/buildd/*.changes; :" -l pbuilder
echo "+++ end of lintian output +++"
```
File `/var/cache/pbuilder/hooks/C10shell`
```shell
#!/bin/sh
set -e
apt-get -y --allow-downgrades install vim bash mc
# invoke shell if build fails
cd /tmp/buildd/*/debian/..
/bin/bash < /dev/tty > /dev/tty 2> /dev/tty
```
Run `sudo cowbuilder create` to build the initial rootfs. Later `sudo cowbuilder
update` can keep it up-to-date. Refer to `cowbuilder(8)` for more details.
### quilt
The far majority of packages use the quilt utility to manage patches. In debian
packages patches are stored under `debian/patches` instead of standard quilt's
`patches`. Create `~/.quiltrc-dpkg`.
```shell
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:diff_ctx=35:diff_cctx=33"
if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
fi
```
Finally, create an alias in your shell rc.
```shell
alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg"
# note: zsh does not require the below complete line
complete -F _quilt_completion $_quilt_complete_opt dquilt
```
### git-buildpackage
Many packages that are maintained in git use git-buildpackage to automate common
task. Usually per-package configuration is stored in `debian/gbp.conf`. Because
we use pbuilder/cowbuilder create the `~/.gbp.conf` with the following contents.
```shell
[DEFAULT]
builder = git-pbuilder -sa -i -I
color = auto
```
### reprepro
Configuration of `reprepro` is not needed, as it is included in this repository
......@@ -133,7 +206,8 @@ tarball. For example `uscan --download-current-version`.
### Modifying the package
Do whatever needs to be done. For patches specifically, usually the easiest way
it to use change sources in-tree and run `dpkg-source --commit`.
it to use change sources in-tree and run `dpkg-source --commit`. You can also
use (d)quilt directly.
### Bumping the package version
......@@ -177,11 +251,11 @@ Building is as easy as running `sudo cowbuilder build sourcepkg.dsc`. For
cowbuilder/pbuilder specifically the result will end up in
`/var/cache/pbuilder/result`.
Sign the binary package by running `debsign` on the `.changes` file.
Sign the binary package by running `sign.sh`, included in this repository.
### Adding the packages to the repo
Simply run `reprepro include binarypkg.changes`
Simply run `include.sh`, included in this repository.
Finally run `rsync.sh` to sync the local repository to the archive on
https://mel.vin/debian/. Note that syncing is a primitive sync and not additive!
......@@ -189,6 +263,10 @@ This means managing the actual repo should be done from a single machine, or by
syncing the `db`, `dists` and `pool` folders. A more serious repo uses incoming
queues which does not have this problem.
To clear the locally built packages run `result_clear.sh`. Note that you need to
`chown root:$USER` and `chmod 775` the result directory locally to avoid needing
root to remove the built packages.
## Submitting patches upstream
If the fix is proper and for a legitimate issue that exists in an official
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment