The following commit has been merged in the master branch:
commit bcf5b91012270362523a7c9426fa025ada977a23
Author: James Vega <james...@debian.org>
Date:   Sun May 1 22:09:10 2011 -0400

    debchange: Add -M option to use debian/control's Maintainer information.
    
    Closes: #560900
    Signed-off-by: James Vega <james...@debian.org>

diff --git a/debian/changelog b/debian/changelog
index 82a11e0..7496c94 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ devscripts (2.10.73) UNRELEASED; urgency=low
       Lindfors for the patch.  (Closes: #587523)
     + Only download a file if it doesn't exist or its hashsum doesn't match
       the one specified by snapshot.d.o.
+  * debchange: Add -M option to use debian/control's Maintainer information.
+    Thanks to Modestas Vainius for the patch.  (Closes: #560900)
 
   [ Benjamin Drung ]
   * Add myself to uploaders.
diff --git a/scripts/debchange.1 b/scripts/debchange.1
index 00fd9b1..0a3ebc7 100644
--- a/scripts/debchange.1
+++ b/scripts/debchange.1
@@ -327,6 +327,14 @@ Note that there may be some interesting interactions if
 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 \fIdebian/control\fR \fBMaintainer\fR 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 \-\-\fR[\fBno\fR]\fBmainttrailer ", " \-t
 If mainttrailer is set, it will avoid modifying the existing changelog
 trailer line (i.e. the maintainer and date-stamp details), unless
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index f72f4dd..5885ebe 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -164,6 +164,8 @@ Options:
          (default: do not)
   -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
@@ -304,7 +306,7 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
 # 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_team, $opt_bpo, $opt_l, $opt_c, 
$opt_m, $opt_create, $opt_package, @closes);
+my ($opt_n, $opt_bn, $opt_qa, $opt_s, $opt_team, $opt_bpo, $opt_l, $opt_c, 
$opt_m, $opt_M, $opt_create, $opt_package, @closes);
 my ($opt_news);
 my ($opt_level, $opt_regex, $opt_noconf, $opt_empty);
 
@@ -342,6 +344,7 @@ GetOptions("help|h" => \$opt_help,
           'multimaint-merge!' => \$opt_multimaint_merge,
           'multi-maint-merge!' => \$opt_multimaint_merge,
           "m|maintmaint" => \$opt_m,
+          "M|controlmaint" => \$opt_M,
           "t|mainttrailer!" => \$opt_t,
           "check-dirname-level=s" => \$opt_level,
           "check-dirname-regex=s" => \$opt_regex,
@@ -671,7 +674,7 @@ if (! exists $env{'DEBEMAIL'} or ! exists 
$env{'DEBFULLNAME'}) {
 }
 
 # 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'}) {
@@ -716,13 +719,33 @@ if (! $opt_m) {
        $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 = Parse::DebControl->new;
+           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_team 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)) {

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to pkg-devscripts-unsubscr...@teams.debian.net.

Reply via email to