[SCM] Git repository for devscripts branch, master, updated. v2.11.7-42-g4e37799

Benjamin Drung bdrung at debian.org
Thu May 31 01:23:03 UTC 2012


The following commit has been merged in the master branch:
commit 4e37799e18b218a3247fdcb4559cf53cc7487e84
Author: Benjamin Drung <bdrung at debian.org>
Date:   Thu May 31 03:22:13 2012 +0200

    debchange: Try to guess the vendor based on the given distribution name.
    
    LP: #723715

diff --git a/debian/changelog b/debian/changelog
index 08ec98d..1c8bbb4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,6 +36,7 @@ devscripts (2.11.8) UNRELEASED; urgency=low
       entry. Use the Ubuntu devel release.
     + Don't use NMU versioning for NMUs / Security uploads on Ubuntu.
     + dch --increment changes XbuildY to Xubuntu1 on Ubuntu (LP: #690230).
+    + Try to guess the vendor based on the given distribution name (LP: #723715)
 
   [ Stefano Rivera ]
   * devscripts.Logger Don't substitute arguments into logged strings unless
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index 1f484e0..ed8a08c 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -72,6 +72,22 @@ sub have_lpdc {
     return $lpdc_broken ? 0 : 1;
 }
 
+my $debian_distro_info;
+sub get_debian_distro_info {
+    return $debian_distro_info if defined $debian_distro_info;
+    eval {
+	require Debian::DistroInfo;
+    };
+    if ($@) {
+	printf "libdistro-info-perl is not installed, Debian release names "
+	       . "are not known.\n";
+	$debian_distro_info = 0;
+    } else {
+	$debian_distro_info = DebianDistroInfo->new();
+    }
+    return $debian_distro_info;
+}
+
 my $ubuntu_distro_info;
 sub get_ubuntu_distro_info {
     return $ubuntu_distro_info if defined $ubuntu_distro_info;
@@ -430,9 +446,23 @@ if (defined $opt_u) {
 my $vendor;
 if (not $opt_vendor eq '') {
     $vendor = $opt_vendor;
-} elsif (system('command -v dpkg-vendor >/dev/null 2>&1') >> 8 == 0) {
-    $vendor = `dpkg-vendor --query Vendor 2>/dev/null`;
-    chomp $vendor;
+} else {
+    if (defined $opt_D) {
+	# Try to guess the vendor based on the given distribution name
+	my $distro = $opt_D;
+	$distro =~ s/-.*//;
+	my $deb_info = get_debian_distro_info();
+	my $ubu_info = get_ubuntu_distro_info();
+	if ($deb_info != 0 and $deb_info->valid($distro)) {
+	    $vendor = 'Debian';
+	} elsif ($ubu_info != 0 and $ubu_info->valid($distro)) {
+	    $vendor = 'Ubuntu';
+	}
+    }
+    if (not defined $vendor and system('command -v dpkg-vendor >/dev/null 2>&1') >> 8 == 0) {
+	$vendor = `dpkg-vendor --query Vendor 2>/dev/null`;
+	chomp $vendor;
+    }
 }
 $vendor ||= 'Debian';
 if ($vendor eq 'Ubuntu' and ($opt_n or $opt_bn or $opt_qa or $opt_bpo)) {

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list