aboutsummaryrefslogtreecommitdiff
path: root/paludis/resolver/resolver_TEST_blockers_setup.sh
blob: 01465d772025845d11ffda06d6314a4727023f1f (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
#!/usr/bin/env bash
# vim: set ft=sh sw=4 sts=4 et :

mkdir resolver_TEST_blockers_dir || exit 1
cd resolver_TEST_blockers_dir || exit 1

mkdir -p build
mkdir -p distdir
mkdir -p installed

mkdir -p repo/{profiles/profile,metadata}

cd repo
echo "repo" > profiles/repo_name
: > metadata/categories.conf

: > profiles/categories
cat <<'END' > profiles/profile/make.defaults
ARCH=test
END

# hard
echo 'hard' >> metadata/categories.conf

mkdir -p 'packages/hard/target'
cat <<END > packages/hard/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="
    ( !hard/a-pkg[<2] !hard/z-pkg[<2] )
    "
END

mkdir -p 'packages/hard/a-pkg'
cat <<END > packages/hard/a-pkg/a-pkg-2.exheres-0
SUMMARY="dep"
PLATFORMS="test"
SLOT="0"
END

mkdir -p 'packages/hard/z-pkg'
cat <<END > packages/hard/z-pkg/z-pkg-2.exheres-0
SUMMARY="dep"
PLATFORMS="test"
SLOT="0"
END

# unfixable
echo 'unfixable' >> metadata/categories.conf

mkdir -p 'packages/unfixable/target'
cat <<END > packages/unfixable/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="
    ( !unfixable/a-pkg )
    "
END

mkdir -p 'packages/unfixable/a-pkg'
cat <<END > packages/unfixable/a-pkg/a-pkg-2.exheres-0
SUMMARY="dep"
PLATFORMS="test"
SLOT="0"
END

# remove
echo 'remove' >> metadata/categories.conf

mkdir -p 'packages/remove/target'
cat <<END > packages/remove/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="
    ( !remove/a-pkg !remove/z-pkg )
    "
END

mkdir -p 'packages/remove/a-pkg'
cat <<END > packages/remove/a-pkg/a-pkg-2.exheres-0
SUMMARY="dep"
PLATFORMS="test"
SLOT="0"
END

mkdir -p 'packages/remove/z-pkg'
cat <<END > packages/remove/z-pkg/z-pkg-2.exheres-0
SUMMARY="dep"
PLATFORMS="test"
SLOT="0"
END

# blocked-and-dep
echo 'blocked-and-dep' >> metadata/categories.conf

mkdir -p 'packages/blocked-and-dep/target'
cat <<END > packages/blocked-and-dep/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="
    ( !blocked-and-dep/both blocked-and-dep/both )
    "
END

mkdir -p 'packages/blocked-and-dep/both'
cat <<END > packages/blocked-and-dep/both/both-1.exheres-0
SUMMARY="dep"
PLATFORMS="test"
SLOT="0"
END

# block-and-dep-cycle
echo 'block-and-dep-cycle' >> metadata/categories.conf

mkdir -p 'packages/block-and-dep-cycle/target'
cat <<END > packages/block-and-dep-cycle/target/target-1.ebuild
EAPI="2"
DESCRIPTION="target"
KEYWORDS="test"
SLOT="0"
DEPEND="
    block-and-dep-cycle/dep
    "
END

mkdir -p 'packages/block-and-dep-cycle/dep'
cat <<END > packages/block-and-dep-cycle/dep/dep-1.ebuild
EAPI="2"
DESCRIPTION="dep"
KEYWORDS="test"
SLOT="0"
DEPEND="
    !=block-and-dep-cycle/target-0
    "
END

# hard-block-and-dep-cycle
echo 'hard-block-and-dep-cycle' >> metadata/categories.conf

mkdir -p 'packages/hard-block-and-dep-cycle/target'
cat <<END > packages/hard-block-and-dep-cycle/target/target-1.ebuild
EAPI="2"
DESCRIPTION="target"
KEYWORDS="test"
SLOT="0"
DEPEND="
    hard-block-and-dep-cycle/dep
    "
END

mkdir -p 'packages/hard-block-and-dep-cycle/dep'
cat <<END > packages/hard-block-and-dep-cycle/dep/dep-1.ebuild
EAPI="2"
DESCRIPTION="dep"
KEYWORDS="test"
SLOT="0"
DEPEND="
    !!=hard-block-and-dep-cycle/target-0
    "
END

# self-block
for e in "eb" "ex" ; do
    for i in "x" "0" "1" ; do
        for d in "x" "0" "1" ; do
            for b in "w" "s" ; do
                cat=self-block-${e}-${i}-${d}-${b}

                dep=${cat}/dep

                if [[ "${d}" != "x" ]] ; then
                    if [[ "${e}" == "eb" ]] ; then
                        dep="=${dep}-${d}"
                    else
                        dep="${dep}[=${d}]"
                    fi
                fi

                if [[ "${b}" == "w" ]] ; then
                    if [[ "${e}" == "eb" ]] ; then
                        dep="!${dep}"
                    else
                        dep="!${dep} [[ resolution = uninstall-blocked-after ]]"
                    fi
                else
                    if [[ "${e}" == "eb" ]] ; then
                        dep="!!${dep}"
                    else
                        dep="!${dep}"
                    fi
                fi

                echo $cat >> metadata/categories.conf

                mkdir -p 'packages/'$cat'/target'
                if [[ "${e}" == "eb" ]] ; then
                    cat <<END > packages/$cat/target/target-1.ebuild
EAPI="2"
DESCRIPTION="target"
KEYWORDS="test"
SLOT="0"
DEPEND="
    ${cat}/dep
    "
END
                else
                    cat <<END > packages/$cat/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="build+run:
    ${cat}/dep
    "
END
                fi

                mkdir -p 'packages/'$cat'/dep'
                if [[ "${e}" == "eb" ]] ; then
                    cat <<END > packages/$cat/dep/dep-1.ebuild
EAPI="2"
DESCRIPTION="target"
KEYWORDS="test"
SLOT="0"
DEPEND="
    ${dep}
    "
END
                else
                    cat <<END > packages/$cat/dep/dep-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="build+run:
    ${dep}
    "
END
                fi

            done
        done
    done
done

# uninstall-blocked-after
echo 'uninstall-blocked-after' >> metadata/categories.conf

mkdir -p 'packages/uninstall-blocked-after/target'
cat <<END > packages/uninstall-blocked-after/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="
    ( !uninstall-blocked-after/dep[=1] [[ resolution = uninstall-blocked-after ]] )
    "
END

mkdir -p 'packages/upgrade-blocked-after/dep'
cat <<END > packages/upgrade-blocked-after/dep/dep-2.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES=""
END

# uninstall-blocked-before
echo 'uninstall-blocked-before' >> metadata/categories.conf

mkdir -p 'packages/uninstall-blocked-before/target'
cat <<END > packages/uninstall-blocked-before/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="
    ( !uninstall-blocked-before/dep[=1] [[ resolution = uninstall-blocked-before ]] )
    "
END

mkdir -p 'packages/upgrade-blocked-before/dep'
cat <<END > packages/upgrade-blocked-before/dep/dep-2.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES=""
END

# upgrade-blocked-before
echo 'upgrade-blocked-before' >> metadata/categories.conf

mkdir -p 'packages/upgrade-blocked-before/target'
cat <<END > packages/upgrade-blocked-before/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="
    ( !upgrade-blocked-before/dep[=1] [[ resolution = upgrade-blocked-before ]] )
    "
END

mkdir -p 'packages/upgrade-blocked-before/dep'
cat <<END > packages/upgrade-blocked-before/dep/dep-2.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES=""
END

# manual
echo 'manual' >> metadata/categories.conf

mkdir -p 'packages/manual/target'
cat <<END > packages/manual/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="
    ( !manual/dep[=1] [[ resolution = manual ]] )
    "
END

mkdir -p 'packages/manual/dep'
cat <<END > packages/manual/dep/dep-2.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES=""
END

# other-slot-first
echo 'other-slot-first' >> metadata/categories.conf

mkdir -p 'packages/other-slot-first/target'
cat <<END > packages/other-slot-first/target/target-1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="0"
DEPENDENCIES="other-slot-first/dep:1 other-slot-first/dep:2"
END

mkdir -p 'packages/other-slot-first/dep'
cat <<END > packages/other-slot-first/dep/dep-1.1.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="1"
DEPENDENCIES=""
END

cat <<END > packages/other-slot-first/dep/dep-2.exheres-0
SUMMARY="target"
PLATFORMS="test"
SLOT="2"
DEPENDENCIES="!other-slot-first/dep[<1.1]"
END

cd ..