Package: devscripts
Version: 2.10.59
Severity: wishlist
File: /usr/bin/debchange
Tags: patch

Hello,

it would be great if debchage optionally allowed to use maintainer details from
debian/control rather than DEBFULLNAME/DEBEMAIL. I suggested a couple of use
cases in the updated manual page (quoted below). A patch implementing this
feature is attached.

.BR \-\-controlmaint ", " \-M
Use maintainer details from the debian/control Maintainer field rather than
relevant environment variables (\fBDEBFULLNAME\fR/\fBDEBEMAIL\fR etc.). This
option might be useful to restore details of the main maintainer in the
changelog trailer after a bogus edit (e.g. when \fB\-m\fR was intended but
forgot) or when releasing a package in the name of the main maintainer (e.g.
the team).


-- Package-specific info:

--- /etc/devscripts.conf ---
DEBSIGN_MAINT="Modestas Vainius"
DEBCHANGE_RELEASE_HEURISTIC=changelog
DEBCHANGE_MULTIMAINT_MERGE=yes
DEBCHANGE_MAINTTRAILER=yes

--- ~/.devscripts ---
Not present

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/1 CPU core)
Locale: LANG=lt_LT.UTF-8, LC_CTYPE=lt_LT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages devscripts depends on:
ii  dpkg-dev                      1.15.5.4   Debian package development tools
ii  libc6                         2.10.2-2   GNU C Library: Shared libraries
ii  perl                          5.10.1-8   Larry Wall's Practical Extraction 

