Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 878505 - sys-apps/gentoo-functions: add eqawarn, eqatag, edo, maybe die?
Summary: sys-apps/gentoo-functions: add eqawarn, eqatag, edo, maybe die?
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-28 04:21 UTC by Sam James
Modified: 2024-05-22 01:12 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-10-28 04:21:42 UTC
Useful for splitting scripts out of Portage or running them independently.
Comment 1 Larry the Git Cow gentoo-dev 2024-05-17 04:03:47 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=6761163b5c8667a1a111683f5bf72e5dff4e604e

commit 6761163b5c8667a1a111683f5bf72e5dff4e604e
Author:     Kerin Millar <kfm@plushkava.net>
AuthorDate: 2024-05-16 12:55:08 +0000
Commit:     Kerin Millar <kfm@plushkava.net>
CommitDate: 2024-05-17 01:40:20 +0000

    Add a die() function
    
    For now, it will only be defined if no utility, function or alias
    already exists by that name. Like the exit builtin, it is able to
    preserve the value of $? but will never exit with a status of 0. For
    example, the following will preserve the exit status of failing_command.
    
    failing_command || die "gadzooks"
    
    Whereas the following will ignore the value of $? - being that it is 0 -
    and instead exit with a status of 1.
    
    if prevailing_command; then
            die "fiddlesticks"
    fi
    
    Signed-off-by: Kerin Millar <kfm@plushkava.net>
    Bug: https://bugs.gentoo.org/878505

 functions.sh   | 20 ++++++++++++++++++++
 test-functions | 39 +++++++++++++++++++++++++--------------
 2 files changed, 45 insertions(+), 14 deletions(-)
Comment 2 Larry the Git Cow gentoo-dev 2024-05-18 14:04:39 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=dea9bf08dd93895101331a3d4e307199d6962891

commit dea9bf08dd93895101331a3d4e307199d6962891
Author:     Kerin Millar <kfm@plushkava.net>
AuthorDate: 2024-05-18 13:13:37 +0000
Commit:     Kerin Millar <kfm@plushkava.net>
CommitDate: 2024-05-18 13:27:54 +0000

    Add an edo() function
    
    Its implementation is similar to that of the edo eclass.
    
    Signed-off-by: Kerin Millar <kfm@plushkava.net>
    Bug: https://bugs.gentoo.org/878505

 functions.sh   | 25 +++++++++++++++++++++++++
 test-functions | 15 +++++++++++++++
 2 files changed, 40 insertions(+)

https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=61e6f15aab5524331946d5172fcd73d30c3c16f0

commit 61e6f15aab5524331946d5172fcd73d30c3c16f0
Author:     Kerin Millar <kfm@plushkava.net>
AuthorDate: 2024-05-18 10:26:00 +0000
Commit:     Kerin Millar <kfm@plushkava.net>
CommitDate: 2024-05-18 11:28:43 +0000

    Add an eqawarn() function
    
    In portage's isolated-functions, eqawarn() prints a warning with the
    asterisk in dark yellow as opposed to bright yellow. To my mind, this
    does not merit yet another cookier-cutter function in gentoo-functions.
    So, for now, implement it as an ewarn() wrapper.
    
    Signed-off-by: Kerin Millar <kfm@plushkava.net>
    Bug: https://bugs.gentoo.org/878505

 functions.sh | 9 +++++++++
 1 file changed, 9 insertions(+)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-05-18 17:14:36 UTC
Calling this done, as per discussion, eqatag has unknown semantics outside of Portage and needs consideration separately.
Comment 4 Larry the Git Cow gentoo-dev 2024-05-22 01:12:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=8a8dc3b63c8c639117c12a22960b03102dc00942

commit 8a8dc3b63c8c639117c12a22960b03102dc00942
Author:     Kerin Millar <kfm@plushkava.net>
AuthorDate: 2024-05-19 17:41:23 +0000
Commit:     Kerin Millar <kfm@plushkava.net>
CommitDate: 2024-05-20 07:49:53 +0000

    Add an eqatag() function
    
    This differs from the isolated-functions implementation in that it will
    render a line of compact JSON then use the logger(1) utility to log it.
    It requires jq in order to do so. Should jq be unavailable, a warning
    will be displayed, though no more than once.
    
    Signed-off-by: Kerin Millar <kfm@plushkava.net>
    Bug: https://bugs.gentoo.org/878505

 functions.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)