Unpacking SRPMs

Florian Weimer fweimer at redhat.com
Wed May 22 14:49:28 UTC 2013

On 05/17/2013 04:46 PM, Daniel P. Berrange wrote:
> On Fri, May 17, 2013 at 04:37:13PM +0200, Florian Weimer wrote:
>> I'd like some scriptable way to unpack SRPMs up and including to the
>> %prep stage.  Ideally, the results would end up in a directory I
>> specify, and intermediate directories which only contain a single
>> subdirectory are skipped.  (The eventual goal is to run two such
>> directory tress through diff -uraN, and I want to avoid spurious
>> differences due to an update from foo-1.2 to foo-1.3.)
>> I've already learned the hard way that I need to use something like
>> mock because some %prep script assume that build requires are
>> installed.  But mock does not appear to support an option to stop
>> after the %prep stage.
> I guess you were using the --rebuild arg to mock ?  Can you do
> something like this where you invoke rpmbuild explicitly with
> the args you need to just run upto %prep:
>     mock --init
>     mock --installdeps  /path/to/srpm
>     mock --copyin /path/to/srpm /srpm
>     mock --shell /usr/bin/rpmbuild -bp /srpm

I put the various suggestions in this thread together and the attached 
script appears to work.  Admittedly, some parts of it are rather ugly.

Florian Weimer / Red Hat Product Security Team
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mock-prep.py
Type: text/x-python
Size: 4397 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/devel/attachments/20130522/04e9a8be/attachment.py>

More information about the devel mailing list