From f6b3e17b8ed8489c12f2a6700bd43a9e93c6b12f Mon Sep 17 00:00:00 2001 From: Robert Scheck Date: Dec 20 2006 13:43:54 +0000 Subject: fix broken sftp support by adding --sftp-command (#220316) --- diff --git a/duplicity-0.4.2-scp.patch b/duplicity-0.4.2-scp.patch deleted file mode 100644 index 8521c09..0000000 --- a/duplicity-0.4.2-scp.patch +++ /dev/null @@ -1,58 +0,0 @@ -Adds support for port numbers in a SCP url like: scp://user@host:port - thanks to -Christian Schneider . - ---- duplicity-0.4.2/src/backends.py 2006-05-12 19:31:59.000000000 +0200 -+++ duplicity-0.4.2/src/backends.py.scp 2006-05-12 19:42:37.000000000 +0200 -@@ -264,23 +264,25 @@ - """This backend copies files using scp. List not supported""" - def __init__(self, parsed_url): - """scpBackend initializer""" -- self.host_string = parsed_url.server # of form user@hostname:port -+ self.host_string = parsed_url.host # of form user@hostname:port - self.remote_dir = parsed_url.path # can be empty string -+ if parsed_url.port: self.port_string = parsed_url.port -+ else: self.port_string = 22 - if self.remote_dir: self.remote_prefix = self.remote_dir + "/" - else: self.remote_prefix = "" - - def put(self, source_path, remote_filename = None): - """Use scp to copy source_dir/filename to remote computer""" - if not remote_filename: remote_filename = source_path.get_filename() -- commandline = "%s %s %s:%s%s" % \ -- (scp_command, source_path.name, self.host_string, -+ commandline = "%s -P %s %s %s:%s%s" % \ -+ (scp_command, self.port_string, source_path.name, self.host_string, - self.remote_prefix, remote_filename) - self.run_command(commandline) - - def get(self, remote_filename, local_path): - """Use scp to get a remote file""" -- commandline = "%s %s:%s%s %s" % \ -- (scp_command, self.host_string, self.remote_prefix, -+ commandline = "%s -P %s %s:%s%s %s" % \ -+ (scp_command, self.port_string, self.host_string, self.remote_prefix, - remote_filename, local_path.name) - self.run_command(commandline) - local_path.setdata() -@@ -295,8 +297,8 @@ - be distinguished from the file boundaries. - - """ -- commandline = ("echo -e 'cd %s\nls -1' | %s -b - %s" % -- (self.remote_dir, sftp_command, self.host_string)) -+ commandline = ("echo -e 'cd %s\nls -1' | %s -p %s -b - %s" % -+ (self.remote_dir, sftp_command, self.port_string, self.host_string)) - l = self.popen(commandline).split('\n')[2:] # omit sftp prompts - return filter(lambda x: x, l) - -@@ -305,8 +307,8 @@ - assert len(filename_list) > 0 - pathlist = map(lambda fn: self.remote_prefix + fn, filename_list) - del_prefix = "echo 'rm " -- del_postfix = ("' | %s -b - %s 1>/dev/null" % -- (sftp_command, self.host_string)) -+ del_postfix = ("' | %s -p %s -b - %s 1>/dev/null" % -+ (sftp_command, self.port_string, self.host_string)) - for fn in filename_list: - commandline = del_prefix + self.remote_prefix + fn + del_postfix - self.run_command(commandline) diff --git a/duplicity-0.4.2-sftp.patch b/duplicity-0.4.2-sftp.patch new file mode 100644 index 0000000..afe4858 --- /dev/null +++ b/duplicity-0.4.2-sftp.patch @@ -0,0 +1,37 @@ +Adds support for --sftp-command option - thanks to intrigeri . + +--- duplicity-0.4.2/src/commandline.py 2006-02-03 04:44:31.000000000 +0100 ++++ duplicity-0.4.2/src/commandline.py.sftp 2006-12-20 14:15:38.000000000 +0100 +@@ -50,7 +50,7 @@ + "list-current-files", "no-encryption", + "no-print-statistics", "null-separator", + "remove-older-than=", "restore-dir=", "restore-time=", +- "scp-command=", "short-filenames", "sign-key=", ++ "scp-command=", "sftp-command=", "short-filenames", "sign-key=", + "ssh-command=", "verbosity=", "verify", "version"]) + except getopt.error, e: + command_line_error("%s" % (str(e),)) +@@ -95,6 +95,7 @@ + elif opt == "-t" or opt == "--restore-time": + globals.restore_time = dup_time.genstrtotime(arg) + elif opt == "--scp-command": backends.scp_command = arg ++ elif opt == "--sftp-command": backends.sftp_command = arg + elif opt == "--short-filenames": globals.short_filenames = 1 + elif opt == "--sign-key": set_sign_key(arg) + elif opt == "--ssh-command": backends.ssh_command = arg +--- duplicity-0.4.2/duplicity.1 2006-02-03 04:44:31.000000000 +0100 ++++ duplicity-0.4.2/duplicity.1.sftp 2006-12-20 14:24:58.000000000 +0100 +@@ -271,6 +271,13 @@ + give extra arguments to scp, for instance "--scp-command \'scp -i + foo\'". The default is "scp". + .TP ++.BI "--sftp-command " command ++This option only matters when using the ssh/scp backend. There ++.I command ++will be used instead of sftp for listing and deleting files. The ++default is "sftp". For more information see ++.BR --scp-command . ++.TP + .BI "--sign-key " key + This option can be used when backing up or restoring. When backing + up, all backup files will be signed with keyid diff --git a/duplicity.spec b/duplicity.spec index 9e5f868..b281a9e 100644 --- a/duplicity.spec +++ b/duplicity.spec @@ -3,13 +3,13 @@ Summary: Encrypted bandwidth-efficient backup using rsync algorithm Name: duplicity Version: 0.4.2 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL Group: Applications/Archiving URL: http://www.nongnu.org/duplicity/ Source: http://savannah.nongnu.org/download/%{name}/%{name}-%{version}.tar.gz Patch0: duplicity-0.4.1-timeout.patch -Patch1: duplicity-0.4.2-scp.patch +Patch1: duplicity-0.4.2-sftp.patch Requires: gnupg >= 1.0.6 %if "%{?fedora}" <= "3" Requires: python-abi = %(%{__python} -c "import sys ; print sys.version[:3]") @@ -32,7 +32,7 @@ hard links. %prep %setup -q %patch0 -p1 -b .timeout -%patch1 -p1 -b .scp +%patch1 -p1 -b .sftp %build %{__python} setup.py build @@ -56,6 +56,9 @@ rm -rf $RPM_BUILD_ROOT %{python_sitearch}/%{name}/*.so %changelog +* Wed Dec 20 2006 Robert Scheck 0.4.2-6 +- fix broken sftp support by adding --sftp-command (#220316) + * Sun Dec 17 2006 Robert Scheck 0.4.2-5 - own %%{python_sitearch}/%%{name} and not only %%{python_sitearch}