#801894 autopkgtest: Support conditional dependencies

#801894#5
Date:
2015-10-15 17:48:17 UTC
From:
To:
Dear Maintainer,

With python-pex, an extra dependency is required on Ubuntu that isn't
required on Debian.  Originally I was keeping an Ubuntu delta that
only differed by including the extra dependency in d/tests/control.
After some discussion on IRC, it was suggested that the test could do
this instead:

dpkg-vendor --is ubuntu && apt-get install -y ubuntu-drivers-common || true

That worked, but has the disadvantage that the test has to also add
the allow-root restriction.  I'm wondering if there isn't a way do add
a syntax for conditional additional dependencies.

We talked about a couple of options on IRC.  My thinking now is that
perhaps something like

Depends-<vendor>: foo

e.g.

Depends-Ubuntu: foo

could work.  Maybe you want to generalize that into any conditional,
so for example:

Depends: @, (dpkg-vendor --is ubuntu) foo, blah


- -- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.2.0-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages autopkgtest depends on:
ii  apt-utils       1.0.10.2
ii  libdpkg-perl    1.18.3
ii  procps          2:3.3.10-4
ii  python3         3.4.3-7
ii  python3-debian  0.1.27

Versions of packages autopkgtest recommends:
ii  autodep8  0.2

Versions of packages autopkgtest suggests:
pn  lxc          <none>
pn  qemu-system  <none>
pn  qemu-utils   <none>
ii  schroot      1.6.10-2

- -- no debconf information
iQIcBAEBCAAGBQJWH+bfAAoJEBJutWOnSwa/3N8P/i4u4NwVXCIV1d+To8i53vho
SSKadShV6VN/+5O0Px3gRthDz3jDFvZ+w1V69lL9VGLIbpIlfNLwWVvCahy3yBQh
Wh92DPHmpilz/adooCwOSMj3uVTzhBCRkXDXgaqMFMZoK3qy0qN0G4HK6dEyXnG4
WhdomdUKrHwB0sc+I+Zwig/hCHxO53GLir0vbMoI4aC5rzhXD9iLOstuqc3wOLIi
7D11VtQ8AKgS1tV34JFTmPsjZtYfeWDUomLj3e4oEpPEC6H5azKRNqZm7wdt5+3z
b4NeQHRtU4N4IPETX3HdzSwC2ri3xcDDhx3Ed76altbqCuE5BAMN707J08xBVicY
3e6aDCgCoJT2raVkuUlDG5lKLnz8QwCQuzwGv2b7vGg0pU0USnFPvtzSDIRhTaKq
WZxl5/juiFaqvmEbuQGIrNktGgX0+xiJfGR1qwxy/hgsDoJ+ILkdCiBv2LceLUzT
OYj9LA/lwbsJKl2I+Q15IF+BoBcm4eiGDC5yVMSq5V0vXGEBBtL8mRnEPR/GQOq2
GEo3xecnHAA1BA/Ainfu13aI7PO6DbfOWd/xLTzPUpIswwlQf29xjmAmkP+TAnV3
Cru0ewqZK2k9ZWokG6dZnt68x3yCR10la7dRKPbnv5Kd47wr8SwhsRR4K6nYy/HG
JDjStbZZiO11vgsS4eX0
=BlBe
-----END PGP SIGNATURE-----

#801894#10
Date:
2015-10-21 07:41:16 UTC
From:
To:
Barry Warsaw [2015-10-15 13:48 -0400]:

Out of interest, this does sound like a bug, no? Is the binary you are
testing perhaps missing that dependency? If the test is exactly the
same then the dependencies ought to be too?

I suppose that extra dependency is not available in Debian. You could
use something like

  Depends: ubuntu-only-package | aspell-doc

i. e. alternatively depend on something which you don't need and which
isn't already installed in minimal testbeds. With that you can get the
effect with today's autopkgtest.

It could, but that smells like an use case which we'd probably use
once in the entire archive, and it's quite some work to implement.

If we need to take diversion between Debian and derivatives into
account, then maybe this should be done more generally, similarly to
deiban/patches/series.ubuntu? E. g. there could be a
debian/tests/control.<dpkg vendor name>, and if that doesn't exist,
fall back to the usual debian/tests/control ?

While that would mean more duplication in your particular case (take
it as motivation to fix that delta :), and it really smells like a
bug) it might also help with some other use cases, like you want to
run different tests on Debian and Ubuntu.

I don't want to do that, as dpkg/apt can't understand this.

To be honest, I'm still sceptical about this as it feels like
overgeneralizing a workaround for one bug; but I keep it open as
wishlist for now.

Thanks,

Martin

#801894#17
Date:
2015-10-21 14:07:58 UTC
From:
To:
Oh, it's a bug, but not in pex.  The bug is in ubuntu-release-upgrader because
its package install creates dangling symlinks which are only satisfied when
other packages are installed.  I actually have a MP to fix this:

https://code.launchpad.net/~barry/ubuntu-release-upgrader/lp1485093

That's a great idea.

However, I'd suggest always running control.<vendor> and control.  That way
only the delta needs to be defined in control.<vendor> so it reduces
duplication.  If there is no overlap between the tests for various vendors,
then a package could just include only e.g. control.ubuntu and control.debian,
etc.

It's entirely possible, but maybe only theoretical right now.  We certainly
have packages in Ubuntu that aren't in Debian, and the presence of those
packages may affect the tests of other packages, even without considering
bugs.