Bug#711356: debchange: Allow config overrides in environment
On Thu, Jun 06, 2013 at 04:16:28PM +0200, Loïc Minier wrote: > It would be nice if dch configs could be overriden from the environment > as per attached patch. This would likely be useful in more than my > specfic use case, but here's why I'd like this feature: I work on > Debian, Linaro and Ubuntu packages with Debian, Ubuntu, Linaro and other > hats and from various environments. I have my shell config to set my > git/bzr/dch name and email address as follow: > alias debian='EMAIL="lool-nospam-debian.org" BZR_EMAIL="Loïc Minier > <$EMAIL>"' > alias linaro='EMAIL="loic.minier-nospam-linaro.org" BZR_EMAIL="Loïc > Minier <$EMAIL>"' > alias ubuntu='EMAIL="loic.minier-nospam-ubuntu.com" BZR_EMAIL="Loïc > Minier <$EMAIL>"' > export NAME="Loïc Minier" > export EMAIL="lool-nospam-dooz.org" Adding the appropriate variant of DEBFULLNAME="Loïc Minier to your aliases should resolve most of your request, since DEBFULLNAME is one of the few environment variables we honor. > I'd like to do the same with the DEBCHANGE_VENDOR which is used for > version number heuristics, but currently devscripts only read from > command-line or config files; hence the attached patch to read from the > environment. There was a specific choice at some point in devscripts' history not to honor configuration from the environment except for a select few items (like DEBFULLNAME). It's been that way, as far as I can tell, the entirety of devscripts' history, so I'm hesitant to change that, especially just for one script. Hopefully at least the DEBFULLNAME information helps. Cheers, -- James GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy signature.asc Description: Digital signature
Bug#711356: debchange: Allow config overrides in environment
Package: devscripts Version: 2.13.2 Severity: wishlist File: /usr/bin/dch Tags: patch Hi there! It would be nice if dch configs could be overriden from the environment as per attached patch. This would likely be useful in more than my specfic use case, but here's why I'd like this feature: I work on Debian, Linaro and Ubuntu packages with Debian, Ubuntu, Linaro and other hats and from various environments. I have my shell config to set my git/bzr/dch name and email address as follow: alias debian='EMAIL="lool-nospam-debian.org" BZR_EMAIL="Loïc Minier <$EMAIL>"' alias linaro='EMAIL="loic.minier-nospam-linaro.org" BZR_EMAIL="Loïc Minier <$EMAIL>"' alias ubuntu='EMAIL="loic.minier-nospam-ubuntu.com" BZR_EMAIL="Loïc Minier <$EMAIL>"' export NAME="Loïc Minier" export EMAIL="lool-nospam-dooz.org" (inserted nospam in place of @) This alllows me to work with my Debian hat by prefixing commands with debian: debian dch -a debian debcommit or to switch my shell config to my Linaro hat with: linaro dch -a debcommit etc. I'd like to do the same with the DEBCHANGE_VENDOR which is used for version number heuristics, but currently devscripts only read from command-line or config files; hence the attached patch to read from the environment. Cheers, -- Loïc Minier >From 87df467c805c156486e69a4e94e2fc35f3161245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Minier?= Date: Thu, 6 Jun 2013 16:06:09 +0200 Subject: [PATCH] debchange: Allow config overrides in environment --- scripts/debchange.pl | 5 + 1 file changed, 5 insertions(+) diff --git a/scripts/debchange.pl b/scripts/debchange.pl index 98acd63..684e5b8 100755 --- a/scripts/debchange.pl +++ b/scripts/debchange.pl @@ -314,6 +314,11 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) { my $shell_out = `/bin/bash -c '$shell_cmd'`; @config_vars{keys %config_vars} = split /\n/, $shell_out, -1; +# Allow overrides in the environment +foreach my $var (keys %config_vars) { +$config_vars{$var} = $ENV{$var} if $ENV{$var}; +} + # Check validity $config_vars{'DEBCHANGE_PRESERVE'} =~ /^(yes|no)$/ or $config_vars{'DEBCHANGE_PRESERVE'}='no'; -- 1.8.3