]> git.deb.at Git - deb/packages.git/blobdiff - bin/create_index_pages
Only have one CGI-Script and move most of the code from the
[deb/packages.git] / bin / create_index_pages
index 4161a7654761acd9bce6d932948eaf455f5e6079..ff1084aa4b40ce54de52e3417bf3275fbc1c3a71 100755 (executable)
@@ -14,6 +14,7 @@ use lib './lib';
 use Packages::Config qw( $TOPDIR $DBDIR @ARCHIVES @SUITES );
 use Packages::HTML;
 use Packages::Page;
+use Packages::Sections;
 &Packages::Config::init( './' );
 sub gettext { return $_[0]; }
 sub dgettext { return $_[1]; }
@@ -32,84 +33,10 @@ my $priorities = retrieve "$DBDIR/priorities.info";
 
 #use Data::Dumper;
 #print STDERR Dumper($sections, $subsections, $priorities);
-my %sections_descs = (
-                     'admin'           => [ "Administration Utilities",
-                                            "Utilities to administer system resources, manage user accounts, etc." ],
-                     'base'            => [ "Base Utilities",
-                                            "Basic needed utilities of every Debian system." ],
-                     'comm'            => [ "Communication Programs",
-                                            "Software to use your modem in the old fashioned style." ],
-                     'devel'           => [ "Development",
-                                            "Development utilities, compilers, development environments, libraries, etc." ],
-                     'doc'             => [ "Documentation",
-                                            "FAQs, HOWTOs and other documents trying to explain everything related to Debian, and software needed to browse documentation (man, info, etc)." ],
-                     'editors' => [ "Editors",
-                                    "Software to edit files. Programming environments." ],
-                     'electronics'     => [ "Electronics",
-                                            "Electronics utilities." ],
-                     'embedded'        => [ "Embedded software",
-                                            "Software suitable for use in embedded applications." ],
-                     'games'           => [ "Games",
-                                            "Programs to spend a nice time with after all this setting up." ],
-                     'gnome'           => [ "GNOME",
-                                            "The GNOME desktop environment, a powerful, easy to use set of integrated applications." ],
-                     'graphics'        => [ "Graphics",
-                                            "Editors, viewers, converters... Everything to become an artist." ],
-                     'hamradio'        => [ "Ham Radio",
-                                            "Software for ham radio." ],
-                     'interpreters'    => [ "Interpreters",
-                                            "All kind of interpreters for interpreted languages. Macro processors." ],
-                     'kde'             => [ "KDE",
-                                            "The K Desktop Environment, a powerful, easy to use set of integrated applications." ],
-                     'libs'            => [ "Libraries",
-                                            "Libraries to make other programs work. They provide special features to developers." ],
-                     'libdevel'        => [ "Library development",
-                                            "Libraries necessary for developers to write programs that use them." ],
-                     'mail'            => [ "Mail",
-                                            "Programs to route, read, and compose E-mail messages." ],
-                     'math'            => [ "Mathematics",
-                                            "Math software." ],
-                     'misc'            => [ "Miscellaneous",
-                                            "Miscellaneous utilities that didn\'t fit well anywhere else." ],
-                     'net'             => [ "Network",
-                                            "Daemons and clients to connect your Debian GNU/Linux system to the world." ],
-                     'news'            => [ "Newsgroups",
-                                            "Software to access Usenet, to set up news servers, etc." ],
-                     'non-US'  => [ "Software restricted in the U.S.",
-                                    "These packages probably may not be used in or distributed from the U.S. due to software patents. You should check the regulations in your country before using this software." ],
-                     'oldlibs' => [ "Old Libraries",
-                                    "Old versions of libraries, kept for backward compatibility with old applications." ],
-                     'otherosfs'       => [ "Other OS\'s and file systems",
-                                            "Software to run programs compiled for other operating system, and to use their filesystems." ],
-                     'perl'            => [ "Perl",
-                                            "Everything about Perl, an interpreted scripting language." ],
-                     'python'  => [ "Python",
-                                    "Everything about Python, an interpreted, interactive object oriented language." ],
-                     'science' => [ "Science",
-                                    "Basic tools for scientific work" ],
-                     'shells'  => [ "Shells",
-                                    "Command shells. Friendly user interfaces for beginners." ],
-                     'sound'           => [ "Sound",
-                                            "Utilities to deal with sound: mixers, players, recorders, CD players, etc." ],
-                     'tex'             => [ "TeX",
-                                            "The famous typesetting software and related programs." ],
-                     'text'            => [ "Text Processing",
-                                            "Utilities to format and print text documents." ],
-                     'utils'           => [ "Utilities",
-                                            "Utilities for file/disk manipulation, backup and archive tools, system monitoring, input systems, etc." ],
-                     'virtual' => [ "Virtual packages",
-                                    "Virtual packages." ],
-                     'web'             => [ "Web Software",
-                                            "Web servers, browsers, proxies, download tools etc." ],
-                     'x11'             => [ "X Window System software",
-                                            "X servers, libraries, fonts, window managers, terminal emulators and many related applications." ],
-                     'debian-installer' => [ "debian-installer udeb packages",
-                                             "Special packages for building customized debian-installer variants. Do not install them on a normal system!" ],
-                     );
-
 
 my (%pages);
 
