[SCM] Git repository for devscripts branch, master, updated. v2.11.7-33-g3c61f23

Benjamin Drung bdrung at debian.org
Wed May 30 22:14:31 UTC 2012


The following commit has been merged in the master branch:
commit ea7efb510344868dced804baa9b21aae5ed6b3a8
Author: Stefano Rivera <stefanor at debian.org>
Date:   Thu May 31 00:03:15 2012 +0200

    debchange: Use distro-info to determine Ubuntu release names.
    
    Signed-off-by: Benjamin Drung <bdrung at debian.org>

diff --git a/debian/changelog b/debian/changelog
index a303fc7..272a80f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -39,6 +39,7 @@ devscripts (2.11.8) UNRELEASED; urgency=low
   [ Stefano Rivera ]
   * devscripts.Logger Don't substitute arguments into logged strings unless
     they were provided. (LP: #968129)
+  * debchange: Use distro-info to determine Ubuntu release names.
 
   [ Salvatore Bonaccorso ]
   * bts: When searching for usertags use tag= in the url (followed by
diff --git a/debian/control b/debian/control
index 0abb3a7..401634a 100644
--- a/debian/control
+++ b/debian/control
@@ -52,6 +52,7 @@ Recommends: at,
             fakeroot,
             gnupg,
             libcrypt-ssleay-perl,
+            libdistro-info-perl,
             libjson-perl,
             libparse-debcontrol-perl,
             libsoap-lite-perl,
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index 6db7010..1ded253 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -72,6 +72,22 @@ sub have_lpdc {
     return $lpdc_broken ? 0 : 1;
 }
 
+my $ubuntu_distro_info;
+sub get_ubuntu_distro_info {
+    return $ubuntu_distro_info if defined $ubuntu_distro_info;
+    eval {
+	require Debian::DistroInfo;
+    };
+    if ($@) {
+	printf "libdistro-info-perl is not installed, Ubuntu release names "
+	       . "are not known.\n";
+	$ubuntu_distro_info = 0;
+    } else {
+	$ubuntu_distro_info = UbuntuDistroInfo->new();
+    }
+    return $ubuntu_distro_info;
+}
+
 sub usage () {
     print <<"EOF";
 Usage: $progname [options] [changelog entry]
@@ -431,9 +447,24 @@ if (defined $opt_D) {
 	    $warnings++ if not $opt_force_dist;
 	}
     } elsif ($vendor eq 'Ubuntu') {
-	unless ($opt_D =~ /^((hardy|lucid|natty|oneiric|precise|quantal)(-updates|-security|-proposed|-backports)?|UNRELEASED)$/) {
-	    warn "$progname warning: Recognised distributions are:\n{hardy,lucid,natty,oneiric,precise,quantal}{,-updates,-security,-proposed,-backports} and UNRELEASED.\nUsing your request anyway.\n";
-	    $warnings++ if not $opt_force_dist;
+	if ($opt_D eq 'UNRELEASED') {
+	    ;
+	} else {
+	    my $ubu_release = $opt_D;
+	    $ubu_release =~ s/(-updates|-security|-proposed|-backports)$//;
+	    my $ubu_info = get_ubuntu_distro_info();
+	    if ($ubu_info == 0) {
+		warn "$progname warning: Unable to determine if $ubu_release "
+		     . "is a valid Ubuntu release";
+	    } elsif (! $ubu_info->valid($ubu_release)) {
+		printf STDERR "$progname warning: Recognised distributions "
+		              . "are:\n{"
+		              . join(',', $ubu_info->supported())
+		              . "}{,-updates,-security,-proposed,-backports} "
+		              . "and UNRELEASED.\n"
+		              . "Using your request anyway.\n";
+		$warnings++ if not $opt_force_dist;
+	    }
 	}
     } else {
 	# Unknown vendor, skip check
@@ -578,7 +609,14 @@ if (! $opt_create || ($opt_create && $opt_news)) {
     if ($vendor eq 'Ubuntu') {
 	# In Ubuntu the development release regularly changes, don't just copy
 	# the previous name.
-	$DISTRIBUTION = 'quantal';
+	my $ubu_info = get_ubuntu_distro_info();
+	if ($ubu_info == 0 or !$ubu_info->devel()) {
+	    warn "$progname warning: Unable to determine the current Ubuntu "
+	         . "development release. Using UNRELEASED instead.";
+	    $DISTRIBUTION = 'UNRELEASED';
+	} else {
+	    $DISTRIBUTION = $ubu_info->devel();
+	}
     } else {
 	$DISTRIBUTION=$changelog{'Distribution'};
     }
@@ -1309,7 +1347,19 @@ if (($opt_r || $opt_a || $merge) && ! $opt_create) {
 		if ($dist_indicator and not $opt_D) {
 		    $distribution = $dist_indicator;
 		} elsif ($vendor eq 'Ubuntu') {
-		    $distribution = $opt_D || "quantal";
+		    if ($opt_D) {
+			$distribution = $opt_D;
+		    } else {
+			my $ubu_info = get_ubuntu_distro_info();
+			if ($ubu_info == 0 or !$ubu_info->devel()) {
+			    warn "$progname warning: Unable to determine the "
+			         . "current Ubuntu development release. "
+			         . "Using UNRELEASED instead.";
+			    $distribution = 'UNRELEASED';
+			} else {
+			    $distribution = $ubu_info->devel();
+			}
+		    }
 		} else {
 		    $distribution = $opt_D || $lastdist || "unstable";
 		}

-- 
Git repository for devscripts



More information about the devscripts-devel mailing list