[devscripts] 05/06: debchange: Add support for uploads to Debian LTS with the new --lts flag

Mattia Rizzolo mattia at debian.org
Sat Nov 11 23:16:38 UTC 2017


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository devscripts.

commit 7200782daaefe13adcad3e68303b60d7cc8641df
Author: Antoine Beaupré <anarcat at debian.org>
Date:   Sun Nov 12 00:12:46 2017 +0100

    debchange: Add support for uploads to Debian LTS with the new --lts flag
    
    Closes: #762715
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
 scripts/debchange.1               |  4 ++++
 scripts/debchange.bash_completion |  2 +-
 scripts/debchange.pl              | 36 ++++++++++++++++++++++++------------
 test/test_debchange               |  3 +++
 4 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/scripts/debchange.1 b/scripts/debchange.1
index f539494..f29d681 100644
--- a/scripts/debchange.1
+++ b/scripts/debchange.1
@@ -246,6 +246,10 @@ appending a "build1" or by incrementing a rebuild version number.
 Increment the Debian release number for a Debian Security Team non-maintainer
 upload, and add a \fBSecurity Team upload\fR changelog comment.
 .TP
+.BR \-\-lts
+Increment the Debian release number for a LTS Security Team non-maintainer
+upload, and add a \fBLTS Security Team upload\fR changelog comment.
+.TP
 .B \-\-team
 Increment the Debian release number for a team upload, and add a \fBTeam upload\fR
 changelog comment.
diff --git a/scripts/debchange.bash_completion b/scripts/debchange.bash_completion
index 85df282..d136eb6 100644
--- a/scripts/debchange.bash_completion
+++ b/scripts/debchange.bash_completion
@@ -11,7 +11,7 @@ _debchange()
     prev=${COMP_WORDS[COMP_CWORD-1]}
     options='-a --append -i --increment -v --newversion -e --edit\
              -r --release --force-save-on-release --no-force-save-on-release\
-             --create --empty --package --auto-nmu --no-auto-nmu -n --nmu\
+             --create --empty --package --auto-nmu --no-auto-nmu -n --nmu --lts\
              --bin-nmu -q --qa -R --rebuild -s --security --team -U --upstream\
              --bpo --stable -l --local -b --force-bad-version --allow-lower-version\
              --force-distribution --closes --noquery --query -d --fromdirname\
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index 75c9ac6..d4ac8da 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -154,6 +154,8 @@ Options:
          Increment the Debian release number for a no-change rebuild
   -s, --security
          Increment the Debian release number for a Debian Security Team upload
+  --lts
+         Increment the Debian release number for a LTS Security Team upload
   --team
          Increment the Debian release number for a team upload
   -U, --upstream
@@ -231,7 +233,7 @@ Options:
   --version
          Display version information
   At most one of -a, -i, -e, -r, -v, -d, -n, --bin-nmu, -q, --qa, -R, -s,
-  --team, --bpo, --stable, -l (or their long equivalents) may be used.
+  --lts, --team, --bpo, --stable, -l (or their long equivalents) may be used.
   With no options, one of -i or -a is chosen by looking at the release
   specified in the changelog.
 
@@ -351,7 +353,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_R, $opt_s, $opt_team, $opt_U, $opt_bpo, $opt_stable, $opt_l, $opt_c, $opt_m, $opt_M, $opt_create, $opt_package, @closes);
+my ($opt_n, $opt_bn, $opt_qa, $opt_R, $opt_s, $opt_lts, $opt_team, $opt_U, $opt_bpo, $opt_stable, $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);
 
