14 use Packages::Config qw( $TOPDIR $DBDIR @ARCHIVES @SUITES );
17 &Packages::Config::init( './' );
18 sub gettext { return $_[0]; }
19 sub dgettext { return $_[1]; }
21 my $wwwdir = "$TOPDIR/www";
23 tie my %packages, 'DB_File', "$DBDIR/packages_small.db",
24 O_RDONLY, 0666, $DB_BTREE
25 or die "couldn't tie DB $DBDIR/packages_small.db: $!";
27 my $sections = retrieve "$DBDIR/sections.info";
28 my $subsections = retrieve "$DBDIR/subsections.info";
29 # work around problems with non-US security updates
30 $subsections->{oldstable}{us}{'non-US'}++;
31 my $priorities = retrieve "$DBDIR/priorities.info";
34 #print STDERR Dumper($sections, $subsections, $priorities);
35 my %sections_descs = (
36 'admin' => [ "Administration Utilities",
37 "Utilities to administer system resources, manage user accounts, etc." ],
38 'base' => [ "Base Utilities",
39 "Basic needed utilities of every Debian system." ],
40 'comm' => [ "Communication Programs",
41 "Software to use your modem in the old fashioned style." ],
42 'devel' => [ "Development",
43 "Development utilities, compilers, development environments, libraries, etc." ],
44 'doc' => [ "Documentation",
45 "FAQs, HOWTOs and other documents trying to explain everything related to Debian, and software needed to browse documentation (man, info, etc)." ],
46 'editors' => [ "Editors",
47 "Software to edit files. Programming environments." ],
48 'electronics' => [ "Electronics",
49 "Electronics utilities." ],
50 'embedded' => [ "Embedded software",
51 "Software suitable for use in embedded applications." ],
53 "Programs to spend a nice time with after all this setting up." ],
55 "The GNOME desktop environment, a powerful, easy to use set of integrated applications." ],
56 'graphics' => [ "Graphics",
57 "Editors, viewers, converters... Everything to become an artist." ],
58 'hamradio' => [ "Ham Radio",
59 "Software for ham radio." ],
60 'interpreters' => [ "Interpreters",
61 "All kind of interpreters for interpreted languages. Macro processors." ],
63 "The K Desktop Environment, a powerful, easy to use set of integrated applications." ],
64 'libs' => [ "Libraries",
65 "Libraries to make other programs work. They provide special features to developers." ],
66 'libdevel' => [ "Library development",
67 "Libraries necessary for developers to write programs that use them." ],
69 "Programs to route, read, and compose E-mail messages." ],
70 'math' => [ "Mathematics",
72 'misc' => [ "Miscellaneous",
73 "Miscellaneous utilities that didn\'t fit well anywhere else." ],
75 "Daemons and clients to connect your Debian GNU/Linux system to the world." ],
76 'news' => [ "Newsgroups",
77 "Software to access Usenet, to set up news servers, etc." ],
78 'non-US' => [ "Software restricted in the U.S.",
79 "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." ],
80 'oldlibs' => [ "Old Libraries",
81 "Old versions of libraries, kept for backward compatibility with old applications." ],
82 'otherosfs' => [ "Other OS\'s and file systems",
83 "Software to run programs compiled for other operating system, and to use their filesystems." ],
85 "Everything about Perl, an interpreted scripting language." ],
86 'python' => [ "Python",
87 "Everything about Python, an interpreted, interactive object oriented language." ],
88 'science' => [ "Science",
89 "Basic tools for scientific work" ],
90 'shells' => [ "Shells",
91 "Command shells. Friendly user interfaces for beginners." ],
93 "Utilities to deal with sound: mixers, players, recorders, CD players, etc." ],
95 "The famous typesetting software and related programs." ],
96 'text' => [ "Text Processing",
97 "Utilities to format and print text documents." ],
98 'utils' => [ "Utilities",
99 "Utilities for file/disk manipulation, backup and archive tools, system monitoring, input systems, etc." ],
100 'virtual' => [ "Virtual packages",
101 "Virtual packages." ],
102 'web' => [ "Web Software",
103 "Web servers, browsers, proxies, download tools etc." ],
104 'x11' => [ "X Window System software",
105 "X servers, libraries, fonts, window managers, terminal emulators and many related applications." ],
106 'debian-installer' => [ "debian-installer udeb packages",
107 "Special packages for building customized debian-installer variants. Do not install them on a normal system!" ],
113 foreach my $s (@SUITES) {
114 foreach my $a (@ARCHIVES) {
115 next if $a eq 'security';
116 next if $a eq 'non-US';
117 my $key = ($a eq 'us') ? $s : "$s/$a";
118 mkpath ( "$wwwdir/$key" );
119 open $pages{$key}{index}{fh}, '>', "$wwwdir/$key/index.en.html.new"
120 or die "can't open index file for output: $!";
121 open $pages{$key}{fh}, '>', "$wwwdir/$key/allpackages.en.html.new"
122 or die "can't open index file for output: $!";
124 my $title = sprintf( gettext ( "Software Packages in \"%s\"" ),
126 my $index_title = sprintf( gettext ( "List of sections in \"%s\"" ),
128 print {$pages{$key}{fh}} header( title => $title,
129 title_keywords => "debian, $s",
130 desc => encode_entities( $title, '"' ),
132 title( $title ), '<dl>';
133 print {$pages{$key}{index}{fh}} header( title => $index_title,
134 title_keywords => "debian, $s",
135 desc => encode_entities( $index_title, '"' ),
137 title( $index_title ), '<div id="lefthalfcol"><dl>';
139 foreach my $sec (keys %{$sections->{$s}{$a}}) {
140 mkpath ( "$wwwdir/$key/$sec" );
141 open $pages{$key}{$sec}{fh}, '>', "$wwwdir/$key/$sec/index.en.html.new"
142 or die "can't open index file for output: $!";
143 $title = sprintf( gettext ( "Software Packages in \"%s\", section %s" ),
145 print {$pages{$key}{$sec}{fh}} header( title => $title,
146 title_keywords => "debian, $s, $sec",
147 desc => encode_entities( $title, '"' ),
149 title( $title ), '<dl>';
151 my $i = 0; my $num_sections = keys %{$subsections->{$s}{$a}};
152 foreach my $ssec (keys %{$subsections->{$s}{$a}}) {
153 next if $ssec eq '-';
154 mkpath ( "$wwwdir/$key/$ssec" );
155 open $pages{$key}{$ssec}{fh}, '>', "$wwwdir/$key/$ssec/index.en.html.new"
156 or die "can't open index file for output: $!";
157 $title = sprintf( gettext ( "Software Packages in \"%s\", subsection %s" ),
159 print {$pages{$key}{$ssec}{fh}} header( title => $title,
160 title_keywords => "debian, $s, $ssec",
161 desc => encode_entities( $title, '"' ),
163 title( $title ), '<dl>';
165 if ($sections_descs{$ssec}) {
166 print {$pages{$key}{index}{fh}} "<dt><a href=\"$ssec/\">".dgettext( 'sections', $sections_descs{$ssec}[0] )."</a></dt><dd>".dgettext( 'sections', $sections_descs{$ssec}[1] )."</dd>\n";
168 if ($i eq ceil($num_sections/2)) {
169 print {$pages{$key}{index}{fh}} "</dl>\n</div> <!-- end lefthalfcol -->\n<div id=\"righthalfcol\">\n<dl>\n";
173 foreach my $prio (keys %{$priorities->{$s}{$a}}) {
174 next if $prio eq '-';
175 mkpath ( "$wwwdir/$key/$prio" );
176 open $pages{$key}{$prio}{fh}, '>', "$wwwdir/$key/$prio/index.en.html.new"
177 or die "can't open index file for output: $!";
178 $title = sprintf( gettext ( "Software Packages in \"%s\", priority %s" ),
180 print {$pages{$key}{$prio}{fh}} header( title => $title,
181 title_keywords => "debian, $s, $prio",
182 desc => encode_entities( $title, '"' ),
184 title( $title ), '<dl>';
189 while (my ($pkg, $data) = each %packages) {
191 foreach (split /\000/o, $data) {
192 my @data = split ( /\s/o, $_, 8 );
194 if ($data[0] !~ /^(?:us|security|non-US)$/o) {
195 $key = "$data[1]/$data[0]";
197 $pkg{$key} ||= new Packages::Page( $pkg );
198 $pkg{$key}->merge_package( { package => $pkg,
201 architecture => $data[2],
203 subsection => $data[4],
204 priority => $data[5],
206 description => $data[7] } );
208 while (my ($key, $entry) = each %pkg) {
209 my (undef, $v_str) = $entry->get_version_string;
210 my $subsection = $entry->get_newest( 'subsection' );
211 my $section = $entry->get_newest( 'section' );
212 my $archive = $entry->get_newest( 'archive' );
213 my $short_desc_txt = $entry->get_newest( 'description' );
214 my $short_desc = encode_entities( $short_desc_txt, "<>&\"" );
215 my $priority = $entry->get_newest( 'priority' );
217 my $str = "<dt><a href=\"$pkg\">$pkg</a> ($v_str) ";
218 my $txt_str = "$pkg ($v_str)";
219 if ($section ne 'main') {
220 $str .= marker( $section );
221 $txt_str .= " [$section]";
223 if ($archive ne 'us') {
224 $str .= marker( $archive );
225 $txt_str .= " [$archive]";
227 $str .= "</dt>\n <dd>$short_desc</dd>\n";
228 $txt_str .= " $short_desc_txt\n";
229 print {$pages{$key}{fh}} $str
230 or die "couldn't write to output file: $!";
231 print {$pages{$key}{$section}{fh}} $str
232 or die "couldn't write to output file: $!";
233 if ($subsection ne '-') {
234 print {$pages{$key}{$subsection}{fh}} $str
235 or die "couldn't write to output file: $!";
237 if ($priority ne '-') {
238 print {$pages{$key}{$priority}{fh}} $str
239 or die "couldn't write to output file: $!";
244 foreach my $s (@SUITES) {
245 foreach my $a (@ARCHIVES) {
246 next if $a eq 'security';
247 next if $a eq 'non-US';
248 my $key = ($a eq 'us') ? $s : "$s/$a";
249 my $root = ($a eq 'us') ? '' : '../';
250 print {$pages{$key}{index}{fh}} '</dl></div>',
251 "<p class=\"psmallcenter\"><a href=\"allpackages\" title=\"".gettext( "List of all packages" )."\">".
252 gettext( "All packages" ) ."</a><br>(<a href=\"allpackages.en.txt.gz\">".
253 gettext( "compact compressed textlist" )."</a>)</p>\n";
254 print {$pages{$key}{index}{fh}} trailer( "$root../" );
255 close $pages{$key}{index}{fh} or
256 warn "can't open index file for output $wwwdir/$key/index.en.html.new: $!";
257 rename( "$wwwdir/$key/index.en.html.new",
258 "$wwwdir/$key/index.en.html" );
259 print {$pages{$key}{fh}} '</dl>', trailer( "$root../" );
260 close $pages{$key}{fh} or
261 warn "can't close index file $wwwdir/$key/allpackages.en.html.new: $!";
262 rename( "$wwwdir/$key/allpackages.en.html.new",
263 "$wwwdir/$key/allpackages.en.html" );
264 foreach my $sec (keys %{$sections->{$s}{$a}}) {
265 print {$pages{$key}{$sec}{fh}} '</dl>', trailer( "$root../../" );
266 close $pages{$key}{$sec}{fh} or
267 warn "can't close index file $wwwdir/$key/$sec/index.en.html.new: $!";
268 rename( "$wwwdir/$key/$sec/index.en.html.new",
269 "$wwwdir/$key/$sec/index.en.html" );
271 foreach my $ssec (keys %{$subsections->{$s}{$a}}) {
272 next if $ssec eq '-';
273 print {$pages{$key}{$ssec}{fh}} '</dl>', trailer( "$root../../" );
274 close $pages{$key}{$ssec}{fh} or
275 warn "can't close index file $wwwdir/$key/$ssec/index.en.html.new: $!";
276 rename( "$wwwdir/$key/$ssec/index.en.html.new",
277 "$wwwdir/$key/$ssec/index.en.html" );
279 foreach my $prio (keys %{$priorities->{$s}{$a}}) {
280 next if $prio eq '-';
281 print {$pages{$key}{$prio}{fh}} '</dl>', trailer( "$root../../" );
282 close $pages{$key}{$prio}{fh} or
283 warn "can't close index file $wwwdir/$key/$prio/index.en.html.new: $!";
284 rename( "$wwwdir/$key/$prio/index.en.html.new",
285 "$wwwdir/$key/$prio/index.en.html" );