• [gentoo-dev] [PATCH] texlive-common.eclass: add newline between tlbobj

    From Florian Schmaus@21:1/5 to All on Sun Apr 28 10:50:02 2024
    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
  • From Ulrich Mueller@21:1/5 to All on Sun Apr 28 14:20:01 2024
    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

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmYuPWsPHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4uuTEH/RRvkE0af68HrmkDjj35Xp2zNkRCntzQgTMn LA6Eq/OfbI37L2Kx/28B6EcFBmgYJS/1THdfeh49qeR4vCWRTDfUYQzDj8zRgIez j1xo0dmFTxC511P/bXFG7ji+VG9K5+FmxPi/GQyElBrlfYljAkKbDxPLilh7mNZI j8VxSaouOHLG/jNWNdL1DeIh0NwmaJsdBy1lJaV9qjpCf7ATEERoOdpk0FTDGZW4 HVkJrkwDRmOnSExZi6v+FDyk54i/wBNuLeVFqg3RyFKZV0vew41MqVEVDaL7cyPZ RJgUBFzaxiRlKMLZ1vzRabsQrjHrKJ2Nwu5BKAxgAo6CnblejBYbV
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)