• [gentoo-dev] [PATCH 0/2] edo.eclass: enhace edob for usage with nosiy c

    From Florian Schmaus@21:1/5 to All on Wed May 8 19:20:01 2024
    The motivation for this change is to allow edob to be used with noisy
    commands, i.e., commands that produce a lot of output, in cases where
    the output is in general not of interest. However, if the command
    fails, the output should be shown and appear in build.log.

    We do this by simply redirecting the output to a file in $T, and show
    this file if the command returned a non-zero exit status.

    We already have a few cases in ::gentoo where such output is simply
    redirected to /dev/null, hindering post-mortem analysis. Those could
    be converted to edob with its new behavior.

    PR at https://github.com/gentoo/gentoo/pull/36117

    Florian Schmaus (2):
    edo.eclass: enhace edob for usage with nosiy commands
    eftmutil-sys: use edob

    eclass/edo.eclass | 54 ++++++++++++++++++++++++++++++++----
    eclass/texlive-common.eclass | 8 ++++--
    2 files changed, 53 insertions(+), 9 deletions(-)

    --
    2.43.2

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Florian Schmaus@21:1/5 to All on Wed May 8 19:20:01 2024
    Normally, edob can, or rather should, not be used with noisy commands,
    i.e., commands that produce an output. This is because the output
    destroys the concept of ebegin and eend, where the eend marker is shown
    on the same line that is produced by ebegin.

    However, it sometimes would be nice to use edob with noisy commands, but
    this means to redirect stdout and stderr of those commands. Instead of redirecting the output to /dev/null, we save the output in a log file
    under T. This allows us to present the output to the user in case the
    command fails, making it futhermore part of the build.log, which we
    expect users to attach to bug reports.

    Signed-off-by: Florian Schmaus <flow@gentoo.org>
    ---
    eclass/edo.eclass | 66 ++++++++++++++++++++++++++++++++++++++++-------
    1 file changed, 56 insertions(+), 10 deletions(-)

    diff --git a/eclass/edo.eclass b/eclass/edo.eclass
    index c2e7ed60083f..0d410719675c 100644
    --- a/eclass/edo.eclass
    +++ b/eclass/edo.eclass
    @@ -1,4 +1,4 @@
    -# Copyright 2022 Gentoo Authors
    +# Copyright 2022-2024 Gentoo Authors
    # Distributed under the terms of the GNU General Public License v2

    # @ECLASS: edo.eclass
    @@ -12,10 +12,14 @@
    # This eclass provides the 'edo' command, and an 'edob' variant for ebegin/eend,
    # which logs the command used verbosely and dies (exits) on failure.
    #
    -# This eclass should be used only where needed to give a more verbose log, e.g.
    -# for invoking non-standard ./configure scripts, or building objects/binaries -# directly within ebuilds via compiler invocations. It is NOT to be used
    -# in place of generic 'command || die' where verbosity is unnecessary.
    +# The 'edo' command should be used only where needed to give a more verbos
  • From Sam James@21:1/5 to Florian Schmaus on Mon May 13 17:10:01 2024
    Florian Schmaus <flow@gentoo.org> writes:

    The motivation for this change is to allow edob to be used with noisy commands, i.e., commands that produce a lot of output, in cases where
    the output is in general not of interest. However, if the command
    fails, the output should be shown and appear in build.log.

    We do this by simply redirecting the output to a file in $T, and show
    this file if the command returned a non-zero exit status.

    We already have a few cases in ::gentoo where such output is simply redirected to /dev/null, hindering post-mortem analysis. Those could
    be converted to edob with its new behavior.

    PR at https://github.com/gentoo/gentoo/pull/36117


    LGTM. I agree there's value in it.

    Florian Schmaus (2):
    edo.eclass: enhace edob for usage with nosiy commands

    s/nosiy/noisy/

    eftmutil-sys: use edob

    eclass/edo.eclass | 54 ++++++++++++++++++++++++++++++++----
    eclass/texlive-common.eclass | 8 ++++--
    2 files changed, 53 insertions(+), 9 deletions(-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gentoo@dhaller.de@21:1/5 to All on Sun May 19 11:10:01 2024
    Hello,

    08.05.2024 19:15:52 Florian Schmaus <flow@gentoo.org>:
    [..]
    # @FUNCTION: edob
    -# @USAGE: <command> [<args>...]
    +# @USAGE: [-m <message>] [-l <log-name>] <command> [<args>...]
                                 ^^!
    [..]
    -l <log-name> is provided, then <log-name> is
    [..]
    edob() {
    [..]
    +   while true; do
    +       case "${1}" in
    +           -m|-n)
                     ^^! ITYM '-l' here

    +               [[ $# -lt 2 ]] && die "Must provide an argument to ${1}"
    +               case "${1}" in +                   -m) +                       message="${2}" +                       ;; +                   -n)
                          ^^! ITYM '-l' here

    +                       log="${2}"

    [..]

    Fix yer option character ;)

    -dnh

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