=head1 METHODS
-=over 8
-
-=item getpkgsrc
+=head2 getpkgsrc
Returns a reference to a hash of binary package names to their corresponding
source package names.
return $_pkgsrc;
}
-=item getpkgcomponent
+=head2 getpkgcomponent
Returns a reference to a hash of binary package names to the component of
the archive containing those binary packages (e.g. "main", "contrib",
return $_pkgcomponent;
}
-=item getsrcpkgs
+=head2 getsrcpkgs
Returns a list of the binary packages produced by a given source package.
return @{$_srcpkg->{$src}};
}
-=item binarytosource
+=head2 binarytosource
Returns a reference to the source package name and version pair
corresponding to a given binary package name, version, and architecture.
# need an extra cache for speed here.
return () unless defined $gBinarySourceMap;
+ if ($binname =~ m/^src:(.+)$/) {
+ return $1;
+ }
if (not tied %_binarytosource) {
tie %_binarytosource, MLDBM => $gBinarySourceMap, O_RDONLY or
die "Unable to open $gBinarySourceMap for reading";
elsif (exists $binary{$binver}) {
if (defined $binarch) {
my $src = $binary{$binver}{$binarch};
+ if (not defined $src and exists $binary{$binver}{all}) {
+ $src = $binary{$binver}{all};
+ }
return () unless defined $src; # not on this arch
# Copy the data to avoid tiedness problems.
return dclone($src);
return ();
}
-=item sourcetobinary
+=head2 sourcetobinary
Returns a list of references to triplets of binary package names, versions,
and architectures corresponding to a given source package name and version.
# avoid autovivification
my $source = $_sourcetobinary{$srcname};
return () unless defined $source;
- my %source = %{$source};
- if (exists $source{$srcver}) {
- my $bin = $source{$srcver};
+ if (exists $source->{$srcver}) {
+ my $bin = $source->{$srcver};
return () unless defined $bin;
return @$bin;
}
return map [$_, $srcver], @srcpkgs;
}
-=item getversions
+=head2 getversions
Returns versions of the package in a distribution at a specific
architecture
for my $arch (exists $param{arch}?
make_list($param{arch}):
(grep {not $param{no_source_arch} or
- $_ ne 'source'
- } keys %{$version->{$dist}})) {
+ $_ ne 'source'
+ } keys %{$version->{$dist}})) {
next unless defined $version->{$dist}{$arch};
for my $ver (ref $version->{$dist}{$arch} ?
keys %{$version->{$dist}{$arch}} :
}
-=item makesourceversions
+=head2 makesourceversions
@{$cgi_var{found}} = makesourceversions($cgi_var{package},undef,@{$cgi_var{found}});
my %param = validate_with(params => \@_,
spec => {package => {type => SCALAR|ARRAYREF,
},
- arch => {type => SCALAR|ARRAYREF,
+ arch => {type => SCALAR|ARRAYREF|UNDEF,
default => ''
},
versions => {type => SCALAR|ARRAYREF,
my ($warnings) = globify_scalar(exists $param{warnings}?$param{warnings}:undef);
my ($debug) = globify_scalar(exists $param{debug} ?$param{debug} :undef);
-
my @packages = grep {defined $_ and length $_ } make_list($param{package});
- my @archs = grep {defined $_ } make_list ($param{archs});
+ my @archs = grep {defined $_ } make_list ($param{arch});
if (not @archs) {
push @archs, '';
}
}
next;
}
+ elsif ($param{guess_source} and
+ exists$param{source_version_cache}{$cachekey.'/guess'}) {
+ for my $v (@{$param{source_version_cache}{$cachekey.'/guess'}}) {
+ $sourceversions{$v} = 1;
+ }
+ next;
+ }
my @srcinfo = binarytosource($pkg, $version, $arch);
if (not @srcinfo) {
# We don't have explicit information about the
} else {
next;
}
+ # store guesses in a slightly different location
+ $param{source_version_cache}{$cachekey.'/guess'} = [ map { "$_->[0]/$_->[1]" } @srcinfo ];
}
}
+ else {
+ # only store this if we didn't have to guess it
+ $param{source_version_cache}{$cachekey} = [ map { "$_->[0]/$_->[1]" } @srcinfo ];
+ }
$sourceversions{"$_->[0]/$_->[1]"} = 1 foreach @srcinfo;
- $param{source_version_cache}{$cachekey} = [ map { "$_->[0]/$_->[1]" } @srcinfo ];
}
}
}
-=back
-
-=cut
-
1;