[Debian-l10n-commits] r2733 - in /ddtp-web: Changelog Packages2db.pl

nekral-guest at users.alioth.debian.org nekral-guest at users.alioth.debian.org
Thu Jul 28 14:00:49 UTC 2011


Author: nekral-guest
Date: Thu Jul 28 14:00:48 2011
New Revision: 2733

URL: http://svn.debian.org/wsvn/?sc=1&rev=2733
Log:
	* Packages2db.pl: is_description_id_active() added.
	* Packages2db.pl: Do not inject description_id in active_tb when
	already in active_tb (and do not compute or re-inject their
	parts).

Modified:
    ddtp-web/Changelog
    ddtp-web/Packages2db.pl

Modified: ddtp-web/Changelog
URL: http://svn.debian.org/wsvn/ddtp-web/Changelog?rev=2733&op=diff
==============================================================================
--- ddtp-web/Changelog (original)
+++ ddtp-web/Changelog Thu Jul 28 14:00:48 2011
@@ -1,3 +1,10 @@
+2011-07-28  Nicolas Francois  <nicolas.francois at centraliens.net>
+
+	* Packages2db.pl: is_description_id_active() added.
+	* Packages2db.pl: Do not inject description_id in active_tb when
+	already in active_tb (and do not compute or re-inject their
+	parts).
+
 2011-07-28  Nicolas Francois  <nicolas.francois at centraliens.net>
 
 	* Packages2packages_tb.pl: Ignore errors when injecting

Modified: ddtp-web/Packages2db.pl
URL: http://svn.debian.org/wsvn/ddtp-web/Packages2db.pl?rev=2733&op=diff
==============================================================================
--- ddtp-web/Packages2db.pl (original)
+++ ddtp-web/Packages2db.pl Thu Jul 28 14:00:48 2011
@@ -97,6 +97,17 @@
 		return $description_tag_id;
 	}
 
+	sub is_description_id_active {
+		my $description_id= shift(@_);
+
+		my $sth = $dbh->prepare("SELECT description_id FROM active_tb WHERE description_id=?");
+		$sth->execute($description_id);
+		if ($sth->fetchrow_array) {
+			return 1;
+		}
+		return 0;
+	}
+
 	sub save_active_to_db {
 		my $description_id= shift(@_);
 
@@ -159,7 +170,7 @@
 			$dbh->commit;   # commit the changes if we get this far
 		};
 		if ($@) {
-			warn "Packages2db.pl: failed to INSERT description_id '$description_id', part_md5 '$part_md5' into part_description_tb:$@\n";
+			warn "Packages2db.pl: failed to INSERT description_id '$description_id', part_md5 '$part_md5' into part_description_tb: $@\n";
 			$dbh->rollback; # undo the incomplete changes
 		}
 	}
@@ -203,6 +214,7 @@
 				save_version_to_db($description_id,$version,$package);
 			}
 			if (($description_id) and ($distribution eq 'sid')) {
+				if (! is_description_id_active($description_id)) {
 				save_active_to_db($description_id);
 
 				my @parts = desc_to_parts($description);
@@ -216,6 +228,7 @@
 				while ($a <= $#parts_md5 ) {
 					&save_part_description_to_db($description_id,$parts_md5[$a]);
 					$a++
+				}
 				}
 			}
 




More information about the Debian-l10n-commits mailing list