Skip to content

Commit

Permalink
Merge branch 'patrik-rdiff-backup-beta' into 'master'
Browse files Browse the repository at this point in the history
Test with beta version of rdiff-backup

See merge request ikus-soft/rdiffweb!241
  • Loading branch information
ikus060 committed Sep 29, 2022
2 parents 34f7007 + 1269126 commit fc5bfa3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
8 changes: 5 additions & 3 deletions .gitlab-ci.yml
Expand Up @@ -51,15 +51,17 @@ py3:
- TOXENV: py3
IMAGE: [python:3.6, python:3.7, python:3.8, python:3.9, python:3.10]

buster-rdiff-backup2:
rdiff-backup-beta:
<<: *tox
image: python:3.7-buster
image: python:3.9-bullseye
variables:
TOXENV: buster
allow_failure: true
before_script:
- apt-get update
- apt -y install librsync-dev
- pip install "rdiff-backup<3,>=2" tox
- pip install tox
- pip install -U --pre rdiff-backup

debian:
<<: *tox
Expand Down
10 changes: 6 additions & 4 deletions rdiffweb/core/librdiff.py
Expand Up @@ -1157,14 +1157,16 @@ def restore(self, path, restore_as_of, kind=None):
stderr=subprocess.PIPE,
env=None,
)
# Check if the processing is properly started
# Read stderr output until "Starting restore of"
# Check if the restore process is properly starting
# Read the first 100 line until "Processing changed file"
max_line = 100
output = b''
success = False
line = proc.stderr.readline()
while line:
while max_line > 0 and line:
max_line -= 1
output += line
if b'Starting restore of' in line:
if b'Processing changed file' in line:
success = True
break
line = proc.stderr.readline()
Expand Down
3 changes: 3 additions & 0 deletions rdiffweb/core/restore.py
Expand Up @@ -235,6 +235,9 @@ def restore(restore, restore_as_of, kind, encoding, dest, log=logger.debug):
# Read the output of rdiff-backup
with popen(cmd, env=env) as output:
for line in output:
# Since rdiff-backup 2.1.2b1 the line start with b'* '
if line.startswith(b'* '):
line = line[2:]
line = line.rstrip(b'\n')
log('rdiff-backup: %r' % line)
if not line.startswith(TOKEN):
Expand Down
6 changes: 3 additions & 3 deletions rdiffweb/core/tests/test_restore.py
Expand Up @@ -30,9 +30,9 @@
import unittest
from zipfile import ZipFile

import rdiffweb.test
from rdiffweb.core.librdiff import popen
from rdiffweb.core.restore import restore
from rdiffweb.test import AppTestCase

EXPECTED = {}
EXPECTED["이루마 YIRUMA - River Flows in You.mp3"] = 3636731
Expand Down Expand Up @@ -76,12 +76,12 @@ def restore_async(*args, **kwargs):
thread.start()


class RestoreTest(AppTestCase):
class RestoreTest(rdiffweb.test.WebCase):

maxDiff = None

def setUp(self):
AppTestCase.setUp(self)
super().setUp()

# Define path to be archived
self.path = os.path.join(self.testcases.encode('ascii'), b'testcases')
Expand Down

0 comments on commit fc5bfa3

Please sign in to comment.