RPM Community Forums

Mailing List Message of <rpm-users>

Evaluating macros defined in specfiles

From: Eric MSP Veith <eveith@wwweb-library.net>
Date: Sun 03 May 2009 - 00:38:39 CEST
Message-Id: <200905030038.40196.eveith@wwweb-library.net>
Hash: SHA1

Hello list,

if one defines a macro in a spec file, is there any way to evaluate it from 
a process started during/by rpmbuild?

Background is: I wrote a little Perl script that translates macros in files 
for me. I use this for config or init files I supply with packages and which 
sometimes need a full path, and since I don't want to explicility use sed 
every time, I wrote this convenience script. I basically have lines like 

"%{__cat} '%{SOURCE1}' | %{__m2rpath} > somefile'

in my specfile, with '%{__m2rpath}' beeing my utility. It does nothing more 
than scanning each line for something that looks like a RPM macro definition 
(m/(%{\w+})/) and runs "rpm -E $1" against it. This works, of course, well 
with macros that are known to the whole build system, but fails with new 
definitions made in the spec file.

Is there any way to catch those, too?

Thanks in advance,
		-- Eric
Version: GnuPG v1.4.9 (GNU/Linux)

Received on Sun May 3 01:11:51 2009
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.