+print "opening files ...\n";
 foreach my $s (@SUITES) {
     foreach my $a (@ARCHIVES) {
        next if $a eq 'security';
@@ -149,7 +76,7 @@ foreach my $s (@SUITES) {
            title( $title ), '<dl>';
        }
        my $i = 0; my $num_sections = keys %{$subsections->{$s}{$a}};
-       foreach my $ssec (keys %{$subsections->{$s}{$a}}) {
+       foreach my $ssec ((keys %{$subsections->{$s}{$a}}, 'virtual')) {
            next if $ssec eq '-';
            mkpath ( "$wwwdir/$key/$ssec" );
            open $pages{$key}{$ssec}{fh}, '>', "$wwwdir/$key/$ssec/index.en.html.new"
@@ -186,6 +113,7 @@ foreach my $s (@SUITES) {
     }
 }
 
+print "writing package info ...\n";
 while (my ($pkg, $data) = each %packages) {
     my %pkg;
     foreach (split /\000/o, $data) {
@@ -195,17 +123,30 @@ while (my ($pkg, $data) = each %packages) {
            $key = "$data[1]/$data[0]";
        }
        $pkg{$key} ||= new Packages::Page( $pkg );
-       $pkg{$key}->merge_package( { package => $pkg,
-                                    archive => $data[0],
-                                    suite => $data[1],
-                                    architecture => $data[2],
-                                    section => $data[3],
-                                    subsection => $data[4],
-                                    priority => $data[5],
-                                    version => $data[6],
-                                    description => $data[7] } );
+       if ($data[2] ne 'virtual') {
+           $pkg{$key}->merge_package( { package => $pkg,
+                                        archive => $data[0],
+                                        suite => $data[1],
+                                        architecture => $data[2],
+                                        section => $data[3],
+                                        subsection => $data[4],
+                                        priority => $data[5],
+                                        version => $data[6],
+                                        description => $data[7] } );
+       } else {
+           $pkg{$key}->add_provided_by([split /\s+/, $data[7]]);
+       }
     }
     while (my ($key, $entry) = each %pkg) {
+       if (my $provided_by = $entry->{provided_by}) {
+           my $str = "<dt><a href=\"$pkg\">$pkg</a> ".
+               "</dt>\n     <dd>virtual package provided by ".
+               join( ', ',map { "<a href=\"../$_\">$_</a>" } @$provided_by)."</dd>\n";
+           my $txt_str = "$pkg\tvirtual package provided by ".join(', ', @$provided_by)."\n";
+           print {$pages{$key}{virtual}{fh}} $str
+               or die "couldn't write to output file: $!";
+       }
+       next if $entry->is_virtual;
        my (undef, $v_str) = $entry->get_version_string;
        my $subsection = $entry->get_newest( 'subsection' );
        my $section = $entry->get_newest( 'section' );
@@ -241,6 +182,7 @@ while (my ($pkg, $data) = each %packages) {
     }
 }
 
+print "closing files ...\n";
 foreach my $s (@SUITES) {
     foreach my $a (@ARCHIVES) {
        next if $a eq 'security';
@@ -268,7 +210,7 @@ foreach my $s (@SUITES) {
            rename( "$wwwdir/$key/$sec/index.en.html.new",
                    "$wwwdir/$key/$sec/index.en.html" );
        }
-       foreach my $ssec (keys %{$subsections->{$s}{$a}}) {
+       foreach my $ssec ((keys %{$subsections->{$s}{$a}}, 'virtual')) {
            next if $ssec eq '-';
            print {$pages{$key}{$ssec}{fh}} '</dl>', trailer( "$root../../" );
            close $pages{$key}{$ssec}{fh} or