public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] texlive-common.eclass: add newline between tlbobj entries in tlpdb
@ 2024-04-28  8:40 Florian Schmaus
  2024-04-28 12:13 ` Ulrich Mueller
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Schmaus @ 2024-04-28  8:40 UTC (permalink / raw)
  To: gentoo-dev; +Cc: tex, Florian Schmaus

We previously created the texlive.tlpdb by concatenating all tlpobj
files. This means that the entries will be right after another.

As it turns out, some TeX Live tools require a newline (e.g., tlmgr)
between the entries, while others do not (e.g., texdoc). And the
"official" tlpdb also has the entries separated by newlines. Therefore
this changes texlive-common_update_tlpdb() to also add them.

Signed-off-by: Florian Schmaus <flow@gentoo.org>
---
 eclass/texlive-common.eclass | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/eclass/texlive-common.eclass b/eclass/texlive-common.eclass
index b32ea2af1121..929062c0444a 100644
--- 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
-- 
2.43.2



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

* Re: [gentoo-dev] [PATCH] texlive-common.eclass: add newline between tlbobj entries in tlpdb
  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
  2024-04-28 16:49   ` Florian Schmaus
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Mueller @ 2024-04-28 12:13 UTC (permalink / raw)
  To: Florian Schmaus; +Cc: gentoo-dev, tex

[-- 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 --]

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

* Re: [gentoo-dev] [PATCH] texlive-common.eclass: add newline between tlbobj entries in tlpdb
  2024-04-28 12:13 ` Ulrich Mueller
@ 2024-04-28 16:49   ` Florian Schmaus
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Schmaus @ 2024-04-28 16:49 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: gentoo-dev, tex


[-- Attachment #1.1.1: Type: text/plain, Size: 1248 bytes --]

On 28/04/2024 14.13, Ulrich Mueller wrote:
>>>>>> 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}"

That is exactly the feedback I was hoping for.

Thanks ulm.


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 17797 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

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

end of thread, other threads:[~2024-04-28 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2024-04-28 16:49   ` Florian Schmaus

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