Author: adam-guest
Date: 2008-03-15 19:05:17 +0000 (Sat, 15 Mar 2008)
New Revision: 1139

Modified:
   trunk/conf.default.in
   trunk/debian/changelog
   trunk/debian/postinst
   trunk/scripts/debchange.1
   trunk/scripts/debchange.pl
Log:
  + Add an --allow-lower-version option which is similar to
    --force-bad-version but allows a regular expression to be specified
    which the new version must match. Based on a patch by Frank K?\195?\188ster
    (Closes: #381159)

Modified: trunk/conf.default.in
===================================================================
--- trunk/conf.default.in       2008-03-15 15:58:56 UTC (rev 1138)
+++ trunk/conf.default.in       2008-03-15 19:05:17 UTC (rev 1139)
@@ -161,6 +161,10 @@
 #
 # Use a fixed timezone in changelog entries?
 # DEBCHANGE_TZ=UTC
+#
+# Allow a new version to be lower than the current package version
+# if the new version matches the specified regular expression
+# DEBCHANGE_LOWER_VERSION_PATTERN=bpo
 
 ##### debcheckout
 #

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-03-15 15:58:56 UTC (rev 1138)
+++ trunk/debian/changelog      2008-03-15 19:05:17 UTC (rev 1139)
@@ -15,6 +15,10 @@
     + Add non-maintainer uploads (including security and QA uploads),
       backports and the use of local version strings to the list of
       cases where debchange doesn't have to guess the user's intentions
+    + Add an --allow-lower-version option which is similar to
+      --force-bad-version but allows a regular expression to be specified
+      which the new version must match. Based on a patch by Frank Küster
+      (Closes: #381159)
   * checkbashisms:
     + Use Getopt::Long for option parsing
     + Add an option to force checking of scripts that would normally be

Modified: trunk/debian/postinst
===================================================================
--- trunk/debian/postinst       2008-03-15 15:58:56 UTC (rev 1138)
+++ trunk/debian/postinst       2008-03-15 19:05:17 UTC (rev 1139)
@@ -423,6 +423,17 @@
 
 EOF
        fi
+
+       if dpkg --compare-versions "$2" lt 2.10.19
+       then
+           # Added in devscripts 2.10.19
+           cat >> /etc/devscripts.conf <<EOF
+# Allow a new version to be lower than the current package version
+# if the new version matches the specified regular expression
+# DEBCHANGE_LOWER_VERSION_PATTERN=bpo
+
+EOF
+       fi
     fi
 fi
 

Modified: trunk/scripts/debchange.1
===================================================================
--- trunk/scripts/debchange.1   2008-03-15 15:58:56 UTC (rev 1138)
+++ trunk/scripts/debchange.1   2008-03-15 19:05:17 UTC (rev 1139)
@@ -100,9 +100,9 @@
 prevented by using the \fB\-\-preserve\fR command line or
 configuration file option as described below.
 .PP
-If \fB\-\-force\-bad\-version\fR is used, debchange will not stop if
-the new version is less than the current one.  This is especially
-useful while doing backports. 
+If \fB\-\-force\-bad\-version\fR or \fB\-\-allow\-lower\-version\fR is used,
+debchange will not stop if the new version is less than the current one.
+This is especially useful while doing backports. 
 .SH "Directory name checking"
 In common with several other scripts in the \fBdevscripts\fR package,
 \fBdebchange\fR will climb the directory tree until it finds a
@@ -217,6 +217,10 @@
 Force a version number to be less than the current one (e.g., when
 backporting).
 .TP
+.BR \-\-allow\-lower\-version
+Allow a version number to be less than the current one if the new version
+matches the specified pattern.
+.TP
 .BR \-\-force\-distribution
 Force the provided distribution to be used, even if it doesn't match the list 
of known 
 distributions (e.g. for unofficial distributions).
@@ -360,6 +364,10 @@
 .BR DEBCHANGE_TZ
 Use this timezone for changelog entries.  Default is the user/system
 timezone as shown by `date \-R`.
+.TP
+.BR DEBCHANGE_LOWER_VERSION_PATTERN
+If this is set, then it is the same as the
+\fB\-\-allow\-lower\-version command line parameter being used.
 .SH ENVIRONMENT
 .TP
 .BR DEBEMAIL ", " EMAIL ", " DEBFULLNAME ", " NAME

Modified: trunk/scripts/debchange.pl
===================================================================
--- trunk/scripts/debchange.pl  2008-03-15 15:58:56 UTC (rev 1138)
+++ trunk/scripts/debchange.pl  2008-03-15 19:05:17 UTC (rev 1139)
@@ -89,6 +89,9 @@
   -b, --force-bad-version
          Force a version to be less than the current one (e.g., when
          backporting)
+  --allow-lower-version
+         Allow a version to be less than the current one (e.g., when
+         backporting) if it matches a specified pattern
   --force-distribution
          Force the provided distribution to be used, even if it doesn't match
          the list of known distributions
@@ -170,6 +173,7 @@
 my $opt_multimaint_merge = 0;
 my $opt_tz = undef;
 my $opt_t = '';
+my $opt_allow_lower = '';
 
 # Next, read configuration files and then command line
 # The next stuff is boilerplate
@@ -189,6 +193,7 @@
                       'DEBCHANGE_TZ' => $ENV{TZ}, # undef if TZ unset
                       'DEBCHANGE_MULTIMAINT_MERGE' => 'no',
                       'DEBCHANGE_MAINTTRAILER' => '',
+                      'DEBCHANGE_LOWER_VERSION_PATTERN' => '',
                       );
     $config_vars{'DEBCHANGE_TZ'} ||= '';
     my %config_default = %config_vars;
@@ -237,6 +242,7 @@
     $opt_multimaint_merge = $config_vars{'DEBCHANGE_MULTIMAINT_MERGE'} eq 'no' 
? 0 : 1;
     $opt_t = ($config_vars{'DEBCHANGE_MAINTTRAILER'} eq 'no' ? 0 : 1)
        if $config_vars{'DEBCHANGE_MAINTTRAILER'};
+    $opt_allow_lower = $config_vars{'DEBCHANGE_LOWER_VERSION_PATTERN'};
 }
 
 # We use bundling so that the short option behaviour is the same as
