]>
git.saurik.com Git - apt.git/blob - test/integration/test-external-installation-planner-protocol
4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
7 configarchitecture 'amd64'
9 buildsimplenativepackage 'libfoo' 'amd64' '3' 'experimental' 'Multi-Arch: same'
10 buildsimplenativepackage 'foo' 'all' '3' 'experimental' 'Depends: newstuff'
11 buildsimplenativepackage 'foo' 'all' '2' 'unstable' 'Depends: libfoo:amd64, stuff
12 Conflicts: bar, libfoo:i386
13 Recommends: unrelated'
14 buildsimplenativepackage 'libfoo' 'amd64' '2' 'unstable' 'Multi-Arch: same'
15 buildsimplenativepackage 'unrelated-2' 'amd64' '2' 'unstable'
16 insertinstalledpackage 'foo' 'all' '1'
17 insertinstalledpackage 'bar' 'all' '1'
18 insertinstalledpackage 'stuff' 'all' '1'
19 insertinstalledpackage 'unrelated-1' 'all' '1'
21 setupaptarchive --no-update
23 EIPPLOG="${TMPWORKINGDIRECTORY}/rootdir
/var
/log
/apt
/eipp.log
"
24 echo "Dir
::Log
::Planner
\"$EIPPLOG\";" > ./rootdir/etc/apt/apt.conf.d/eipp-logging
26 testsuccess apt update
27 export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded
/dump.eipp
"
28 testfailure test -r "$EIPPLOG"
29 testfailure aptget install foo --planner dump -y
30 testfailure test -r "$EIPPLOG"
31 testfailure grep 'unrelated-2' "$APT_EDSP_DUMP_FILENAME"
32 testsuccessequal '2' grep -c '^Package: foo$' "$APT_EDSP_DUMP_FILENAME"
33 testsuccessequal '1' grep -c '^Package: libfoo$' "$APT_EDSP_DUMP_FILENAME"
34 testsuccessequal 'Planner: dump' grep '^Planner: ' "$APT_EDSP_DUMP_FILENAME"
36 testsuccess aptget install foo -s
37 testsuccess aptget install foo -y
38 testsuccess test -r "$EIPPLOG"
39 testsuccessequal 'Request: EIPP 0.1
43 Install: libfoo:amd64 foo:amd64
44 Planner: internal' head -n 6 "$EIPPLOG"
45 aptinternalplanner < "$EIPPLOG" > planner.log || true
46 testsuccessequal 'Remove: 6
48 Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
51 testsuccess aptget install foo -s --reinstall
52 testsuccess aptget install foo -y --reinstall
53 testsuccess test -r "$EIPPLOG"
54 testsuccessequal 'Request: EIPP 0.1
58 Planner: internal' head -n 5 "$EIPPLOG"
59 aptinternalplanner < "$EIPPLOG" > planner.log || true
60 testsuccessequal 'Unpack: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
63 testsuccess aptget purge foo -s
64 testsuccess aptget purge foo -y
65 testsuccess test -r "$EIPPLOG"
66 testsuccessequal 'Request: EIPP 0.1
70 Planner: internal' head -n 5 "$EIPPLOG"
71 aptinternalplanner < "$EIPPLOG" > planner.log || true
72 testsuccessequal 'Remove: 4' grep -e '^Unpack:' -e '^Install:' -e '^Configure:' -e '^Remove:' planner.log
74 testplannerfailuremsg() {
75 local PLANNER="rootdir
/usr
/lib
/apt
/planners
/$1"
76 echo "$2" > "$PLANNER"
78 testfailuremsg "$3" apt install foo -s --planner $1
81 testplannerfailuremsg 'exit0withmsg' "#!/bin/sh
82 echo 'Error: instant-exit
83 Message: This planner exits instantly'
84 exit 0" 'E: External planner failed with: This planner exits instantly'
86 testplannerfailuremsg 'exit1withoutmsg' "#!/bin/sh
87 exit 1" 'E: Sub-process exit1withoutmsg returned an error code (1)'
89 testplannerfailuremsg 'exit1withmsg' "#!/bin/sh
90 echo 'Error: instant-exit
91 Message: This planner exits instantly'
92 exit 1" 'E: External planner failed with: This planner exits instantly
93 E: Sub-process exit1withmsg returned an error code (1)'