NUL-separated.
Also, lookup source packages by archive/suite, instead of version
my $src_version = '';
if ($data{'source'}) {
$src = $data{'source'};
- $src_version = $1
- if $src =~ s/\s+\((.*)\).*//; # strip version info
+ $src =~ s/\s+.*//; # strip version info
}
$data{'source'} = $src;
- $data{'source-version'} = $src_version if $src_version;
my $descr = $data{'description'};
my $did = undef;
if (exists($descriptions{$descr})) {
next if $key eq 'package' or $key eq 'version' or $key eq 'architecture'
or $key eq 'maintainer';
print STDERR "WARN: $key ($suite/$archive/$data{package}/$data{architecture}\n" unless defined $value;
- $data .= "$key: $value\n";
+ $data .= "$key\00$value\00";
}
+ $data =~ s/.$//s;
$packages_all_db{"$data{'package'} $data{'architecture'} $data{'version'}"}
= $data;
}
while (/^(\S+):\s*(.*)\s*$/mg) {
my ($key, $value) = ($1, $2);
$value =~ s/\377/\n /g;
- $data .= "$key: $value\n";
$key =~ tr [A-Z] [a-z];
$data{$key} = $value;
}
$source_names{$data{'package'}} = 1;
+ delete $data{'binary'};
+
+ $data{files} =~ s/\s*\n\s*/\01/sog;
+ $data{files} =~ s/^\01//sg;
my $section = 'main';
my $subsection = $data{section} || '-';
$sources_small{$data{'package'}} .=
"$archive $suite $section $subsection $data{'priority'} $data{'version'}\000";
- $data{archive} = $archive;
while (my ($key, $value) = each (%data)) {
- next if $key eq 'package' or $key eq 'version';
+ next if $key eq 'package' or $key eq 'archive' or $key eq 'suite';
print STDERR "WARN: $key ($suite/$archive/$data{package}/$data{architecture}\n" unless defined $value;
- $data .= "$key: $value\n";
+ $data .= "$key\00$value\00";
}
- $sources_all_db{"$data{'package'} $data{'version'}"}
+ $data =~ s/.$//so;
+ $sources_all_db{"$archive $suite $data{'package'}"}
= $data;
}
my (undef, $archive, undef, $arch, $section, $subsection,
$priority, $version) = @$entry;
- my $data = $packages_all{"$pkg $arch $version"};
- $page->merge_data($pkg, $version, $arch, $data) or debug( "Merging $pkg $arch $version FAILED", 2 );
+ my %data = split /\000/, $packages_all{"$pkg $arch $version"};
+ $data{package} = $pkg;
+ $data{architecture} = $arch;
+ $data{version} = $version;
+ $page->merge_package(\%data) or debug( "Merging $pkg $arch $version FAILED", 2 );
}
$version = $page->{newest};
my $source = $page->get_newest( 'source' );
- my $source_version = $page->get_newest( 'source-version' )
- || $version;
- debug( "find source package: source=$source (=$source_version)", 1);
- my $src_data = $sources_all{"$source $source_version"};
- unless ($src_data) { #fucking binNMUs
- my $versions = $page->get_versions;
- my $sources = $page->get_arch_field( 'source' );
- my $source_versions = $page->get_arch_field( 'source-version' );
- foreach (version_sort keys %$versions) {
- $source = $sources->{$versions->{$_}[0]};
- $source = $source_versions->{$versions->{$_}[0]}
- || $version;
- $src_data = $sources_all{"$source $source_version"};
- last if $src_data;
- }
- error( "couldn't find source package" ) unless $src_data;
- }
- $page->add_src_data( $source, $source_version, $src_data )
+ $archive = $page->get_newest( 'archive' );
+ debug( "find source package: source=$source", 1);
+ my $src_data = $sources_all{"$archive $suite $source"};
+ $page->add_src_data( $source, $src_data )
if $src_data;
my $st1 = new Benchmark;
my $encodedpkg = uri_escape( $pkg );
my ($v_str, $v_str_arch, $v_str_arr) = $page->get_version_string();
my $did = $page->get_newest( 'description' );
- $archive = $page->get_newest( 'archive' );
$section = $page->get_newest( 'section' );
$subsection = $page->get_newest( 'subsection' );
my $filenames = $page->get_arch_field( 'filename' );
$str .= gettext( "Not found" );
} else {
foreach( @$files ) {
- my ($src_file_md5, $src_file_size, $src_file_name) = @$_;
+ my ($src_file_md5, $src_file_size, $src_file_name) = split /\s/o, $_;
for ($page->get_newest('archive')) {
/security/o && do {
$str .= "<a href=\"$env->{security}/$src_dir/$src_file_name\">["; last };
return $self;
}
-sub merge_data {
- my ($self, $pkg, $version, $architecture, $data) = @_;
-
- my %data = ( package => $pkg,
- version => $version,
- architecture => $architecture );
- chomp($data);
- 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 );
- return $self->merge_package( \%data );
-}
-
sub gettext { return $_[0]; }
sub split_name_mail {
my $string = shift;
}
sub add_src_data {
- my ($self, $src, $version, $data) = @_;
-
- chomp($data);
- my %data = ();
- $data =~ s/\n\s+/\377/g;
- while ($data =~ /^(\S+):\s*(.*)\s*$/mog) {
- my ($key, $value) = ($1, $2);
- $key =~ tr [A-Z] [a-z];
- $data{$key} = $value;
- }
+ my ($self, $src, $data) = @_;
+
+ my %data = split /\00/o, $data;
$self->{src}{package} = $src;
- $self->{src}{version} = $version;
+ $self->{src}{version} = $data{version};
if ($data{files}) {
- $self->{src}{files} = [];
- foreach my $sf ( split( /\377/, $data{files} ) ) {
- next unless $sf;
- # md5, size, name
- push @{$self->{src}{files}}, [ split( /\s+/, $sf) ];
- }
+ my @files = split /\01/so, $data{files};
+ $self->{src}{files} = \@files;
+ print @{$self->{src}{files}};
}
$self->{src}{directory} = $data{directory};
my @uploaders;