@@ -258,6 +264,7 @@
           "package=s" => \$opt_package,
           "v|newversion=s" => \$opt_v,
           "b|force-bad-version" => \$opt_b,
+          "allow-lower-version" => \$opt_allow_lower,
           "force-distribution" => \$opt_force_dist,
           "d|fromdirname" => \$opt_d,
           "p" => \$opt_p,
@@ -370,8 +377,8 @@
 
 if ($opt_create) {
     if ($opt_a || $opt_i || $opt_e || $opt_r || $opt_b || $opt_n || $opt_bn ||
-           $opt_qa || $opt_s || $opt_bpo || $opt_l) {
-       warn "$progname warning: ignoring 
-a/-i/-e/-r/-b/-n/--bin-nmu/--qa/-s/--bpo/-l options with --create\n";
+           $opt_qa || $opt_s || $opt_bpo || $opt_l || $opt_allow_lower) {
+       warn "$progname warning: ignoring 
-a/-i/-e/-r/-b/--allow-lower-version/-n/--bin-nmu/--qa/-s/--bpo/-l options with 
--create\n";
        $warnings++;
     }
     if ($opt_package && $opt_d) {
@@ -859,7 +866,7 @@
 
        if (system("dpkg --compare-versions $VERSION lt $NEW_VERSION" .
                  " 2>/dev/null 1>&2")) {
-           if ($opt_b) {
+           if ($opt_b or ($opt_allow_lower and $NEW_VERSION =~ 
/$opt_allow_lower/)) {
                warn "$progname warning: new version ($NEW_VERSION) is less 
than\n" .
                    "the current version number ($VERSION).\n";
            } else {



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to