vinaigrette/README.md

59 lines
3.1 KiB
Markdown
Raw Normal View History

2017-09-01 17:35:08 +02:00
Vinaigrette
===========
Build those damn .deb's
2018-06-04 22:26:35 +02:00
How this shit works
-------------------
2017-09-01 17:35:08 +02:00
2022-01-14 02:21:17 +01:00
The build chain relies on `sbuild`, a wrapper tool for building the `.deb`, and `reprepro` to handle the apt repo part (signing and serving)
2017-09-01 17:35:08 +02:00
2022-01-14 02:21:17 +01:00
1. Initially, some chroots are prepared, one per available distribution (buster, bullseye, ...), pre-installed with build dependencies to speed up builds. See the `scripts/make-chroots` script.
2. `reprepro` is configured in [`/var/www/repo/debian/conf/distributions`](config/distributions). In this file, you'll find the supported distributions (aka codenames), and branches (aka components: stable, testing, unstable). It also declares what GPG key to use to sign the repo.
3. Upstream codes are kept in `gitrepos/`
4. Builds are launched, either manually via `./ynh-build` and `scripts/ynh-custom-builds` - or via a cron job (c.f. `./daily-build` which in fact runs every 15ish mins?)
- These scripts usually perform consistency checks, or tweak the changelog / version number, and then call `scripts/build_deb`, itself calling `sbuild` and `reprepro include`
- In the most simple case, the software being build is arch-independent, such as Python. In that case, it is pretty straightforward : `sbuild` starts the chroot, in which build dependencies are installed, and `dpkg-buildpackage` is called.
- In more complex cases, the software is arch-dependent. In that case, `sbuild` is called multiple times with `--host=$arch`. It will still run in the same amd64 chroot, but will install dependencies for the foreign architecture (such as the C compiler for armhf, or lib-foobar-dev for armhf), and build the package using these.
- For every `.deb`/`.changes` generated, `reprepro include` is called to add the new build to the apt repo. The builds are signed with the key declared in `conf/distributions`.
5. ???
6. PROFIT!
2017-09-01 17:35:08 +02:00
2022-01-14 02:21:17 +01:00
Troubleshooting
2017-09-01 17:38:36 +02:00
---------------
2017-09-01 17:35:08 +02:00
2022-01-19 22:07:00 +01:00
#### Debugging apt/dpkg being in broken state in the chroot
If you savagely Ctrl+C during a build, dpkg/apt may end up in a broken state
You can debug this by entering the chroot with `schroot -c $DIST-amd64-sbuild`
#### Relaunching a build manually with a shell ?
2022-01-14 02:21:17 +01:00
If a build fails and needs to be debugged, you should run `export DEBUG=true`, and re-run the appropriate build command. This should add the option `--anything-failed-commands='%s'` to the `sbuild` command, which will then drop you in an interactive shell inside the chroot, right after the failure. This should help investigate what's happening.
2018-05-08 04:58:48 +02:00
#### Removing "conflicting" sources
2018-05-08 04:58:48 +02:00
- Sometimes reprepro is an ass and wont let you add some sources because a
supposedly more recent version already exists
- To make it happy, you can use the undocumented `removesrc` feature :
```
2021-01-27 23:02:56 +01:00
# From the folder /var/www/repo/debian
2018-05-08 04:58:48 +02:00
reprepro removesrc <codename> <source-package-names> [<source-version>]
# For instance
reprepro removesrc stretch yunohost-admin 3.0.0+201804281857
```
2021-01-27 23:02:56 +01:00
#### Removing a deb package from the repo
```
reprepro remove <codename> <package>
# For instance, from anywhere
reprepro -Vb /var/www/repo/debian remove buster python3-miniupnpc
```
(`-Vb /var/www/repo/debian` is where the repo is stored)