From 80d1b5c09c823bc5154897d2f7c5b990f576b727 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Tue, 7 Feb 2006 15:53:55 +0000 Subject: [PATCH] Adapt to DB format changes --- cgi-bin/show_package.pl | 11 ++++++----- lib/Packages/Search.pm | 2 ++ lib/Packages/SrcPage.pm | 30 ++++++++++-------------------- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/cgi-bin/show_package.pl b/cgi-bin/show_package.pl index 747db62..5e7cfe2 100755 --- a/cgi-bin/show_package.pl +++ b/cgi-bin/show_package.pl @@ -342,8 +342,8 @@ unless (@Packages::CGI::fatal_errors) { my (undef, $archive, undef, $section, $subsection, $priority, $version) = @$entry; - my $data = $sources_all{"$pkg $version"}; - $page->merge_data($pkg, $version, $data) or debug( "Merging $pkg $version FAILED", 2 ); + my $data = $sources_all{"$archive $suite $pkg"}; + $page->merge_data($pkg, $suite, $archive, $data) or debug( "Merging $pkg $version FAILED", 2 ); } $version = $page->{version}; @@ -459,7 +459,8 @@ unless (@Packages::CGI::fatal_errors) { gettext("Size (in kB)"), gettext("md5sum") ); foreach( @$source_files ) { - my ($src_file_md5, $src_file_size, $src_file_name) = @$_; + my ($src_file_md5, $src_file_size, $src_file_name) + = split /\s+/, $_; my $src_url; for ($archive) { /security/o && do { @@ -495,8 +496,8 @@ unless (@Packages::CGI::fatal_errors) { } } -#use Data::Dumper; -#debug( "Final page object:\n".Dumper($page), 3 ); +use Data::Dumper; +debug( "Final page object:\n".Dumper($page), 3 ); my $title = $opts{source} ? "Details of source package $pkg in $suite" : diff --git a/lib/Packages/Search.pm b/lib/Packages/Search.pm index 6945284..37f3996 100644 --- a/lib/Packages/Search.pm +++ b/lib/Packages/Search.pm @@ -489,9 +489,11 @@ sub find_binaries { foreach (split /\000/o, $bins) { my @data = split /\s/, $_, 5; + debug( "find_binaries: considering @data", 3 ); if (($data[0] eq $archive) && ($data[1] eq $suite)) { $bins{$data[2]}++; + debug( "find_binaries: using @data", 3 ); } } diff --git a/lib/Packages/SrcPage.pm b/lib/Packages/SrcPage.pm index aaee2a9..e3e6f57 100644 --- a/lib/Packages/SrcPage.pm +++ b/lib/Packages/SrcPage.pm @@ -12,19 +12,13 @@ our @ISA = qw( Packages::Page ); #FIXME: change parameters so that we can use the version from Packages::Page sub merge_data { - my ($self, $pkg, $version, $data) = @_; - - my %data = ( package => $pkg, - version => $version, - ); - chomp($data); - $data =~ s/\n\s+/\377/g; - while ($data =~ /^(\S+):\s*(.*)\s*$/mg) { - my ($key, $value) = ($1, $2); - $key =~ tr [A-Z] [a-z]; - $data{$key} = $value; - } -# debug( "Merge package:\n".Dumper(\%data), 3 ); + my ($self, $pkg, $suite, $archive, $data) = @_; + + my %data = split /\00/o, $data; + $data{package} = $pkg; + $data{suite} = $suite; + $data{archive} = $archive; + return $self->merge_package( \%data ); } @@ -35,7 +29,7 @@ our @DEP_FIELDS = qw( build-depends build-depends-indep sub merge_package { my ($self, $data) = @_; - ($data->{package} && $data->{version}) || return; + ($data->{package} && $data->{suite} && $data->{archive}) || return; $self->{package} ||= $data->{package}; ($self->{package} eq $data->{package}) || return; debug( "merge package $data->{package}/$data->{version} into $self (".($self->{version}||'').")", 2 ); @@ -62,12 +56,8 @@ sub merge_package { $self->{uploaders} = \@uploaders; if ($data->{files}) { - $self->{files} = []; - foreach my $sf ( split( /\377/, $data->{files} ) ) { - next unless $sf; - # md5, size, name - push @{$self->{files}}, [ split( /\s+/, $sf) ]; - } + my @files = split /\01/so, $data->{files}; + $self->{files} = \@files; } foreach (@DEP_FIELDS) { -- 2.39.2