diff options
author | Michael Schroeder <mls@suse.de> | 2012-09-05 15:56:42 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-09-05 15:57:20 +0200 |
commit | b33fb3b59eb74899d3502ba7c56f8fec3617bb69 (patch) | |
tree | 928d6a169e22f7ad0bf716bf4f1cdc400ed625c7 | |
parent | afa6f85f64d9193699db06041bbe7233c5c3a53c (diff) | |
download | build-b33fb3b59eb74899d3502ba7c56f8fec3617bb69.tar.gz build-b33fb3b59eb74899d3502ba7c56f8fec3617bb69.tar.bz2 build-b33fb3b59eb74899d3502ba7c56f8fec3617bb69.zip |
- support binary rpms with fo SOURCERPM header element
-rw-r--r-- | Build/Rpm.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Build/Rpm.pm b/Build/Rpm.pm index fbb7dee..788826e 100644 --- a/Build/Rpm.pm +++ b/Build/Rpm.pm @@ -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) { @@ -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); @@ -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'}) { @@ -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 ''; |