summaryrefslogtreecommitdiffstats
path: root/test/integration/test-apt-get-satisfy
blob: fc7e8050e9e0e4fd5c778b983de19d89ef3dee96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"

setupenvironment
allowremovemanual
configarchitecture 'i386' 'amd64'

insertpackage 'stable' 'depends' 'i386' '1'
insertpackage 'stable' 'depends' 'amd64' '1'
insertinstalledpackage 'conflicts' 'i386' '1' 'Multi-Arch: same'
insertinstalledpackage 'conflicts' 'amd64' '1' 'Multi-Arch: same'
setupaptarchive

testrun() {
	local TYPE="$1"
	local HEADER="$2"
	shift 2
	msgmsg "$TYPE: Normal"
	testsuccessequal "$HEADER
The following packages will be REMOVED:
  conflicts
The following NEW packages will be installed:
  depends
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Remv conflicts [1]
Inst depends (1 stable [i386])
Conf depends (1 stable [i386])" aptget satisfy --simulate "depends (>= 1)" "Conflicts: conflicts:i386 (>= 1) [i386], conflicts:amd64 (>= 1) [amd64]" "$@"

	testsuccessequal "$HEADER
The following packages will be REMOVED:
  conflicts:amd64
The following NEW packages will be installed:
  depends:amd64
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Remv conflicts:amd64 [1]
Inst depends:amd64 (1 stable [amd64])
Conf depends:amd64 (1 stable [amd64])" aptget satisfy --simulate "depends (>= 1)" "Conflicts: conflicts:i386 (>= 1) [i386], conflicts:amd64 (>= 1) [amd64]" --host-architecture amd64 "$@"

	msgmsg "$TYPE: Build profile"

	testsuccessequal "$HEADER
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget satisfy --simulate "depends:amd64 <a>, depends:i386 <i>" "$@"

	testsuccessequal "$HEADER
The following NEW packages will be installed:
  depends:amd64
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst depends:amd64 (1 stable [amd64])
Conf depends:amd64 (1 stable [amd64])" aptget satisfy --simulate "depends:amd64 <a>, depends:i386 <i>" -P a "$@"

	testsuccessequal "$HEADER
The following NEW packages will be installed:
  depends
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst depends (1 stable [i386])
Conf depends (1 stable [i386])" aptget satisfy --simulate "depends:amd64 <a>, depends:i386 <i>" -P i "$@"

	msgmsg "$TYPE: Broken syntax"
	testfailureequal "E: Problem parsing dependency: apt (>= 2" aptget satisfy 'foo' 'apt (>= 2' -s "$@"
	testfailureequal "E: Problem parsing dependency: Conflicts: apt (>= 2" aptget satisfy 'foo' 'Conflicts: apt (>= 2' -s "$@"

	msgmsg "$TYPE: Legacy operators"
	testfailureequal "E: Invalid operator '<' at offset 5, did you mean '<<' or '<='? - in: foo (< 1)" aptget satisfy 'foo (< 1)' -s "$@"
	testfailureequal "E: Invalid operator '>' at offset 5, did you mean '>>' or '>='? - in: foo (> 1)" aptget satisfy 'foo (> 1)' -s "$@"

	msgmsg "$TYPE: Unsupported dependency type"
	testfailureequal "E: Problem parsing dependency: Recommends: foo" aptget satisfy 'Recommends: foo' -s "$@"

	msgmsg "$TYPE: Empty dependency"
	testfailureequal "E: Problem parsing dependency: " aptget satisfy '' -s "$@"
}

testrun 'Internal' 'Reading package lists...
Building dependency tree...'

testrun 'External' 'Reading package lists...
Building dependency tree...
Execute external solver...' --solver apt

testfailuremsg "E: Unsatisfiable dependency group satisfy:command-line:i386=1 -> depends:i386" aptget satisfy --simulate "depends (>= 2)" "Conflicts: conflicts:i386 (>= 1) [i386], conflicts:amd64 (>= 1) [amd64]" --solver 3.0

testfailureequal "Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 satisfy:command-line : Depends: depends (>= 2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages." aptget satisfy --simulate "depends (>= 2)" "Conflicts: conflicts:i386 (>= 1) [i386], conflicts:amd64 (>= 1) [amd64]" --solver internal

if [ "$APT_SOLVER" != "3.0" ]; then
# FIXME: solver3 doesn't produce nice errors in the external solver scenario
testfailureequal "Reading package lists...
Building dependency tree...
Execute external solver...
The solver encountered an error of type: ERR_UNSOLVABLE
The following information might help you to understand what is wrong:
The following packages have unmet dependencies:
 satisfy:command-line : Depends: depends (>= 2) but it is not going to be installed

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 satisfy:command-line : Depends: depends (>= 2) but it is not going to be installed
                        Conflicts: conflicts:i386 (>= 1)
E: External solver failed with: The following packages have unmet dependencies:" aptget satisfy --simulate "depends (>= 2)" "Conflicts: conflicts:i386 (>= 1) [i386], conflicts:amd64 (>= 1) [amd64]" --solver apt
fi