X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=cgi-bin%2Fshow_package.pl;h=747db62ada96ee2b29bd87695a7b2255c19befd3;hb=08721b8e6f4a348804799627d44ca4902e47921d;hp=34613995fb1a695a271ee09c75b3aec9d9490dac;hpb=91edc66c5f872b41114dc61bdefc6d89c205a183;p=deb%2Fpackages.git
diff --git a/cgi-bin/show_package.pl b/cgi-bin/show_package.pl
index 3461399..747db62 100755
--- a/cgi-bin/show_package.pl
+++ b/cgi-bin/show_package.pl
@@ -13,6 +13,7 @@
# see http://www.fsf.org/copyleft/gpl.html for a copy of the license
use strict;
+use lib '../lib';
use CGI qw( -oldstyle_urls );
use CGI::Carp qw( fatalsToBrowser );
use POSIX;
@@ -22,10 +23,14 @@ use DB_File;
use Benchmark;
use Deb::Versions;
+use Packages::Config qw( $DBDIR $ROOT @SUITES @ARCHIVES @SECTIONS
+ @ARCHITECTURES %FTP_SITES );
use Packages::CGI;
+use Packages::DB;
use Packages::Search qw( :all );
-use Packages::HTML ();
+use Packages::HTML;
use Packages::Page ();
+use Packages::SrcPage ();
&Packages::CGI::reset;
@@ -47,38 +52,8 @@ my $debug = $debug_allowed && $input->param("debug");
$debug = 0 if !defined($debug) || $debug !~ /^\d+$/o;
$Packages::CGI::debug = $debug;
-# read the configuration
-our $config_read_time ||= 0;
-our $db_read_time ||= 0;
-our ( $topdir, $ROOT, @SUITES, @SECTIONS, @ARCHIVES, @ARCHITECTURES );
-
-# FIXME: move to own module
-my $modtime = (stat( "../config.sh" ))[9];
-if ($modtime > $config_read_time) {
- if (!open (C, '<', "../config.sh")) {
- error( "Internal: Cannot open configuration file." );
- }
- while ( \n/go;
+ $long_desc =~ s/(((\n|\A) [^\n]*)+)/\n$1\n<\/pre>/sgo;
+# $long_desc = conv_desc( $lang, $long_desc );
+# $short_desc = conv_desc( $lang, $short_desc );
+
+ my %all_suites;
+ foreach (@results, @non_results) {
+ my $a = $_->[1];
+ my $s = $_->[2];
+ if ($a =~ /^(?:us|security|non-US)$/o) {
+ $all_suites{$s}++;
+ } else {
+ $all_suites{"$s/$a"}++;
+ }
+ }
+ foreach (suites_sort(keys %all_suites)) {
+ if (("$suite/$archive" eq $_)
+ || (!$all_suites{"$suite/$archive"} && ($suite eq $_))) {
+ $package_page .= "[ $_ ] ";
+ } else {
+ $package_page .=
+ "[ $_ ] ";
+ }
+ }
+ $package_page .= '
';
+
+ $package_page .= simple_menu( [ gettext( "Distribution:" ),
+ gettext( "Overview over this suite" ),
+ "$ROOT/$suite/",
+ $suite ],
+ [ gettext( "Section:" ),
+ gettext( "All packages in this section" ),
+ "$ROOT/$suite/$subsection/",
+ $subsection ],
+ );
+
+ my $title .= sprintf( gettext( "Package: %s (%s)" ), $pkg, $v_str );
+ $title .= " ".marker( $archive ) if $archive ne 'us';
+ $title .= " ".marker( $subsection ) if $subsection eq 'non-US'
+ and $archive ne 'non-US'; # non-US/security
+ $title .= " ".marker( $section ) if $section ne 'main';
+ $package_page .= title( $title );
+
+ $package_page .= "".gettext( "Versions:" )." $v_str_arch
\n"
+ unless $version eq $v_str;
+
+ if ($suite eq "experimental") {
+ $package_page .= note( gettext( "Experimental package"),
+ gettext( "Warning: This package is from the experimental distribution. That means it is likely unstable or buggy, and it may even cause data loss. If you ignore this warning and install it nevertheless, you do it on your own risk.")."
". + gettext( "Users of experimental packages are encouraged to contact the package maintainers directly in case of problems." ) + ); + } + if ($subsection eq "debian-installer") { + note( gettext( "debian-installer udeb package"), + gettext( "Warning: This package is intended for the use in building debian-installer images only. Do not install it on a normal Debian system." ) + ); + } + $package_page .= pdesc( $short_desc, $long_desc ); + + # + # display dependencies + # + my $dep_list; + $dep_list = print_deps( \%packages, \%opts, $pkg, + $page->get_dep_field('depends'), + 'depends' ); + $dep_list .= print_deps( \%packages, \%opts, $pkg, + $page->get_dep_field('recommends'), + 'recommends' ); + $dep_list .= print_deps( \%packages, \%opts, $pkg, + $page->get_dep_field('suggests'), + 'suggests' ); - read_entry_all( \%packages, $pkg, \@results, \@non_results, \%opts ); + if ( $dep_list ) { + $package_page .= "
".gettext("Architecture")." | ".gettext("Files")." | ".gettext( "Package Size")." | ".gettext("Installed Size")." |
---|---|---|---|
$a | \n"; + $package_page .= ""; + if ( $suite ne "experimental" ) { + $package_page .= sprintf( "[".gettext( "list of files" )."]\n", + "$ROOT/$suite/$encodedpkg/$a/filelist", $pkg ); + } else { + $package_page .= gettext( "no current information" ); + } + $package_page .= " | \n"; #FIXME: css + $package_page .= floor(($sizes_deb->{$a}/102.4)+0.5)/10 . " kB"; + $package_page .= " | \n"; #FIXME: css + $package_page .= $sizes_inst->{$a} . " kB"; + $package_page .= " | \n
". + gettext( "Users of experimental packages are encouraged to contact the package maintainers directly in case of problems." ) + ); + } + if ($subsection eq "debian-installer") { + note( gettext( "debian-installer udeb package"), + gettext( "Warning: This package is intended for the use in building debian-installer images only. Do not install it on a normal Debian system." ) + ); + } + + my $binaries = find_binaries( $pkg, $archive, $suite, \%src2bin ); + if ($binaries && @$binaries) { + $package_page .= '
%s | %s | %s | ", + gettext("File"), + gettext("Size (in kB)"), + gettext("md5sum") ); + foreach( @$source_files ) { + my ($src_file_md5, $src_file_size, $src_file_name) = @$_; + my $src_url; + for ($archive) { + /security/o && do { + $src_url = $FTP_SITES{security}; last }; + /volatile/o && do { + $src_url = $FTP_SITES{volatile}; last }; + /backports/o && do { + $src_url = $FTP_SITES{backports}; last }; + /non-us/io && do { + $src_url = $FTP_SITES{'non-US'}; last }; + $src_url = $FTP_SITES{us}; + } + $src_url .= "/$source_dir/$src_file_name"; + + $package_page .= "
---|---|---|
$src_file_name | \n" + ."".sprintf("%.1f", (floor(($src_file_size/102.4)+0.5)/10))." | \n" + ."$src_file_md5 |
".$packages_all{"$pkg $arch $version"}.""; - } - -# my %versions = $pkg->get_arch_versions( $env->{archs} ); -# my %subsuites = $pkg->get_arch_fields( 'subdistribution', -# $env->{archs} ); -# my %filenames = $pkg->get_arch_fields( 'filename', -# $env->{archs} ); -# my %file_md5s = $pkg->get_arch_fields( 'md5sum', -# $env->{archs} ); - -# my $subsuite_kw = $d->{subsuite} || $env->{distribution}; -# my $size_kw = exists $d->{sizes_deb}{i386} ? $d->{sizes_deb}{i386} : first_val($d->{sizes_deb}); - - -# foreach my $lang (@{$env->{langs}}) { -# &Generated::Strings::string_lang($lang); - -# my $dirname = "$env->{dest_dir}/$d->{subsection}"; -# my $filename = "$dirname/$name.$lang.html"; - -# unless (( $lang eq 'en' ) -# || $env->{db}->is_translated( $name, $d->{version}, -# ${$versions{v2a}{$d->{version}}}[0], -# $lang )) { -# next; -# } -# progress() if $env->{opts}{progress}; - -# # -# # process description -# # -# my $short_desc = encode_entities( $env->{db}->get_short_desc( $d->{desc_md5}, -# $lang ), "<>&\"" ); -# my $long_desc = encode_entities( $env->{db}->get_long_desc( $d->{desc_md5}, -# $lang ), "<>&\"" ); - -# $long_desc =~ s,((ftp|http|https)://[\S~-]+?/?)((\>\;)?[)]?[']?[:.\,]?(\s|$)),$1$3,go; # syntax highlighting -> ']; -# $long_desc =~ s/\A //o; -# $long_desc =~ s/\n /\n/sgo; -# $long_desc =~ s/\n.\n/\n
\n/go; -# $long_desc =~ s/(((\n|\A) [^\n]*)+)/\n
$1\n<\/pre>/sgo; - -# $long_desc = conv_desc( $lang, $long_desc ); -# $short_desc = conv_desc( $lang, $short_desc ); - -# # -# # begin output -# # -# my $package_page = header( title => $name, lang => $lang, -# desc => $short_desc, -# keywords => "$env->{distribution}, $subsuite_kw, $d->{section}, $d->{subsection}, size:$size_kw $d->{version}" ); -# $package_page .= simple_menu( [ gettext( "Distribution:" ), -# gettext( "Overview over this distribution" ), -# "../", -# $env->{distribution} ], -# [ gettext( "Section:" ), -# gettext( "All packages in this section" ), -# "../$d->{subsection}/", -# $d->{subsection} ], -# ); - -# my $title .= sprintf( gettext( "Package: %s (%s)" ), $name, $d->{v_str_simple} ); -# $title .= " ".marker( $d->{subsuite} ) if $d->{subsuite}; -# $title .= " ".marker( $d->{section} ) if $d->{section} ne 'main'; -# $package_page .= title( $title ); - -# $package_page .= "".gettext( "Versions:" )." $d->{v_str_arch}
\n" -# unless $d->{version} eq $d->{v_str_simple}; - -# if ($env->{distribution} eq "experimental") { -# $package_page .= note( gettext( "Experimental package"), -# gettext( "Warning: This package is from the experimental distribution. That means it is likely unstable or buggy, and it may even cause data loss. If you ignore this warning and install it nevertheless, you do it on your own risk.")."". -# gettext( "Users of experimental packages are encouraged to contact the package maintainers directly in case of problems." ) -# ); -# } -# if ($d->{section} eq "debian-installer") { -# $package_page .= note( gettext( "debian-installer udeb package"), -# gettext( "Warning: This package is intended for the use in building debian-installer images only. Do not install it on a normal Debian system." ) -# ); -# } -# $package_page .= pdesc( $short_desc, $long_desc ); - -# # -# # display dependencies -# # -# my $dep_list = print_deps( $env, $lang, $pkg, $d->{depends}, 'depends' ); -# $dep_list .= print_deps( $env, $lang, $pkg, $d->{recommends}, 'recommends' ); -# $dep_list .= print_deps( $env, $lang, $pkg, $d->{suggests}, 'suggests' ); - -# if ( $dep_list ) { -# $package_page .= "
\n"; -# $package_page .= sprintf( "\n"; -# } - -# # -# # Download package -# # -# my $encodedpack = uri_escape( $name ); -# $package_page .= "".gettext( "Other Packages Related to %s" )."
\n", $name ); -# if ($env->{distribution} eq "experimental") { -# $package_page .= note( gettext( "Note that the \"experimental\" distribution is not self-contained; missing dependencies are likely found in the \"unstable\" distribution." ) ); -# } - -# $package_page .= pdeplegend( [ 'dep', gettext( 'depends' ) ], -# [ 'rec', gettext( 'recommends' ) ], -# [ 'sug', gettext( 'suggests' ) ], ); - -# $package_page .= $dep_list; -# $package_page .= ""; -# $package_page .= sprintf( "\n"; - -# # -# # more information -# # -# $package_page .= pmoreinfo( name => $name, env => $env, data => $d, -# bugreports => 1, sourcedownload => 1, -# changesandcopy => 1, maintainers => 1, -# search => 1 ); - -# # -# # Trailer -# # -# my @tr_langs = (); -# foreach my $l (@{$env->{langs}}) { -# next if $l eq $lang; -# push @tr_langs, $l if ( $l eq 'en' ) -# || $env->{db}->is_translated( $name, $d->{version}, -# ${$versions{v2a}{$d->{version}}}[0], -# $l ); -# } -# $package_page .= trailer( '../..', $name, $lang, @tr_langs ); -# } -# } + print $package_page; } my $tet1 = new Benchmark; my $tetd = timediff($tet1, $tet0);".gettext( "Download %s\n" )."
", -# $name ) ; -# $package_page .= "\n"; -# $package_page .= "
".gettext("Download for all available architectures")." \n"; -# $package_page .= "\n"; -# $package_page .= " \n"; -# foreach my $a ( @all_archs ) { -# if ( exists $versions{a2v}{$a} ) { -# $package_page .= "".gettext("Architecture")." ".gettext("Files")." ".gettext( "Package Size")." ".gettext("Installed Size")." \n"; -# $package_page .= " "; -# } -# } -# $package_page .= "\n \n"; -# $package_page .= ""; -# $package_page .= "&file=".uri_escape($filenames{a2f}->{$a}); -# $package_page .= "&md5sum=$file_md5s{a2f}->{$a}"; -# $package_page .= "&arch=$a"; -# # there was at least one package with two -# # different source packages on different -# # archs where one had a security update -# # and the other one not -# if ($subsuites{a2f}{$a} -# && ($subsuites{a2f}{$a} =~ /security/o) ) { -# $package_page .= "&type=security"; -# } elsif ($subsuites{a2f}{$a} -# && ($subsuites{a2f}{$a} =~ /volatile/o) ) { -# $package_page .= "&type=volatile"; -# } elsif ($d->{is_nonus}) { -# $package_page .= "&type=nonus"; -# } else { -# $package_page .= "&type=main"; -# } -# $package_page .= "\">$a
"; -# if ( $env->{distribution} ne "experimental" ) { -# $package_page .= sprintf( "[".gettext( "list of files" )."]\n", "$FILELIST_URL$encodedpack&version=$env->{distribution}&arch=$a", $name ); -# } else { -# $package_page .= "no files"; -# } -# $package_page .= " \n"; -# my $size = $d->{sizes_deb}{$a}; -# $package_page .= "$size"; -# $package_page .= " \n"; -# my $inst_size = $d->{sizes_inst}{$a}; -# $package_page .= "$inst_size"; -# $package_page .= " \n".gettext ( "Size is measured in kBytes." )."
\n"; -# $package_page .= "