[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: debvm for autopkgtests with multiple host?

Hi Johannes,

On Sun, Sep 24, 2023 at 10:27:37AM +0200, Johannes Schauer Marin Rodrigues wrote:
> There is really not much magic. The core of it is to pass this to your
> mmdebstrap or debvm-create invocation:
>     --setup-hook='for f in /etc/apt/sources.list /etc/apt/sources.list.d/* /etc/apt/preferences.d/*;
>                   do [ -e "$f" ] && { echo; sed "s| file://| copy://|" "$f"; } | tee "$1/$f" >&2; done'
>     --hook-dir=/usr/share/mmdebstrap/hooks/file-mirror-automount

This sounds simple, but reality is a little more elaborate.

For one thing, there also is
/usr/share/mmdebstrap/hooks/copy-host-apt-sources-and-preferences. This
hook directory is similar but subtly different from the above setup
 * It does not perform the translation of file:// uris into copy://uris.
 * It is more accurate in terms of following non-standard locations for
   the various configuration items.
 * Neither of these clear the 0000sources.list created by mmdebstrap by
 * The latter one verifies that you have the same package versions
   inside and outside.

Did I accurately represent the differences? Which one would you prefer
in which situation?

Adding any of this to debvm-create will not just work, because
debvm-create also adds the maybe-merged-usr hook and any pass-through
arguments you add come later. Therefore the maybe-merged-usr hook would
come before this hook and it fails if you pass an empty sources.list,
which would be most useful. As a workaround, you may add

    --skip=usrmerge -- --hook-dir=/usr/share/mmdebstrap/hooks/maybe-merged-usr

to the debvm-create invocation to reorder the hooks to actually work.

What seems to work is this:


That final empty string supplies the apt sources. Does this sound about
right? If yes, I'd like to add this as a non-flaky autopkgtest to debvm.


Reply to: