Skip to content

Commit

Permalink
fix: update rdiff-backup to 1.3.3 and matching patches from Debian
Browse files Browse the repository at this point in the history
  • Loading branch information
fastcat committed Mar 16, 2020
1 parent 06d3020 commit 478fb85
Show file tree
Hide file tree
Showing 10 changed files with 773 additions and 9 deletions.
7 changes: 4 additions & 3 deletions cross/rdiff-backup/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
PKG_NAME = rdiff-backup
PKG_VERS = 1.2.8
PKG_VERS = 1.3.3
PKG_EXT = tar.gz
# TODO: this pattern will change with future builds
PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT)
PKG_DIST_SITE = http://download.savannah.gnu.org/releases/rdiff-backup/
PKG_DIST_SITE = http://download.savannah.nongnu.org/releases/rdiff-backup
PKG_DIR = $(PKG_NAME)-$(PKG_VERS)

DEPENDS = cross/librsync
DEPENDS = cross/librsync cross/attr cross/acl

HOMEPAGE = http://www.nongnu.org/rdiff-backup/
COMMENT = A remote incremental backup of all your files
Expand Down
6 changes: 3 additions & 3 deletions cross/rdiff-backup/digests
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
rdiff-backup-1.2.8.tar.gz SHA1 14ffe4f5b46a8a96ded536c1d03ae5e85faae318
rdiff-backup-1.2.8.tar.gz SHA256 0d91a85b40949116fa8aaf15da165c34a2d15449b3cbe01c8026391310ac95db
rdiff-backup-1.2.8.tar.gz MD5 1a94dc537fcf74d6a3a80bd27808e77b
rdiff-backup-1.3.3.tar.gz SHA256 ee030ce638df0eb1047cf72578e0de15d9a3ee9ab24da2dc0023e2978be30c06
rdiff-backup-1.3.3.tar.gz SHA1 b36c9b5c06941a86210242f8213f60153a1eba28
rdiff-backup-1.3.3.tar.gz MD5 e3ec506c01e12b693adb79751daa7c63
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Description: 01_fix_restricted_test-server_option.diff
# Author: Carl Chenet <[email protected]>

diff -urNad rdiff_backup/Main.py rdiff-backup-1.2.8/rdiff_backup/Main.py
--- rdiff_backup/Main.py 2009-03-16 15:36:21.000000000 +0100
+++ rdiff_backup/Main.py 2010-02-20 11:26:27.000000000 +0100
@@ -288,7 +288,7 @@
elif action == "remove-older-than": RemoveOlderThan(rps[0])
elif action == "restore": Restore(*rps)
elif action == "restore-as-of": Restore(rps[0], rps[1], 1)
- elif action == "test-server": SetConnections.TestConnections()
+ elif action == "test-server": SetConnections.TestConnections(rps)
elif action == "verify": Verify(rps[0])
else: raise AssertionError("Unknown action " + action)

diff -urNad rdiff_backup/SetConnections.py rdiff-backup-1.2.8/rdiff_backup/SetConnections.py
--- rdiff_backup/SetConnections.py 2009-03-16 15:36:21.000000000 +0100
+++ rdiff_backup/SetConnections.py 2010-02-20 11:29:43.000000000 +0100
@@ -241,20 +241,25 @@
Globals.backup_reader = Globals.isbackup_reader = \
Globals.backup_writer = Globals.isbackup_writer = None

-def TestConnections():
+def TestConnections(rpaths):
"""Test connections, printing results"""
if len(Globals.connections) == 1: print "No remote connections specified"
else:
- for i in range(1, len(Globals.connections)): test_connection(i)
+ assert len(Globals.connections) == len(rpaths) + 1
+ for i in range(1, len(Globals.connections)):
+ test_connection(i, rpaths[i-1])

-def test_connection(conn_number):
+def test_connection(conn_number, rp):
"""Test connection. conn_number 0 is the local connection"""
print "Testing server started by: ", __conn_remote_cmds[conn_number]
conn = Globals.connections[conn_number]
try:
assert conn.Globals.get('current_time') is None
- assert type(conn.os.listdir('.')) is list
version = conn.Globals.get('version')
+ try:
+ assert type(conn.os.getuid()) is int
+ except AttributeError: # Windows doesn't support os.getuid()
+ assert type(conn.os.listdir(rp.path)) is list
except:
sys.stderr.write("Server tests failed\n")
raise
25 changes: 25 additions & 0 deletions cross/rdiff-backup/patches/02_python_2.6_deprecationwarning.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Description: 02_python_2.6_deprecationwarning.diff
# Author: by <[email protected]> converted to Quilt by Carl Chenet <[email protected]>
# from the nmu suggestion by Carlos Alberto Lopez Perez <[email protected]>
# patch adapted from the one at https://savannah.nongnu.org/bugs/?26064
# This fix the following warning: "DeprecationWarning: os.popen2 is
# deprecated. Use the subprocess module."
# Also, the *nix version of rdiff-backup requires shell=True instead of
# shell=False in the subprocess.Popen call

diff -urNad rdiff_backup/SetConnections.py rdiff-backup-1.2.8/rdiff_backup/SetConnections.py
--- rdiff_backup/SetConnections.py 2009-03-16 15:36:21.000000000 +0100
+++ rdiff_backup/SetConnections.py 2009-10-03 19:27:54.935647306 +0200
@@ -135,10 +135,10 @@
if not remote_cmd: return Globals.local_connection

Log("Executing " + remote_cmd, 4)
- if os.name == "nt":
+ if map(int, sys.version.split()[0].split('.')[:2]) >= [2, 6]:
import subprocess
try:
- process = subprocess.Popen(remote_cmd, shell=False, bufsize=0,
+ process = subprocess.Popen(remote_cmd, shell=True, bufsize=0,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
(stdin, stdout) = (process.stdin, process.stdout)
96 changes: 96 additions & 0 deletions cross/rdiff-backup/patches/03_fix_hardlinks.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Description: fix_hardlinks.diff
# Author: by <[email protected]> converted to Quilt format by Carl Chenet <[email protected]>
# from the nmu suggestion by Carlos Alberto Lopez Perez <[email protected]>
# Apply hard-links bug fix patch
# https://savannah.nongnu.org/bugs/index.php?26848

diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' rdiff_backup/Hardlink.py rdiff-backup-1.2.8/rdiff_backup/Hardlink.py
--- rdiff_backup/Hardlink.py 2009-03-16 14:36:21.000000000 +0000
+++ rdiff_backup/Hardlink.py 2012-01-03 11:44:21.708987145 +0000
@@ -95,7 +95,13 @@
src_rorp.getnumlinks() == dest_rorp.getnumlinks() == 1):
return 1 # Hard links don't apply

- if src_rorp.getnumlinks() < dest_rorp.getnumlinks(): return 0
+ """The sha1 of linked files is only stored in the metadata of the first
+ linked file on the dest side. If the first linked file on the src side is
+ deleted, then the sha1 will also be deleted on the dest side, so we test for this
+ & report not equal so that another sha1 will be stored with the next linked
+ file on the dest side"""
+ if (not islinked(src_rorp) and not dest_rorp.has_sha1()): return 0
+ if src_rorp.getnumlinks() != dest_rorp.getnumlinks(): return 0
src_key = get_inode_key(src_rorp)
index, remaining, dest_key, digest = _inode_index[src_key]
if dest_key == "NA":
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' rdiff_backup/compare.py rdiff-backup-1.2.8/rdiff_backup/compare.py
--- rdiff_backup/compare.py 2009-03-16 14:36:21.000000000 +0000
+++ rdiff_backup/compare.py 2012-01-03 11:43:33.792989189 +0000
@@ -25,7 +25,7 @@
"""

from __future__ import generators
-import Globals, restore, rorpiter, log, backup, static, rpath, hash, robust
+import Globals, restore, rorpiter, log, backup, static, rpath, hash, robust, Hardlink

def Compare(src_rp, mirror_rp, inc_rp, compare_time):
"""Compares metadata in src_rp dir with metadata in mirror_rp at time"""
@@ -80,14 +80,15 @@
bad_files = 0
for repo_rorp in repo_iter:
if not repo_rorp.isreg(): continue
- if not repo_rorp.has_sha1():
+ verify_sha1 = get_hash(repo_rorp)
+ if not verify_sha1:
log.Log("Warning: Cannot find SHA1 digest for file %s,\n"
"perhaps because this feature was added in v1.1.1"
% (repo_rorp.get_indexpath(),), 2)
continue
fp = RepoSide.rf_cache.get_fp(base_index + repo_rorp.index, repo_rorp)
computed_hash = hash.compute_sha1_fp(fp)
- if computed_hash == repo_rorp.get_sha1():
+ if computed_hash == verify_sha1:
log.Log("Verified SHA1 digest of " + repo_rorp.get_indexpath(), 5)
else:
bad_files += 1
@@ -95,11 +96,24 @@
"doesn't match recorded digest of\n %s\n"
"Your backup repository may be corrupted!" %
(repo_rorp.get_indexpath(), computed_hash,
- repo_rorp.get_sha1()), 2)
+ verify_sha1), 2)
RepoSide.close_rf_cache()
if not bad_files: log.Log("Every file verified successfully.", 3)
return bad_files

+def get_hash (repo_rorp):
+ """ Try to get a sha1 digest from the repository. If hardlinks
+ are saved in the metadata, get the sha1 from the first hardlink """
+ Hardlink.add_rorp(repo_rorp)
+ if Hardlink.islinked(repo_rorp):
+ verify_sha1 = Hardlink.get_sha1(repo_rorp)
+ elif repo_rorp.has_sha1():
+ verify_sha1 = repo_rorp.get_sha1()
+ else:
+ verify_sha1 = None
+ Hardlink.del_rorp(repo_rorp)
+ return verify_sha1
+
def print_reports(report_iter):
"""Given an iter of CompareReport objects, print them to screen"""
assert not Globals.server
@@ -199,12 +213,13 @@
"""Like above, but also compare sha1 sums of any regular files"""
def hashes_changed(src_rp, mir_rorp):
"""Return 0 if their data hashes same, 1 otherwise"""
- if not mir_rorp.has_sha1():
+ verify_sha1 = get_hash(mir_rorp)
+ if not verify_sha1:
log.Log("Warning: Metadata file has no digest for %s, "
"unable to compare." % (mir_rorp.get_indexpath(),), 2)
return 0
elif (src_rp.getsize() == mir_rorp.getsize() and
- hash.compute_sha1(src_rp) == mir_rorp.get_sha1()):
+ hash.compute_sha1(src_rp) == verify_sha1):
return 0
return 1

Loading

0 comments on commit 478fb85

Please sign in to comment.