X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=bin%2Fcreate_index_pages;h=eb797d34bb0c906bed604857e3dc92a7482143bf;hb=2c644c36736052f4bd1abff4101375848203fb66;hp=7f35b31a4ffe57f0dcdb8d8388d24f75b37de86b;hpb=1bae1b743532d7d100015b751fe1f7be52198b8b;p=deb%2Fpackages.git diff --git a/bin/create_index_pages b/bin/create_index_pages index 7f35b31..eb797d3 100755 --- a/bin/create_index_pages +++ b/bin/create_index_pages @@ -27,8 +27,9 @@ delete $ENV{'LANG'}; delete $ENV{'LC_ALL'}; delete $ENV{'LC_MESSAGES'}; bindtextdomain ( 'pdo', $LOCALES ); -bindtextdomain ( 'sections', $LOCALES ); bindtextdomain ( 'templates', $LOCALES ); +bindtextdomain ( 'sections', $LOCALES ); +bindtextdomain ( 'langs', $LOCALES ); textdomain( 'pdo' ); my $wwwdir = "$TOPDIR/www"; @@ -42,6 +43,9 @@ tie my %src_packages, 'DB_File', "$DBDIR/sources_small.db", tie my %src2bin, 'DB_File', "$DBDIR/sources_packages.db", O_RDONLY, 0666, $DB_BTREE or die "couldn't open $DBDIR/sources_packages.db: $!"; +tie my %desctrans, 'DB_File', "$DBDIR/descriptions_translated.db", + O_RDONLY, 0666, $DB_BTREE + or die "couldn't tie DB $DBDIR/descriptions_translated.db: $!"; my $sections = retrieve "$DBDIR/sections.info"; my $subsections = retrieve "$DBDIR/subsections.info"; @@ -50,18 +54,10 @@ my $priorities = retrieve "$DBDIR/priorities.info"; #use Data::Dumper; #print STDERR Dumper($sections, $subsections, $priorities); -my (%pages, %tt_vars); +my (%pages); -$tt_vars{make_search_url} = sub { return &Packages::CGI::make_search_url(@_) }; -$tt_vars{make_url} = sub { return &Packages::CGI::make_url(@_) }; -$tt_vars{g} = sub { return &Packages::I18N::Locale::tt_gettext(@_) }; -# needed to work around the limitations of the the FILTER syntax -$tt_vars{html_encode} = sub { return HTML::Entities::encode_entities(@_,'<>&"') }; -$tt_vars{uri_escape} = sub { return URI::Escape::uri_escape(@_) }; -$tt_vars{quotemeta} = sub { return quotemeta($_[0]) }; - -my $template = new Packages::Template( "$TOPDIR/templates", 'html', \%tt_vars ); -my $txt_template = new Packages::Template( "$TOPDIR/templates", 'txt', \%tt_vars ); +my $template = new Packages::Template( "$TOPDIR/templates", 'html'); +my $txt_template = new Packages::Template( "$TOPDIR/templates", 'txt'); print "write suite index files ...\n"; foreach my $s (@SUITES) { @@ -113,7 +109,7 @@ while (my ($pkg, $data) = each %packages) { my ($virt, $p_data) = split /\000/o, $data, 2; %virt = split /\01/o, $virt; foreach (split /\000/o, $p_data||'') { - my @data = split ( /\s/o, $_, 8 ); + my @data = split ( /\s/o, $_, 9 ); $pkg{$data[1]} ||= new Packages::Page( $pkg ); $pkg{$data[1]}->merge_package( { package => $pkg, archive => $data[0], @@ -123,7 +119,8 @@ while (my ($pkg, $data) = each %packages) { subsection => $data[4], priority => $data[5], version => $data[6], - description => $data[7] } ); + 'description-md5' => $data[7], + description => $data[8] } ); } foreach (keys %virt) { next if $_ eq '-'; @@ -145,6 +142,18 @@ while (my ($pkg, $data) = each %packages) { $p{section} = $entry->get_newest( 'section' ); $p{archive} = $entry->get_newest( 'archive' ); $p{desc} = $entry->get_newest( 'description' ); + my $desc_md5 = $entry->get_newest( 'description-md5' ); + my $trans_desc = $desctrans{$desc_md5}; + if ($trans_desc) { + my %sdescs; + my %trans_desc = split /\000|\001/, $trans_desc; + while (my ($l, $d) = each %trans_desc) { + $d =~ s/\n.*//os; + + $sdescs{$l} = $d; + } + $p{trans_desc} = \%sdescs; + } $p{priority} = $entry->get_newest( 'priority' ); } push @{$allpkgs{$key}}, \%p;