Bug 117261 - Want a way to find out what rpms a build command will create
Summary: Want a way to find out what rpms a build command will create
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm-build
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-03-02 12:30 UTC by Toralf
Modified: 2007-04-18 17:03 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-03-02 15:57:29 UTC
Embargoed:


Attachments (Terms of Use)

Description Toralf 2004-03-02 12:30:30 UTC
Description of problem:
I'll file this here since I got no response on the rpm mailing list:

A simple and direct way to ask rpmbuild what files it's going to
create, would be nice. So far I've been using

rpm -q [<--defines etc. used during build>] --specfile <spec>
--queryformat "`rpm --eval '%{_rpmdir}/%{_rpmfilename}'`"

However,

  1. I've always been thinking that there ought to be a more
     direct way
  2. If I have a package "foo" with
     %package server
     and
     %package client
     (to use an example from "Maximum RPM"), and also
     %files server
     and
     %files client
     but no filelist for the main package, my query will list
     something like
     /usr/src/redhat/RPMS/i386/foo-1.0-1.i386.rpm
     /usr/src/redhat/RPMS/i386/foo-server-1.0-1.i386.rpm
     /usr/src/redhat/RPMS/i386/foo-client-1.0-1.i386.rpm
     but an actual rpmbuild will create just the latter two files;
     there will be no rpm for "foo" itself, since it has no %files!

Version-Release number of selected component (if applicable):
4.2-1, 4.2-0.69 and various earlier releases...

Comment 1 Toralf 2004-03-02 12:46:32 UTC
I also thought that

rpmbuild -bb --nobuild ...

might help, but it doesn't, since it will exit with error messages
about missing files. Which doesn't make sense, at least when using
BuildRoot; *of course* the files are missing when you skip the build
stages.

Comment 2 Jeff Johnson 2004-03-02 15:32:49 UTC
Try
    rpm -q --specfile foo.spec
You can add --queryformat if you need exact file paths.

Comment 3 Toralf 2004-03-02 15:50:55 UTC
I think you missed the point. What I was saying was that

1. There ought to be a *simple* and *direct* way to get this info, IMO.

rpm -q --specfile ... --queryformat "`rpm --eval
'%{_rpmdir}/%{_rpmfilename}'`\n"

is neither simple, nor direct.

2. This method will simply return the list that results from expanding
/usr/src/redhat/RPPMS/%{ARCH}/%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm
or whatever, once for each package mentioned in the spec file. That's
generally *not* the same thing as a list of the files rpmbuild with
the spec file would create, since there may be packages for which rpms
are never created (namely the ones which have no %files)


Comment 4 Jeff Johnson 2004-03-02 15:57:29 UTC
What makes you think that there is anything simpler or
more direct than querying the specfile? No matter what,
a parse needs to happen, and sub-packages can be conditional
on %ifarch.

Comment 5 Toralf 2004-03-02 16:16:15 UTC
What makes me think that, is the observation that an actual build can
work out the file name based on internal info, rather than
--queryformat etc. Well, I'm stating the obvious yet another time, but
the point is that the code that parses the data the right way must be
there already, so why not offer a way to run this code separately, and
print the result on screen?

Comment 6 Jeff Johnson 2004-03-02 16:27:04 UTC
I *did* give you a way to run this code seperately and
print the result.

You complained "not simple and direct".

What do you want? If you want a single option
to do the dirty deed. then put the following
in /etc/popt (watch for typos):

    rpm alias --showpkgstobebuiltfromspecfile -q --sepcfile
    rpmq alias --showpkgstobebultfromspecfile -q --specfile

and invoke as

    rpm --showpkgstobebuiltfromspecfile foo.spec

     rpm --q

Comment 7 Toralf 2004-03-02 16:37:01 UTC
I think you misunderstood. I'm not saying that "rpm -q --specfile"
isn't simple enough. My objection is that to get the output filenames,
I have to rpm --eval '%{_rpmdir}/%{_rpmfilename}' and feed the result
back into rpm --queryformat.

Comment 8 Jeff Johnson 2004-03-02 16:41:24 UTC
And? What do you expect? There is no simpler or more direct.
wrap the command in a 2 libe shell script if it bothers you.

Or use a popt alias.

Or use a shell alias.

Comment 9 Toralf 2004-03-02 16:53:16 UTC
I expect a mode of operation where rpm -q does the above mentioned
eval and queryformat setup implicitly, just like rpmbuild does.

But having said that, I didn't add this report because I was too
worried about running two commands instead of one; the main issue is
that the method doesn't quite work, due to the above mentioned problem
with packages that have no file list.


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