Bug 227513 - rpm --queryformat %{SOURCE} doesn't work with --specfile
rpm --queryformat %{SOURCE} doesn't work with --specfile
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: rpm (Show other bugs)
4.3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Panu Matilainen
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-06 11:02 EST by Nick Leverton
Modified: 2012-06-20 09:19 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 09:19:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Nick Leverton 2007-02-06 11:02:37 EST
description of problem:

The following query always produces '(none)' as outout, given a valid 
specfile:

rpm -q --qf='[%{SOURCE}\n]' --specfile filename.spec

I would expect it to print the Source files named in the specfile, the same as
rpm -q --qf='[%{SOURCE}\n]' -p filename.src.rpm does.  The same applies to the 
Patch  tag.

I'd like to use this feature to help automate our Subversion integration and 
package building, so that I can ensure sources are present and up-to-date, but 
at present it's not possible without parsing specfiles by hand.


Version-Release number of selected component (if applicable):
$ rpm --version
RPM version 4.3.3

How reproducible:
See below.

Steps to Reproduce:
1. take valid specfile with some Source tags
2.  rpm -q --qf='[%{SOURCE}\n]' --specfile filename.spec
3.  
  
Actual results:
text '(none)' is printed.

Expected results:
Value of all Source tags from specfile should be printed.

Additional info:
Also fix for Patch0..n, please
Comment 1 Jeff Johnson 2007-02-06 13:03:51 EST
Try creating a srpm before querying, not hard. There are a
large number of difficulties with the --specfile querying that
are not easily solved.
Comment 2 Nick Leverton 2007-02-06 13:18:46 EST
Thanks, but ... build an SRPM to see if the sources are up to date so that I 
can then build an SRPM ?  I'm not sure that always hangs together.   It 
depends on the sources at least being all present in the first place.  I think 
it's probably easier not to reply on rpm for querying specfiles.

But I'll have a quick look at the source and see if I can understand why these 
two tags are so hard to implement usefully.

Nick
Comment 3 Jeff Johnson 2007-03-28 13:08:23 EDT
The fundamental problem is that RPMTAG_SOURCE (and RPMTAG_PATCH) are added just before
packaging a source rpm, not during parsing of a spec file.

So --specfile which parses the specfile, and then queries the tags within binary headers, cannot query
info that doesn't exist. Note binary, not source, rpm header(s) used for querying as well.
Comment 4 Jeff Johnson 2007-03-29 15:26:30 EDT
Fixed in rpm cvs, should be in rpm-4.4.9-0.2 when built.

UPSTREAM
Comment 5 Jiri Pallich 2012-06-20 09:19:04 EDT
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life. 
Please See https://access.redhat.com/support/policy/updates/errata/

If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.

Note You need to log in before you can comment on or make changes to this bug.