On Fri, 3 Jul 2020 11:09:47 -0700
PGNet Dev <pgnet.dev(a)gmail.com> wrote:
on F32,
date +FORMAT,
date +%Y%m%d_%H%M%S
returns
20200703_105351
as expected.
in an rpm .spec, if I define
%define _build_timestamp %( date +%Y%m%d_%H%M%S )
and _use_ %{_build_timestamp) _anywhere_ else in the spec, at exec of
any of rpmbuild/mock build/@COPR etc, it appears as
'20200703_105351OURCE'
?????
Simply changing the define to
%define _build_timestamp %( date +%Y%m%d_%H%M%S | head -c 15 )
'fixes' the problem, and use of %{_build_timestamp) correctly returns
'20200703_105351'
Is this a bug in rpmbuild or date? Or a problem in my usage?
Remember that '%' introduces a macro expansion, so if that's not what
you want, you should escape the '%' as '%%':
%define _build_timestamp %( date +%%Y%%m%%d_%%H%%M%%S )
Paul.