Commit eb7449bb authored by Michael Terry's avatar Michael Terry

more bad-volume work; it seems to be correct now

parent 175dfb75
......@@ -853,6 +853,19 @@ public class Duplicity : Object
return rv;
}
// Hacky function to return later parts of a duplicity filename.
// Used to chop off the date bit
string parse_duplicity_file(string file, int skip_bits)
{
int next = 0;
while (skip_bits-- > 0 && next >= 0)
next = file.index_of_char('.', next) + 1;
if (next < 0)
return "";
else
return file.substring(next);
}
protected virtual void process_error(string[] firstline, List<string>? data,
string text_in)
{
......@@ -900,7 +913,8 @@ public class Duplicity : Object
// If it's *still* bad, tell the user, but I'm not sure what they can
// do about it.
if (mode == Operation.Mode.BACKUP) {
var this_volume = firstline[2];
// strip date info from volume (after cleanup below, we'll get new date)
var this_volume = parse_duplicity_file(firstline[2], 2);
if (last_bad_volume != this_volume) {
bad_volume_count = 0;
last_bad_volume = this_volume;
......
......@@ -24,12 +24,12 @@ import base
import os
import tempfile
if not base.dup_meets_version(0, 6, 16):
base.skip()
# Set up our duplicity wrapper to be called by deja-dup
os.environ['PATH'] = os.path.join(scriptdir, 'bad-volume-bin') + ":" + os.environ['PATH']
# TODO: These aren't done yet; ldtp in Ubuntu 11.10 is crazy right now
# I've done manually similar testing though.
def set_skip_volumes(vols):
(fd, name) = tempfile.mkstemp()
f = os.fdopen(fd, 'wb')
......@@ -40,12 +40,14 @@ def set_skip_volumes(vols):
def test():
base.setup()
if not base.dup_meets_version(0, 6, 16): base.skip()
set_skip_volumes([3, 3, 3])
base.backup_simple(backend='file', encrypt=False, includes=['/usr/bin'],
error='lblBlarg')
def test():
base.setup()
if not base.dup_meets_version(0, 6, 16): base.skip()
set_skip_volumes([1, 2, 3, 4])
base.backup_simple(backend='file', encrypt=False, includes=['/usr/bin'])
......
......@@ -28,18 +28,19 @@ import subprocess
# Drop the PATH override that pointed to this script
os.environ['PATH'] = os.environ['PATH'].split(':', 1)[-1]
# Read the skip file to see what we should skip
f = open(os.environ['DEJA_DUP_TEST_SKIP_FILE'])
all_volumes = f.read().split()
f.close()
extra_args = []
if all_volumes:
f = open(os.environ['DEJA_DUP_TEST_SKIP_FILE'], 'wb')
f.write(' '.join(all_volumes[1:]))
if 'DEJA_DUP_TEST_SKIP_FILE' in os.environ and 'full' in sys.argv and '--dry-run' not in sys.argv:
# Read the skip file to see what we should skip
f = open(os.environ['DEJA_DUP_TEST_SKIP_FILE'])
all_volumes = f.read().split()
f.close()
extra_args = ['--skip-volume', all_volumes[0]]
if all_volumes:
f = open(os.environ['DEJA_DUP_TEST_SKIP_FILE'], 'wb')
f.write(' '.join(all_volumes[1:]))
f.close()
extra_args = ['--skip-volume', all_volumes[0]]
subprocess.call(['duplicity'] + sys.argv[1:] + extra_args)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment