[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: rh-rpm] Re: Extract spec file from rpm?



On Fri, 7 Mar 2003, Jeff Johnson wrote:

> > Um, you mean like "rpm2cpio <pkg>.src.rpm | cpio -mi \*.spec"?
> 
> If it works, nearly perfect.
> 
> Can you rename output file on the fly too?

Looks like backticks do the trick so long as there is only 
one .spec file; this works:

[herrold@gateway2000 dl]$ mv `rpm2cpio yum-0.9.3-1.src.rpm  | \
	cpio -mi \*.spec 2> /dev/null ; rpm2cpio yum-0.9.3-1.src.rpm | \
	cpio -idt '*.spec' 2> /dev/null ` newname.spec
[herrold@gateway2000 dl]$ rpm2cpio yum-0.9.3-1.src.rpm  | cpio \
	-mi \*.spec 2> /dev/null ; rpm2cpio yum-0.9.3-1.src.rpm | cpio \
	-idt '*.spec' 2> /dev/null
yum.spec
[herrold@gateway2000 dl]$ diff yum.spec  newname.spec
[herrold@gateway2000 dl]$ ls -al *spec
-rw-rw-r--    1 herrold  herrold      2285 Oct 20 22:01 newname.spec
-rw-rw-r--    1 herrold  herrold      2285 Oct 20 22:01 yum.spec
[herrold@gateway2000 dl]$

With more than one specfile in the tarball, you would want an 
xargs or a for loop to walk the namespace 

-- Russ Herrold





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []