Sync the tmp patch with Fedora.

This commit is contained in:
ajacoutot 2013-03-19 09:21:22 +00:00
parent b9e429218c
commit f3a6a4cf45
10 changed files with 261 additions and 29 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.16 2013/03/11 11:41:29 espie Exp $
# $OpenBSD: Makefile,v 1.17 2013/03/19 09:21:22 ajacoutot Exp $
SHARED_ONLY= Yes
@ -6,7 +6,7 @@ COMMENT= simple encrypted backup tool for GNOME
GNOME_VERSION= 24.0
GNOME_PROJECT= deja-dup
REVISION= 0
REVISION= 1
CATEGORIES= sysutils x11/gnome
@ -17,15 +17,15 @@ MAINTAINER= Antoine Jacoutot <ajacoutot@openbsd.org>
# GPLv3
PERMIT_PACKAGE_CDROM= Yes
WANTLIB += GL ICE SM X11 Xau Xcomposite Xcursor Xdamage Xdmcp
WANTLIB += Xext Xfixes Xi Xinerama Xrandr Xrender atk-1.0 atk-bridge-2.0
WANTLIB += atspi c cairo cairo-gobject dbus-1 expat ffi fontconfig
WANTLIB += freetype gcrypt gdk-3 gdk_pixbuf-2.0 gio-2.0 girepository-1.0
WANTLIB += ICE SM X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi
WANTLIB += Xinerama Xrandr Xrender atk-1.0 atk-bridge-2.0 atspi
WANTLIB += c cairo cairo-gobject dbus-1 expat ffi fontconfig freetype
WANTLIB += gcrypt gdk-3 gdk_pixbuf-2.0 gio-2.0 girepository-1.0
WANTLIB += glib-2.0 gmodule-2.0 gnome-keyring gobject-2.0 gpg-error
WANTLIB += gthread-2.0 gtk-3 harfbuzz icudata icule icuuc m nautilus-extension
WANTLIB += notify pango-1.0 pangocairo-1.0 pangoft2-1.0 pcre peas-1.0
WANTLIB += pixman-1 png pthread pthread-stubs xcb xcb-render xcb-shm
WANTLIB += z
WANTLIB += graphite2 gthread-2.0 gtk-3 harfbuzz icudata icule
WANTLIB += icuuc m nautilus-extension notify pango-1.0 pangocairo-1.0
WANTLIB += pangoft2-1.0 pcre peas-1.0 pixman-1 png pthread pthread-stubs
WANTLIB += xcb xcb-render xcb-shm z
MASTER_SITES= https://launchpad.net/deja-dup/${GNOME_VERSION:C/^([0-9]+).*/\1/}/${GNOME_VERSION}/+download/

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-common_CommonUtils_vala,v 1.1 2013/01/21 08:23:30 ajacoutot Exp $
$OpenBSD: patch-common_CommonUtils_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
https://bugzilla.redhat.com/show_bug.cgi?id=892063
rhbz#892063
--- common/CommonUtils.vala.orig Tue Aug 21 17:08:23 2012
+++ common/CommonUtils.vala Mon Jan 21 08:43:45 2013
+++ common/CommonUtils.vala Tue Mar 19 10:10:32 2013
@@ -444,6 +444,9 @@ public bool initialize(out string header, out string m
var unused_backend = DejaDup.Backend.get_default();
unused_backend = null;

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-common_OperationBackup_vala,v 1.1 2013/01/21 08:23:30 ajacoutot Exp $
$OpenBSD: patch-common_OperationBackup_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
https://bugzilla.redhat.com/show_bug.cgi?id=892063
rhbz#892063
--- common/OperationBackup.vala.orig Tue Aug 21 02:48:37 2012
+++ common/OperationBackup.vala Mon Jan 21 08:43:45 2013
+++ common/OperationBackup.vala Tue Mar 19 10:10:32 2013
@@ -116,11 +116,11 @@ public class OperationBackup : Operation
rv.append(Path.build_filename(dir, ".xsession-errors"));
}

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-common_Operation_vala,v 1.1 2013/01/21 08:23:30 ajacoutot Exp $
$OpenBSD: patch-common_Operation_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
https://bugzilla.redhat.com/show_bug.cgi?id=892063
rhbz#892063
--- common/Operation.vala.orig Tue Aug 21 17:08:23 2012
+++ common/Operation.vala Mon Jan 21 08:43:45 2013
+++ common/Operation.vala Tue Mar 19 10:10:32 2013
@@ -223,6 +223,7 @@ public abstract class Operation : Object
finished = true;

View File

@ -0,0 +1,172 @@
$OpenBSD: patch-tests_runner_runner_vala,v 1.1 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- tests/runner/runner.vala.orig Tue Aug 21 17:08:23 2012
+++ tests/runner/runner.vala Tue Mar 19 10:10:32 2013
@@ -51,8 +51,15 @@ void backup_setup()
Environment.set_variable("DEJA_DUP_TOOLS_PATH", "../../tools/duplicity", true);
Environment.set_variable("DEJA_DUP_TEST_MOCKSCRIPT", Path.build_filename(dir, "mockscript"), true);
Environment.set_variable("XDG_CACHE_HOME", cachedir, true);
- Environment.set_variable("PATH", "./mock:" + Environment.get_variable("PATH"), true);
+ Environment.set_variable("PATH",
+ "./mock:" +
+ Environment.get_variable("DEJA_DUP_TEST_PATH"),
+ true);
+ var tempdir = Path.build_filename(dir, "tmp");
+ DejaDup.ensure_directory_exists(tempdir);
+ Environment.set_variable("DEJA_DUP_TEMPDIR", tempdir, true);
+
var settings = DejaDup.get_settings();
settings.set_string(DejaDup.BACKEND_KEY, "file");
settings = DejaDup.get_settings(DejaDup.FILE_ROOT);
@@ -61,11 +68,9 @@ void backup_setup()
void backup_teardown()
{
- var path = Environment.get_variable("PATH");
- if (path.has_prefix("./mock:")) {
- path = path.substring(7);
- Environment.set_variable("PATH", path, true);
- }
+ Environment.set_variable("PATH",
+ Environment.get_variable("DEJA_DUP_TEST_PATH"),
+ true);
var file = File.new_for_path(Environment.get_variable("DEJA_DUP_TEST_MOCKSCRIPT"));
if (file.query_exists(null)) {
@@ -112,14 +117,22 @@ string default_args(BackupRunner br, Mode mode = Mode.
var archive = tmp_archive ? "?" : "%s/deja-dup".printf(cachedir);
+ string enc_str = "";
+ if (!encrypted)
+ enc_str = "--no-encryption ";
+
+ var tempdir = Path.build_filename(test_home, "tmp");
+
+ var end_str = "%s'--verbosity=9' '--gpg-options=--no-use-agent' '--archive-dir=%s' '--tempdir=%s' '--log-fd=?'".printf(enc_str, archive, tempdir);
+
if (mode == Mode.CLEANUP)
- return "cleanup '--force' 'file://%s' '--gio' %s'--verbosity=9' '--gpg-options=--no-use-agent' '--archive-dir=%s' '--log-fd=?'".printf(backupdir, encrypted ? "" : "'--no-encryption' ", archive);
+ return "cleanup '--force' 'file://%s' '--gio' %s".printf(backupdir, end_str);
else if (mode == Mode.RESTORE)
- return "'restore' '--gio' '--force' 'file://%s' '%s' %s'--verbosity=9' '--gpg-options=--no-use-agent' '--archive-dir=%s' '--log-fd=?'".printf(backupdir, restoredir, encrypted ? "" : "'--no-encryption' ", archive);
+ return "'restore' '--gio' '--force' 'file://%s' '%s' %s".printf(backupdir, restoredir, end_str);
else if (mode == Mode.VERIFY)
- return "'restore' '--file-to-restore=%s/deja-dup/metadata' '--gio' '--force' 'file://%s' '%s/deja-dup/metadata' %s'--verbosity=9' '--gpg-options=--no-use-agent' '--archive-dir=%s' '--log-fd=?'".printf(cachedir.substring(1), backupdir, cachedir, encrypted ? "" : "'--no-encryption' ", archive);
+ return "'restore' '--file-to-restore=%s/deja-dup/metadata' '--gio' '--force' 'file://%s' '%s/deja-dup/metadata' %s".printf(cachedir.substring(1), backupdir, cachedir, end_str);
else if (mode == Mode.LIST)
- return "'list-current-files' '--gio' 'file://%s' %s'--verbosity=9' '--gpg-options=--no-use-agent' '--archive-dir=%s' '--log-fd=?'".printf(backupdir, encrypted ? "" : "'--no-encryption' ", archive);
+ return "'list-current-files' '--gio' 'file://%s' %s".printf(backupdir, end_str);
string source_str = "";
if (mode == Mode.DRY || mode == Mode.BACKUP)
@@ -129,10 +142,6 @@ string default_args(BackupRunner br, Mode mode = Mode.
if (mode == Mode.DRY)
dry_str = "--dry-run ";
- string enc_str = "";
- if (!encrypted)
- enc_str = "--no-encryption ";
-
string args = "";
if (br.is_full && !br.is_first && (mode == Mode.BACKUP || mode == Mode.DRY))
@@ -147,7 +156,7 @@ string default_args(BackupRunner br, Mode mode = Mode.
string[] excludes1 = {"~/Downloads", "~/.local/share/Trash", "~/.xsession-errors", "~/.thumbnails", "~/.Private", "~/.gvfs", "~/.adobe/Flash_Player/AssetCache"};
var user = Environment.get_user_name();
- string[] excludes2 = {"/home/.ecryptfs/%s/.Private".printf(user), "/sys", "/proc", "/tmp"};
+ string[] excludes2 = {"/home/.ecryptfs/%s/.Private".printf(user), "/sys", "/proc", tempdir};
foreach (string ex in excludes1) {
ex = ex.replace("~", Environment.get_home_dir());
@@ -166,7 +175,7 @@ string default_args(BackupRunner br, Mode mode = Mode.
args += "'--exclude=%s/deja-dup' '--exclude=%s' '--exclude=**' ".printf(cachedir, cachedir);
}
- args += "%s%s'--gio' %s'file://%s' %s'--verbosity=9' '--gpg-options=--no-use-agent' '--archive-dir=%s' '--log-fd=?'".printf(extra, dry_str, source_str, backupdir, enc_str, archive);
+ args += "%s%s'--gio' %s'file://%s' %s".printf(extra, dry_str, source_str, backupdir, end_str);
return args;
}
@@ -175,6 +184,8 @@ class BackupRunner : Object
{
public delegate void OpCallback (DejaDup.Operation op);
public DejaDup.Operation op = null;
+ public string path = null;
+ public string script = null;
public string? init_error = null;
public bool success = true;
public bool cancelled = false;
@@ -188,6 +199,12 @@ class BackupRunner : Object
public void run()
{
+ if (script != null)
+ run_script(script);
+
+ if (path != null)
+ Environment.set_variable("PATH", path, true);
+
string header, msg;
if (!DejaDup.initialize(out header, out msg)) {
if (header + "\n" + msg != init_error)
@@ -298,9 +315,13 @@ void add_to_mockscript(string contents)
string replace_keywords(string in)
{
var home = Environment.get_home_dir();
+ var mockdir = "./mock";
var cachedir = Environment.get_variable("XDG_CACHE_HOME");
var test_home = Environment.get_variable("DEJA_DUP_TEST_HOME");
+ var path = Environment.get_variable("PATH");
return in.replace("@HOME@", home).
+ replace("@MOCK_DIR@", mockdir).
+ replace("@PATH@", path).
replace("@XDG_CACHE_HOME@", cachedir).
replace("@TEST_HOME@", test_home);
}
@@ -351,6 +372,10 @@ void process_operation_block(KeyFile keyfile, string g
br.error_detail = keyfile.get_string(group, "ErrorDetail");
if (keyfile.has_key(group, "Passphrases"))
br.passphrases = keyfile.get_integer(group, "Passphrases");
+ if (keyfile.has_key(group, "Path"))
+ br.path = replace_keywords(keyfile.get_string(group, "Path"));
+ if (keyfile.has_key(group, "Script"))
+ br.script = replace_keywords(keyfile.get_string(group, "Script"));
if (keyfile.has_key(group, "Settings")) {
var settings_list = keyfile.get_string_list(group, "Settings");
var settings = DejaDup.get_settings();
@@ -449,10 +474,15 @@ void process_duplicity_run_block(KeyFile keyfile, stri
};
}
- if (script != null)
- dupscript += "\n" + "SCRIPT: " + script;
- else if (mode == Mode.VERIFY)
- dupscript += "\n" + "SCRIPT: mkdir -p %s/deja-dup/metadata; echo 'This folder can be safely deleted.\\n0' > %s/deja-dup/metadata/README".printf(cachedir, cachedir);
+ var verify_script = "mkdir -p %s/deja-dup/metadata && echo 'This folder can be safely deleted.\\n0' > %s/deja-dup/metadata/README".printf(cachedir, cachedir);
+ if (mode == Mode.VERIFY)
+ dupscript += "\n" + "SCRIPT: " + verify_script;
+ if (script != null) {
+ if (mode == Mode.VERIFY)
+ dupscript += " && " + script;
+ else
+ dupscript += "\n" + "SCRIPT: " + script;
+ }
if (passphrase)
dupscript += "\n" + "PASSPHRASE: test";
@@ -522,6 +552,10 @@ int main(string[] args)
if (args.length > 1)
script = args[1];
Environment.set_variable("DEJA_DUP_TEST_SCRIPT", script, true);
+
+ // Save PATH, as tests might reset it on us
+ Environment.set_variable("DEJA_DUP_TEST_PATH",
+ Environment.get_variable("PATH"), true);
var parts = script.split("/");
var suitename = parts[parts.length - 2];

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-tests_scripts_clean-tempdir_test,v 1.1 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- tests/scripts/clean-tempdir.test.orig Tue Mar 19 10:10:32 2013
+++ tests/scripts/clean-tempdir.test Tue Mar 19 10:10:32 2013
@@ -0,0 +1,12 @@
+# Make sure we clean up the tempdir that we give to duplicity after we're done
+
+[Operation]
+Type=backup
+Script=mkdir -p @TEST_HOME@/tmp/duplicity-blarg @TEST_HOME@/tmp/nope
+
+[Duplicity]
+Runs=status;dry;backup;status-restore;list;verify;
+
+# Check at end of everything that we cleared the temp files
+[Duplicity verify]
+Script=test ! -e @TEST_HOME@/tmp/duplicity-blarg -a -d @TEST_HOME@/tmp/nope

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-tests_scripts_instance-error_test,v 1.1 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- tests/scripts/instance-error.test.orig Tue Mar 19 10:10:32 2013
+++ tests/scripts/instance-error.test Tue Mar 19 10:10:32 2013
@@ -0,0 +1,21 @@
+# Make sure we correctly bubble up an error message from
+# DuplicityInstance.start(). In this case, an error about spawning duplicity.
+
+[Operation]
+Type=backup
+# Delete mockscript ourselves, because the runner will notice that it is still
+# there and fail. Since we never run our mock duplicity, it is never cleaned
+# naturally. Also symlink python since the mock duplicity needs it
+Script=mkdir -p @TEST_HOME@/mockcopy && cp -r @MOCK_DIR@/* @TEST_HOME@/mockcopy && ln -s `which python` @TEST_HOME@/mockcopy/python
+Path=@TEST_HOME@/mockcopy
+Success=false
+Error=Failed to execute child process "duplicity" (No such file or directory)
+
+[Duplicity]
+Runs=status;dry;
+
+[Duplicity status]
+# We let duplicity go for one operation to let it get initialized (i.e. we
+# don't want to mess up any of its early calls like --version).
+# Also clean the mockscript out since our mock won't be doing it.
+Script=/bin/rm @TEST_HOME@/mockcopy/duplicity @TEST_HOME@/mockscript

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-tests_scripts_verify_test,v 1.1 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- tests/scripts/verify.test.orig Tue Aug 21 02:48:37 2012
+++ tests/scripts/verify.test Tue Mar 19 10:10:32 2013
@@ -7,4 +7,4 @@ Error=Your backup appears to be corrupted. You should
Runs=status;dry;backup;status-restore;list;verify;
[Duplicity verify]
-Script=mkdir -p @XDG_CACHE_HOME@/deja-dup/metadata; echo 'Nope' > @XDG_CACHE_HOME@/deja-dup/metadata/README
+Script=echo 'Nope' > @XDG_CACHE_HOME@/deja-dup/metadata/README

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-tools_duplicity_DuplicityInstance_vala,v 1.1 2013/01/21 08:23:30 ajacoutot Exp $
$OpenBSD: patch-tools_duplicity_DuplicityInstance_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
https://bugzilla.redhat.com/show_bug.cgi?id=892063
rhbz#892063
--- tools/duplicity/DuplicityInstance.vala.orig Tue Sep 18 18:41:56 2012
+++ tools/duplicity/DuplicityInstance.vala Mon Jan 21 08:44:03 2013
@@ -29,9 +29,30 @@ internal class DuplicityInstance : Object
+++ tools/duplicity/DuplicityInstance.vala Tue Mar 19 10:10:32 2013
@@ -29,9 +29,31 @@ internal class DuplicityInstance : Object
public bool verbose {get; private set; default = false;}
public string forced_cache_dir {get; set; default = null;}
@ -26,7 +26,8 @@ https://bugzilla.redhat.com/show_bug.cgi?id=892063
+ done(false, false);
+ }
+ catch (Error e) {
+ warning("%s\n", e.message);
+ // Fake a generic message from duplicity
+ message({"ERROR", "1"}, null, e.message);
+ done(false, false);
+ }
+ }
@ -37,7 +38,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=892063
var verbose_str = Environment.get_variable("DEJA_DUP_DEBUG");
if (verbose_str != null && int.parse(verbose_str) > 0)
verbose = true;
@@ -76,46 +97,29 @@ internal class DuplicityInstance : Object
@@ -76,46 +98,29 @@ internal class DuplicityInstance : Object
if (cache_dir == null)
cache_dir = Environment.get_user_cache_dir();
if (cache_dir != null) {
@ -98,7 +99,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=892063
argv.append("--log-fd=%d".printf(pipes[1]));
}
@@ -195,9 +199,10 @@ internal class DuplicityInstance : Object
@@ -195,9 +200,10 @@ internal class DuplicityInstance : Object
if (pipes[1] != -1)
Posix.close(pipes[1]);

View File

@ -1,9 +1,9 @@
$OpenBSD: patch-tools_duplicity_DuplicityJob_vala,v 1.1 2013/01/21 08:23:30 ajacoutot Exp $
$OpenBSD: patch-tools_duplicity_DuplicityJob_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
https://bugzilla.redhat.com/show_bug.cgi?id=892063
rhbz#892063
--- tools/duplicity/DuplicityJob.vala.orig Tue Aug 21 17:08:23 2012
+++ tools/duplicity/DuplicityJob.vala Mon Jan 21 08:44:03 2013
+++ tools/duplicity/DuplicityJob.vala Tue Mar 19 10:10:32 2013
@@ -1459,13 +1459,7 @@ internal class DuplicityJob : DejaDup.ToolJob
}