diff -Nru dput-0.9.2.35/debian/changelog dput-0.9.2.36/debian/changelog --- dput-0.9.2.35/debian/changelog 2008-09-22 14:23:05.000000000 -0400 +++ dput-0.9.2.36/debian/changelog 2008-11-10 05:05:11.000000000 -0500 @@ -1,3 +1,23 @@ +dput (0.9.2.36) unstable; urgency=low + + * sftp.py: Created dput method module to add support for uploads via sftp. + * ftp.py: + - Catch exceptions that are thrown on call to ftp_connection.quit() + - Fixes LP: #183624 + * debian/control: Added suggests on bzr (as we use the bzrlib.transport) + * debian/rules: Updated to install sftp.py + * dput: + - Added ability to pass an argument to the host configuration by placing + a colon after the hostname. The variable with the same name of the host + will be replaced with the string following the colon. (LP: #196797) + - Properly check to see if config stanza exists for host. (LP: #196786) + - Updated version string to reflect current version. + * dput.cf: Updated ppa stanza to make use of argument support. + * dput.cf.5: Updated manpage to note support for sftp transport and host args. + * dput.1: Updated man page to document host argument feature and sftp support. + + -- Cody A.W. Somerville Mon, 10 Nov 2008 04:55:40 -0500 + dput (0.9.2.35) unstable; urgency=low * dput.cf: add ssh-upload pointing to ssh.upload.debian.org. diff -Nru dput-0.9.2.35/debian/rules dput-0.9.2.36/debian/rules --- dput-0.9.2.35/debian/rules 2008-09-22 14:01:17.000000000 -0400 +++ dput-0.9.2.36/debian/rules 2008-11-10 04:56:30.000000000 -0500 @@ -40,6 +40,7 @@ install --mode=0644 http.py $(TMPDIR)/usr/share/dput install --mode=0644 https.py $(TMPDIR)/usr/share/dput install --mode=0644 scp.py $(TMPDIR)/usr/share/dput + install --mode=0644 sftp.py $(TMPDIR)/usr/share/dput install --mode=0644 local.py $(TMPDIR)/usr/share/dput install --mode=0644 rsync.py $(TMPDIR)/usr/share/dput install --mode=0644 dputhelper.py $(TMPDIR)/usr/share/dput/helper diff -Nru dput-0.9.2.35/dput dput-0.9.2.36/dput --- dput-0.9.2.35/dput 2008-09-22 14:01:17.000000000 -0400 +++ dput-0.9.2.36/dput 2008-11-10 05:06:27.000000000 -0500 @@ -26,7 +26,7 @@ sys.path.insert(0,'/usr/share/dput/helper') import dputhelper -dput_version = "dput 0.9.2.30" +dput_version = "dput 0.9.2.36" config = None upload_methods = {} @@ -698,6 +698,13 @@ elif len(args) == 1 and not check_only: package_to_upload = args[0:] else: + if ':' in args[0]: + args[0], hostArgument = args[0].split(":", 1) + if config.has_section(args[0]): + config.set(args[0], args[0], hostArgument) + else: + config.set(args[0], args[0], "") + if not check_only: if debug: print "D: Checking if a host was named on the command line." @@ -758,6 +765,10 @@ else: host = preferred_host + if not config.has_section(host): + print "E: No host %s found in config" % host + sys.exit(1) + # Check if we already did this upload or not check_upload_logfile(package_name, host, check_only, call_lintian, force_upload, debug) diff -Nru dput-0.9.2.35/dput.1 dput-0.9.2.36/dput.1 --- dput-0.9.2.35/dput.1 2008-09-22 14:01:17.000000000 -0400 +++ dput-0.9.2.36/dput.1 2008-11-10 04:56:30.000000000 -0500 @@ -6,7 +6,7 @@ .SH SYNTAX .B dput [\fIoptions\fR] -[\fBhost\fR] +[\fBhost\fR[:\fBargument\fR]] \fBpackage.changes\fR ... .SH DESCRIPTION This is a tool for uploading Debian packages into the archive. You may specify @@ -14,13 +14,17 @@ .I host argument. If omitted, dput uses the host specified by .I default_host -(or, historically \fIdefault_host_non-us\fR) configuration option. -Also you have to pass the program one or more name of +(or, historically \fIdefault_host_non-us\fR) configuration option. You also can +pass an argument to the host by appending the hostname with a colon followed +by the argument. For example, you can upload easily to different launchpad PPAs +by passing the PPAs' id to the ppa host without having to modify dput.cf. +.P +You have to pass the program one or more name of .I package.changes files and then they will be sequentially uploaded. .P This program will then upload the package for you into the archive, using a -selected upload method. Currently dput supports ftp, scp, rsync, http, +selected upload method. Currently dput supports ftp, scp, rsync, http, sftp, https, and local. The method scripts have been split from the main script so it is easy to add new methods. Look in /usr/share/dput/ for examples. diff -Nru dput-0.9.2.35/dput.cf dput-0.9.2.36/dput.cf --- dput-0.9.2.35/dput.cf 2008-09-22 14:30:40.000000000 -0400 +++ dput-0.9.2.36/dput.cf 2008-11-10 05:08:46.000000000 -0500 @@ -87,8 +87,7 @@ [ppa] fqdn = ppa.launchpad.net method = ftp -# replace with your Launchpad ID -incoming = ~/ubuntu +incoming = ~%(ppa)s/ubuntu login = anonymous [mentors] diff -Nru dput-0.9.2.35/dput.cf.5 dput-0.9.2.36/dput.cf.5 --- dput-0.9.2.35/dput.cf.5 2008-09-22 14:01:17.000000000 -0400 +++ dput-0.9.2.36/dput.cf.5 2008-11-10 04:56:30.000000000 -0500 @@ -53,6 +53,10 @@ the package will be uploaded using ssh's scp. This transfers files using a secure ssh tunnel, and needs an account on the upload machine. .TP +.I sftp +the package will be uploaded using ssh's sftp. This transfers files using a +secure ssh tunnel, and needs sftp access on the upload machine. +.TP .I rsync the package will be uploaded using rsync over ssh. This is similar to scp, but can save some bandwidth if the destination file already exists on the @@ -150,6 +154,13 @@ This defines the default host for packages that are allowed to be uploaded to the main archive. This variable is used when guessing the host to upload to. +.SH HOST ARGUMENT +.P +If a user passes an argument to a host by appending the hostname with a colon, +.B %(HOSTNAME)s +will be replaced with the specified argument. Otherwise, it will be replaced +with an empty string. + .SH BUGS .P Please send bug reports to the author. diff -Nru dput-0.9.2.35/ftp.py dput-0.9.2.36/ftp.py --- dput-0.9.2.35/ftp.py 2008-09-22 14:01:17.000000000 -0400 +++ dput-0.9.2.36/ftp.py 2008-11-10 04:56:30.000000000 -0500 @@ -71,4 +71,10 @@ print "D: Should exit silently now, but will throw exception for debug." raise sys.exit(1) - ftp_connection.quit() + try: + ftp_connection.quit() + except Exception, e: + if debug: + print "D: %s thrown while attmempting to properly quit ftp session." % e + print "D: Throwing exception for debugging purposes." + raise diff -Nru dput-0.9.2.35/sftp.py dput-0.9.2.36/sftp.py --- dput-0.9.2.35/sftp.py 1969-12-31 19:00:00.000000000 -0500 +++ dput-0.9.2.36/sftp.py 2008-11-10 04:56:30.000000000 -0500 @@ -0,0 +1,38 @@ +# sftp.py - dput method for sftp transport +# +# @author Cody A.W. Somerville +# @company Canonical Ltd. +# @date 07 November 2008 +# + +import os, sys + +try: + import bzrlib.transport +except Exception, e: + print "E: bzrlib must be installed to use sftp transport." + sys.exit(1) + +def upload(fqdn, login, incoming, files, debug, compress, progress=0): + if not login or login == '*': + login = os.getenv("USER") + + if not incoming.endswith("/"): + incoming = "%s/" % incoming + + try: + t = bzrlib.transport.get_transport("sftp://%s/%s" % (fqdn, incoming)) + except Exception, e: + print "%s\nE: Error connecting to remote host." % e + sys.exit(1) + + for f in files: + baseFilename = f.split("/")[len(f.split("/"))-1] + sys.stdout.write(" %s: " % baseFilename) + sys.stdout.flush() + try: + t.put_file(baseFilename, file(f, 'rb')) + except Exception, e: + print "\n%s\nE: Error uploading file." % e + sys.exit(1) + print "done."