Versions of packages devscripts recommends:
ii  at                 3.1.12-1              Delayed job execution and batch pr
ii  bsd-mailx [mailx]  8.1.2-0.20090911cvs-2 simple mail user agent
ii  bzr                2.0.2-1               easy to use distributed version co
ii  curl               7.19.7-1              Get a file from an HTTP, HTTPS or 
ii  cvs                1:1.12.13-12          Concurrent Versions System
ii  dctrl-tools        2.14                  Command-line tools to process Debi
pn  debian-keyring     <none>                (no description available)
pn  debian-maintainers <none>                (no description available)
ii  dput               0.9.5.1               Debian package upload tool
ii  dupload            2.6.6                 utility to upload Debian packages
ii  equivs             2.0.7-0.1             Circumvent Debian package dependen
ii  fakeroot           1.14.4-1              Gives a fake root environment
ii  git-core           1:1.6.5.4-1           fast, scalable, distributed revisi
ii  gnupg              1.4.10-2              GNU privacy guard - a free PGP rep
ii  iceweasel [www-bro 3.5.5-1               lightweight web browser based on M
ii  konqueror [www-bro 4:4.3.4-1             KDE 4's advanced file manager, web
pn  libauthen-sasl-per <none>                (no description available)
ii  libcrypt-ssleay-pe 0.57-2                Support for https protocol in LWP
ii  libparse-debcontro 2.005-2               Easy OO parsing of Debian control-
ii  libsoap-lite-perl  0.710.10-1            Perl implementation of a SOAP clie
ii  libterm-size-perl  0.2-4+b1              Perl extension for retrieving term
ii  libtimedate-perl   1.1900-1              Time and date functions for Perl
ii  liburi-perl        1.50-1                module to manipulate and access UR
ii  libwww-perl        5.834-1               Perl HTTP/WWW client/server librar
ii  libyaml-syck-perl  1.07-1                fast, lightweight YAML loader and 
ii  links [www-browser 2.2-1+b1              Web browser running in text mode
ii  links2 [www-browse 2.2-1+b1              Web browser running in both graphi
ii  lintian            2.2.18                Debian package checker
ii  lsb-release        3.2-23                Linux Standard Base version report
ii  lynx-cur [www-brow 2.8.8dev.1-1          Text-mode WWW Browser with NLS sup
ii  lzma               4.43-14               Compression method of 7z format in
ii  mailx              1:20081101-2          Transitional package for mailx ren
ii  man-db             2.5.6-4               on-line manual pager
ii  openssh-client [ss 1:5.1p1-8             secure shell client, an rlogin/rsh
ii  patch              2.6-2                 Apply a diff file to an original
ii  patchutils         0.3.1-2               Utilities to work with patches
ii  sensible-utils     0.0.2                 Utilities for sensible alternative
ii  strace             4.5.19-1              A system call tracer
ii  subversion         1.6.6dfsg-2           Advanced version control system
ii  unzip              6.0-1                 De-archiver for .zip files
ii  w3m [www-browser]  0.5.2-2.1             WWW browsable pager with excellent
pn  wdiff              <none>                (no description available)
ii  wget               1.12-1.1              retrieves files from the web

Versions of packages devscripts suggests:
ii  build-essential               11.4       Informational list of build-essent
pn  cvs-buildpackage              <none>     (no description available)
pn  devscripts-el                 <none>     (no description available)
pn  gnuplot                       <none>     (no description available)
ii  libfile-desktopentry-perl     0.04-2     Perl module to handle freedesktop 
pn  libnet-smtp-ssl-perl          <none>     (no description available)
ii  mutt                          1.5.20-5   text-based mailreader supporting M
pn  svn-buildpackage              <none>     (no description available)
ii  w3m                           0.5.2-2.1  WWW browsable pager with excellent

-- no debconf information
Index: scripts/debchange.1
===================================================================
--- scripts/debchange.1	(revision 2051)
+++ scripts/debchange.1	(working copy)
@@ -318,6 +318,14 @@
 multi-maintainer mode is in use; you will probably wish to check the
 changelog manually before uploading it in such cases.
 .TP
+.BR \-\-controlmaint ", " \-M
+Use maintainer details from the debian/control Maintainer field rather than
+relevant environment variables (\fBDEBFULLNAME\fR/\fBDEBEMAIL\fR etc.). This
+option might be useful to restore details of the main maintainer in the
+changelog trailer after a bogus edit (e.g. when \fB\-m\fR was intended but
+forgot) or when releasing a package in the name of the main maintainer (e.g.
+the team).
+.TP
 .BR \-\-[no]mainttrailer ", " \-t
 If mainttrailer is set, it will avoid modifying the existing changelog
 trailer line (i.e. the maintainer and date-stamp details), unless
Index: scripts/debchange.pl
===================================================================
--- scripts/debchange.pl	(revision 2051)
+++ scripts/debchange.pl	(working copy)
@@ -158,6 +158,8 @@
          indicate if multiple maintainers are now involved (default: do so)
   -m, --maintmaint
          Don\'t change (maintain) the maintainer details in the changelog entry
+  -M, --controlmaint
+         Use maintainer name and email from the debian/control Maintainer field
   -t, --mainttrailer
          Don\'t change (maintain) the trailer line in the changelog entry; i.e.
          maintain the maintainer and date/time details
@@ -298,7 +300,7 @@
 # with older debchange versions.
 my ($opt_help, $opt_version);
 my ($opt_i, $opt_a, $opt_e, $opt_r, $opt_v, $opt_b, $opt_d, $opt_D, $opt_u, $opt_force_dist);
-my ($opt_n, $opt_bn, $opt_qa, $opt_s, $opt_bpo, $opt_l, $opt_c, $opt_m, $opt_create, $opt_package, @closes);
+my ($opt_n, $opt_bn, $opt_qa, $opt_s, $opt_bpo, $opt_l, $opt_c, $opt_m, $opt_M, $opt_create, $opt_package, @closes);
 my ($opt_news);
 my ($opt_ignore, $opt_level, $opt_regex, $opt_noconf, $opt_empty);
 
@@ -333,6 +335,7 @@
 	   "multimaint!" => \$opt_multimaint,
 	   "multi-maint!" => \$opt_multimaint,
 	   "m|maintmaint" => \$opt_m,
+	   "M|controlmaint" => \$opt_M,
 	   "t|mainttrailer!" => \$opt_t,
 	   "ignore-dirname" => \$opt_ignore,
 	   "check-dirname-level=s" => \$opt_level,
@@ -668,7 +671,7 @@
 }
 
 # Now use the gleaned values to detemine our MAINTAINER and EMAIL values
-if (! $opt_m) {
+if (! $opt_m and ! $opt_M) {
     if (exists $env{'DEBFULLNAME'}) {
 	$MAINTAINER = $env{'DEBFULLNAME'};
     } elsif (exists $env{'NAME'}) {
@@ -713,13 +716,32 @@
 	$EMAIL = $addr if $addr;
     }
     # Otherwise, $EMAIL retains its default value of the last changelog entry
-} # if (! $opt_m)
+} # if (! $opt_m and ! $opt_M)
 
+if ($opt_M) {
+    if (-f 'debian/control') {
+	if (have_lpdc()) {
+	    my $parser = new Parse::DebControl;
+	    my $deb822 = $parser->parse_file('debian/control', {stripComments => 'true'});
+	    my $maintainer = decode_utf8($deb822->[0]->{'Maintainer'});
+	    if ($maintainer =~ /^(.*)\s+<(.*)>$/) {
+		$MAINTAINER = $1;
+		$EMAIL = $2;
+	    } else {
+		fatal "$progname: invalid debian/control Maintainer field value\n";
+	    }
+	} else {
+	    fatal "$progname: unable to get maintainer from debian/control: $lpdc_broken\n";
+	}
+    } else {
+	fatal "Missing file debian/control";
+    }
+}
 #####
 
 if ($opt_auto_nmu eq 'yes' and ! $opt_v and ! $opt_l and ! $opt_s and 
     ! $opt_qa and ! $opt_bpo and ! $opt_bn and ! $opt_n and ! $opt_c and
-    ! (exists $ENV{'CHANGELOG'} and length $ENV{'CHANGELOG'}) and
+    ! (exists $ENV{'CHANGELOG'} and length $ENV{'CHANGELOG'}) and ! $opt_M and
     ! $opt_create and ! $opt_a_passed and ! $opt_r and ! $opt_e and
     ! ($opt_release_heuristic eq 'changelog' and
 	$changelog{'Distribution'} eq 'UNRELEASED' and ! $opt_i_passed)) {

Reply via email to