[Rpm-ecosystem] Trying to understand %buildsubdir and debuginfo generation
Jeff Johnson
n3npq at me.com
Thu Apr 26 22:56:04 UTC 2018
> On Apr 26, 2018, at 2:48 PM, Jason L Tibbitts III <tibbs at math.uh.edu> wrote:
>
> A question came up in the Fedora Packaging Committee: Why is a %build
> section required for debuginfo packages to be generated.
>
> We were looking into the R packaging guidelines. R modules are built
> and installed in one step which cannot be split, so in Fedora everything
> is just done in the %install step and the %build section is empty.
> %prep is present as usual and has a normal call to %setup. But for some
> reason %build must be present, or debuginfo packages aren't generated.
>
> Looking at the macros, everything related to debuginfo packages is hung
> off of a redefinition of the %install macro:
>
> %install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
> %%install\
> %{nil}
> (from the redhat-rpm-config macros file)
>
> Obviously %_enable_debug_packages and %buildsubdir must be defined for
> this to happen, and %_enable_debug_packages is set to 1 in the same
> macros file, so it must be that %buildsubdir is not getting defined.
> And that implies that somehow %buildsubdir gets set when %build is
> parsed or processed.
>
> But looking in the rpm source, I see only one place where that macro is
> set: in the doSetupMacro function (in build/parsePrep.c):
>
> rpmPushMacro(spec->macros, "buildsubdir", NULL, spec->buildSubdir, rpmPushMacro(spec->RMIL_SPEC);
>
> The stock macros file seems to agree that this is defined by %setup:
>
> # The sub-directory (relative to %{_builddir}) where sources are compiled.
> # This macro is set after processing %setup, either explicitly from the
> # value given to -n or the default name-version.
> #
> #%buildsubdir
>
> But the package does have %prep and it does call %setup. So obviously
> I'm missing something. Most likely I'm misunderstanding how a internal
> macro like that gets set in the rpm source. I do see in the doScript
> function from build/build.c how spec->buildSubdir gets used in %build,
> but I don't see anything there spec->that sets it or pushes that value
> into a macro definition.
>
%buildsubdir is set from %setup arguments.
You are unlikely to achieve any joy trying to set or change its value.
I know of no reason why a -debuginfo package needs a %build section. What is much more likely is that you have some odd ordering of scriptlet sections, because -debuginfo packages are just an invisible subpackage where existing section markers are overloaded to insert -debuginfo sub package info (which -- iirc from 15yo memory -- happens with %prep, not %build, but ICBW)
73 de Jeff
> Could someone please enlighten me? Thanks,
>
> - J<
> _______________________________________________
> Rpm-ecosystem mailing list
> Rpm-ecosystem at lists.rpm.org
> http://lists.rpm.org/mailman/listinfo/rpm-ecosystem
More information about the Rpm-ecosystem
mailing list