=item source -- returns source/version instead of just versions
+=item no_source_arch -- discards the source architecture when arch is
+not passed. [Used for finding the versions of binary packages only.]
+Defaults to 0, which does not discard the source architecture. (This
+may change in the future, so if you care, please code accordingly.)
+
=back
=cut
sub get_versions{
my %param = validate_with(params => \@_,
- spec => {package => {type => SCALAR,
+ spec => {package => {type => SCALAR|ARRAYREF,
},
dist => {type => SCALAR|ARRAYREF,
default => 'unstable',
source => {type => BOOLEAN,
default => 0,
},
+ no_source_arch => {type => BOOLEAN,
+ default => 0,
+ },
},
);
my $versions;
for my $dist (make_list($param{dist})) {
for my $arch (exists $param{arch}?
make_list($param{arch}):
- (keys %{$version->{$dist}})) {
+ (grep {not $param{no_source_arch} or
+ $_ ne 'source'
+ } keys %{$version->{$dist}})) {
next unless defined $version->{$dist}{$arch};
for my $ver (ref $version->{$dist}{$arch} ?
keys %{$version->{$dist}{$arch}} :
my $f_ver = $ver;
if ($param{source}) {
($f_ver) = makesourceversions($package,$arch,$ver);
+ next unless defined $f_ver;
}
if ($param{time}) {
$versions{$f_ver} = max($versions{$f_ver}||0,$version->{$dist}{$arch}{$ver});