Update to deja-dup-26.0.

This commit is contained in:
ajacoutot 2013-03-30 19:11:06 +00:00
parent 31b36df038
commit b0d49ad9cd
13 changed files with 14 additions and 573 deletions

View File

@ -1,12 +1,11 @@
# $OpenBSD: Makefile,v 1.17 2013/03/19 09:21:22 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.18 2013/03/30 19:11:06 ajacoutot Exp $
SHARED_ONLY= Yes
COMMENT= simple encrypted backup tool for GNOME
GNOME_VERSION= 24.0
GNOME_VERSION= 26.0
GNOME_PROJECT= deja-dup
REVISION= 1
CATEGORIES= sysutils x11/gnome
@ -21,7 +20,7 @@ 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 += glib-2.0 gmodule-2.0 secret-1 gobject-2.0 gpg-error
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
@ -34,14 +33,12 @@ MODULES= devel/dconf \
lang/python \
x11/gnome
MODGNOME_TOOLS= yelp
MODGNOME_TOOLS= vala yelp
MODGNOME_DESKTOP_FILE= Yes
MODGNOME_ICON_CACHE= Yes
LIBTOOL_FLAGS= --tag=disable-static
BUILD_DEPENDS= lang/vala
RUN_DEPENDS= sysutils/duplicity
LIB_DEPENDS= devel/libpeas \
@ -57,7 +54,11 @@ CONFIGURE_ARGS += --without-ccpanel
FAKE_FLAGS= sysconfdir=${PREFIX}/share/examples/deja-dup
# XXX push a proper fix upstream
BUILD_DEPENDS += textproc/gsed
pre-configure:
perl -pi -e 's,sed -i,gsed -i,g' \
${WRKSRC}/data/Makefile.in
${SUBST_CMD} ${WRKSRC}/common/PythonChecker.vala
.include <bsd.port.mk>

View File

@ -1,2 +1,2 @@
SHA256 (deja-dup-24.0.tar.xz) = RQaHHLmFjqjvVu9izCBhOhicEjBwwSMpO1M7364zNnM=
SIZE (deja-dup-24.0.tar.xz) = 865076
SHA256 (deja-dup-26.0.tar.xz) = X6VGzngRg9YEEUhYPPHH1lkM7Iwc8O3W0NtQP8i4ACs=
SIZE (deja-dup-26.0.tar.xz) = 820956

View File

@ -1,145 +0,0 @@
$OpenBSD: patch-common_CommonUtils_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- common/CommonUtils.vala.orig Tue Aug 21 17:08:23 2012
+++ 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;
+ // And cleanup from any previous runs
+ clean_tempdirs.begin();
+
return true;
}
@@ -580,6 +583,128 @@ public Date get_full_backup_threshold_date()
date.subtract_days(days);
return date;
+}
+
+public bool ensure_directory_exists(string path)
+{
+ var gfile = File.new_for_path(path);
+ try {
+ if (gfile.make_directory_with_parents())
+ return true;
+ }
+ catch (IOError.EXISTS e) {
+ return true; // ignore
+ }
+ catch (Error e) {
+ warning("%s\n", e.message);
+ }
+ return false;
+}
+
+// By default, duplicity uses normal tmp folders like /tmp to store its
+// in-process files. These can get quite large, especially when restoring.
+// You may need up to twice the size of the largest source file.
+// Because /tmp may not be super large, especially on systems that use
+// tmpfs by default (e.g. Fedora 18), we try to use a tempdir that is on
+// the same partition as the source files.
+public async string get_tempdir()
+{
+ var tempdirs = get_tempdirs();
+
+ // First, decide the "main include". Assume that if $HOME
+ // is present, that is it. Else, the first include we find decides it.
+ // This is admittedly fast and loose, but our primary concern is just
+ // avoiding silly choices like tmpfs or tiny special /tmp partitions.
+ var settings = get_settings();
+ var include_val = settings.get_value(INCLUDE_LIST_KEY);
+ var include_list = parse_dir_list(include_val.get_strv());
+ File main_include = null;
+ var home = File.new_for_path(Environment.get_home_dir());
+ foreach (var include in include_list) {
+ if (include.equal(home)) {
+ main_include = include;
+ break;
+ }
+ else if (main_include == null)
+ main_include = include;
+ }
+ if (main_include == null)
+ return tempdirs[0];
+
+ // Grab that include's fs ID
+ string filesystem_id;
+ try {
+ var info = yield main_include.query_info_async(FileAttribute.ID_FILESYSTEM,
+ FileQueryInfoFlags.NONE);
+ filesystem_id = info.get_attribute_string(FileAttribute.ID_FILESYSTEM);
+ }
+ catch (Error e) {
+ return tempdirs[0];
+ }
+
+ // Then, see which of our possible tempdirs matches that partition.
+ foreach (var tempdir in tempdirs) {
+ string temp_id;
+ ensure_directory_exists(tempdir);
+ try {
+ var gfile = File.new_for_path(tempdir);
+ var info = yield gfile.query_info_async(FileAttribute.ID_FILESYSTEM,
+ FileQueryInfoFlags.NONE);
+ temp_id = info.get_attribute_string(FileAttribute.ID_FILESYSTEM);
+ }
+ catch (Error e) {
+ continue;
+ }
+ if (temp_id == filesystem_id)
+ return tempdir;
+ }
+
+ // Fallback to simply using the highest preferred tempdir
+ return tempdirs[0];
+}
+
+public string[] get_tempdirs()
+{
+ var tempdir = Environment.get_variable("DEJA_DUP_TEMPDIR");
+ if (tempdir != null && tempdir != "")
+ return {tempdir};
+ // Prefer directories that have their own cleanup logic in case ours isn't
+ // run for a while. (e.g. /tmp every boot, /var/tmp every now and then)
+ return {Environment.get_tmp_dir(), "/var/tmp",
+ Path.build_filename(Environment.get_user_cache_dir(), Config.PACKAGE,
+ "tmp")};
+}
+
+public async void clean_tempdirs()
+{
+ var tempdirs = get_tempdirs();
+ const int NUM_ENUMERATED = 16;
+ foreach (var tempdir in tempdirs) {
+ var gfile = File.new_for_path(tempdir);
+
+ // Now try to find and delete all files that start with "duplicity-"
+ try {
+ var enumerator = yield gfile.enumerate_children_async(
+ FileAttribute.STANDARD_NAME,
+ FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
+ Priority.DEFAULT, null);
+ while (true) {
+ var infos = yield enumerator.next_files_async(NUM_ENUMERATED,
+ Priority.DEFAULT, null);
+ foreach (FileInfo info in infos) {
+ if (info.get_name().has_prefix("duplicity-")) {
+ var child = gfile.get_child(info.get_name());
+ yield new DejaDup.RecursiveDelete(child).start_async();
+ }
+ }
+ if (infos.length() != NUM_ENUMERATED)
+ break;
+ }
+ }
+ catch (Error e) {
+ // No worries
+ }
+ }
}
} // end namespace

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-common_OperationBackup_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- common/OperationBackup.vala.orig Tue Aug 21 02:48:37 2012
+++ 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"));
}
- // Some problematic directories like /tmp and /proc should be left alone
- dir = Environment.get_tmp_dir();
- if (dir != null)
- rv.append(dir);
-
+ // Skip all of our temporary directories
+ foreach (var tempdir in DejaDup.get_tempdirs())
+ rv.append(tempdir);
+
+ // Skip kernel directories
rv.append("/proc");
rv.append("/sys");

View File

@ -1,14 +0,0 @@
$OpenBSD: patch-common_Operation_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- common/Operation.vala.orig Tue Aug 21 17:08:23 2012
+++ common/Operation.vala Tue Mar 19 10:10:32 2013
@@ -223,6 +223,7 @@ public abstract class Operation : Object
finished = true;
unclaim_bus();
+ yield DejaDup.clean_tempdirs();
done(success, cancelled, detail);
}

View File

@ -1,10 +1,10 @@
$OpenBSD: patch-configure,v 1.1 2012/09/11 07:03:50 ajacoutot Exp $
$OpenBSD: patch-configure,v 1.2 2013/03/30 19:11:06 ajacoutot Exp $
Fix DATADIRNAME: see LOCALBASE/share/aclocal/{glib-gettext.m4,intltool.m4}
--- configure.orig Tue Aug 21 21:20:36 2012
+++ configure Tue Sep 11 08:56:09 2012
@@ -14751,6 +14751,9 @@ else
--- configure.orig Mon Mar 18 20:19:27 2013
+++ configure Sat Mar 30 20:01:01 2013
@@ -14745,6 +14745,9 @@ else
fi
;;

View File

@ -1,12 +0,0 @@
$OpenBSD: patch-data_Makefile_in,v 1.3 2012/08/30 08:00:12 ajacoutot Exp $
--- data/Makefile.in.orig Tue Aug 21 21:20:33 2012
+++ data/Makefile.in Thu Aug 30 09:08:44 2012
@@ -661,7 +661,7 @@ uninstall-am: uninstall-autostartDATA uninstall-deskto
deja-dup-preferences.desktop.in: deja-dup-preferences.desktop.in.in
$(install_sh_DATA) $^ $@
-@HAVE_CCPANEL_TRUE@ sed -i "s/^Categories=.*/\0\n\nNotShowIn=$(shell grep OnlyShowIn $(srcdir)/deja-dup-ccpanel.desktop.in | cut -d= -f2)/" $@
+@HAVE_CCPANEL_TRUE@ perl -pi -e "s/^Categories=.*/\0\n\nNotShowIn=$(shell grep OnlyShowIn $(srcdir)/deja-dup-ccpanel.desktop.in | cut -d= -f2)/" $@
deja-dup-monitor.desktop.in: deja-dup-monitor.desktop.in.in
sed "s|@pkglibexecdir@|$(pkglibexecdir)|g" $^ > $@

