On 16. 03. 21 20:22, Jos de Kloe wrote:
Hi Miro,
in general I think explicit is better than implicit
(and since I am Dutch, this seems obvious to me).
:D
But regarding your question, I think a better argument for creating a
macro is
to prevent mistakes from packagers. I think that is more relevant than avoiding
a few lines of code in a spec file.
The examples I've put are really not that complex as %py3_build/%py3_install, so
I don't think "error prevention" would apply for them.
For myself, I am happy as long as I can find or print the definition
of a macro
easily. For some this is easy enough, i.e.:
> rpm --eval '%py3_install'
\
CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}"
LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}"\
/usr/bin/python3 setup.py install -O1 --skip-build --root
$HOME/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64
rm -rfv
$HOME/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/bin/__pycache__
and this also illustrates my earlier point, since I am sure I would forget
setting this CFLAGS and LD_FLAGS often (are they really needed for plain python
packages?).
No, they are not needed for noarch packages, but they are needed or extension
modules and since we don't want a different set of macros for noarch/arch, we
set it everywhere.
But for other macros this just doesn't work, i.e.:
> rpm --eval '%autosetup'
error: lua script failed: attempt to index a nil value
Yes, some macros need the context defined in the spec file, this one needs a
defined source.
And actually, it is also not obvious to me where this one is defined
(a grep on
the files in /usr/lib/rpm/macros.d/ did not tell me anything relevant).
This macro is defined directly in the /usr/lib/rpm/macros file.
Cheers,
Thanks for the input Jos, I really appreciate it.
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok