summaryrefslogtreecommitdiffstats
path: root/tests/snapshotcopyrestore.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/snapshotcopyrestore.test')
-rw-r--r--tests/snapshotcopyrestore.test597
1 files changed, 597 insertions, 0 deletions
diff --git a/tests/snapshotcopyrestore.test b/tests/snapshotcopyrestore.test
new file mode 100644
index 0000000..fdb4155
--- /dev/null
+++ b/tests/snapshotcopyrestore.test
@@ -0,0 +1,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