From: Tim Riemenschneider Date: Thu, 5 Jun 2014 21:49:14 +0000 (+0200) Subject: Include suggestions of Rob Browning: X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=c1bc62d5b06181ea1fe0b8af789027d9bf248fff;p=packages%2Fb%2Fbup.git Include suggestions of Rob Browning: - don't use set -e in testcase - catch exceptions on read - reword option-help Signed-off-by: Tim Riemenschneider --- diff --git a/cmd/index-cmd.py b/cmd/index-cmd.py index 3309398..2e97315 100755 --- a/cmd/index-cmd.py +++ b/cmd/index-cmd.py @@ -206,7 +206,7 @@ exclude= a path to exclude from the backup (may be repeated) exclude-from= skip --exclude paths in file (may be repeated) exclude-rx= skip paths matching the unanchored regex (may be repeated) exclude-rx-from= skip --exclude-rx patterns in file (may be repeated) -exclude-caches exclude CACHEDIR.TAG-directories +exclude-caches exclude directories containing a CACHEDIR.TAG v,verbose increase log output (can be used more than once) x,xdev,one-file-system don't cross filesystem boundaries """ diff --git a/lib/bup/drecurse.py b/lib/bup/drecurse.py index 4f40415..4f30ce6 100644 --- a/lib/bup/drecurse.py +++ b/lib/bup/drecurse.py @@ -67,8 +67,10 @@ def _recursive_dirlist(prepend, xdev, bup_dir=None, tag_contents = 'Signature: 8a477f597d28d172789f06886806bc55' if os.path.exists(prepend+name+tag_filename): f = open(prepend+name+tag_filename, 'rb') - data = f.read(len(tag_contents)) - f.close() + try: + data = f.read(len(tag_contents)) + finally: + f.close() if data == tag_contents: debug1('Skipping %r: excluding cache dir' % (prepend+name)) continue diff --git a/t/test-index-excludes.sh b/t/test-index-excludes.sh index 86e5bc8..eea0d13 100755 --- a/t/test-index-excludes.sh +++ b/t/test-index-excludes.sh @@ -7,19 +7,18 @@ bup() { "$top/bup" "$@"; } WVSTART "exclude-caches" ( - set -e -o pipefail - D="$(wvmktempdir)" - force-delete $D - mkdir $D + D="$(WVPASS wvmktempdir)" || exit $? + WVPASS force-delete $D + WVPASS mkdir $D export BUP_DIR="$D/.bup" WVPASS bup init - touch $D/a + WVPASS touch $D/a WVPASS bup random 128k >$D/b - mkdir $D/d $D/d/e + WVPASS mkdir $D/d $D/d/e WVPASS bup random 512 >$D/f - echo 'Signature: 8a477f597d28d172789f06886806bc55' > $D/d/CACHEDIR.TAG + WVPASS echo 'Signature: 8a477f597d28d172789f06886806bc55' > $D/d/CACHEDIR.TAG WVPASS bup index -ux --exclude-caches $D - bup save -n exclude $D + WVPASS bup save -n exclude $D WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a b f"