2 . ./wvtest-bup.sh || exit $?
6 if ! [ "$(type -p duplicity)" != "" ]; then
7 WVSKIP 'Cannot find duplicity; skipping test)'
11 top="$(WVPASS pwd)" || exit $?
12 tmpdir="$(WVPASS wvmktempdir)" || exit $?
14 bup() { "$top/bup" "$@"; }
15 dup() { duplicity --archive-dir "$tmpdir/dup-cache" "$@"; }
17 WVSTART "import-duplicity"
18 WVPASS "$top/dev/sync-tree" "$top/test/sampledata/" "$tmpdir/src/"
20 export BUP_DIR="$tmpdir/bup"
21 export GIT_DIR="$tmpdir/bup"
22 export PASSPHRASE=bup_duplicity_passphrase
26 WVPASS mkdir duplicity
27 WVPASS dup src file://duplicity
29 WVPASS touch src/new-file
30 WVPASS dup src file://duplicity
31 WVPASS bup import-duplicity "file://duplicity" import-duplicity
32 WVPASSEQ $(bup ls import-duplicity/ | wc -l) 3
33 WVPASSEQ "$(bup ls import-duplicity/latest/ | sort)" "$(ls src | sort)"
34 WVPASS bup restore -C restore/ import-duplicity/latest/
35 WVFAIL "$top/dev/compare-trees" src/ restore/ > tmp-compare-trees
36 WVPASSEQ $(cat tmp-compare-trees | wc -l) 4
37 # Note: OS X rsync itemize output is currently only 9 chars, not 11.
38 # FreeBSD may output 12 chars instead - accept 9-12
39 # Expect something like this (without the leading spaces):
41 # .L..t...... abs-symlink -> /home/foo/bup/test/sampledata/var/abs-symlink-target
44 expected_diff_rx='^\.d\.\.t\.{4,7} \./$|^\.L\.\.t\.{4,7} '
45 if ! grep -qE "$expected_diff_rx" tmp-compare-trees; then
46 echo -n 'tmp-compare-trees: ' 1>&2
47 cat tmp-compare-trees 1>&2
49 WVPASS grep -qE "$expected_diff_rx" tmp-compare-trees
51 WVPASS rm -rf "$tmpdir"