That makes it possible to extract the long descriptions from English translations since they got dropped from Packages files in some suites. --- bin/parse-translations | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/bin/parse-translations b/bin/parse-translations index d079b7f..00611a9 100755 --- a/bin/parse-translations +++ b/bin/parse-translations @@ -39,6 +39,17 @@ use Packages::Config qw( $TOPDIR $DBDIR @DDTP_LANGUAGES ); &Packages::Config::init( './' ); my %descriptions = (); +# Make it possible to deal with either only English translations (to +# get long descriptions back), or all of them (the default). Since a +# single option needs to be supported, don't bother with getopt: +my @langs = @DDTP_LANGUAGES; +my $output = 'descriptions_translated'; +my $argument = shift @ARGV; +if ($argument and $argument eq '--english-only') { + $output = 'descriptions_translated_english_only'; + @langs = ('en'); +} + $/ = ""; -d $DBDIR || mkpath( $DBDIR ); @@ -50,7 +61,7 @@ my $fixja = Text::Iconv->new("EUC-JP", "UTF-8"); # FIXME: unhardcode dists name my @dists = ('sid', 'wheezy', 'squeeze', 'lenny'); -foreach my $lang (@DDTP_LANGUAGES) { +foreach my $lang (@langs) { (my $locale = $lang) =~ s/^([a-z]{2})-([a-z]{2})$/"$1_".uc($2)/e; print "Reading Translations for $lang ($locale)..."; my $count = 0; @@ -87,7 +98,7 @@ close PKG; print "Writing database (".scalar(keys %descriptions)." unique descriptions)...\n"; my %descriptions_db; -tie %descriptions_db, "DB_File", "$DBDIR/descriptions_translated.db.new", +tie %descriptions_db, "DB_File", "$DBDIR/$output.db.new", O_RDWR|O_CREAT, 0666, $DB_BTREE or die "Error creating DB: $!"; while (my ($md5, $v) = each(%descriptions)) { @@ -104,5 +115,5 @@ while (my ($md5, $v) = each(%descriptions)) { } untie %descriptions_db; -rename("$DBDIR/descriptions_translated.db.new", - "$DBDIR/descriptions_translated.db"); +rename("$DBDIR/$output.db.new", + "$DBDIR/$output.db"); -- 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-4-git-send-email-k...@debian.org