[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] [PATCH] texlive-common.eclass: add newline between tlbobj entries in tlpdb
From:       Florian Schmaus <flow () gentoo ! org>
Date:       2024-04-28 16:49:44
Message-ID: 8d0cdc2c-f05c-428e-b07f-1f7a19bbc4ff () gentoo ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]

[Attachment #4 (multipart/mixed)]

[Attachment #6 (text/plain)]

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.


["OpenPGP_0x8CAC2A9678548E35.asc" (application/pgp-keys)]
["OpenPGP_signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic