public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] texlive-module.eclass: do not treat grep returning 1 as error
@ 2024-05-20 11:10 Florian Schmaus
  2024-05-20 11:10 ` [gentoo-dev] [PATCH 2/3] texlive-module.eclass: invoke doman with nonfatal Florian Schmaus
  2024-05-20 11:10 ` [gentoo-dev] [PATCH 3/3] texlive-module.eclass: include PIPESTATUS in die message Florian Schmaus
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Schmaus @ 2024-05-20 11:10 UTC (permalink / raw
  To: gentoo-dev; +Cc: tex, Florian Schmaus

In case every man page of the dev-texlive/* package is filtered, because
the man pages are already installed by texlive-core, grep returns an
exit status of 1, which we must not treat as an error condition.

Adjust the PIPESTATUS comparison accordingly.

Closes: https://bugs.gentoo.org/931994
Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
 eclass/texlive-module.eclass | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index 0daca41961ff..b202a0188b66 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.eclass
@@ -539,7 +539,10 @@ texlive-module_src_install() {
 			find texmf-dist/doc/man -type f -name '*.[0-9n]' -print |
 				grep -v "${grep_expressions[@]}" |
 				xargs -d '\n' --no-run-if-empty doman
-			[[ "${PIPESTATUS[*]}" =~ ^0(" 0")*$ ]]
+			# The grep in the middle of the pipe may return 1 in case
+			# everything from the input is dropped.
+			# See https://bugs.gentoo.org/931994
+			[[ "${PIPESTATUS[*]}" == "0 "[01]" 0" ]]
 			eend $? || die "error installing man pages"
 
 			# Delete all man pages under texmf-dist/doc/man
-- 
2.44.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-dev] [PATCH 2/3] texlive-module.eclass: invoke doman with nonfatal
  2024-05-20 11:10 [gentoo-dev] [PATCH 1/3] texlive-module.eclass: do not treat grep returning 1 as error Florian Schmaus
@ 2024-05-20 11:10 ` Florian Schmaus
  2024-05-20 11:10 ` [gentoo-dev] [PATCH 3/3] texlive-module.eclass: include PIPESTATUS in die message Florian Schmaus
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Schmaus @ 2024-05-20 11:10 UTC (permalink / raw
  To: gentoo-dev; +Cc: tex, Florian Schmaus, Ulrich Müller

In case doman fails, we do not want to die immediatly as it would
"break" the ebegin/eend combination. Instead, the exit status is passed
through xargs. It will then subsequently appear in PIPESTATUS, where it
is processed by eend || die.

Signed-off-by: Florian Schmaus <flow@gentoo.org>
Suggested-by: Ulrich Müller <ulm@gentoo.org>
---
 eclass/texlive-module.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index b202a0188b66..7d40bfc58994 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.eclass
@@ -538,7 +538,7 @@ texlive-module_src_install() {
 			ebegin "Installing man pages"
 			find texmf-dist/doc/man -type f -name '*.[0-9n]' -print |
 				grep -v "${grep_expressions[@]}" |
-				xargs -d '\n' --no-run-if-empty doman
+				xargs -d '\n' --no-run-if-empty nonfatal doman
 			# The grep in the middle of the pipe may return 1 in case
 			# everything from the input is dropped.
 			# See https://bugs.gentoo.org/931994
-- 
2.44.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-dev] [PATCH 3/3] texlive-module.eclass: include PIPESTATUS in die message
  2024-05-20 11:10 [gentoo-dev] [PATCH 1/3] texlive-module.eclass: do not treat grep returning 1 as error Florian Schmaus
  2024-05-20 11:10 ` [gentoo-dev] [PATCH 2/3] texlive-module.eclass: invoke doman with nonfatal Florian Schmaus
@ 2024-05-20 11:10 ` Florian Schmaus
  2024-05-20 16:35   ` Ulrich Mueller
  1 sibling, 1 reply; 4+ messages in thread
From: Florian Schmaus @ 2024-05-20 11:10 UTC (permalink / raw
  To: gentoo-dev; +Cc: tex, Florian Schmaus

Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
 eclass/texlive-module.eclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/eclass/texlive-module.eclass b/eclass/texlive-module.eclass
index 7d40bfc58994..98c28f578216 100644
--- a/eclass/texlive-module.eclass
+++ b/eclass/texlive-module.eclass
@@ -539,11 +539,12 @@ texlive-module_src_install() {
 			find texmf-dist/doc/man -type f -name '*.[0-9n]' -print |
 				grep -v "${grep_expressions[@]}" |
 				xargs -d '\n' --no-run-if-empty nonfatal doman
+			local pipestatus="${PIPESTATUS[*]}"
 			# The grep in the middle of the pipe may return 1 in case
 			# everything from the input is dropped.
 			# See https://bugs.gentoo.org/931994
-			[[ "${PIPESTATUS[*]}" == "0 "[01]" 0" ]]
-			eend $? || die "error installing man pages"
+			[[ "${pipestatus}" == "0 "[01]" 0" ]]
+			eend $? || die "error installing man pages (pipestatus: ${pipestatus})"
 
 			# Delete all man pages under texmf-dist/doc/man
 			find texmf-dist/doc/man -type f -name '*.[0-9n]' -delete ||
-- 
2.44.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH 3/3] texlive-module.eclass: include PIPESTATUS in die message
  2024-05-20 11:10 ` [gentoo-dev] [PATCH 3/3] texlive-module.eclass: include PIPESTATUS in die message Florian Schmaus
@ 2024-05-20 16:35   ` Ulrich Mueller
  0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Mueller @ 2024-05-20 16:35 UTC (permalink / raw
  To: Florian Schmaus; +Cc: gentoo-dev, tex

[-- Attachment #1: Type: text/plain, Size: 315 bytes --]

>>>>> On Mon, 20 May 2024, Florian Schmaus wrote:

> -			[[ "${PIPESTATUS[*]}" == "0 "[01]" 0" ]]
> -			eend $? || die "error installing man pages"
> +			[[ "${pipestatus}" == "0 "[01]" 0" ]]

Quotes around ${pipestatus} are redundant.

> +			eend $? || die "error installing man pages (pipestatus: ${pipestatus})"

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-20 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-20 11:10 [gentoo-dev] [PATCH 1/3] texlive-module.eclass: do not treat grep returning 1 as error Florian Schmaus
2024-05-20 11:10 ` [gentoo-dev] [PATCH 2/3] texlive-module.eclass: invoke doman with nonfatal Florian Schmaus
2024-05-20 11:10 ` [gentoo-dev] [PATCH 3/3] texlive-module.eclass: include PIPESTATUS in die message Florian Schmaus
2024-05-20 16:35   ` Ulrich Mueller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox