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...
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.
Try rpm -q --specfile foo.spec You can add --queryformat if you need exact file paths.
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)
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.
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?
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
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.
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.
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.