Discussion:
rpm macro expansion time question
(too old to reply)
Alex Wanderleit
2010-03-11 10:54:49 UTC
Permalink
Hi!

I would like to place some logging into the scriptlet parts of a .spec
file,
including the current timestamp in each log line.

Avoiding the same "now evaluation line" over and over throughout the
spec file clutters the actual script:
now=`date +%Y%m%d_%H%M%S`
echo "${now}: +++ prep section start +++" >> /tmp/rpm_install.log

My first approach was to have an rpm macro like this in the preamble
section:
%define now %(date +%Y%m%d_%H%M%S)

Unfortunately, the macro expansion takes place only once at rpm build
time,
yielding a not desired result of writing the rpm build time into the
log file.

Is there a way to define a global macro in one place and have that
available and evaluate
at time of rpm installation/update/erase in various scriptlet parts?

Thank you,
Alex
Alex Wanderleit
2010-03-11 15:30:44 UTC
Permalink
Making things worse, the following

now=`date +%Y%m%d_%H%M%S`
echo "${now}: +++ prep section start +++" >> /tmp/rpm_install.log

becomes:

20100311_161646OURCE: +++ prep section start +++

in the log.

Is %S something special or where does the OURCE coming from?

Loading...