* [gentoo-dev] [PATCH v4 0/1] Add edo.eclass
@ 2022-04-17 17:34 Sam James
2022-04-17 17:34 ` [gentoo-dev] [PATCH v4 1/1] edo.eclass: add new eclass Sam James
2022-04-18 16:05 ` [gentoo-dev] [PATCH v4 0/1] Add edo.eclass David Seifert
0 siblings, 2 replies; 3+ messages in thread
From: Sam James @ 2022-04-17 17:34 UTC (permalink / raw
To: gentoo-dev; +Cc: qa, pms, Sam James
Changes since v3:
- EAPI check cleanup
- Fix long line in eclassdoc
Changes since v2:
- Fix typo in eclass guard
- Rework description of edob
- Use 'einfo', not 'elog'
- Change die message for clarity
Changes since v1:
- Add EAPI 7 support (useful for e.g. base-system@ ebuilds)
- Add 'edob' (edo with ebegin/eend for better logs log-running commands, UX)
Sam James (1):
edo.eclass: add new eclass
eclass/edo.eclass | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 eclass/edo.eclass
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [gentoo-dev] [PATCH v4 1/1] edo.eclass: add new eclass
2022-04-17 17:34 [gentoo-dev] [PATCH v4 0/1] Add edo.eclass Sam James
@ 2022-04-17 17:34 ` Sam James
2022-04-18 16:05 ` [gentoo-dev] [PATCH v4 0/1] Add edo.eclass David Seifert
1 sibling, 0 replies; 3+ messages in thread
From: Sam James @ 2022-04-17 17:34 UTC (permalink / raw
To: gentoo-dev; +Cc: qa, pms, Sam James
Bug: https://bugs.gentoo.org/744880
Signed-off-by: Sam James <sam@gentoo.org>
---
eclass/edo.eclass | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 eclass/edo.eclass
diff --git a/eclass/edo.eclass b/eclass/edo.eclass
new file mode 100644
index 000000000000..aa0385842c35
--- /dev/null
+++ b/eclass/edo.eclass
@@ -0,0 +1,45 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: edo.class
+# @MAINTAINER:
+# QA Team <qa@gentoo.org>
+# @AUTHOR:
+# Sam James <sam@gentoo.org>
+# @SUPPORTED_EAPIS: 7 8
+# @BLURB: Convenience function to run commands verbosely and die on failure
+# @DESCRIPTION:
+# This eclass provides the 'edo' command, and an 'edob' variant for ebegin/eend,
+# which dies (exits) on failure and logs the command used verbosely.
+#
+
+case ${EAPI} in
+ 7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_EDO_ECLASS} ]] ; then
+_EDO_ECLASS=1
+
+# @FUNCTION: edo
+# @USAGE: <command> [<args>...]
+# @DESCRIPTION:
+# Executes a short 'command' with any given arguments and exits on failure
+# unless called under 'nonfatal'.
+edo() {
+ einfo "$@"
+ "$@" || die -n "Failed to run command: $@"
+}
+
+# @FUNCTION: edob
+# @USAGE: <command> [<args>...]
+# @DESCRIPTION:
+# Executes 'command' with ebegin & eend with any given arguments and exits
+# on failure unless called under 'nonfatal'.
+edob() {
+ ebegin "Running $@"
+ "$@"
+ eend $? || die -n "Failed to run command: $@"
+}
+
+fi
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-dev] [PATCH v4 0/1] Add edo.eclass
2022-04-17 17:34 [gentoo-dev] [PATCH v4 0/1] Add edo.eclass Sam James
2022-04-17 17:34 ` [gentoo-dev] [PATCH v4 1/1] edo.eclass: add new eclass Sam James
@ 2022-04-18 16:05 ` David Seifert
1 sibling, 0 replies; 3+ messages in thread
From: David Seifert @ 2022-04-18 16:05 UTC (permalink / raw
To: gentoo-dev; +Cc: qa, pms, Sam James
On Sun, 2022-04-17 at 18:34 +0100, Sam James wrote:
> Changes since v3:
> - EAPI check cleanup
> - Fix long line in eclassdoc
>
> Changes since v2:
> - Fix typo in eclass guard
> - Rework description of edob
> - Use 'einfo', not 'elog'
> - Change die message for clarity
>
> Changes since v1:
> - Add EAPI 7 support (useful for e.g. base-system@ ebuilds)
> - Add 'edob' (edo with ebegin/eend for better logs log-running
> commands, UX)
>
> Sam James (1):
> edo.eclass: add new eclass
>
> eclass/edo.eclass | 45 +++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
> create mode 100644 eclass/edo.eclass
>
LGTM, let's get this in
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-18 16:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-17 17:34 [gentoo-dev] [PATCH v4 0/1] Add edo.eclass Sam James
2022-04-17 17:34 ` [gentoo-dev] [PATCH v4 1/1] edo.eclass: add new eclass Sam James
2022-04-18 16:05 ` [gentoo-dev] [PATCH v4 0/1] Add edo.eclass David Seifert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox