Hi Alexandre,

* Alexandre Rossi <[email protected]> [2025-10-09 17:36]:
While trying to add an extra repo needed by my autopkgtest run, and after
understanding that --extra-repository only applies to the build step, I started
trying to use --autopkgtest-opts.

$ --autopkgtest-opts=--add-apt-source='deb http://deb.example.net/ experimental 
main'
[...]
autopkgtest
-----------

autopkgtest [16:59:30]: starting date and time: 2025-10-09 16:59:30+0200
autopkgtest [16:59:30]: version 5.51
autopkgtest [16:59:30]: host skade; command line: /usr/bin/autopkgtest 
/tmp/lazygal_0.11-2_amd64.changes -- unshare --release unstable --arch amd64 
--add-apt-source=deb http://deb.example.net/ experimental main
usage: autopkgtest-virt-unshare [-h] [-a ARCH] [-b OUTSIDE INSIDE] [-d]
                               [--bootstrapcmd BOOTSTRAPCMD] [-p PREFIX]
                               [-r RELEASE] [-t TARBALL] [-u UNPACK_DIR]
autopkgtest-virt-unshare: error: unrecognized arguments: --add-apt-source=deb 
http://deb.example.net/ experimental main

It seems that unshare makes AUTOPKGTEST_OPTIONS initialized with "-- unshare..."
and that --autopkgtest-opts gets appended after which make the command line 
fail.

The badly generated command line is:

   /usr/bin/autopkgtest /tmp/lazygal_0.11-2_amd64.changes -- unshare --release 
unstable --arch amd64 --add-apt-source='deb http://deb.example.net/ 
experimental main'

instead of:

   /usr/bin/autopkgtest --add-apt-source='deb http://deb.example.net/ 
experimental main' /tmp/lazygal_0.11-2_amd64.changes -- unshare --release 
unstable --arch amd64

You can work around this by setting $autopkgtest_opts in your sbuild.conf. Or setting it to an empty value.

Long term I see different ways to fix this and I am not sure which one would be best:

a) https://salsa.debian.org/ci-team/autopkgtest/-/merge_requests/515 proposes an automatic mode so we could eventually drop the `-- unshare` injection.

b) We could make --autopkgtest-opt[s] drop the `-- unshare` injection so one could freely add autopkgtest options on the command line. Not sure though if it should happen always or only when the user does not have a $autopkgtest_opts set.

c) We could add --autopkgtest-opt[s] at the beginning of the final AUTOPKGTEST_OPTIONS or before the --.

d) We could split --autopkgtest-opt[s] into a multiple options to inject before and after the --.

e) Document the $autopkgtest_opts = [];  workaround.

Cheers Jochen

Attachment: signature.asc
Description: PGP signature

Reply via email to