Skip to content

Commit

Permalink
Fix 'sourcerpm' return for package queries and gate it
Browse files Browse the repository at this point in the history
Before it only worked in repository metadata queries. As this
is an incompatible change we now only add it if the 'source'
option is used.
  • Loading branch information
mlschroe committed May 13, 2024
1 parent 9800231 commit 0d99352
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Build/Deb.pm
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ sub query {
my $src = $name;
if ($res{'SOURCE'}) {
$src = $res{'SOURCE'};
$data->{'sourcedep'} = $src;
$data->{'sourcedep'} = $src if $opts{'source'};
$src =~ s/\s.*$//;
}
$data->{'source'} = $src if $src ne '';
Expand Down
2 changes: 1 addition & 1 deletion Build/Rpm.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,6 @@ sub query {
my %res = rpmq($handle, @tags);
return undef unless %res;
my $src = $res{'SOURCERPM'}->[0];
$res{'sourcerpm'} = $src if $src;
$src = '' unless defined $src;
$src =~ s/-[^-]*-[^-]*\.[^\.]*\.rpm//;
add_flagsvers(\%res, 'PROVIDENAME', 'PROVIDEFLAGS', 'PROVIDEVERSION');
Expand All @@ -1435,6 +1434,7 @@ sub query {
name => $res{'NAME'}->[0],
hdrmd5 => unpack('H32', $res{'SIGTAG_MD5'}->[0]),
};
$data->{'sourcerpm'} = $res{'SOURCERPM'}->[0] if $opts{'source'} && $res{'SOURCERPM'}->[0];
if ($opts{'alldeps'}) {
$data->{'provides'} = [ @{$res{'PROVIDENAME'} || []} ];
$data->{'requires'} = [ @{$res{'REQUIRENAME'} || []} ];
Expand Down

0 comments on commit 0d99352

Please sign in to comment.