@@ -381,6 +383,7 @@ GetOptions("help|h" => \$opt_help,
 	   "team" => \$opt_team,
 	   "U|upstream" => \$opt_U,
 	   "bpo" => \$opt_bpo,
+           "lts" => \$opt_lts,
 	   "stable" => \$opt_stable,
 	   "l|local=s" => \$opt_l,
 	   "query!" => \$opt_query,
@@ -433,8 +436,8 @@ if (defined $opt_level) {
 if (defined $opt_regex) { $check_dirname_regex = $opt_regex; }
 
 # Only allow at most one non-help option
-fatal "Only one of -a, -i, -e, -r, -v, -d, -n/--nmu, --bin-nmu, -q/--qa, -R/--rebuild, -s/--security, --team, --bpo, --stable, -l/--local is allowed;\ntry $progname --help for more help"
-    if ($opt_i?1:0) + ($opt_a?1:0) + ($opt_e?1:0) + ($opt_r?1:0) + ($opt_v?1:0) + ($opt_d?1:0) + ($opt_n?1:0) + ($opt_bn?1:0) + ($opt_qa?1:0) + ($opt_R?1:0) + ($opt_s?1:0) + ($opt_team?1:0) + ($opt_bpo?1:0) + ($opt_stable?1:0) + ($opt_l?1:0) > 1;
+fatal "Only one of -a, -i, -e, -r, -v, -d, -n/--nmu, --bin-nmu, -q/--qa, -R/--rebuild, -s/--security, --lts, --team, --bpo, --stable, -l/--local is allowed;\ntry $progname --help for more help"
+    if ($opt_i?1:0) + ($opt_a?1:0) + ($opt_e?1:0) + ($opt_r?1:0) + ($opt_v?1:0) + ($opt_d?1:0) + ($opt_n?1:0) + ($opt_bn?1:0) + ($opt_qa?1:0) + ($opt_R?1:0) + ($opt_s?1:0) + ($opt_lts?1:0) + ($opt_team?1:0) + ($opt_bpo?1:0) + ($opt_stable?1:0) + ($opt_l?1:0) > 1;
 
 if ($opt_s) {
     $opt_u = "high";
@@ -468,7 +471,7 @@ if (defined $opt_vendor && $opt_vendor) {
     }
 }
 $vendor ||= 'Debian';
-if ($vendor eq 'Ubuntu' and ($opt_n or $opt_bn or $opt_qa or $opt_bpo or $opt_stable)) {
+if ($vendor eq 'Ubuntu' and ($opt_n or $opt_bn or $opt_qa or $opt_bpo or $opt_stable or $opt_lts)) {
     $vendor = 'Debian';
 }
 
@@ -543,9 +546,9 @@ fatal "--package cannot be used when creating a NEWS file"
 
 if ($opt_create) {
     if ($opt_a || $opt_i || $opt_e || $opt_r || $opt_b || $opt_n || $opt_bn ||
-            $opt_qa || $opt_R || $opt_s || $opt_team || $opt_bpo ||
+            $opt_qa || $opt_R || $opt_s || $opt_lts || $opt_team || $opt_bpo ||
             $opt_stable || $opt_l || $opt_allow_lower) {
-        warn "$progname warning: ignoring -a/-i/-e/-r/-b/--allow-lower-version/-n/--bin-nmu/-q/--qa/-R/-s/--team/--bpo/--stable,-l options with --create\n";
+        warn "$progname warning: ignoring -a/-i/-e/-r/-b/--allow-lower-version/-n/--bin-nmu/-q/--qa/-R/-s/--lts/--team/--bpo/--stable,-l options with --create\n";
         $warnings++;
     }
     if ($opt_package && $opt_d) {
@@ -613,6 +616,7 @@ my $EMAIL = 'EMAIL';
 my $DISTRIBUTION = 'UNRELEASED';
 # when updating the lines below also update the help text, the manpage and the testcases.
 my %dists = ( 60, 'squeeze', 70, 'wheezy', 7, 'wheezy', 8, 'jessie', 9, 'stretch' );
+my $lts_dist = '7';
 my $latest_dist = '9';
 # dist guessed from backports, SRU, security uploads...
 my $guessed_dist = '';
@@ -820,7 +824,7 @@ if ($opt_M) {
 
 #####
 
-if ($opt_auto_nmu eq 'yes' and ! $opt_v and ! $opt_l and ! $opt_s and
+if ($opt_auto_nmu eq 'yes' and ! $opt_v and ! $opt_l and ! $opt_s and ! $opt_lts and
     ! $opt_team and ! $opt_qa and ! $opt_R and ! $opt_bpo and ! $opt_bn and
     ! $opt_n and ! $opt_c and ! $opt_stable and
     ! (exists $ENV{'CHANGELOG'} and length $ENV{'CHANGELOG'}) and ! $opt_M and
@@ -957,7 +961,7 @@ if ($opt_news && !$opt_i && !$opt_a) {
 
 # Are we going to have to figure things out for ourselves?
 if (! $opt_i && ! $opt_v && ! $opt_d && ! $opt_a && ! $opt_e && ! $opt_r &&
-    ! $opt_n && ! $opt_bn && ! $opt_qa && ! $opt_R && ! $opt_s && ! $opt_team &&
+    ! $opt_n && ! $opt_bn && ! $opt_qa && ! $opt_R && ! $opt_s && !$opt_lts && ! $opt_team &&
     ! $opt_bpo && ! $opt_stable && ! $opt_l && ! $opt_create) {
     # Yes, we are
     if ($opt_release_heuristic eq 'log') {
@@ -1034,7 +1038,7 @@ my $line;
 my $optionsok=0;
 my $merge=0;
 
-if (($opt_i || $opt_n || $opt_bn || $opt_qa || $opt_R || $opt_s || $opt_team ||
+if (($opt_i || $opt_n || $opt_bn || $opt_qa || $opt_R || $opt_s || $opt_lts || $opt_team ||
      $opt_bpo || $opt_stable || $opt_l || $opt_v || $opt_d ||
     ($opt_news && $VERSION ne $changelog->{Version})) && ! $opt_create) {
 
@@ -1139,6 +1143,9 @@ if (($opt_i || $opt_n || $opt_bn || $opt_qa || $opt_R || $opt_s || $opt_team ||
 		$end .= "~bpo$latest_dist+1";
 	    } elsif ($opt_stable and not $start =~ /\+deb\d+u/) {
 		$end .= "+deb${latest_dist}u1";
+            } elsif ($opt_lts and not $start =~ /\+deb\d+u/) {
+                $end .= "+deb${lts_dist}u1";
+                $guessed_dist = $dists{$lts_dist} . '-security';
 	    } elsif ($opt_l and not $start =~ /\Q$opt_l\E/) {
 		# If it's not already a local package make it so
 		# otherwise we can be safe if we behave like dch -i
@@ -1170,11 +1177,11 @@ if (($opt_i || $opt_n || $opt_bn || $opt_qa || $opt_R || $opt_s || $opt_team ||
 
 		# Attempt to set the distribution for a stable upload correctly
 		# based on the version of the previous upload
-		if ($opt_stable || $opt_bpo || $opt_s) {
+		if ($opt_stable || $opt_bpo || $opt_s || $opt_lts) {
 		    my $previous_dist = $start;
 		    $previous_dist =~ s/^.*[+~](?:deb|bpo)(\d+)(?:u\+)\d+$/$1/;
 		    if (defined $previous_dist and defined $dists{$previous_dist}) {
-                if ($opt_s) {
+                if ($opt_s || $opt_lts) {
                     $guessed_dist = $dists{$previous_dist} . '-security';
                 } elsif ($opt_bpo) {
                     $guessed_dist = $dists{$previous_dist} . '-backports';
@@ -1183,6 +1190,8 @@ if (($opt_i || $opt_n || $opt_bn || $opt_qa || $opt_R || $opt_s || $opt_team ||
                 }
             } elsif ($opt_s) {
                     $guessed_dist = $dists{$latest_dist} . '-security';
+            } elsif ($opt_lts) {
+                    $guessed_dist = $dists{$lts_dist} . '-security';
             } else {
                 # Fallback to using the previous distribution
                 $guessed_dist = $changelog->{Distribution};
@@ -1264,6 +1273,9 @@ if (($opt_i || $opt_n || $opt_bn || $opt_qa || $opt_R || $opt_s || $opt_team ||
 		print O "  * Non-maintainer upload by the Security Team.\n";
 	    }
 	    $line = 1;
+	} elsif ($opt_lts && ! $opt_news) {
+		print O "  * Non-maintainer upload by the LTS Security Team.\n";
+		$line = 1;
 	} elsif ($opt_team && ! $opt_news) {
 	    print O "  * Team upload.\n";
 	    $line = 1;
diff --git a/test/test_debchange b/test/test_debchange
index 03e496d..7dd5248 100755
--- a/test/test_debchange
+++ b/test/test_debchange
@@ -165,6 +165,9 @@ testEncoding() {
     success "-s \"Security upload\""
     verifyMaintainer "dch -s"
 
+    success "-s \"LTS Security upload\""
+    verifyMaintainer "dch --lts"
+
     success "--bpo \"Backports upload\""
     verifyMaintainer "dch --bpo"
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list