[SCM] Git repository for devscripts branch, master, updated. v2.11.7-15-g290ccb9

Benjamin Drung bdrung at debian.org
Mon May 28 15:31:42 UTC 2012


The following commit has been merged in the master branch:
commit 290ccb9a6dcabac98a7c8feb341baafc5c2c143c
Author: Benjamin Drung <bdrung at debian.org>
Date:   Mon May 28 17:31:14 2012 +0200

    debchange: Add --vendor= and DEBCHANGE_VENDOR to override the distributor ID returned by dpkg-vendor.

diff --git a/debian/changelog b/debian/changelog
index da7546e..207b8bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,7 +21,12 @@ devscripts (2.11.8) UNRELEASED; urgency=low
       downloaded.
     + Adapt find_repo() to determine the tarball name for native packages.
 
- -- David Prévot <taffit at debian.org>  Sun, 06 May 2012 23:26:05 -0400
+  [ Benjamin Drung ]
+  * debchange:
+    + Add --vendor= and DEBCHANGE_VENDOR to override the distributor ID
+      returned by dpkg-vendor.
+
+ -- Benjamin Drung <bdrung at debian.org>  Mon, 28 May 2012 17:14:12 +0200
 
 devscripts (2.11.7) unstable; urgency=low
 
diff --git a/scripts/debchange.1 b/scripts/debchange.1
index b99d3d3..361fb80 100644
--- a/scripts/debchange.1
+++ b/scripts/debchange.1
@@ -286,6 +286,11 @@ the configuration variables section below.
 \fB \-\-no\-preserve\fR, \fB\-\-nopreserve\fR
 Do not preserve the source tree directory name (default).
 .TP
+\fB\-\-vendor \fIvendor\fR
+Override the distributor ID over the default returned by dpkg-vendor.
+This name is used for heuristics applied to new package versions and for
+sanity checking of the target distribution.
+.TP
 \fB\-\-distribution \fIdist\fR, \fB\-D \fIdist\fR
 Use the specified distribution in the changelog entry being edited,
 instead of using the previous changelog entry's distribution for new
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index 5d786fa..126297f 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -147,6 +147,8 @@ Options:
          Preserve the directory name
   --no-preserve
          Do not preserve the directory name (default)
+  --vendor <vendor>
+         Override the distributor ID from dpkg-vendor.
   -D, --distribution <dist>
          Use the specified distribution in the changelog entry being edited
   -u, --urgency <urgency>
@@ -223,6 +225,7 @@ my $opt_t = '';
 my $opt_allow_lower = '';
 my $opt_auto_nmu = 'yes';
 my $opt_force_save_on_release = 1;
+my $opt_vendor = undef;
 
 # Next, read configuration files and then command line
 # The next stuff is boilerplate
@@ -245,6 +248,7 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
 		       'DEBCHANGE_LOWER_VERSION_PATTERN' => '',
 		       'DEBCHANGE_AUTO_NMU' => 'yes',
 		       'DEBCHANGE_FORCE_SAVE_ON_RELEASE' => 'yes',
+		       'DEBCHANGE_VENDOR' => '',
 		       );
     $config_vars{'DEBCHANGE_TZ'} ||= '';
     my %config_default = %config_vars;
@@ -301,6 +305,7 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
     $opt_auto_nmu = $config_vars{'DEBCHANGE_AUTO_NMU'};
     $opt_force_save_on_release =
 	$config_vars{'DEBCHANGE_FORCE_SAVE_ON_RELEASE'} eq 'yes' ? 1 : 0;
+    $opt_vendor = $config_vars{'DEBCHANGE_VENDOR'};
 }
 
 # We use bundling so that the short option behaviour is the same as
@@ -355,6 +360,7 @@ GetOptions("help|h" => \$opt_help,
 	   "empty" => \$opt_empty,
 	   "auto-nmu!" => \$opt_auto_nmu,
 	   "force-save-on-release!" => \$opt_force_save_on_release,
+	   "vendor=s" => \$opt_vendor,
 	   )
     or die "Usage: $progname [options] [changelog entry]\nRun $progname --help for more details\n";
 
@@ -401,7 +407,9 @@ if (defined $opt_u) {
 if (defined $opt_D) {
     # See if we're Debian, Ubuntu or someone else, if we can
     my $distributor;
-    if (system('command -v dpkg-vendor >/dev/null 2>&1') >> 8 == 0) {
+    if (not $opt_vendor eq '') {
+	$distributor = $opt_vendor;
+    } elsif (system('command -v dpkg-vendor >/dev/null 2>&1') >> 8 == 0) {
 	$distributor = `dpkg-vendor --query Vendor 2>/dev/null`;
 	chomp $distributor;
     }
diff --git a/test/Makefile b/test/Makefile
index 4b15bcb..02deea3 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -1,5 +1,6 @@
 test:
 	./test_checkbashisms
 	./test_dd-list
+	./test_debchange
 
 .PHONY: test
diff --git a/test/test_debchange b/test/test_debchange
new file mode 100755
index 0000000..239ca7e
--- /dev/null
+++ b/test/test_debchange
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# Copyright (C) 2012, Benjamin Drung <bdrung at debian.org>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+COMMAND="perl -I ${0%/*}/.. ${0%/*}/../scripts/debchange.pl"
+
+. "${0%/*}/shunit2-helper-functions.sh"
+
+success() {
+    runCommand "-c ${SHUNIT_TMPDIR}/changelog --package devscripts-test-package $1" "" "" 0
+}
+
+checkVersion() {
+    local start_param="$1"
+    local param="$2"
+    local start_version="$3"
+    local expected_version="$4"
+    rm -f ${SHUNIT_TMPDIR}/changelog
+    success "--create $start_param -v $start_version \"Devscripts Test Suite.\""
+    success "$param \"Version test.\""
+    local version=$(dpkg-parsechangelog -l${SHUNIT_TMPDIR}/changelog | sed -n 's/^Version: //p')
+    assertEquals "\"dch $param\" from version $start_version" "$expected_version" "$version"
+}
+
+checkDebianVersion() {
+    checkVersion "--vendor Debian -D unstable" "--vendor Debian $1" "$2" "$3"
+}
+
+testDebianIncrement() {
+    checkDebianVersion "-i" "1.0-1" "1.0-2"
+    checkDebianVersion "-i" "12" "13"
+}
+
+. shunit2

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list