Bug 227513 - rpm --queryformat %{SOURCE} doesn't work with --specfile
Summary: rpm --queryformat %{SOURCE} doesn't work with --specfile
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: rpm
Version: 4.3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Panu Matilainen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-02-06 16:02 UTC by Nick Leverton
Modified: 2012-06-20 13:19 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 13:19:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Nick Leverton 2007-02-06 16:02:37 UTC
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 18:03:51 UTC
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 18:18:46 UTC
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 17:08:23 UTC
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 19:26:30 UTC
Fixed in rpm cvs, should be in rpm-4.4.9-0.2 when built.

UPSTREAM

Comment 5 Jiri Pallich 2012-06-20 13:19:04 UTC
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.