Skip to content

Commit

Permalink
- support binary rpms with fo SOURCERPM header element
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Sep 5, 2012
1 parent afa6f85 commit b33fb3b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Build/Rpm.pm
Expand Up @@ -593,6 +593,7 @@ sub rpmq {
my ($magic, $sigtype, $headmagic, $cnt, $cntdata, $lead, $head, $index, $data, $tag, $type, $offset, $count);

local *RPM;
my $forcebinary;
if (ref($rpm) eq 'ARRAY') {
($headmagic, $cnt, $cntdata) = unpack('N@8NN', $rpm->[0]);
if ($headmagic != 0x8eade801) {
Expand Down Expand Up @@ -623,6 +624,7 @@ sub rpmq {
close RPM unless ref($rpm);
return ();
}
$forcebinary = 1 if unpack('@6n', $lead) != 1;
if (read(RPM, $head, 16) != 16) {
warn("Bad rpm $rpm\n");
close RPM unless ref($rpm);
Expand Down Expand Up @@ -719,6 +721,9 @@ sub rpmq {
}
}
}
if ($forcebinary && $stags{1044} && !$res{$stags{1044}}) {
$res{$stags{1044}} = [ '(none)' ]; # like rpm does...
}

if ($need_filenames) {
if ($res{'OLDFILENAMES'}) {
Expand Down Expand Up @@ -867,7 +872,7 @@ sub query {
}
}

$data->{'source'} = $src if $src ne '';
$data->{'source'} = $src eq '(none)' ? $data->{'name'} : $src if $src ne '';
if ($opts{'evra'}) {
my $arch = $res{'ARCH'}->[0];
$arch = $res{'NOSOURCE'} || $res{'NOPATCH'} ? 'nosrc' : 'src' unless $src ne '';
Expand Down

0 comments on commit b33fb3b

Please sign in to comment.