X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=bin%2Fparse-packages;h=a1c8d98dba4def0c44deaf17773305f4ceb58f74;hb=a1283a7c8ff204ff56b92fafac442c1217e4f9d8;hp=11e0ef0ef6a4579686ffe48591a776f371066678;hpb=bf2a8d3268fcfd6ee90d65f4c55cd3b64b9d3461;p=deb%2Fpackages.git diff --git a/bin/parse-packages b/bin/parse-packages index 11e0ef0..a1c8d98 100755 --- a/bin/parse-packages +++ b/bin/parse-packages @@ -2,9 +2,9 @@ # Convert Packages.gz files into Sleepycat db files for efficient usage of # data # -# $Id$ -# # Copyright (C) 2006 Jeroen van Wolffelaar +# Copyright (C) 2006-2007 Frank Lichtenheld +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. use strict; use warnings; @@ -72,7 +72,8 @@ for my $suite (@SUITES) { print "\tseems not to exist, skipping...\n"; next; } - open PKG, "zcat $TOPDIR/archive/$archive/$suite/$what/{,debian-installer/}binary-*/Packages.gz|"; + open PKG, "zcat $TOPDIR/archive/$archive/$suite/$what/binary-*/Packages.gz" + . " $TOPDIR/archive/$archive/$suite/$what/debian-installer/binary-*/Packages.gz|"; while () { next if /^\s*$/; my $data = ""; @@ -87,9 +88,9 @@ for my $suite (@SUITES) { } # Skip double package next if exists($packages_all_db{"$data{'package'} $data{'architecture'} $data{'version'}"}); - # Skip arch:all for amd64 & gnuab, any non-redundancy is + # Skip arch:all for amd64 & debports, any non-redundancy is # usually a bug anyway - next if ($archive eq 'amd64' or $archive eq 'gnuab') + next if ($archive eq 'amd64' or $archive eq 'debports') and $data{architecture} eq 'all'; if ($data{'provides'}) { @@ -115,10 +116,12 @@ for my $suite (@SUITES) { foreach (@complete_tags) { my ($facet, $tag) = split( /::/, $_, 2); if ($tag =~ s/^\{(.+)\}$/$1/) { + warn "pkg=$data{package} tags=$data{tag}\n" unless $facet && $tag; foreach (split( /,/, $tag )) { push @tags, "${facet}::$_"; } } else { + warn "pkg=$data{package} tags=$data{tag}\n" unless $facet && $tag; push @tags, "${facet}::$tag"; } } @@ -149,8 +152,6 @@ for my $suite (@SUITES) { my $subsection = $data{section} || '-'; if ($data{section} && ($data{section} =~ m=/=o)) { ($section, $subsection) = split m=/=o, $data{section}, 2; - ($subsection, $section) = split m=/=o, $data{section}, 2 - if $section eq 'non-US'; } $data{'section'} = $section; $data{'subsection'} = $subsection; @@ -159,7 +160,7 @@ for my $suite (@SUITES) { $subsections{$suite}{$subsection}++; $priorities{$suite}{$data{priority}}++; my $pkgitem = "$archive $suite $data{'architecture'} ". - "$section $subsection $data{'priority'} $data{'version'} $sdescr\0"; + "$section $subsection $data{'priority'} $data{'version'} $data{'description-md5'} $sdescr\0"; my $previtem = ($packages_small{$data{'package'}}{$suite}{$data{'architecture'}} ||= $pkgitem); $packages_small{$data{'package'}}{$suite}{$data{'architecture'}} = $pkgitem @@ -305,7 +306,7 @@ for (my $i=1; $i<= $#descriptions; $i++) { } } if ($tags) { - foreach my $t (split /, /, $tags) { + foreach my $t (split m/, /, $tags) { if ($doc->add_term($t)) { warn "can't add term $t: $!\n"; } @@ -338,11 +339,10 @@ tie %package_postfixes_db, "DB_File", "$DBDIR/package_postfixes.db.new", or die "Error creating DB: $!"; while (my ($k, $v) = each(%package_postfixes)) { $v =~ s/.$//s; - my $nr = $v; - $nr =~ s/[^\000]//g; - $nr = length($nr) + 1; # < number of hits + my $nr = ($v =~ tr/\000/\000/) + 1; if ($nr > $MAX_PACKAGE_POSTFIXES) { - $v = "\001" . $nr; + $v = ($v =~ /\^/) ? "^\001" . $nr + : "\001" . $nr; } $package_postfixes_db{$k} = $v; }