View File

@ -1,172 +0,0 @@
$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

@ -1,19 +0,0 @@
$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

@ -1,28 +0,0 @@
$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

@ -1,12 +0,0 @@
$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,114 +0,0 @@
$OpenBSD: patch-tools_duplicity_DuplicityInstance_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- tools/duplicity/DuplicityInstance.vala.orig Tue Sep 18 18:41:56 2012
+++ 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;}
- public virtual void start(List<string> argv_in, List<string>? envp_in,
- bool as_root = false) throws Error
+ public async void start(List<string> argv_in, List<string>? envp_in,
+ bool as_root = false)
{
+ try {
+ /* Make deep copies of the lists, so if our caller doesn't yield, the
+ lists won't be invalidated. */
+ var argv = new List<string>();
+ foreach (var arg in argv_in)
+ argv.append(arg);
+ var envp = new List<string>();
+ foreach (var env in envp_in)
+ envp.append(env);
+ if (!yield start_internal(argv, envp, as_root))
+ done(false, false);
+ }
+ catch (Error e) {
+ // Fake a generic message from duplicity
+ message({"ERROR", "1"}, null, e.message);
+ done(false, false);
+ }
+ }
+
+ async bool start_internal(List<string> argv_in, List<string>? envp_in,
+ bool as_root) throws Error
+ {
var verbose_str = Environment.get_variable("DEJA_DUP_DEBUG");
if (verbose_str != null && int.parse(verbose_str) > 0)
verbose = true;
@@ -76,46 +98,29 @@ internal class DuplicityInstance : Object
if (cache_dir == null)
cache_dir = Environment.get_user_cache_dir();
if (cache_dir != null) {
- bool add_dir = false;
- var cache_file = File.new_for_path(cache_dir);
- cache_file = cache_file.get_child(Config.PACKAGE);
- try {
- if (cache_file.make_directory_with_parents(null))
- add_dir = true;
- }
- catch (IOError.EXISTS e) {
- add_dir = true; // ignore
- }
- catch (Error e) {
- warning("%s\n", e.message);
- }
- if (add_dir)
- argv.append("--archive-dir=" + cache_file.get_path());
+ cache_dir = Path.build_filename(cache_dir, Config.PACKAGE);
+ if (DejaDup.ensure_directory_exists(cache_dir))
+ argv.append("--archive-dir=" + cache_dir);
}
-
+
+ // Specify tempdir
+ var tempdir = yield DejaDup.get_tempdir();
+ if (DejaDup.ensure_directory_exists(tempdir))
+ argv.append("--tempdir=%s".printf(tempdir));
+
// Add logging argument
if (as_root) {
// Make log file
int logfd = 0;
- try {
- string logname;
- logfd = FileUtils.open_tmp(Config.PACKAGE + "-XXXXXX", out logname);
- logfile = File.new_for_path(logname);
- }
- catch (Error e) {
- warning("%s\n", e.message);
- done(false, false);
- return;
- }
-
+ string logname;
+ logfd = FileUtils.open_tmp(Config.PACKAGE + "-XXXXXX", out logname);
+ logfile = File.new_for_path(logname);
argv.append("--log-file=%s".printf(logfile.get_path()));
}
else {
// Open pipes to communicate with subprocess
- if (Posix.pipe(pipes) != 0) {
- done(false, false);
- return;
- }
+ if (Posix.pipe(pipes) != 0)
+ return false;
argv.append("--log-fd=%d".printf(pipes[1]));
}
@@ -195,9 +200,10 @@ internal class DuplicityInstance : Object
if (pipes[1] != -1)
Posix.close(pipes[1]);
- read_log.begin();
+ yield read_log();
+ return true;
}
-
+
public bool is_started()
{
return (int)child_pid > 0;

View File

@ -1,21 +0,0 @@
$OpenBSD: patch-tools_duplicity_DuplicityJob_vala,v 1.2 2013/03/19 09:21:22 ajacoutot Exp $
rhbz#892063
--- tools/duplicity/DuplicityJob.vala.orig Tue Aug 21 17:08:23 2012
+++ tools/duplicity/DuplicityJob.vala Tue Mar 19 10:10:32 2013
@@ -1459,13 +1459,7 @@ internal class DuplicityJob : DejaDup.ToolJob
}
/* Start duplicity instance */
- try {
- inst.start(argv, envp, needs_root);
- }
- catch (Error e) {
- show_error(e.message);
- done(false, false, null);
- }
+ inst.start.begin(argv, envp, needs_root);
}
}