public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ulrich Mueller <ulm@gentoo.org>
To: Florian Schmaus <flow@gentoo.org>
Cc: gentoo-dev@lists.gentoo.org,  tex@gentoo.org
Subject: Re: [gentoo-dev] [PATCH] texlive-common.eclass: add newline between tlbobj entries in tlpdb
Date: Sun, 28 Apr 2024 14:13:31 +0200	[thread overview]
Message-ID: <ule4xofbo@gentoo.org> (raw)
In-Reply-To: <20240428084001.32729-1-flow@gentoo.org> (Florian Schmaus's message of "Sun, 28 Apr 2024 10:40:00 +0200")

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

>>>>> On Sun, 28 Apr 2024, Florian Schmaus wrote:

> --- a/eclass/texlive-common.eclass
> +++ b/eclass/texlive-common.eclass
> @@ -270,10 +270,18 @@ texlive-common_update_tlpdb() {
>  	touch "${new_tlpdb}" || die
> 
>  	if [[ -d "${tlpobj}" ]]; then
> -		find "${tlpobj}" -maxdepth 1 -type f -name "*.tlpobj" -print0 |
> -			sort -z |
> -			xargs -0 --no-run-if-empty cat >> "${new_tlpdb}"
> -		assert "generating tlpdb failed"
> +		all_tlpobjs() {
> +			find "${tlpobj}" -maxdepth 1 -type f -name "*.tlpobj" -print0 |
> +				sort -z
> +			assert "Error enumerating all tlpobj files"
> +		}
> +		(
> +			while IFS="" read -d $'\0' -r f; do
> +				cat "${f}" || die "Failed to read ${f}"
> +				# Ensure there is an empty line between every tlpobj entry.
> +				echo
> +			done < <(all_tlpobjs)
> +		) >> "${new_tlpdb}"
>  	fi
> 
>  	if [[ -f ${tlpdb} ]]; then

Looks complicated. AFAICS a one-line change like the following would
also do the job:

-			xargs -0 --no-run-if-empty cat >> "${new_tlpdb}"
+			xargs -0 --no-run-if-empty sed -s '$G' >> "${new_tlpdb}"

Alternatively, "sed -s '$s/$/\n/'" would also work (but is longer and
maybe harder to read).

Ulrich

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

  reply	other threads:[~2024-04-28 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-28  8:40 [gentoo-dev] [PATCH] texlive-common.eclass: add newline between tlbobj entries in tlpdb Florian Schmaus
2024-04-28 12:13 ` Ulrich Mueller [this message]
2024-04-28 16:49   ` Florian Schmaus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ule4xofbo@gentoo.org \
    --to=ulm@gentoo.org \
    --cc=flow@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=tex@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox