#589913 dput: Support Ubuntu-style “host argument” parameter

Package:
dput
Source:
dput
Submitter:
Umang Varma
Date:
2022-09-20 21:48:03 UTC
Severity:
wishlist
Tags:
#589913#5
Date:
2010-07-22 07:59:08 UTC
From:
To:
Hello,

Since dput has a [ppa] section in /etc/dput.cf, it might as well be
tweaked so that uploading to a ppa may work as documented. The relevant
section is currently this:

	[ppa]
	fqdn                    = ppa.launchpad.net
	method                  = ftp
	# replace <launchpad-id> with your Launchpad ID
	incoming                = ~<launchpad-id>/ubuntu
	login                   = anonymous

Please change it to the Ubuntu default of

	[ppa]
	fqdn			= ppa.launchpad.net
	method			= ftp
	incoming		= ~%(ppa)s/ubuntu
	login			= anonymous

This way you can upload using `dput ppa:myusername/myppa ...` instead of
having to manually change ~/.dput.cf. This will also let a program like
quickly work on Debian (once it is packaged).

Thanks,

Umang

#589913#10
Date:
2010-07-22 13:30:58 UTC
From:
To:
 My bad. I didn't notice that the argument support is also an Ubuntu
modification.

Maybe as a wishlist request to port argument support from Ubuntu?

Just as a background, I've been trying to get `quickly` to work on
Debian and it runs dput assuming argument support. So it breaks when it
tries to upload to Launchpad's PPAs.

#589913#17
Date:
2016-12-28 12:22:12 UTC
From:
To:
Support for a specific non-Debian archive structure should not be a
part of Debian's ‘dput’.

Thank you for the patch.

While I can understand the desire for this, it is not compelling
enough to add functionality to a Debian-native tool for archives that
are not standard to Debian.

So long as this is a feature specific to a particular non-Debian
infrastructure, it is best that it not be a standard feature in
Debian's ‘dput’.

#589913#34
Date:
2021-03-07 05:25:14 UTC
From:
To:
dput is a package used by folks from many different distros, including
Debian, Ubuntu, many other derivatives and probably some private
archives for specific companies. The audience for it is much wider than
just members of the Debian Project, so it seems reasonable for it to
meet the needs of the entire audience instead of just Debian folks.

There has been talk of adding secondary archives to Debian too (aka
bikesheds), so probably this argument mechanism will be useful for
Debian itself at some point.

#589913#39
Date:
2022-09-20 21:44:56 UTC
From:
To:
Would you consider adding host argument support without providing a
[ppa] implementation? Users could then opt-in by adding a [ppa]
section to their /etc/dput.cf (or ~/.dput.cf). Here's just that piece
of the Ubuntu delta:

diff -urpN dput-1.1.2.orig/doc/man/dput.1 dput-1.1.2/doc/man/dput.1
--- dput-1.1.2.orig/doc/man/dput.1	2022-07-01 16:15:28.000000000 -0600
+++ dput-1.1.2/doc/man/dput.1	2022-09-20 15:28:47.064454572 -0600
@@ -15,7 +15,7 @@
 .OP \-DPUVdflosu
 .OP \-c CONFIGFILE
 .OP \-e DAYS
-.RI [ HOSTNAME ]
+.RI [ HOSTNAME [:ARGUMENT] ]
 .I CHANGESFILE
 \f[R].\|.\|.\f[]
 .YS
@@ -65,6 +65,10 @@ can perform on each package.
 configuration. If not specified, \f[I]HOSTNAME\f[] defaults to the
 value of the \f[B]default_host_main\f[] configuration parameter.
 .
+You also can
+pass an argument to the host by appending the hostname with a colon followed
+by the argument.
+.
 .P
 The file transfer method is determined by the \f[B]method\f[]
 configuration parameter for the specified host. See
diff -urpN dput-1.1.2.orig/doc/man/dput.cf.5 dput-1.1.2/doc/man/dput.cf.5
--- dput-1.1.2.orig/doc/man/dput.cf.5	2022-07-01 16:15:28.000000000 -0600
+++ dput-1.1.2/doc/man/dput.cf.5	2022-09-20 15:27:07.403817539 -0600
@@ -340,6 +340,14 @@ for packages that are allowed to be uplo
 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 FILES
 .
 .TP
diff -urpN dput-1.1.2.orig/dput/dput.py dput-1.1.2/dput/dput.py
--- dput-1.1.2.orig/dput/dput.py	2022-07-01 16:15:28.000000000 -0600
+++ dput-1.1.2/dput/dput.py	2022-09-20 15:31:00.221305900 -0600
@@ -979,6 +979,19 @@ def main():
     if len(args) == 1 and not options.check_only:
         changes_file_paths = args[0:]
     else:
+        if ':' in args[0]:
+            sys.stdout.write("D: Splitting host argument out of  %s.\n" % args[0])
+            args[0], host_argument = args[0].split(":", 1)
+        else:
+            host_argument = ""
+
+        if config.has_section(args[0]):
+            sys.stdout.write("D: Setting host argument.\n")
+            config.set(args[0], args[0], host_argument)
+        else:
+            # Let the code below handle this as it is sometimes okay (ie. -o)
+            pass
+
         if not options.check_only:
             if options.debug:
                 sys.stdout.write(