diff options
author | Jaroslav Lichtblau | 2014-11-30 12:08:52 +0100 |
---|---|---|
committer | Jaroslav Lichtblau | 2014-11-30 12:08:52 +0100 |
commit | 53d86b71be0ffbdec279715854005e37ac009e37 (patch) | |
tree | f524578a8c156b3cddc72c9cb54b87c20f3e2a24 /link-backup.patch | |
parent | 47b47d47bb5f7555b796a9ab4feb6924a7a9d946 (diff) | |
download | aur-link-backup.tar.gz |
link-backup-0.8-6
Diffstat (limited to 'link-backup.patch')
-rw-r--r-- | link-backup.patch | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/link-backup.patch b/link-backup.patch new file mode 100644 index 000000000000..2ee38818f5bb --- /dev/null +++ b/link-backup.patch @@ -0,0 +1,182 @@ +--- lb 2014-11-30 11:51:38.517692925 +0100 ++++ lb.py.n 2014-11-30 11:51:08.968511062 +0100 +@@ -0,0 +1,2 @@ ++#!/usr/bin/python ++ +@@ -9 +11 @@ +-Transfer occurs over standard i/o locally or remotely between a client and ++Transfer occurs over standard I/O locally or remotely between a client and +@@ -31,12 +33,15 @@ +- --verify Run rsync with --dry-run to cross-verify +- --numeric-ids Keep uid/gid values instead of mapping; requires root +- --minutes <mins> Only run for <mins> minutes. Incremental backup. +- --showfiles Don't backup, only list relative path files needing +- backup +- --catalogonly Update catalog only +- --filelist <- or file> Specify filelist. Files relative to srcdir. +- --lock Ensure only one backup to a given dest will run at a time +- --verbose Show what is happening +- --ssh-i <file> Select id file to use for authentication (ssh -i) +- --ssh-C Use ssh compression (ssh -C) +- --ssh-p <port> ssh port on remote host (ssh -p) ++ --catalogonly Update catalog only ++ --exclude <file> Exclude paths matching the regexp rules in file ++ --filelist <- or file> Specify filelist. Files relative to srcdir. ++ --lock Ensure only one backup to a given dest will run at ++ a time ++ --minutes <mins> Only run for <mins> minutes. Incremental backup ++ --numeric-ids Keep uid/gid values instead of mapping; ++ requires root ++ --showfiles Don't backup, only list relative path files needing ++ backup ++ --ssh-C Use ssh compression (ssh -C) ++ --ssh-i <file> Select id file to use for authentication (ssh -i) ++ --ssh-p <port> ssh port on remote host (ssh -p) ++ --verbose Show what is happening ++ --verify Run rsync with --dry-run to cross-verify +@@ -72 +77 @@ +-python lb.py pictures pictures-backup ++lb pictures pictures-backup +@@ -78 +83 @@ +-python lb.py pictures me@fluffy:~/pictures-backup ++lb pictures me@fluffy:~/pictures-backup +@@ -84 +89 @@ +-python lb.py --minutes 240 pictures me@remote:~/pictures-backup ++lb --minutes 240 pictures me@remote:~/pictures-backup +@@ -92,2 +97,2 @@ +-python lb.py --showfiles pictures pictures-backup | \ +-python lb.py --filelist - pictures pictures-backup ++lb --showfiles pictures pictures-backup | \ ++lb --filelist - pictures pictures-backup +@@ -100,2 +105,2 @@ +-python lb.py --showfiles pictures me@remote:~/pictures-backup | \ +-python lb.py --filelist - pictures me@laptop:~/pictures-transfer ++lb --showfiles pictures me@remote:~/pictures-backup | \ ++lb --filelist - pictures me@laptop:~/pictures-transfer +@@ -104 +109 @@ +-python lb.py --catalogonly pictures-transfer me@remote:~/pictures-backup ++lb --catalogonly pictures-transfer me@remote:~/pictures-backup +@@ -107 +112 @@ +-python lb.py pictures me@remote:~/pictures-backup ++lb pictures me@remote:~/pictures-backup +@@ -121 +126 @@ +- ++ +@@ -123,3 +128,3 @@ +- - allow backups to occur while files are changing +- - minor --verify command bug +- - added --verbose logging to tree building ++ - Allow backups to occur while files are changing ++ - Minor --verify command bug ++ - Added --verbose logging to tree building +@@ -162,2 +167,2 @@ +- - added gzip compression of filemap +- - added --numeric-ids ++ - Added gzip compression of filemap ++ - Added --numeric-ids +@@ -166,4 +171,4 @@ +- - filemap format change +- - added --rmempty +- - added --verify to run rsync in verify mode +- - added uid/gid mapping by default unless --numeric-ids is specified ++ - Filemap format change ++ - Added --rmempty ++ - Added --verify to run rsync in verify mode ++ - Added uid/gid mapping by default unless --numeric-ids is specified +@@ -283,0 +289,2 @@ ++ if self.path == os.sep: ++ self.path = "" +@@ -749,0 +757,9 @@ ++ ++def is_excluded(filepath, exclude_rules): ++ exclude_filepath = False ++ if exclude_rules: ++ for rule in exclude_rules: ++ if rule.search(filepath): ++ exclude_filepath = True ++ break ++ return exclude_filepath +@@ -751 +767 @@ +-def build_filelist_from_tree(treepath): ++def build_filelist_from_tree(treepath, exclude_rules): +@@ -754 +770,3 @@ +- self.lenbase = len('%s%s' % (basepath, os.sep)) ++ if basepath == os.sep: ++ basepath = "" ++ self.lenbase = len('%s%s' % (basepath, os.sep)) +@@ -758,13 +776,15 @@ +- # Sometimes a stat may fail, like if there are broken +- # symlinks in the file system +- try: +- # Collect stat values instead of stat objects. It's 6 +- # times smaller (measured) and mutuable +- # (for uid/gid mapping at the dest) +- filepath = join(dirpath, file) +- s = os.stat(filepath) +- if not is_mode_ok(s.st_mode): +- continue +- arg.append((filepath[self.lenbase:], [s.st_mode, s.st_size, s.st_mtime, s.st_uid, s.st_gid])) +- except: +- pass ++ # Sometimes a stat may fail, like if there are broken ++ # symlinks in the file system ++ try: ++ # Collect stat values instead of stat objects. It's 6 ++ # times smaller (measured) and mutuable ++ # (for uid/gid mapping at the dest) ++ filepath = join(dirpath, file) ++ if is_excluded(filepath, exclude_rules): ++ continue ++ s = os.stat(filepath) ++ if not is_mode_ok(s.st_mode): ++ continue ++ arg.append((filepath[self.lenbase:], [s.st_mode, s.st_size, s.st_mtime, s.st_uid, s.st_gid])) ++ except: ++ pass +@@ -777 +797 @@ +-def build_filelist_from_file(treepath, file): ++def build_filelist_from_file(treepath, file, exclude_rules): +@@ -780,0 +801,2 @@ ++ if is_excluded(filepath_rel, exclude_rules): ++ continue +@@ -787 +809 @@ +-def build_filelist(treepath): ++def build_filelist(treepath, exclude_rules): +@@ -792 +814 @@ +- return build_filelist_from_file(treepath, sys.stdin) ++ return build_filelist_from_file(treepath, sys.stdin, exclude_rules) +@@ -795 +817 @@ +- filelist = build_filelist_from_file(treepath, file) ++ filelist = build_filelist_from_file(treepath, file, exclude_rules) +@@ -798 +820 @@ +- return build_filelist_from_tree(treepath) ++ return build_filelist_from_tree(treepath, exclude_rules) +@@ -976 +998 @@ +- filelist_old = build_filelist_from_tree(treepath_last) ++ filelist_old = build_filelist_from_tree(treepath_last, None) +@@ -1009 +1031,21 @@ +- ++ ++ exclude_rules_file_path = None ++ exclude_rules = None ++ for n in xrange(len(sys.argv)): ++ if sys.argv[n] == '--exclude': ++ exclude_rules_file_path = sys.argv[n + 1] ++ break ++ if exclude_rules_file_path: ++ if os.path.isfile(exclude_rules_file_path): ++ exclude_rules_file = open(exclude_rules_file_path, "r") ++ try: ++ exclude_rules = [] ++ for rule in exclude_rules_file: ++ exclude_rules.append(re.compile(rule.strip(), re.UNICODE)) ++ except IOError, e: ++ error('an error occured while reading the excludes file') ++ finally: ++ exclude_rules_file.close() ++ else: ++ error('excludes file "' + exclude_rules_file_path + '" not found') ++ +@@ -1011 +1053 @@ +- filelist = build_filelist(srcpath) ++ filelist = build_filelist(srcpath, exclude_rules) |