[\--no-check-device] [\--fake-invalid] [-f *indexfile*] [\--exclude *path*]
[\--exclude-from *filename*] [\--exclude-rx *pattern*]
[\--exclude-rx-from *filename*] [\--exclude-if-present *filename*]
-[-v] \<filenames...\>
+[\--exclude-caches] [-v] \<filenames...\>
# DESCRIPTION
So you can "touch .do-not-backup-me" to exclude a directory
from backup.
+\--exclude-caches
+: exclude all directories that contain a file CACHEDIR.TAG, whose
+ content begins with "Signature: 8a477f597d28d172789f06886806bc55".
+ For more information on cachedir-tagging, see
+ http://www.brynosaurus.com/cachedir/
+
\--no-check-device
: don't mark a an entry invalid if the device number (stat(2)
st_dev) changes. This can be useful when indexing remote,
bup_dir=bup_dir,
excluded_paths=excluded_paths,
exclude_rxs=exclude_rxs,
- exclude_if_present=opt['exclude-if-present']):
+ exclude_if_present=opt['exclude-if-present'],
+ exclude_caches=opt.exclude_caches):
if opt.verbose>=2 or (opt.verbose==1 and stat.S_ISDIR(pst.st_mode)):
sys.stdout.write('%s\n' % path)
sys.stdout.flush()
exclude-rx= skip paths matching the unanchored regex (may be repeated)
exclude-rx-from= skip --exclude-rx patterns in file (may be repeated)
exclude-if-present= exclude directory if the given file is present
+exclude-caches exclude CACHEDIR.TAG-directories
v,verbose increase log output (can be used more than once)
x,xdev,one-file-system don't cross filesystem boundaries
"""
def _recursive_dirlist(prepend, xdev, bup_dir=None,
excluded_paths=None,
exclude_rxs=None,
- exclude_if_present=None):
+ exclude_if_present=None,
+ exclude_caches=None):
for (name,pst) in _dirlist():
path = prepend + name
if excluded_paths:
if exclude_if_present != None and os.path.exists(prepend+name+exclude_if_present):
debug1('Skipping %r: exclude-file present.\n' % (prepend+name))
continue
+ if exclude_caches:
+ tag_filename = 'CACHEDIR.TAG'
+ 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()
+ if data == tag_contents:
+ debug1('Skipping %r: excluding cache dir' % (prepend+name))
+ continue
if bup_dir != None:
if os.path.normpath(path) == bup_dir:
debug1('Skipping BUP_DIR.\n')
bup_dir=bup_dir,
excluded_paths=excluded_paths,
exclude_rxs=exclude_rxs,
- exclude_if_present=exclude_if_present):
+ exclude_if_present=exclude_if_present,
+ exclude_caches=exclude_caches):
yield i
os.chdir('..')
yield (path, pst)
def recursive_dirlist(paths, xdev, bup_dir=None, excluded_paths=None,
exclude_rxs=None,
- exclude_if_present=None):
+ exclude_if_present=None,
+ exclude_caches=None):
startdir = OsFile('.')
try:
assert(type(paths) != type(''))
bup_dir=bup_dir,
excluded_paths=excluded_paths,
exclude_rxs=exclude_rxs,
- exclude_if_present=exclude_if_present):
+ exclude_if_present=exclude_if_present,
+ exclude_caches=exclude_caches):
yield i
startdir.fchdir()
else:
f"
rm -rf "$D"
) || WVFAIL
+
+WVSTART "exclude-caches"
+(
+ set -e -o pipefail
+ D="$(wvmktempdir)"
+ force-delete $D
+ mkdir $D
+ export BUP_DIR="$D/.bup"
+ WVPASS bup init
+ touch $D/a
+ WVPASS bup random 128k >$D/b
+ mkdir $D/d $D/d/e
+ WVPASS bup random 512 >$D/f
+ echo 'Signature: 8a477f597d28d172789f06886806bc55' > $D/d/CACHEDIR.TAG
+ WVPASS bup index -ux --exclude-caches $D
+ bup save -n exclude $D
+ WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
+b
+f"
+) || WVFAIL