Package: dput
Version: 0.9.6.4
Severity: wishlist
Tags: patch

Hi,

Here a patch to allow use of XDG_CONFIG_HOME/debian/dput.cf for settings.
Reading ~/.dput.cf is still provided for convenience.

Regards,
Rodolphe

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.0.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dput depends on:
ii  gnupg   1.4.19-3
ii  python  2.7.9-1

dput recommends no packages.

Versions of packages dput suggests:
ii  lintian         2.5.31
pn  mini-dinstall   <none>
ii  openssh-client  1:6.7p1-6
ii  rsync           3.1.1-3

-- no debconf information
>From 67e6cb24c81f27716558ccb990427da49bedb9e8 Mon Sep 17 00:00:00 2001
From: Rodolphe PELLOUX-PRAYER <rodol...@damsy.net>
Date: Fri, 5 Jun 2015 16:45:53 +0200
Subject: [PATCH] Read dput config from XDG_CONFIG_HOME too.

---
 bash_completion |  2 ++
 dput            | 11 ++++++++---
 dput.1          |  2 +-
 dput.cf.5       |  2 +-
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/bash_completion b/bash_completion
index f08d018..69ecf1d 100644
--- a/bash_completion
+++ b/bash_completion
@@ -19,6 +19,8 @@ _dput()
     hosts=$(
 	{
 	    grep "^\[.*\]" $HOME/.dput.cf 2> /dev/null | tr -d [] || /bin/true
+	    grep "^\[.*\]" $XDG_CONFIG_HOME/debian/dput.cf 2> /dev/null | tr -d [] || /bin/true
+	    grep "^\[.*\]" $HOME/.config/debian/dput.cf 2> /dev/null | tr -d [] || /bin/true
 	    grep "^\[.*\]" /etc/dput.cf 2> /dev/null | tr -d [] || /bin/true
 	} | grep -v '^DEFAULT$' | sort -u)
 
diff --git a/dput b/dput
index 8b6c105..6b62e64 100755
--- a/dput
+++ b/dput
@@ -87,8 +87,8 @@ def parse_changes(chg_fd):
 
 # read configs in this order:
 #   if specified on the command line, only read extra_config
-#   otherwise, read /etc/dput.cf then ~/.dput.cf
-# the config parser will layer values
+#   otherwise, read /etc/dput.cf then $XDG_CONFIG_HOME/debian/dput.cf
+#   then ~/.dput.cf the config parser will layer values
 def read_configs(extra_config, debug):
     global config
 
@@ -116,7 +116,12 @@ def read_configs(extra_config, debug):
     if extra_config:
         config_files = (extra_config,)
     else:
-        config_files = ('/etc/dput.cf', os.path.expanduser("~/.dput.cf"))
+        xdg_config_home = os.getenv('XDG_CONFIG_HOME') or '~/.config'
+        config_files = (
+            '/etc/dput.cf',
+            os.path.expanduser("%s/debian/dput.cf" % xdg_config_home),
+            os.path.expanduser("~/.dput.cf")
+        )
     fd = None
     for config_file in config_files:
         try:
diff --git a/dput.1 b/dput.1
index 719ea3d..e5bdebf 100644
--- a/dput.1
+++ b/dput.1
@@ -114,7 +114,7 @@ Please send bug reports to the author.
 .I /etc/dput.cf
 global dput configuration file
 .TP
-.I ~/.dput.cf
+.I $XDG_CONFIG_HOME/debian/dput.cf or ~/.dput.cf
 peruser dput configuration file
 
 .SH SEE ALSO
diff --git a/dput.cf.5 b/dput.cf.5
index ca14cf0..a4e34df 100644
--- a/dput.cf.5
+++ b/dput.cf.5
@@ -159,7 +159,7 @@ Please send bug reports to the author.
 .I /etc/dput.cf
 global dput configuration file
 .TP
-.I ~/.dput.cf
+.I $XDG_CONFIG_HOME/debian/dput.cf or ~/.dput.cf
 peruser dput configuration file
 
 .SH AUTHOR
--
libgit2 0.22.2

Reply via email to