[Debian-l10n-commits] [ddtp] branch master updated (356d35c -> bb62413)

Martijn van Oosterhout kleptog-guest at moszumanska.debian.org
Mon Dec 23 16:51:47 UTC 2013


This is an automated email from the git hooks/post-receive script.

kleptog-guest pushed a change to branch master
in repository ddtp.

      from  356d35c   Base stats on amd64 rather than i386, since amd64 is used more now (#725042)
       new  829d82e   Only process files that have actually been sucessfully updated.
       new  bb62413   Fix the importing of descriptions to verify md5.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 Packages2db.pl          | 25 +++++++++++++++++--------
 Packages2packages_tb.sh |  5 +++++
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/Packages2db.pl b/Packages2db.pl
index 5ea6a12..a4a2a28 100755
--- a/Packages2db.pl
+++ b/Packages2db.pl
@@ -59,6 +59,7 @@ sub scan_packages_file {
 	my $prioritize;
 	my $description;
 
+	my $descr_md5;
 	my $tag;
 	my $source;
 	my $priority;
@@ -81,13 +82,12 @@ sub scan_packages_file {
 		return $old_description_id;
 	}
 
-	sub get_description_id {
-		my $description_orig= shift(@_);
+	sub get_description_id_from_md5 {
+		my $description_md5= shift(@_);
 		my $description_id;
 
-		my $md5=md5_hex($description_orig);
 		my $sth = $dbh->prepare("SELECT description_id FROM description_tb WHERE description_md5=?");
-		$sth->execute($md5);
+		$sth->execute($description_md5);
 		($description_id) = $sth->fetchrow_array;
 		return $description_id;
 	}
@@ -266,8 +266,12 @@ sub scan_packages_file {
 		if ($_=~/^$/) {
 			my $description_orig=$description;
 			my @oldtranslang;
+			undef $description_id;
 			eval {
-				$description_id=get_description_id($description_orig);
+				if (!defined($descr_md5)) {
+					$descr_md5 = md5_hex($description_orig);
+				}
+				$description_id=get_description_id_from_md5($descr_md5);
 				if ($description_id) {
 					$description_tag_id=get_description_tag_id($description_id,$distribution);
 					if ($description_tag_id) {
@@ -294,9 +298,12 @@ sub scan_packages_file {
 							push @oldtranslang,$lang;
 						}
 					}
-					my $md5=md5_hex($description_orig);
-					$dbh->do("INSERT INTO description_tb (description_md5, description, package, source, prioritize) VALUES (?,?,?,?,?);", undef, $md5,$description,$package,$source,$prioritize);
-					$description_id=get_description_id($description_orig);
+					# Can only happen if Packages file refer to md5 not in Translation-en file and we don't already know it.
+					if( $descr_md5 ne md5_hex($description_orig) ) {
+						die "  skipped package $package ($source), description doesn't match md5 ($descr_md5)";
+					}
+					$dbh->do("INSERT INTO description_tb (description_md5, description, package, source, prioritize) VALUES (?,?,?,?,?);", undef, $descr_md5,$description,$package,$source,$prioritize);
+					$description_id=get_description_id_from_md5($descr_md5);
 					$dbh->do("INSERT INTO description_tag_tb (description_id, tag, date_begin, date_end) VALUES (?,?,CURRENT_DATE,CURRENT_DATE);", undef, $description_id,$distribution);
 					print "   add new description from $package ($source) with prio $prioritize\n" ;
 				}
@@ -342,6 +349,7 @@ sub scan_packages_file {
 			$source=$1;
 			$prioritize=40;
 			$version="1";
+			undef $descr_md5;
 			$prioritize -= 1 if $package =~ /^(linux|kernel)-/i;
 			$prioritize -= 1 if $package =~ /^(linux|kernel)-source/i;
 			$prioritize -= 2 if $package =~ /^(linux|kernel)-patch/i;
@@ -420,6 +428,7 @@ sub scan_packages_file {
 		}
 		if (/^Description-md5: (.*)/) { # new item
 		        my $md5 = $1;
+		        $descr_md5 = $md5;
 		        if (defined $description_en->{$md5}) {
 		                $description = $description_en->{$md5}{'Description-en'} . "\n";
                         }
diff --git a/Packages2packages_tb.sh b/Packages2packages_tb.sh
index 298324c..b40fbdd 100755
--- a/Packages2packages_tb.sh
+++ b/Packages2packages_tb.sh
@@ -55,6 +55,11 @@ do
 		do
 			file="Packages/Packages_${distribution}_${part}_${arch}.bz2"
 
+			# Skip files older than 2 days...
+			if [ -n "$(find "$file" -mtime +2)" ] ; then
+				echo "skipped $file, too old"
+				continue
+			fi
 			[ -f $file ] && echo -n `date`: $file
 			[ -f $file ] && bzcat $file | $INPORT2DB
 			[ -f $file ] || echo no $file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-l10n/ddtp.git



More information about the Debian-l10n-commits mailing list