[bug#78424] gnu: texlive-libkpathsea: Add definitions for XDG paths.

Message ID 5be04a85bec58fd7af826c245711fbcaab66d19d.1747223352.git.liliana.prikler@gmail.com
State New
Headers
Series [bug#78424] gnu: texlive-libkpathsea: Add definitions for XDG paths. |

Commit Message

Liliana Marie Prikler May 14, 2025, 11:46 a.m. UTC
Without these paths set, if they are unset in the environment, jobs that need
to read from/write to TEXMFVAR or TEXMFCONFIG will fail.  If set, environment
variables take precedence.

* gnu/packages/tex.scm (texlive-libkpathsea): Add replacement, pointing to…
(texlive-libkpathsea/fixed): … this.  Add definitions for XDG_CACHE_HOME and
XDG_CONFIG_HOME.
---
 gnu/packages/tex.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)


base-commit: 5f5d84beccc180f1b51474c0e47eb6e0d0c9175f
  

Comments

Nicolas Goaziou May 16, 2025, 6:58 a.m. UTC | #1
Hello,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Without these paths set, if they are unset in the environment, jobs that need
> to read from/write to TEXMFVAR or TEXMFCONFIG will fail.  If set, environment
> variables take precedence.
>
> * gnu/packages/tex.scm (texlive-libkpathsea): Add replacement, pointing to…
> (texlive-libkpathsea/fixed): … this.  Add definitions for XDG_CACHE_HOME and
> XDG_CONFIG_HOME.
> ---
>  gnu/packages/tex.scm | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
> index 99a65641a4a..e2fe5554a0c 100644
> --- a/gnu/packages/tex.scm
> +++ b/gnu/packages/tex.scm
> @@ -296,6 +296,9 @@ (define-public texlive-source
>  (define-public texlive-libkpathsea
>    (package
>      (name "texlive-libkpathsea")
> +    ;; TODO: ungraft on tex-team or a dedicated branch,
> +    ;; integrating the missing definitions.
> +    (replacement texlive-libkpathsea/fixed)
>      (version (package-version texlive-source))
>      (source
>       (origin
> @@ -395,6 +398,21 @@ (define-public texlive-libkpathsea
>  of user-specified directories similar to how shells look up executables.")
>      (license license:lgpl2.1)))
>  
> +(define texlive-libkpathsea/fixed
> +  (package
> +    (inherit texlive-libkpathsea)
> +    (arguments
> +     (substitute-keyword-arguments (package-arguments texlive-libkpathsea)
> +       ((#:phases phases)
> +        #~(modify-phases #$phases
> +            (add-after 'customize-texmf.cnf 'fix-texmf.cnf
> +              (lambda _
> +                (substitute* "texk/kpathsea/texmf.cnf"
> +                  (("^TEXMFVAR = .*" all)
> +                   (string-append "XDG_CACHE_HOME = ~/.cache\n" all))
> +                  (("^TEXMFCONFIG = .*" all)
> +                   (string-append "XDG_CONFIG_HOME = ~/.config\n" all)))))))))))

It looks good.

Perhaps we could also fix in an additional step a little mistake
I introduced in the recent TeX Live update: cache and config files are
created in, e.g., "$XDG_CACHE_HOME/.texliveYYYY/texmf-var", but it would
make sense to put them in "$XDG_CACHE_HOME/texliveYYYY/texmf-var"
instead.

WDYT?

Regards,
  
Liliana Marie Prikler May 16, 2025, 7:47 p.m. UTC | #2
Am Freitag, dem 16.05.2025 um 08:58 +0200 schrieb Nicolas Goaziou:
> Hello,
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > Without these paths set, if they are unset in the environment, jobs
> > that need
> > to read from/write to TEXMFVAR or TEXMFCONFIG will fail.  If set,
> > environment
> > variables take precedence.
> > 
> > * gnu/packages/tex.scm (texlive-libkpathsea): Add replacement,
> > pointing to…
> > (texlive-libkpathsea/fixed): … this.  Add definitions for
> > XDG_CACHE_HOME and
> > XDG_CONFIG_HOME.
> > ---
> >  gnu/packages/tex.scm | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> > 
> > diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
> > index 99a65641a4a..e2fe5554a0c 100644
> > --- a/gnu/packages/tex.scm
> > +++ b/gnu/packages/tex.scm
> > @@ -296,6 +296,9 @@ (define-public texlive-source
> >  (define-public texlive-libkpathsea
> >    (package
> >      (name "texlive-libkpathsea")
> > +    ;; TODO: ungraft on tex-team or a dedicated branch,
> > +    ;; integrating the missing definitions.
> > +    (replacement texlive-libkpathsea/fixed)
> >      (version (package-version texlive-source))
> >      (source
> >       (origin
> > @@ -395,6 +398,21 @@ (define-public texlive-libkpathsea
> >  of user-specified directories similar to how shells look up
> > executables.")
> >      (license license:lgpl2.1)))
> >  
> > +(define texlive-libkpathsea/fixed
> > +  (package
> > +    (inherit texlive-libkpathsea)
> > +    (arguments
> > +     (substitute-keyword-arguments (package-arguments texlive-
> > libkpathsea)
> > +       ((#:phases phases)
> > +        #~(modify-phases #$phases
> > +            (add-after 'customize-texmf.cnf 'fix-texmf.cnf
> > +              (lambda _
> > +                (substitute* "texk/kpathsea/texmf.cnf"
> > +                  (("^TEXMFVAR = .*" all)
> > +                   (string-append "XDG_CACHE_HOME = ~/.cache\n"
> > all))
> > +                  (("^TEXMFCONFIG = .*" all)
> > +                   (string-append "XDG_CONFIG_HOME = ~/.config\n"
> > all)))))))))))
> 
> It looks good.
> 
> Perhaps we could also fix in an additional step a little mistake
> I introduced in the recent TeX Live update: cache and config files
> are created in, e.g., "$XDG_CACHE_HOME/.texliveYYYY/texmf-var", but
> it would make sense to put them in
> "$XDG_CACHE_HOME/texliveYYYY/texmf-var" instead.
Sure, I don't see a problem with that.  Do you want to push this or
should I go?

Cheers
  
Nicolas Goaziou May 17, 2025, 9:44 a.m. UTC | #3
Hello,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 16.05.2025 um 08:58 +0200 schrieb Nicolas Goaziou:
>> Perhaps we could also fix in an additional step a little mistake
>> I introduced in the recent TeX Live update: cache and config files
>> are created in, e.g., "$XDG_CACHE_HOME/.texliveYYYY/texmf-var", but
>> it would make sense to put them in
>> "$XDG_CACHE_HOME/texliveYYYY/texmf-var" instead.
> Sure, I don't see a problem with that.  Do you want to push this or
> should I go?

Please be my guest ;)

Thank you!

Regards,
  
Andreas Enge June 16, 2025, 11:39 a.m. UTC | #4
Pushed as commit 91a81927345394c9f52bca6ecf743f48cd24d250 .

Andreas
  

Patch

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index 99a65641a4a..e2fe5554a0c 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -296,6 +296,9 @@  (define-public texlive-source
 (define-public texlive-libkpathsea
   (package
     (name "texlive-libkpathsea")
+    ;; TODO: ungraft on tex-team or a dedicated branch,
+    ;; integrating the missing definitions.
+    (replacement texlive-libkpathsea/fixed)
     (version (package-version texlive-source))
     (source
      (origin
@@ -395,6 +398,21 @@  (define-public texlive-libkpathsea
 of user-specified directories similar to how shells look up executables.")
     (license license:lgpl2.1)))
 
+(define texlive-libkpathsea/fixed
+  (package
+    (inherit texlive-libkpathsea)
+    (arguments
+     (substitute-keyword-arguments (package-arguments texlive-libkpathsea)
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (add-after 'customize-texmf.cnf 'fix-texmf.cnf
+              (lambda _
+                (substitute* "texk/kpathsea/texmf.cnf"
+                  (("^TEXMFVAR = .*" all)
+                   (string-append "XDG_CACHE_HOME = ~/.cache\n" all))
+                  (("^TEXMFCONFIG = .*" all)
+                   (string-append "XDG_CONFIG_HOME = ~/.config\n" all)))))))))))
+
 (define-public texlive-libptexenc
   (package
     (name "texlive-libptexenc")