• [gentoo-dev] [PATCH 1/2] meson.eclass: call die -n in phase helpers

    From Mike Gilbert@21:1/5 to All on Tue Mar 26 16:10:01 2024
    This allows the ebuild author to treat some errors as nonfatal.

    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    ---
    eclass/meson.eclass | 8 ++++----
    1 file changed, 4 insertions(+), 4 deletions(-)

    diff --git a/eclass/meson.eclass b/eclass/meson.eclass
    index 3240fddf7e86..3074fcb09fb0 100644
    --- a/eclass/meson.eclass
    +++ b/eclass/meson.eclass
    @@ -425,7 +425,7 @@ meson_src_configure() {
    export -n {C,CPP,CXX,F,OBJC,OBJCXX,LD}FLAGS PKG_CONFIG_{LIBDIR,PATH}
    echo meson setup "${MESONARGS[@]}" >&2
    meson setup "${MESONARGS[@]}"
    - ) || die
    + ) || die -n
    }

    # @FUNCTION: meson_src_compile
    @@ -450,7 +450,7 @@ meson_src_compile() {

    set -- meson compile "${mesoncompileargs[@]}"
    echo "$@" >&2
    - "$@" || die "compile failed"
    + "$@" || die -n "compile failed"
    }

    # @FUNCTION: meson_src_test
    @@ -469,7 +469,7 @@ meson_src_test() {

    set -- meson test "${mesontestargs[@]}"
    echo "$@" >&2
    - "$@" || die "tests failed"
    + "$@" || die -n "tests failed"
    }

    # @FUNCTION: meson_install
    @@ -488,7 +488,7 @@ meson_install() {

    set -- meson install "${mesoninstallargs[@]}"
    echo "$@" >&2
  • From Mike Gilbert@21:1/5 to All on Tue Mar 26 16:10:01 2024
    meson.build has some logic to build ia32 EFI binaries on x86_64 if the toolchain is compatible. Rather than trying to reproduce this logic in
    the ebuild, just try to build it and ignore any failures.

    If meson.build actually defines the targets but we have some other
    compile error, this will move the failure to the install phase instead.

    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    ---
    sys-apps/systemd-utils/systemd-utils-255.4.ebuild | 12 +++++++++---
    1 file changed, 9 insertions(+), 3 deletions(-)

    diff --git a/sys-apps/systemd-utils/systemd-utils-255.4.ebuild b/sys-apps/systemd-utils/systemd-utils-255.4.ebuild
    index b258f5748243..7f17b37aa3ea 100644
    --- a/sys-apps/systemd-utils/systemd-utils-255.4.ebuild
    +++ b/sys-apps/systemd-utils/systemd-utils-255.4.ebuild
    @@ -253,7 +253,7 @@ multilib_src_configure() {
    }

    multilib_src_compile() {
    - local targets=()
    + local targets=() optional_targets=()
    if multilib_is_native_abi; then
    if use boot; then
    local efi_arch= efi_arch_alt=
    @@ -275,7 +275,10 @@ multilib_src_compile() {
    src/boot/efi/addon${efi_arch}.efi.stub
    )
    if [[ -n ${efi_arch_alt} ]]; then
    - targets+=(
    + # If we have a multilib toolchain, meson.build will build the
    + # "alt" arch (ia32). There's no easy way to detect this, so try
    + # to build it and ignore failure.
    + optional_targets+=(
    src/boot/efi/systemd-boot${e
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Mike Gilbert on Tue Mar 26 18:00:01 2024
    On Tue, 2024-03-26 at 11:01 -0400, Mike Gilbert wrote:
    meson.build has some logic to build ia32 EFI binaries on x86_64 if the toolchain is compatible. Rather than trying to reproduce this logic in
    the ebuild, just try to build it and ignore any failures.

    If meson.build actually defines the targets but we have some other
    compile error, this will move the failure to the install phase instead.


    That's not a correct use of nonfatal. It is supposed to be used to
    provide customized error handling (e.g. cleanup step before dying), not
    a cheap way to ignore errors.

    --
    Best regards,
    Michał Górny


    -----BEGIN PGP SIGNATURE-----

    iQFGBAABCgAwFiEEx2qEUJQJjSjMiybFY5ra4jKeJA4FAmYC/R4SHG1nb3JueUBn ZW50b28ub3JnAAoJEGOa2uIyniQOk0sIALD3o0/voKNgxwx0BbMNId54rAdNTL+H VXWrRDv7WDZPaltjrJ2goSKuVDmk9ChXNVEhLIeDL2xtAawo9DvWuWMGSsSdDClz z2j7qrQ5ix6jp/K6KzjpVFOdHGMUCGGeOOX2cbEK6HhThENDZ4a8lZhgbeGszW8S F9WtnxJmYnONsY3bnR9PVoOKnRLHA8+7dcYZn6WCyu0Rykp0nvjyInhO7lpVMUJR TALG3VxNnAC2DgcoqgwhYTtTFlaLhzp84BOGT9knABeH7ZPSHSESeKcgwZW2Xr6P MzKwQSzW33PYDt9+qEzRLsKyvshL/9EJLOswiO7UIhkvP+9RFtD78Ys=
    =T/4F
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Mike Gilbert@21:1/5 to mgorny@gentoo.org on Tue Mar 26 18:00:01 2024
    On Tue, Mar 26, 2024 at 12:51 PM Michał Górny <mgorny@gentoo.org> wrote:

    On Tue, 2024-03-26 at 11:01 -0400, Mike Gilbert wrote:
    meson.build has some logic to build ia32 EFI binaries on x86_64 if the toolchain is compatible. Rather than trying to reproduce this logic in
    the ebuild, just try to build it and ignore any failures.

    If meson.build actually defines the targets but we have some other
    compile error, this will move the failure to the install phase instead.


    That's not a correct use of nonfatal. It is supposed to be used to
    provide customized error handling (e.g. cleanup step before dying), not
    a cheap way to ignore errors.

    I disagree; the error will not go unhandled, it's just being deferred
    until later.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)