On 6/3/24 17:18, Eike Rathke wrote:
Hi Panu,
On Monday, 2024-06-03 15:55:09 +0300, Panu Matilainen wrote:
%{_buildrootdir} is nothing packages should be referring to, in any
circumstance really. It's a potentially shared directory among arbitrary
packages (in the traditional it's ~/rpmbuild/BUILDROOT/ ) and putting
anything there can conflict with other packages being built on the system.
%{buildroot} is what packages should be referring to,
So using %{buildroot} instead of %{_buildrootdir} would be an actual
replacement?
Depends on the case. If, as I suspect below and you confirm in the other
email this was never meant to be packaged, then %{buildroot} of course
is not the right place.
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.
That said, these cases kinda appear to be something not intended to be
packaged at all, just "I need to put this file somewhere". That's one of the
many use-cases we introduced the intermediate %builddir in 4.20, under which
the %{buildroot} itself is.
But that's _only_ available as of 4.20, so not in f39,f40, correct?
Yes. The next best thing would be using %{_builddir}/%{buildsubdir}, aka
$PWD of the build scriptlets, this is available in all rpm versions for
packages using %setup.
- Panu -
Eike
--
_______________________________________________
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
--
_______________________________________________
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