summaryrefslogtreecommitdiffstats
path: root/tests/snapshotcopyrestore.test
blob: fdb41557d49f6ebb2963727129a43719a808f8ce (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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
set -u
. "$TESTSDIR"/test.inc

mkdir -p conf
cat > conf/options <<CONFEND
outhook $SRCDIR/docs/outstore.py
CONFEND
export REPREPRO_OUT_DB=db.out
cat > conf/distributions <<CONFEND
Codename: A
Architectures: abacus calculator
Components: dog cat
Log: logfile
 -A=nonexistant -C=nocomponent --type=none --withcontrol noscript.sh

Codename: B
Architectures: abacus source
Components: dog cat
Contents:
Log: logfile
CONFEND
mkdir logs

testrun - -b . export 3<<EOF
stderr
*=Warning: unknown architecture 'nonexistant', ignoring notificator line at line 5 in ./conf/distributions
stdout
$(odb)
-v1*=Exporting B...
-v2*=Created directory "./dists"
-v2*=Created directory "./dists/B"
-v2*=Created directory "./dists/B/dog"
-v2*=Created directory "./dists/B/dog/binary-abacus"
-v6*= exporting 'B|dog|abacus'...
-v6*=  creating './dists/B/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/B/dog/source"
-v6*= exporting 'B|dog|source'...
-v6*=  creating './dists/B/dog/source/Sources' (gzipped)
-v2*=Created directory "./dists/B/cat"
-v2*=Created directory "./dists/B/cat/binary-abacus"
-v6*= exporting 'B|cat|abacus'...
-v2*=Created directory "./dists/B/cat/source"
-v6*=  creating './dists/B/cat/binary-abacus/Packages' (uncompressed,gzipped)
-v6*= exporting 'B|cat|source'...
-v6*=  creating './dists/B/cat/source/Sources' (gzipped)
-v1*= generating dog/Contents-abacus...
-v1*= generating cat/Contents-abacus...
-v1*=Exporting A...
-v2*=Created directory "./dists/A"
-v2*=Created directory "./dists/A/dog"
-v2*=Created directory "./dists/A/dog/binary-abacus"
-v6*= exporting 'A|dog|abacus'...
-v6*=  creating './dists/A/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/A/dog/binary-calculator"
-v6*= exporting 'A|dog|calculator'...
-v6*=  creating './dists/A/dog/binary-calculator/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/A/cat"
-v2*=Created directory "./dists/A/cat/binary-abacus"
-v6*= exporting 'A|cat|abacus'...
-v6*=  creating './dists/A/cat/binary-abacus/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/A/cat/binary-calculator"
-v6*= exporting 'A|cat|calculator'...
-v6*=  creating './dists/A/cat/binary-calculator/Packages' (uncompressed,gzipped)
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check
dodo test -f db/checksums.db

ed -s conf/distributions <<EOF
g/^ -A=nonexistant/s/nonexistant/calculator/
w
q
EOF

touch importindex

testrun - -b . _addpackage B importindex bar foo 3<<EOF
returns 255
stderr
*=Warning: unknown component 'nocomponent', ignoring notificator line at line 5 in ./conf/distributions
*=_addpackage needs -C and -A and -T set!
-v0*=There have been errors!
EOF

ed -s conf/distributions <<EOF
g/^ -A/s/nocomponent/cat/
w
q
EOF

testrun - -b . -A source -T dsc _addpackage B importindex bar foo 3<<EOF
returns 255
stderr
*=Warning: unknown packagetype 'none', ignoring notificator line at line 5 in ./conf/distributions
*=_addpackage needs -C and -A and -T set!
-v0*=There have been errors!
EOF

# -A=calculator -C=cat --type=dsc --via=include --withcontrol noscript.sh
ed -s conf/distributions <<EOF
g/^ -A=/s/=none/=dsc --via=include/
w
q
EOF


testrun - -b . -A abacus -C dog _addpackage B importindex bar foo 3<<EOF
returns 255
stderr
*=_addpackage needs -C and -A and -T set!
-v0*=There have been errors!
EOF

testrun - -b . -T deb -C dog _addpackage B importindex bar foo 3<<EOF
returns 255
stderr
*=_addpackage needs -C and -A and -T set!
-v0*=There have been errors!
EOF

testrun - -b . -T deb -A abacus -C dog _addpackage B importindex bar foo 3<<EOF
stderr
stdout
EOF

cat > importindex <<EOF
Test:
EOF

testrun - -b . -T deb -A abacus -C dog _addpackage B importindex bar foo 3<<EOF
returns 249
stderr
*=Error parsing importindex line 1 to 1: Chunk without 'Package:' field!
-v0*=There have been errors!
stdout
EOF

cat > importindex <<EOF
Package: another
Version: 0
Architecture: abacus
MD5Sum: 0
Size: 0
Filename: none
EOF

testrun - -b . -T deb -A abacus -C dog _addpackage B importindex bar foo 3<<EOF
stderr
stdout
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check

cat > importindex <<EOF
Package: foo
Version: 0
Architecture: abacus
EOF

testrun - -b . -T deb -A abacus -C dog _addpackage B importindex bar foo 3<<EOF
returns 255
stderr
*=Data does not look like binary control: 'Package: foo
*=Version: 0
*=Architecture: abacus'
-v0*=There have been errors!
stdout
EOF

cat > importindex <<EOF
Package: foo
Version: 0
Architecture: abacus
MD5sum: 0
Size: 0
Filename: none
EOF

testrun - -b . -T deb -A abacus -C dog _addpackage B importindex bar foo 3<<EOF
returns 249
stderr
*=Error: cannot yet deal with files changing their position
*=(pool/dog/f/foo/foo_0_abacus.deb vs none in foo version 0)
-v0*=There have been errors!
stdout
EOF

mkdir -p pool/dog/f/foo
echo "some data" > foo_0_abacus.deb

cat > importindex <<EOF
Package: foo
Version: 0
Architecture: abacus
MD5sum: $(md5 foo_0_abacus.deb)
Size: $(stat -c "%s" foo_0_abacus.deb)
Filename: pool/dog/f/foo/foo_0_abacus.deb
EOF

testrun - -b . -T deb -A abacus -C dog _addpackage B importindex bar foo 3<<EOF
returns 249
stderr
*=Error: package foo version 0 lists file pool/dog/f/foo/foo_0_abacus.deb not yet in the pool!
-v0*=There have been errors!
stdout
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check

testrun empty -b . dumpunreferenced

mv foo_0_abacus.deb pool/dog/f/foo/foo_0_abacus.deb
testrun - -b . _detect pool/dog/f/foo/foo_0_abacus.deb 3<<EOF
stderr
stdout
$(ofa 'pool/dog/f/foo/foo_0_abacus.deb')
-v0*=1 files were added but not used.
-v0*=The next deleteunreferenced call will delete them.
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check

testrun - -b . dumpunreferenced 3<<EOF
stderr
stdout
*=pool/dog/f/foo/foo_0_abacus.deb
EOF

# TODO: why is there no error for faulty .deb here?

testrun - -b . -T deb -A abacus -C dog _addpackage B importindex bar foo 3<<EOF
stderr
*=Strange control data for 'foo': no Description at all
stdout
-v1*=Adding 'foo' '0' to 'B|dog|abacus'.
$(opa 'foo' x 'B' 'dog' 'abacus' 'deb')
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*=  replacing './dists/B/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v6*= looking for changes in 'B|dog|source'...
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
-v1*= generating dog/Contents-abacus...
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check

testrun empty -b . dumpunreferenced

echo "dsc-content" > pool/dog/f/foo/foo_1.dsc
echo "tar-content" > pool/dog/f/foo/foo_1.tar.gz

cat > importindex <<EOF
Package: foo
Version: 1
Directory: pool/dog/f/foo
Files:
 $(mdandsize pool/dog/f/foo/foo_1.dsc) foo_1.dsc
 $(mdandsize pool/dog/f/foo/foo_1.tar.gz) foo_1.tar.gz
EOF

testrun - -b . -T dsc -C dog _addpackage B importindex bar foo 3<<EOF
returns 249
stderr
*=Error: package foo version 1 lists file pool/dog/f/foo/foo_1.dsc not yet in the pool!
-v0*=There have been errors!
stdout
EOF

testrun empty -b . dumpunreferenced

testrun - -b . _detect pool/dog/f/foo/foo_1.dsc 3<<EOF
stderr
stdout
$(ofa 'pool/dog/f/foo/foo_1.dsc')
-v0*=1 files were added but not used.
-v0*=The next deleteunreferenced call will delete them.
EOF

mv pool/dog/f/foo/foo_1.tar.gz foo_1.tar.gz
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check
mv foo_1.tar.gz pool/dog/f/foo/foo_1.tar.gz

testrun - -b . -T dsc -C dog _addpackage B importindex bar foo 3<<EOF
returns 249
stderr
*=Error: package foo version 1 lists file pool/dog/f/foo/foo_1.tar.gz not yet in the pool!
-v0*=There have been errors!
stdout
EOF

testrun - -b . _detect pool/dog/f/foo/foo_1.tar.gz 3<<EOF
stderr
stdout
$(ofa 'pool/dog/f/foo/foo_1.tar.gz')
-v0*=1 files were added but not used.
-v0*=The next deleteunreferenced call will delete them.
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check

testrun - -b . dumpunreferenced 3<<EOF
stderr
stdout
*=pool/dog/f/foo/foo_1.dsc
*=pool/dog/f/foo/foo_1.tar.gz
EOF

testrun - -b . -T dsc -C dog _addpackage B importindex bar foo 3<<EOF
stderr
stdout
-v1*=Adding 'foo' '1' to 'B|dog|source'.
$(opa 'foo' x 'B' 'dog' 'source' 'dsc')
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*= looking for changes in 'B|dog|source'...
-v6*=  replacing './dists/B/dog/source/Sources' (gzipped)
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check

testrun empty -b . dumpunreferenced

testrun - -b . gensnapshot B now 3<<EOF
stdout
-v2*=Created directory "./dists/B/snapshots"
-v2*=Created directory "./dists/B/snapshots/now"
-v2*=Created directory "./dists/B/snapshots/now/dog"
-v2*=Created directory "./dists/B/snapshots/now/dog/binary-abacus"
-v6*= exporting 'B|dog|abacus'...
-v6*=  creating './dists/B/snapshots/now/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/B/snapshots/now/dog/source"
-v6*= exporting 'B|dog|source'...
-v6*=  creating './dists/B/snapshots/now/dog/source/Sources' (gzipped)
-v2*=Created directory "./dists/B/snapshots/now/cat"
-v2*=Created directory "./dists/B/snapshots/now/cat/binary-abacus"
-v6*= exporting 'B|cat|abacus'...
-v6*=  creating './dists/B/snapshots/now/cat/binary-abacus/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/B/snapshots/now/cat/source"
-v6*= exporting 'B|cat|source'...
-v6*=  creating './dists/B/snapshots/now/cat/source/Sources' (gzipped)
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check

testrun - -b . dumpreferences 3<<EOF
stdout
*=B|dog|abacus pool/dog/f/foo/foo_0_abacus.deb
*=s=B=now pool/dog/f/foo/foo_0_abacus.deb
*=B|dog|source pool/dog/f/foo/foo_1.dsc
*=s=B=now pool/dog/f/foo/foo_1.dsc
*=B|dog|source pool/dog/f/foo/foo_1.tar.gz
*=s=B=now pool/dog/f/foo/foo_1.tar.gz
EOF

testrun - -b . gensnapshot A now 3<<EOF
stdout
-v2*=Created directory "./dists/A/snapshots"
-v2*=Created directory "./dists/A/snapshots/now"
-v2*=Created directory "./dists/A/snapshots/now/dog"
-v2*=Created directory "./dists/A/snapshots/now/dog/binary-abacus"
-v6*= exporting 'A|dog|abacus'...
-v6*=  creating './dists/A/snapshots/now/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/A/snapshots/now/dog/binary-calculator"
-v6*= exporting 'A|dog|calculator'...
-v6*=  creating './dists/A/snapshots/now/dog/binary-calculator/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/A/snapshots/now/cat"
-v2*=Created directory "./dists/A/snapshots/now/cat/binary-abacus"
-v6*= exporting 'A|cat|abacus'...
-v6*=  creating './dists/A/snapshots/now/cat/binary-abacus/Packages' (uncompressed,gzipped)
-v2*=Created directory "./dists/A/snapshots/now/cat/binary-calculator"
-v6*= exporting 'A|cat|calculator'...
-v6*=  creating './dists/A/snapshots/now/cat/binary-calculator/Packages' (uncompressed,gzipped)
EOF
REPREPRO_OUT_DIR=. "$SRCDIR"/docs/outstore.py --check

testout "" -b . dumpreferences
grep '^.|' results | sed -e 's/|[^ ]* / contains /' | sort | uniq > references.normal
grep '^s=' results | sed -e 's/^s=\(.\)=[^ ]* /\1 contains /' | sort > references.snapshot
dodiff -u references.normal references.snapshot
rm references.normal references.snapshot
# Remove contents from original, to make them more look alike:
for n in dists/B/Release dists/B/snapshots/now/Release dists/A/Release dists/A/snapshots/now/Release ; do
	ed -s $n <<EOF
g/^Date: /s/ .*/ unified/
g,^Suite: ./snapshots/now$,d
w
q
EOF
done
mkdir tmp
mv dists/B/Contents-abacus.gz tmp/
mv dists/B/dog/Contents-abacus.gz tmp/dog
mv dists/B/cat/Contents-abacus.gz tmp/cat
mv dists/B/snapshots/now dists/B.snapshot
mv dists/A/snapshots/now dists/A.snapshot
printf 'g/Contents-/d\nw\nq\n' | ed -s dists/B/Release
rmdir dists/B/snapshots
rmdir dists/A/snapshots
dodiff -r -u dists/B.snapshot dists/B
dodiff -r -u dists/A.snapshot dists/A
mkdir dists/B/snapshots
mkdir dists/A/snapshots
mv dists/B.snapshot dists/B/snapshots/now
mv dists/A.snapshot dists/A/snapshots/now
mv tmp/dog dists/B/dog/Contents-abacus.gz
mv tmp/cat dists/B/cat/Contents-abacus.gz
mv tmp/Contents-abacus.gz dists/B/

testrun empty -b . dumpunreferenced

testrun - -b . restore B before foo 3<<EOF
stderr
*=Could not find './dists/B/snapshots/before/dog/binary-abacus/Packages' nor './dists/B/snapshots/before/dog/binary-abacus/Packages.gz',
*=ignoring that part of the snapshot.
*=Could not find './dists/B/snapshots/before/dog/source/Sources' nor './dists/B/snapshots/before/dog/source/Sources.gz',
*=Could not find './dists/B/snapshots/before/cat/binary-abacus/Packages' nor './dists/B/snapshots/before/cat/binary-abacus/Packages.gz',
*=Could not find './dists/B/snapshots/before/cat/source/Sources' nor './dists/B/snapshots/before/cat/source/Sources.gz',
stdout
EOF

testrun - -b . dumpreferences 3<<EOF
stdout
*=B|dog|abacus pool/dog/f/foo/foo_0_abacus.deb
*=s=B=now pool/dog/f/foo/foo_0_abacus.deb
*=B|dog|source pool/dog/f/foo/foo_1.dsc
*=s=B=now pool/dog/f/foo/foo_1.dsc
*=B|dog|source pool/dog/f/foo/foo_1.tar.gz
*=s=B=now pool/dog/f/foo/foo_1.tar.gz
EOF

testrun - -b . restore B now foo 3<<EOF
stderr
*=Strange control data for 'foo': no Description at all
*=Warning: replacing 'foo' version '0' with equal version '0' in 'B|dog|abacus'!
*=Warning: replacing 'foo' version '1' with equal version '1' in 'B|dog|source'!
stdout
-v1*=Adding 'foo' '0' to 'B|dog|abacus'.
$(opu 'foo' x x 'B' 'dog' 'abacus' 'deb')
-v1*=Adding 'foo' '1' to 'B|dog|source'.
$(opu 'foo' x x 'B' 'dog' 'source' 'dsc')
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*=  replacing './dists/B/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v6*= looking for changes in 'B|dog|source'...
-v6*=  replacing './dists/B/dog/source/Sources' (gzipped)
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
-v1*= generating dog/Contents-abacus...
EOF

testrun empty -b . dumpunreferenced
testrun - -b . dumpreferences 3<<EOF
stdout
*=B|dog|abacus pool/dog/f/foo/foo_0_abacus.deb
*=s=B=now pool/dog/f/foo/foo_0_abacus.deb
*=B|dog|source pool/dog/f/foo/foo_1.dsc
*=s=B=now pool/dog/f/foo/foo_1.dsc
*=B|dog|source pool/dog/f/foo/foo_1.tar.gz
*=s=B=now pool/dog/f/foo/foo_1.tar.gz
EOF

testrun - -b . restoresrc B now foo 0 1 3<<EOF
stderr
*=Strange control data for 'foo': no Description at all
*=Warning: replacing 'foo' version '0' with equal version '0' in 'B|dog|abacus'!
*=Warning: replacing 'foo' version '1' with equal version '1' in 'B|dog|source'!
stdout
-v1*=Adding 'foo' '0' to 'B|dog|abacus'.
$(opu 'foo' x x 'B' 'dog' 'abacus' 'deb')
-v1*=Adding 'foo' '1' to 'B|dog|source'.
$(opu 'foo' x x 'B' 'dog' 'source' 'dsc')
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*=  replacing './dists/B/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v6*= looking for changes in 'B|dog|source'...
-v6*=  replacing './dists/B/dog/source/Sources' (gzipped)
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
-v1*= generating dog/Contents-abacus...
EOF

testrun - -b . restoresrc B now foo 0 3<<EOF
stderr
*=Strange control data for 'foo': no Description at all
*=Warning: replacing 'foo' version '0' with equal version '0' in 'B|dog|abacus'!
stdout
-v1*=Adding 'foo' '0' to 'B|dog|abacus'.
$(opu 'foo' x x 'B' 'dog' 'abacus' 'deb')
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*=  replacing './dists/B/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v6*= looking for changes in 'B|dog|source'...
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
-v1*= generating dog/Contents-abacus...
EOF

testrun - -b . restoresrc B now foo 1 3<<EOF
stderr
*=Warning: replacing 'foo' version '1' with equal version '1' in 'B|dog|source'!
stdout
-v1*=Adding 'foo' '1' to 'B|dog|source'.
$(opu 'foo' x x 'B' 'dog' 'source' 'dsc')
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*= looking for changes in 'B|dog|source'...
-v6*=  replacing './dists/B/dog/source/Sources' (gzipped)
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
EOF
testrun - -b . restorefilter B now 'Directory' 3<<EOF
stderr
*=Warning: replacing 'foo' version '1' with equal version '1' in 'B|dog|source'!
stdout
-v1*=Adding 'foo' '1' to 'B|dog|source'.
$(opu 'foo' x x 'B' 'dog' 'source' 'dsc')
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*= looking for changes in 'B|dog|source'...
-v6*=  replacing './dists/B/dog/source/Sources' (gzipped)
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
EOF

testrun - -b . remove B bar foo 3<<EOF
stderr
-v0*=Not removed as not found: bar
stdout
$(opd 'foo' unset B dog abacus deb)
$(opd 'foo' unset B dog source dsc)
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*=  replacing './dists/B/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v6*= looking for changes in 'B|dog|source'...
-v6*=  replacing './dists/B/dog/source/Sources' (gzipped)
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
-v1*= generating dog/Contents-abacus...
EOF

testrun - -b . dumpreferences 3<<EOF
stdout
*=s=B=now pool/dog/f/foo/foo_0_abacus.deb
*=s=B=now pool/dog/f/foo/foo_1.dsc
*=s=B=now pool/dog/f/foo/foo_1.tar.gz
EOF

testrun empty -b . dumpunreferenced

dodo test -f pool/dog/f/foo/foo_1.dsc

testrun - -b . restore B now bar foo 3<<EOF
stderr
*=Strange control data for 'foo': no Description at all
stdout
-v1*=Adding 'foo' '0' to 'B|dog|abacus'.
$(opa 'foo' x 'B' 'dog' 'abacus' 'deb')
-v1*=Adding 'foo' '1' to 'B|dog|source'.
$(opa 'foo' x 'B' 'dog' 'source' 'dsc')
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*=  replacing './dists/B/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v6*= looking for changes in 'B|dog|source'...
-v6*=  replacing './dists/B/dog/source/Sources' (gzipped)
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
-v1*= generating dog/Contents-abacus...
EOF

testrun empty -b . unreferencesnapshot B now

testrun empty -b . dumpunreferenced

testrun - -b . remove B bar foo 3<<EOF
stderr
-v0*=Not removed as not found: bar
stdout
$(opd 'foo' unset B dog abacus deb)
$(opd 'foo' unset B dog source dsc)
-v0*=Exporting indices...
-v6*= looking for changes in 'B|dog|abacus'...
-v6*=  replacing './dists/B/dog/binary-abacus/Packages' (uncompressed,gzipped)
-v6*= looking for changes in 'B|dog|source'...
-v6*=  replacing './dists/B/dog/source/Sources' (gzipped)
-v6*= looking for changes in 'B|cat|abacus'...
-v6*= looking for changes in 'B|cat|source'...
-v1*= generating dog/Contents-abacus...
-v0*=Deleting files no longer referenced...
$(ofd 'pool/dog/f/foo/foo_0_abacus.deb')
$(ofd 'pool/dog/f/foo/foo_1.dsc')
$(ofd 'pool/dog/f/foo/foo_1.tar.gz')
-v2*=removed now empty directory ./pool/dog/f/foo
-v2*=removed now empty directory ./pool/dog/f
-v2*=removed now empty directory ./pool/dog
-v2*=removed now empty directory ./pool
EOF

testrun empty -b . dumpunreferenced
testrun empty -b . dumpreferences

rm -r conf db dists importindex logs tmp db.out*
testsuccess