[Po4a-commits] "po-debconf podebconf-report-po,1.58,1.59"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Tue May 20 21:31:30 UTC 2008


Update of /cvsroot/po4a/po-debconf
In directory alioth:/tmp/cvs-serv22968

Modified Files:
	podebconf-report-po 
Log Message:
Use the package and version set in the POT file if none were specified with an option or found in a debian/changelog. Closes: #481221


Index: podebconf-report-po
===================================================================
RCS file: /cvsroot/po4a/po-debconf/podebconf-report-po,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- podebconf-report-po	20 May 2008 20:38:40 -0000	1.58
+++ podebconf-report-po	20 May 2008 21:31:25 -0000	1.59
@@ -445,6 +445,27 @@
 	$GZIP_ARG = 0;
 }
 
+if ($POTFILE eq "") {
+	opendir(DIR, $PODIR);
+	foreach my $potFile (grep(/\.pot$/, readdir(DIR))) {
+		if (length $POTFILE) {
+			die "Too many pot file found.\n".
+			    "Please specify one with the --potfile option.\n";
+		}
+		$POTFILE = $potFile;
+	}
+	closedir(DIR);
+	opendir(DIR, $PODIR);
+	if (length $POTFILE) {
+		print "Using $POTFILE for the call for translation\n";
+	} else {
+		warn "No POT file found. You should specify one with the ".
+		     "--potfile option, or specify in the mail how to ".
+		     "retrieve it."
+	}
+	closedir(DIR);
+}
+
 ## Try to find the maintainer e-mail address and the package name
 
 #  Package version
@@ -502,6 +523,20 @@
 		close (CHG);
 	}
 }
+if ($PKG_VERSION eq 'N/A' and $PACKAGE_ARG eq '') {
+	# Try to read the PACKAGEand VERSION from the .pot file
+	Verbose("PODIR: $PODIR");
+	Verbose("POTFILE: $POTFILE");
+	my $content = &ReadFile($PODIR . "/" . $POTFILE);
+	$content =~ m/\n"Project-Id-Version:\s*([^"]*)\s*\\n"\n/i;
+	my $package_and_version = $1;
+	if ($package_and_version =~ m/^(.+)\s+(.+?)$/i) {
+		$PACKAGE_ARG = $1;
+		$PKG_VERSION = $2;
+	} else {
+		$PACKAGE_ARG = $package_and_version;
+	}
+}
 $PACKAGE_AND_VERSION = $PACKAGE_ARG .
 	($PKG_VERSION ne 'N/A' ? " ".$PKG_VERSION : "");
 Verbose("Package: $PACKAGE_ARG");
@@ -557,24 +592,6 @@
 my $poFiles = {};
 my $statistics = "language        translated     fuzzy     untranslated\n".
                  "-----------------------------------------------------\n";
-if (defined $CALL and length $CALL and $POTFILE eq "") {
-	foreach my $potFile (grep(/\.pot$/, readdir(DIR))) {
-		if (length $POTFILE) {
-			die "Too many pot file found.\n".
-			    "Please specify one with the --potfile option.\n";
-		}
-		$POTFILE = $potFile;
-	}
-closedir(DIR);
-opendir(DIR, $PODIR);
-	if (length $POTFILE) {
-		print "Using $POTFILE for the call for translation\n";
-	} else {
-		warn "No POT file found. You should specify one with the ".
-		     "--potfile option, or specify in the mail how to ".
-		     "retrieve it."
-	}
-}
 if (defined $CALL and length $CALL) {
 	foreach my $poFile (grep(/\.po$/, sort readdir(DIR))) {
 		$poFiles->{$poFile} = {};




More information about the Po4a-commits mailing list