diff mbox series

[bug#60820] Add 'totpages' latex package.

Message ID 87358cwxot.fsf@cea.fr
State New
Headers show
Series [bug#60820] Add 'totpages' latex package. | expand

Commit Message

Matthieu Lemerre Jan. 14, 2023, 10:36 p.m. UTC
Hi Guix!

This is my first guix package -- I have some texlive, ocaml and emacs packages missing for my installation, so I thought it would be best to share them!

Bests
Matthieu

---
 gnu/packages/tex.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Nicolas Goaziou Jan. 15, 2023, 6:26 p.m. UTC | #1
Hello,

Matthieu Lemerre <racin@free.fr> writes:

> This is my first guix package -- I have some texlive, ocaml and emacs
> packages missing for my installation, so I thought it would be best to
> share them!

Thank you.

> +(define-public texlive-latex-totpages

The name should be texlive-totpages.

> +  (package
> +    (inherit (simple-texlive-package "texlive-latex-totpages"
> +                                     (list "doc/latex/totpages/"
> +                                           "source/latex/totpages/"
> +                                           "tex/latex/totpages/")
> +                                     (base32
> +                                      "1mmya2fqdskyavw3hvdiygfyp9cll7bl4lpi7pl2jf9s7ds49j5a")
> +                                     #:trivial? #t))

This is not a trivial package. The source contains ".ins" files that
should be used to generate the library itself. See, for example,
texlive-tabu package.

Regards,
Matthieu Lemerre Jan. 23, 2023, 9:55 p.m. UTC | #2
Hello,

> > +(define-public texlive-latex-totpages

> The name should be texlive-totpages.

Is there a reason why? The package lives under the latex/ directory, like the hyphenat and totpages package, which have latex- in their name.

> > +  (package
> > +    (inherit (simple-texlive-package "texlive-latex-totpages"
> > +                                     (list "doc/latex/totpages/"
> > +                                           "source/latex/totpages/"
> > +                                           "tex/latex/totpages/")
> > +                                     (base32
> > +                                      "1mmya2fqdskyavw3hvdiygfyp9cll7bl4lpi7pl2jf9s7ds49j5a")
> > +                                     #:trivial? #t))

I am confused. The hyphenat package also has a .ins in its archive, and it is defined as a trivial package.
Maybe I need to just remove source/latex/totpages from the list?

Best regards,
Matthieu
Nicolas Goaziou Jan. 24, 2023, 1:16 p.m. UTC | #3
Hello,

racin@free.fr writes:

>> > +(define-public texlive-latex-totpages
>
>> The name should be texlive-totpages.
>
> Is there a reason why? The package lives under the latex/ directory, like the hyphenat and totpages package, which have latex- in their name.

Guix dropped the directory part in package names months ago. It doesn't
always make sense: some packages install files in more than one
top-level directory. Also, it was decided packages should follow TeXLive
naming scheme, as used in "texlive.tlpdb".

As another data point, if you import hyphenat

  guix shell subversion -- import texlive hyphenat

you can see the suggested name is "texlive-hyphenat":

  (... (simple-texlive-package "texlive-hyphenat" ...))

Note also that a number of deprecation functions in "tex.scm" already
move packages to the suggested naming scheme, e.g.:

  (define-deprecated-package texlive-latex-beamer texlive-beamer)

It is unfortunate that hyphenat package was pushed with the wrong name.
It will need a deprecation notice at some point.

>> > +  (package
>> > +    (inherit (simple-texlive-package "texlive-latex-totpages"
>> > +                                     (list "doc/latex/totpages/"
>> > +                                           "source/latex/totpages/"
>> > +                                           "tex/latex/totpages/")
>> > +                                     (base32
>> > +                                      "1mmya2fqdskyavw3hvdiygfyp9cll7bl4lpi7pl2jf9s7ds49j5a")
>> > +                                     #:trivial? #t))
>
> I am confused. The hyphenat package also has a .ins in its archive,
> and it is defined as a trivial package.

Again, current hyphenat package is wrong. You should not consider it as
an example. It simply does not install enough files.

Guix provides an helper function to determine if a TeXLive package is
complete or not, `files-differ?' in (guix import texlive):

  $ guix repl
  scheme@(guix-user)> ,use (guix import texlive)
  scheme@(guix-user)> (files-differ? "/gnu/store/n7pbka00i9y7jvbvqpm2jzf961cmlyya-texlive-latex-hyphenat-59745/share" "hyphenat")
  $1 = ("texmf-dist/source/latex/hyphenat/hyphenat.ins" "texmf-dist/source/latex/hyphenat/hyphenat.dtx")

It means that hyphenat package doesn't install its sources. Not good.

> Maybe I need to just remove source/latex/totpages from the list?

Please don't. I already suggested how to deal with the issue. Do not
hesitate to ping me if you have troubles with what I suggest.

Regards,
Matthieu Lemerre Jan. 24, 2023, 10:25 p.m. UTC | #4
Hello,

> >> > +(define-public texlive-latex-totpages
> >
> >> The name should be texlive-totpages.
> >
> > Is there a reason why? The package lives under the latex/ directory, like the hyphenat and totpages package, which have latex- in their name.

> Guix dropped the directory part in package names months ago. It doesn't
> always make sense: some packages install files in more than one
> top-level directory. Also, it was decided packages should follow TeXLive
> naming scheme, as used in "texlive.tlpdb".

Thanks, it makes sense now. I did not understand that some cleanup was going on.

> It means that hyphenat package doesn't install its sources. Not good.

Thanks, I now know how to check if my package is correctly installed. 
I am not sure why we would want to install the sources in the final package,
instead of the .sty and the .pdf of the documentation

>  I already suggested how to deal with the issue. 
> Do not hesitate to ping me if you have troubles with what I suggest.

Thanks. The issue that I had is that the new definition is much more complex than what 
the importer suggested, or what old packages like hyphenat were doing, even though it is a 
very simple package. But I think I understand what it does and I can replicate that.

Best regards,
Matthieu
Nicolas Goaziou Jan. 25, 2023, 4:35 p.m. UTC | #5
Hello,

racin@free.fr writes:

> Thanks, I now know how to check if my package is correctly installed. 
> I am not sure why we would want to install the sources in the final package,
> instead of the .sty and the .pdf of the documentation

It is not "instead of". We want to install all of them, while, when
possible, generating them from source.

Let's assume for a second Guix provides all TeX Live packages
piece-wise. The idea is that if someone installs all the packages, they
would get the whole TeX Live distribution, including the sources, i.e.,
the "texlive" package.

Regards,
Matthieu Lemerre Jan. 25, 2023, 5:42 p.m. UTC | #6
Hello,

> It is not "instead of". We want to install all of them, while, when
> possible, generating them from source.

> Let's assume for a second Guix provides all TeX Live packages
> piece-wise. The idea is that if someone installs all the packages, they
> would get the whole TeX Live distribution, including the sources, i.e.,
> the "texlive" package.

But if someone need the source, my understanding is that one can just use guix  build -S 
or some other command to retrieve them.
So I don't see the interest of having them too in the compiled output, as they are not useful for 
normal usage of the package; it seems to take up space for no reason.

Sorry to bother you with my questions, as I am new to guix.

Regards,
Matthieu Lemerre
Nicolas Goaziou Jan. 27, 2023, 9:02 a.m. UTC | #7
Hello,

racin@free.fr writes:

>> Let's assume for a second Guix provides all TeX Live packages
>> piece-wise. The idea is that if someone installs all the packages, they
>> would get the whole TeX Live distribution, including the sources, i.e.,
>> the "texlive" package.
>
> But if someone need the source, my understanding is that one can just use guix  build -S 
> or some other command to retrieve them.
> So I don't see the interest of having them too in the compiled output, as they are not useful for 
> normal usage of the package; it seems to take up space for no reason.

I don't know if the reason is strong enough, but I gave you one above.

In any case, the main nit here is that we try to generate files from
source, which "#trivial? #t" prevents.

> Sorry to bother you with my questions, as I am new to guix.

No problem!

Regards,
Nicolas Goaziou April 18, 2023, 1:33 p.m. UTC | #8
Hello,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> racin@free.fr writes:
>
>> But if someone need the source, my understanding is that one can just use guix  build -S 
>> or some other command to retrieve them.
>> So I don't see the interest of having them too in the compiled output, as they are not useful for 
>> normal usage of the package; it seems to take up space for no reason.
>
> I don't know if the reason is strong enough, but I gave you one above.
>
> In any case, the main nit here is that we try to generate files from
> source, which "#trivial? #t" prevents.

I renamed the package, updated its definition, set propagated inputs,
and applied it. Thank you for the initial work.

You make a fair point with the source distribution, but unfortunately,
it didn't raise much interest so far. It might be worth asking it on
Guix Devel ML.

Meanwhile, I'm closing this bug.

Regards,
diff mbox series

Patch

diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm
index dafed9d3c3..1e28c36549 100644
--- a/gnu/packages/tex.scm
+++ b/gnu/packages/tex.scm
@@ -11935,6 +11935,25 @@  (define-public texlive-latex-hyphenat
 fonts.")
     (license license:lppl1.3c+)))
 
+(define-public texlive-latex-totpages
+  (package
+    (inherit (simple-texlive-package "texlive-latex-totpages"
+                                     (list "doc/latex/totpages/"
+                                           "source/latex/totpages/"
+                                           "tex/latex/totpages/")
+                                     (base32
+                                      "1mmya2fqdskyavw3hvdiygfyp9cll7bl4lpi7pl2jf9s7ds49j5a")
+                                     #:trivial? #t))
+    (build-system texlive-build-system)
+    (version "2.00")
+    (home-page "https://ctan.org/pkg/totpages")
+    (synopsis "Count pages in a document, and report last page number")
+    (description
+     "The package counts the actual pages in the document (as opposed to reporting the
+number of the last page, as does lastpage).  The counter itself may be shipped
+out to the DVI file.  The package uses the everyshi package for its task.")
+    (license license:lppl)))
+
 (define-public texlive-latex-lastpage
   (package
     (inherit (simple-texlive-package