From: Frank Lichtenheld Date: Wed, 1 Feb 2006 21:15:14 +0000 (+0000) Subject: Split section (main, etc.) from subsection (admin, etc.) on db generation X-Git-Tag: switch-to-templates~216 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=c049f68b67a8ffdce5280f39f96b38abf005641d;p=deb%2Fpackages.git Split section (main, etc.) from subsection (admin, etc.) on db generation --- diff --git a/bin/parse-packages b/bin/parse-packages index 6caf5cf..b5c2ceb 100755 --- a/bin/parse-packages +++ b/bin/parse-packages @@ -91,8 +91,13 @@ for my $suite (@suites) { my $sdescr = $descr; $sdescr =~ s/\n.*//s; + my $section = 'main'; + my $subsection = $data{section}; + if ($data{section} && ($data{section} =~ m=/=o)) { + ($section, $subsection) = split m=/=o, $data{section}, 2; + } $packages_small{$data{'package'}} .= "$suite $data{'architecture'} ". - "$data{'section'} $data{'priority'} $data{'version'} $sdescr\000"; + "$section $subsection $data{'priority'} $data{'version'} $sdescr\000"; $sources_packages{$src} .= "$data{'package'} $data{'architecture'} $data{'version'}\000"; } diff --git a/cgi-bin/search_packages.pl b/cgi-bin/search_packages.pl index e22b8bd..1912dac 100755 --- a/cgi-bin/search_packages.pl +++ b/cgi-bin/search_packages.pl @@ -197,13 +197,7 @@ if ($searchon eq 'names') { if ($exact) { my $result = $packages{$keyword}; foreach (split /\000/, $result) { - my @data = split ( /\s/, $_, 6 ); - #FIXME, should be done on db generation - if ($data[2] =~ m,/,) { - $data[2] =~ s,/.*$,,; - } else { - $data[2] = 'main'; - } + my @data = split ( /\s/, $_, 7 ); print "DEBUG: Considering entry ".join( ':', @data)."
" if $debug > 2; if ($suites{$data[0]} && ($archs{$data[1]} || $data[1] eq 'all') && $sections{$data[2]}) { @@ -217,13 +211,7 @@ if ($searchon eq 'names') { (index($pkg, $keyword) >= 0) or next; #$pkg =~ /\Q$keyword\E/ or next; foreach (split /\000/, $packages{$pkg}) { - my @data = split ( /\s/, $_, 6 ); - #FIXME, should be done on db generation - if ($data[2] =~ m,/,) { - $data[2] =~ s,/.*$,,; - } else { - $data[2] = 'main'; - } + my @data = split ( /\s/, $_, 7 ); print "DEBUG: Considering entry ".join( ':', @data)."
" if $debug > 2; if ($suites{$data[0]} && ($archs{$data[1]} || $data[1] eq 'all') && $sections{$data[2]}) { @@ -300,11 +288,12 @@ my (%pkgs, %sect, %part, %desc, %binaries); unless ($search_on_sources) { foreach (@results) { - my ($pkg_t, $suite, $arch, $section, $priority, $version, $desc) = @$_; + my ($pkg_t, $suite, $arch, $section, $subsection, + $priority, $version, $desc) = @$_; my ($package) = $pkg_t =~ m/^(.+)/; # untaint $pkgs{$package}{$suite}{$version}{$arch} = 1; - $sect{$package}{$suite}{$version} = 'subsection'; + $sect{$package}{$suite}{$version} = $subsection; $part{$package}{$suite}{$version} = $section unless $section eq 'main'; $desc{$package}{$suite}{$version} = $desc;