From 467844f89ee7e0feee26effdffc0bddc456ab39f Mon Sep 17 00:00:00 2001 From: owsla Date: Wed, 18 Jul 2007 21:52:11 +0000 Subject: Add --tempfile and --remote-tempfile options. git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@829 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 5 +++++ rdiff-backup/rdiff-backup.1 | 16 +++++++++++++--- rdiff-backup/rdiff_backup/Globals.py | 4 ++++ rdiff-backup/rdiff_backup/Main.py | 10 ++++++---- rdiff-backup/rdiff_backup/SetConnections.py | 3 +++ 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index e17b55e..8a5a6d2 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,6 +1,11 @@ New in v1.1.13 (????/??/??) --------------------------- +New options: --tempdir and --remote-tempdir. The first one sets the +directory that rdiff-backup uses for temporary files on the local system. +The second adds the --tempdir option with the given path when invoking +rdiff-backup on remote systems. (Andrew Ferguson) + Don't run the extended attributes test if rdiff-backup is run with the --no-eas option. Prevents hang in isolated cases. (Andrew Ferguson) diff --git a/rdiff-backup/rdiff-backup.1 b/rdiff-backup/rdiff-backup.1 index c2283f6..c21c2d4 100644 --- a/rdiff-backup/rdiff-backup.1 +++ b/rdiff-backup/rdiff-backup.1 @@ -1,4 +1,4 @@ -.TH RDIFF-BACKUP 1 "NOVEMBER 2006" "Version 1.1.6" "User Manuals" \" -*- nroff -*- +.TH RDIFF-BACKUP 1 "JULY 2007" "Version 1.1.13" "User Manuals" \" -*- nroff -*- .SH NAME rdiff-backup \- local/remote mirror and incremental backup .SH SYNOPSIS @@ -190,7 +190,7 @@ Exclude all socket files. .B "\-\-exclude-symbolic-links" Exclude all symbolic links. .TP -.BI "\-\exclude-if-present " filename +.BI "\-\-exclude-if-present " filename Exclude directories if .IR filename is present. This option needs to come before any other include or @@ -361,7 +361,6 @@ or switches, where the time will be given in seconds since the epoch. .TP .B \-\-override-chars-to-quote -.TP If the filesystem to which we are backing up is not case-sensitive, automatic 'quoting' of characters occurs. For example, a file 'Developer.doc' will be converted into ';068eveloper.doc'. To override this behavior, you need to specify this option. .TP .B \-\-preserve-numerical-ids @@ -399,6 +398,11 @@ See the .B REMOTE OPERATION section for more information. .TP +.BI "\-\-remote-tempdir " path +Adds the \-\-tempdir option with argument +.I path +when invoking remote instances of rdiff-backup. +.TP .BI "\-\-remove-older-than " time_spec Remove the incremental backup information in the destination directory that has been around longer than the given time. @@ -460,6 +464,12 @@ When running ssh, do not use the \-C option to enable compression. is ignored if you specify a new schema using .B \-\-remote-schema. .TP +.BI "\-\-tempdir " path +Sets the directory that rdiff-backup uses for temporary files to +the given path. The environment variables TMPDIR, TEMP, and TMP can +also be used to set the temporary files directory. See the +documentation of the Python tempfile module for more information. +.TP .BI "\-\-terminal-verbosity " [0-9] Select which messages will be displayed to the terminal. If missing the level defaults to the verbosity level. diff --git a/rdiff-backup/rdiff_backup/Globals.py b/rdiff-backup/rdiff_backup/Globals.py index c130143..9a71ce9 100644 --- a/rdiff-backup/rdiff_backup/Globals.py +++ b/rdiff-backup/rdiff_backup/Globals.py @@ -226,6 +226,10 @@ permission_mask = 07777 # the original permissions symlink_perms = None +# If set, the path that should be used instead of the default Python +# tempfile.tempdir value on remote connections +remote_tempdir = None + def get(name): """Return the value of something in this module""" return globals()[name] diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index a363aa5..cf3be6c 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -20,7 +20,7 @@ """Start (and end) here - read arguments, set global settings, etc.""" from __future__ import generators -import getopt, sys, re, os, cStringIO +import getopt, sys, re, os, cStringIO, tempfile from log import Log, LoggerError, ErrorLog import Globals, Time, SetConnections, selection, robust, rpath, \ manage, backup, connection, restore, FilenameMapping, \ @@ -81,11 +81,11 @@ def parse_cmdlineoptions(arglist): "no-eas", "no-file-statistics", "no-hard-links", "null-separator", "override-chars-to-quote=", "parsable-output", "preserve-numerical-ids", "print-statistics", - "remote-cmd=", "remote-schema=", + "remote-cmd=", "remote-schema=", "remote-tempdir=", "remove-older-than=", "restore-as-of=", "restrict=", "restrict-read-only=", "restrict-update-only=", "server", - "ssh-no-compression", "terminal-verbosity=", "test-server", - "user-mapping-file=", "verbosity=", "verify", + "ssh-no-compression", "tempdir=", "terminal-verbosity=", + "test-server", "user-mapping-file=", "verbosity=", "verify", "verify-at-time=", "version"]) except getopt.error, e: commandline_error("Bad commandline options: " + str(e)) @@ -176,6 +176,7 @@ def parse_cmdlineoptions(arglist): restore_timestr, action = arg, "restore-as-of" elif opt == "--remote-cmd": remote_cmd = arg elif opt == "--remote-schema": remote_schema = arg + elif opt == "--remote-tempdir": Globals.remote_tempdir = arg elif opt == "--remove-older-than": remove_older_than_string = arg action = "remove-older-than" @@ -193,6 +194,7 @@ def parse_cmdlineoptions(arglist): Globals.server = 1 elif opt == "--ssh-no-compression": Globals.set('ssh_compression', None) + elif opt == "--tempdir": tempfile.tempdir = arg elif opt == "--terminal-verbosity": Log.setterm_verbosity(arg) elif opt == "--test-server": action = "test-server" elif opt == "--user-mapping-file": user_mapping_filename = arg diff --git a/rdiff-backup/rdiff_backup/SetConnections.py b/rdiff-backup/rdiff_backup/SetConnections.py index 9341db9..0d30cf0 100644 --- a/rdiff-backup/rdiff_backup/SetConnections.py +++ b/rdiff-backup/rdiff_backup/SetConnections.py @@ -52,6 +52,9 @@ def get_cmd_pairs(arglist, remote_schema = None, remote_cmd = None): if remote_schema: __cmd_schema = remote_schema elif not Globals.ssh_compression: __cmd_schema = __cmd_schema_no_compress + if Globals.remote_tempdir: + __cmd_schema += (" --tempdir=" + Globals.remote_tempdir) + if not arglist: return [] desc_pairs = map(parse_file_desc, arglist) -- cgit v1.2.1