-print "write suite index files ...\n";
-foreach my $s (@SUITES) {
- my $key = $s;
- mkpath ( "$wwwdir/$key" );
- foreach my $lang (@LANGUAGES) {
- my $locale = get_locale( $lang );
- setlocale ( LC_ALL, $locale ) or do {
- warn "couldn't set locale ($lang/$locale)\n";
- next;
- };
- open $pages{$key}{$lang}{index}{fh}, '>', "$wwwdir/$key/index.$lang.html.new"
- or die "can't open index file for output: $!";
- my $index_title = sprintf( _g( "List of sections in \"%s\"" ),
- $key );
- print {$pages{$key}{$lang}{index}{fh}} header( title => $index_title,
- title_keywords => "debian, $s",
- desc => encode_entities( $index_title, '"' ),
- lang => $lang ),
- title( $index_title ), '<div id="lefthalfcol"><dl>';
- my $i = 0; my $num_sections = keys %{$subsections->{$s}};
- foreach my $ssec ((keys %{$subsections->{$s}}, 'virtual')) {
- next if $ssec eq '-';
- if ($sections_descs{$ssec}) {
- print {$pages{$key}{$lang}{index}{fh}} "<dt><a href=\"$ssec/\">".dgettext( 'sections', $sections_descs{$ssec}[0] )."</a></dt><dd>".dgettext( 'sections', $sections_descs{$ssec}[1] )."</dd>\n";
- $i++;
- if ($i eq ceil($num_sections/2)) {
- print {$pages{$key}{$lang}{index}{fh}} "</dl>\n</div> <!-- end lefthalfcol -->\n<div id=\"righthalfcol\">\n<dl>\n";
- }
- }
- }
-
- print {$pages{$key}{$lang}{index}{fh}} '</dl></div>',
- "<p class=\"psmallcenter\"><a href=\"allpackages\" title=\""._g( "List of all packages" )."\">".
- _g( "All packages" ) ."</a><br>(<a href=\"allpackages?format=txt.gz\">".
- _g( "compact compressed textlist" )."</a>)</p>\n";
- print {$pages{$key}{$lang}{index}{fh}} trailer( "../", 'index', $lang, @LANGUAGES );
- close $pages{$key}{$lang}{index}{fh} or
- warn "can't close index file $wwwdir/$key/index.$lang.html.new: $!";
- rename( "$wwwdir/$key/index.$lang.html.new",
- "$wwwdir/$key/index.$lang.html" );
-
- }
-}
-setlocale( LC_ALL, 'C' ) or die "couldn't reset locale";
-
-print "opening files ...\n";
-foreach my $s (@SUITES) {
- my $key = $s;
- mkpath ( "$wwwdir/$key" );
- open $pages{$key}{fh}, '>', "$wwwdir/$key/allpackages.en.html.new"
- or die "can't open index file for output: $!";
- $pages{$key}{textgz} = gzopen("$wwwdir/$key/allpackages.en.txt.gz.new",
- 'wb9')
- or die "can't open text index file for output: $!";
-
- my $title = sprintf( _g( "Software Packages in \"%s\"" ),
- $key );
- print {$pages{$key}{fh}} header( title => $title,
- title_keywords => "debian, $s",
- desc => encode_entities( $title, '"' ),
- lang => 'en' ),
- title( $title ), '<dl>';
- my $title_txt = sprintf( _g( "All Debian Packages in \"%s\"" ),
- $key )."\n\n";
- $title_txt .= _g( "Last Modified: " ).gmtime()."\n".
- sprintf(_g( "Copyright (C) 1997-%d SPI;\nSee <URL:http://www.debian.org/license> for the license terms."), (gmtime)[5]+1900 )."\n\n";
- $pages{$key}{textgz}->gzwrite($title_txt);
-
- foreach my $sec (keys %{$sections->{$s}}) {
- mkpath ( "$wwwdir/$key/$sec" );
- open $pages{$key}{$sec}{fh}, '>', "$wwwdir/$key/$sec/index.en.html.new"
- or die "can't open index file for output: $!";
- $title = sprintf( _g( "Software Packages in \"%s\", section %s" ),
- $key, $sec );
- print {$pages{$key}{$sec}{fh}} header( title => $title,
- title_keywords => "debian, $s, $sec",
- desc => encode_entities( $title, '"' ),
- lang => 'en' ),
- title( $title ), '<dl>';
- }
- foreach my $ssec ((keys %{$subsections->{$s}}, 'virtual')) {
- next if $ssec eq '-';
- mkpath ( "$wwwdir/$key/$ssec" );
- open $pages{$key}{$ssec}{fh}, '>', "$wwwdir/$key/$ssec/index.en.html.new"
- or die "can't open index file for output: $!";
- $title = sprintf( _g( "Software Packages in \"%s\", subsection %s" ),
- $key, $ssec );
- print {$pages{$key}{$ssec}{fh}} header( title => $title,
- title_keywords => "debian, $s, $ssec",
- desc => encode_entities( $title, '"' ),
- lang => 'en' ),
- title( $title ), '<dl>';
- }
- foreach my $prio (keys %{$priorities->{$s}}) {
- next if $prio eq '-';
- mkpath ( "$wwwdir/$key/$prio" );
- open $pages{$key}{$prio}{fh}, '>', "$wwwdir/$key/$prio/index.en.html.new"
- or die "can't open index file for output: $!";
- $title = sprintf( _g( "Software Packages in \"%s\", priority %s" ),
- $key, $prio );
- print {$pages{$key}{$prio}{fh}} header( title => $title,
- title_keywords => "debian, $s, $prio",
- desc => encode_entities( $title, '"' ),
- lang => 'en' ),
- title( $title ), '<dl>';
- }
-}