test-essential-force-loopbreak 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'native'
  7. insertinstalledpackage 'sysvinit' 'native' '1' 'Essential: yes'
  8. buildsimplenativepackage 'sysvinit' 'native' '2' 'sid' 'Pre-Depends: sysvinit-core | systemd-sysv
  9. Essential: yes'
  10. buildsimplenativepackage 'sysvinit-core' 'native' '2' 'sid'
  11. buildsimplenativepackage 'systemd-sysv' 'native' '2~conflict' 'sid-conflict' 'Conflicts: sysvinit (<< 2)
  12. Breaks: sysvinit-core'
  13. buildsimplenativepackage 'systemd-sysv' 'native' '2~break' 'sid-break' 'Breaks: sysvinit (<< 2), sysvinit-core'
  14. setupaptarchive
  15. cp -a rootdir/var/lib/dpkg/status dpkg.status.backup
  16. testforcebreak() {
  17. cp -a dpkg.status.backup rootdir/var/lib/dpkg/status
  18. rm -f rootdir/var/lib/apt/extended_states
  19. testfailureequal "Reading package lists...
  20. Building dependency tree...
  21. The following additional packages will be installed:
  22. sysvinit
  23. The following NEW packages will be installed:
  24. systemd-sysv
  25. The following packages will be upgraded:
  26. sysvinit
  27. 1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  28. E: This installation run will require temporarily removing the essential package sysvinit:$(getarchitecture 'native') due to a Conflicts/Pre-Depends loop. This is often bad, but if you really want to do it, activate the APT::Force-LoopBreak option.
  29. E: Internal Error, Could not early remove sysvinit:$(dpkg --print-architecture) (2)" aptget install systemd-sysv -t "$1" -s
  30. # ensure that really nothing happens
  31. testfailure aptget install systemd-sysv -y -t "$1"
  32. testdpkginstalled 'sysvinit'
  33. testdpkgnotinstalled 'systemd-sysv'
  34. # with enough force however …
  35. cp -a dpkg.status.backup rootdir/var/lib/dpkg/status
  36. testsuccess aptget install systemd-sysv -y -t "$1" -o APT::Force-LoopBreak=1 -o Debug::pkgDpkgPm=1
  37. cp rootdir/tmp/testsuccess.output apt.output
  38. testsuccess grep -- '--force-remove-essential --remove sysvinit' apt.output
  39. testsuccess aptget install systemd-sysv -y -t "$1" -o APT::Force-LoopBreak=1
  40. testdpkginstalled 'sysvinit' 'systemd-sysv'
  41. }
  42. testforcebreak 'sid-conflict'
  43. testforcebreak 'sid-break'