Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sbuild and bind mounts

62 views
Skip to first unread message

Norbert Preining

unread,
Mar 16, 2021, 11:20:03 PM3/16/21
to
Hi,

(please Cc)

in the Qt/KDE Team we use a script for test-building our groups of
packages. Those groups need to be build in tiers (levels) so that later
packages have access to the build of earlier levels.
The script we currently use is based on cowbuilder with --bindmounts
to get the package repo of hitherto built packages into the build
process, and hook scripts to active the respective apt sources line.

Recently I started using btrfs snapshots with sbuild (and eatmydata)
because it is sooo much faster than cowbuilder, so I would like to add
sbuild support to our tier-build script.

My questions are how to achieve:
- bind-mount directories into the sbuild chroot
- add lines to /etc/apt/sources.list
before the build process starts?

Thanks for any suggestion.

Best

Norbert

--
PREINING Norbert https://www.preining.info
Fujitsu Research Labs + IFMGA Guide + TU Wien + TeX Live + Debian Dev
GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13

Johannes Schauer Marin Rodrigues

unread,
Mar 17, 2021, 4:10:03 AM3/17/21
to
Hi Norbert,

Quoting Norbert Preining (2021-03-17 03:55:53)
> in the Qt/KDE Team we use a script for test-building our groups of packages.
> Those groups need to be build in tiers (levels) so that later packages have
> access to the build of earlier levels. The script we currently use is based
> on cowbuilder with --bindmounts to get the package repo of hitherto built
> packages into the build process, and hook scripts to active the respective
> apt sources line.

with sbuild you can use --extra-package=package.deb or
--extra-package=/path/to/debs and then sbuild will use those debs or all debs
in the directory you specify, respectively, to satisfy dependencies and you
don't need to manage an apt repository yourself.

> Recently I started using btrfs snapshots with sbuild (and eatmydata)
> because it is sooo much faster than cowbuilder, so I would like to add
> sbuild support to our tier-build script.
>
> My questions are how to achieve:
> - bind-mount directories into the sbuild chroot

This depends on the chroot backend you are using. The default backend is
schroot and you probably want a solution for that one and not for the
autopkgtest or unshare backend. With schroot you would add additional mount
points by editing /etc/schroot/sbuild/fstab

> - add lines to /etc/apt/sources.list
> before the build process starts?

You can either use this sbuild option:

--extra-repository="deb http://deb.debian.org/debian experimental main"

or you can use the option

--chroot-setup-commands="echo 'deb ...' >> /etc/apt/sources.list"

which runs arbitrary shell scripts inside your chroot.

All of the above is documented in the sbuild man page but there is lots of
stuff in there so I can understand why it's hard to find things without reading
the whole thing first. Anyways, if you see ways how to improve the man page,
I'd like to hear about them. Other than that there is
https://wiki.debian.org/sbuild which collects common recipes of how to use
sbuild in different scenarios, so feel free to add things you find useful to
it.

Thanks!

cheers, josch
signature.asc

Norbert Preining

unread,
Mar 17, 2021, 8:40:03 PM3/17/21
to
Hi Johannes,

thanks for your answer!

> with sbuild you can use --extra-package=package.deb or
> --extra-package=/path/to/debs and then sbuild will use those debs or all debs
> in the directory you specify, respectively, to satisfy dependencies and you
> don't need to manage an apt repository yourself.

Ahh, does that mean sbuild creates the apt repo files itself and adds it
automatically to the sources.list?

This would indeed help a lot, but I need one more piece of information:
I need to add pinning information (I guess via --chroot-setup-commands)
to give the above extra repository a very low pin so that by default
packages are taken from the normal archives.

Is the path for the above extra repository (--extra-package=/path/to/dir/)
fixed?

> autopkgtest or unshare backend. With schroot you would add additional mount
> points by editing /etc/schroot/sbuild/fstab

Since I don't want to do this permanently but only for the staged
builds, the above method would be by far more usable.

> or you can use the option
>
> --chroot-setup-commands="echo 'deb ...' >> /etc/apt/sources.list"

> All of the above is documented in the sbuild man page but there is lots of
> stuff in there so I can understand why it's hard to find things without reading

Indeed, I found the --chroot-setup-commands but I didn't spot the
--extra-package
Unfortunately the man page seems not to give the information where the
extra repository is generated.

Thanks for your help!

Norbert Preining

unread,
Apr 11, 2021, 10:50:04 PM4/11/21
to
Hi Johannes,

quite some time has passed, but for a new release of KDE frameworks I
now want to get this working ...

On Wed, 17 Mar 2021, Johannes Schauer Marin Rodrigues wrote:
> --extra-package=/path/to/debs

So that is exactly what I need, with one exception:

Is there a way to determine the directory that will be used for
packages/dirs imported via
--extra-package
so that one can adjust the apt pinning configuration for this repo?

I want to add a set of packages to the resolver (use --extra-packages)
but pin them to lower than what is in the archive, to make sure that
they are only used when explicitely requests. This can be done with
--chroot-setup-commands, but for that I need to know **where** the
resolver directory is created.

Thanks for any comment!

Best

Norbert

--
PREINING Norbert https://www.preining.info
Fujitsu + IFMGA Guide + TU Wien + TeX Live + Debian Dev
0 new messages