Re: RPM_* env variables vs macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Dne 04. 06. 24 v 9:27 Vít Ondruch napsal(a):

Dne 04. 06. 24 v 8:11 Panu Matilainen napsal(a):
On 6/3/24 17:18, Eike Rathke wrote:
Hi Panu,

On Monday, 2024-06-03 15:55:09 +0300, Panu Matilainen wrote:

or better yet, ${RPM_BUILD_ROOT}.

Why better?

In general, the RPM_* environment variables available to build scriptlets are what should be used instead of macros. Because, macros are processed while parsing the spec, which is different from actually *building* it. For one, using the environment improves srpm reproducibility because the local gunk like number of CPUs, the concrete path of %buildroot etc are only visible the scriptlets where actually used.

It's a subtle thing, took me 10+ years with rpm to grok the recommendation I'd seen long, long, long ago.


I wish this nugget was captured somewhere on more prominent place. Because what you say does not really correspond with what we have in guidelines:

https://docs.fedoraproject.org/en-US/packaging-guidelines/#_using_buildroot_and_optflags_vs_rpm_build_root_and_rpm_opt_flags

And I have not checked the RPM documentation


There is this section:

https://rpm-software-management.github.io/rpm/manual/spec.html#build-scriptlets

also recommending RPM_ macros for scriptlets:


> Note: many of these have macro counterparts which may seem more convenient and consistent with the rest of the spec, but one should always use the environment variables inside the scripts. The reason for this is that macros are evaluated during spec parse and may not be up-to-date, whereas environment variables are evaluated at the time of their execution in the script.


Vít


, but I think that the env variables are underdocumented in the FPG.


Vít

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux