Re: Extract source URLs from RPM spec files

Michael Jennings <[email protected]>
Newsgroups gmane.linux.redhat.rpm.general
Message-ID <[email protected]>
On Thursday, 06 December 2007, at 22:57:27 (+0100),
Mildred wrote:

> I would like to create a probram that would download automatically
> the source files of packages given a spec file and build it using
> rpmbuild.

I believe rpmbuild in RPM 5 already does this.

> But I just wonder how to extract the source URLs from the spec
> file. I can't use standard srep and sed since often the Source line
> contains variables that need to be resolved.
> 
> I found that rpm has an option --specfile that seems deigned for
> that purpose. But rpm do not seems to be aware of the source
> filenames unfortunately.
> 
> Does anyone knows how I could extract this information without
> writing a spec file parser ?

rpm --eval "`cat foo.spec`" will get you most of the way there.

Michael

-- 
Michael Jennings (a.k.a. KainX)  http://www.kainx.org/  <[email protected]>
Linux Server/Cluster Admin, LBL.gov       Author, Eterm (www.eterm.org)
-----------------------------------------------------------------------
 "I have failed over and over again in my life.  And that is why I
  succeed."                                          -- Michael Jordan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.