Use description-md5 from English translations (when available) to restore the long descriptions during package processing.
Fix for: http://bugs.debian.org/657557 Archive change: http://lists.debian.org/debian-devel-announce/2012/01/msg00004.html --- bin/parse-packages | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/bin/parse-packages b/bin/parse-packages index a1c8d98..b926982 100755 --- a/bin/parse-packages +++ b/bin/parse-packages @@ -59,6 +59,10 @@ $/ = ""; -d "$DBDIR/xapian.old" && rmtree("$DBDIR/xapian.old"); mkpath( "$DBDIR/xapian.new" ); +# Needed to compensate removal of long descriptions from Packages files: +my %descriptions_translated_db; +tie %descriptions_translated_db, "DB_File", "files/db/descriptions_translated.db", O_RDONLY, 0666, $DB_BTREE; + for my $suite (@SUITES) { my %package_names_suite = (); my %packages_all_db; @@ -129,6 +133,23 @@ for my $suite (@SUITES) { $data{'tag'} = join ", ", @tags; } + # If description-md5 is present, use a lookup, thanks + # to the English translation which got processed right + # before: + if ($data{'description-md5'}) { + # The short description is a nice fallback: + my $description = $data{'description'}; + my $lookup = $descriptions_translated_db{$data{'description-md5'}}; + if ($lookup) { + while ($lookup =~ /([^\001]*)\001([^\000]*)\000/g) { + my ($language, $translated_description) = ($1, $2); + $description = $translated_description + if $language eq 'en'; + } + $data{'description'} = $description; + } + } + # we add some additional data here my $descr = "$data{'description'}\000$data{'package'}\000" .($data{'tag'}||''); @@ -194,6 +215,8 @@ for my $suite (@SUITES) { untie %packages_all_db; } +untie %descriptions_translated_db; + print "Writing databases...\n"; my %packages_small_db; tie %packages_small_db, "DB_File", "$DBDIR/packages_small.db.new", -- 1.7.2.5 -- To UNSUBSCRIBE, email to debian-www-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1329789968-11695-3-git-send-email-k...@debian.org