Add patch for --exclude-from, proposed upstream.
This commit is contained in:
parent
5c0e99a37b
commit
f826bf8187
4 changed files with 95 additions and 1 deletions
|
@ -1,4 +1,7 @@
|
|||
$NetBSD: distinfo,v 1.10 2013/11/13 17:38:45 thomasklausner Exp $
|
||||
$NetBSD: distinfo,v 1.11 2013/11/24 02:35:19 thomasklausner Exp $
|
||||
|
||||
SHA1 (patch-Documentation_bup-index.md) = 51146c78a20c47d13d903453609089ceddea815b
|
||||
SHA1 (patch-Makefile) = 65529710daa78f77eea0c814838b837763477c25
|
||||
SHA1 (patch-cmd_index-cmd.py) = 1d873835ab29c0aa79af3caf46a662a770ae40a3
|
||||
SHA1 (patch-config_configure) = 9360a8be2cef559d93f1a5301f1f397f31da7d72
|
||||
SHA1 (patch-lib_bup_helpers.py) = 2f0a9fdfa98be02bfa6d518bed7570759f5ffa7e
|
||||
|
|
27
bup-git/patches/patch-Documentation_bup-index.md
Normal file
27
bup-git/patches/patch-Documentation_bup-index.md
Normal file
|
@ -0,0 +1,27 @@
|
|||
$NetBSD: patch-Documentation_bup-index.md,v 1.1 2013/11/24 02:35:19 thomasklausner Exp $
|
||||
|
||||
Document --exclude-rx-from.
|
||||
|
||||
--- Documentation/bup-index.md.orig 2013-11-15 09:46:48.000000000 +0000
|
||||
+++ Documentation/bup-index.md
|
||||
@@ -10,7 +10,8 @@ bup-index - print and/or update the bup
|
||||
|
||||
bup index \<-p|-m|-s|-u\> [-H] [-l] [-x] [\--fake-valid] [\--no-check-device]
|
||||
[\--fake-invalid] [\--check] [\--clear] [-f *indexfile*] [\--exclude *path*]
|
||||
-[\--exclude-from *filename*] [\--exclude-rx *pattern*] [-v] \<filenames...\>
|
||||
+[\--exclude-from *filename*] [\--exclude-rx *pattern*]
|
||||
+[\--exclude-rx-from *file*] [-v] \<filenames...\>
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
@@ -168,6 +169,10 @@ does, due to the accommodations describe
|
||||
* '/foo/.' - exclude the content of any directory named foo
|
||||
* '^/tmp/.' - exclude root-level /tmp's content, but not /tmp itself
|
||||
|
||||
+\--exclude-rx-from=*filename*
|
||||
+: read --exclude-rx paths from *filename*, one pattern per-line (can
|
||||
+ be used more than once).
|
||||
+
|
||||
\--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,
|
16
bup-git/patches/patch-cmd_index-cmd.py
Normal file
16
bup-git/patches/patch-cmd_index-cmd.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
$NetBSD: patch-cmd_index-cmd.py,v 1.1 2013/11/24 02:35:19 thomasklausner Exp $
|
||||
|
||||
Document --exclude-rx-from.
|
||||
|
||||
--- cmd/index-cmd.py.orig 2013-11-15 09:46:48.000000000 +0000
|
||||
+++ cmd/index-cmd.py
|
||||
@@ -196,7 +196,8 @@ fake-invalid mark all index entries as i
|
||||
f,indexfile= the name of the index file (normally BUP_DIR/bupindex)
|
||||
exclude= a path to exclude from the backup (can be used more than once)
|
||||
exclude-from= a file that contains exclude paths (can be used more than once)
|
||||
-exclude-rx= skip paths that match the unanchored regular expression
|
||||
+exclude-rx= skip paths that match the unanchored regular expression (can be used more than once)
|
||||
+exclude-rx-from= a file that contains exclude patterns (can be used more than once)
|
||||
v,verbose increase log output (can be used more than once)
|
||||
x,xdev,one-file-system don't cross filesystem boundaries
|
||||
"""
|
48
bup-git/patches/patch-lib_bup_helpers.py
Normal file
48
bup-git/patches/patch-lib_bup_helpers.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
$NetBSD: patch-lib_bup_helpers.py,v 1.1 2013/11/24 02:35:19 thomasklausner Exp $
|
||||
|
||||
Add --exclude-rx-from and fix a bug in --exclude-rx error handling.
|
||||
|
||||
--- lib/bup/helpers.py.orig 2013-11-15 09:46:48.000000000 +0000
|
||||
+++ lib/bup/helpers.py
|
||||
@@ -735,19 +735,34 @@ def parse_excludes(options, fatal):
|
||||
raise fatal("couldn't read %s" % parameter)
|
||||
for exclude_path in f.readlines():
|
||||
excluded_paths.append(realpath(exclude_path.strip()))
|
||||
+ f.close()
|
||||
return excluded_paths
|
||||
|
||||
|
||||
def parse_rx_excludes(options, fatal):
|
||||
"""Traverse the options and extract all rx excludes, or call
|
||||
Option.fatal()."""
|
||||
- rxs = [v for f, v in options if f == '--exclude-rx']
|
||||
- for i in range(len(rxs)):
|
||||
- try:
|
||||
- rxs[i] = re.compile(rxs[i])
|
||||
- except re.error, ex:
|
||||
- o.fatal('invalid --exclude-rx pattern (%s):' % (ex, rxs[i]))
|
||||
- return rxs
|
||||
+ excluded_patterns = []
|
||||
+
|
||||
+ for flag in options:
|
||||
+ (option, parameter) = flag
|
||||
+ if option == '--exclude-rx':
|
||||
+ try:
|
||||
+ excluded_patterns.append(re.compile(parameter))
|
||||
+ except re.error, ex:
|
||||
+ fatal('invalid --exclude-rx pattern (%s): %s' % (parameter, ex))
|
||||
+ elif option == '--exclude-rx-from':
|
||||
+ try:
|
||||
+ f = open(realpath(parameter))
|
||||
+ except IOError, e:
|
||||
+ raise fatal("couldn't read %s" % parameter)
|
||||
+ for pattern in f.readlines():
|
||||
+ try:
|
||||
+ excluded_patterns.append(re.compile(pattern.rstrip('\n')))
|
||||
+ except re.error, ex:
|
||||
+ fatal('invalid --exclude-rx pattern (%s): %s' % (pattern.rstrip('\n'), ex))
|
||||
+ f.close()
|
||||
+ return excluded_patterns
|
||||
|
||||
|
||||
def should_rx_exclude_path(path, exclude_rxs):
|
Loading…
Reference in a new issue