[PATCH] Add 'totpages' latex package.

  • Done
  • quality assurance status badge
Details
2 participants
  • Nicolas Goaziou
  • Matthieu Lemerre
Owner
unassigned
Submitted by
Matthieu Lemerre
Severity
normal
M
M
Matthieu Lemerre wrote on 14 Jan 2023 23:36
(address . guix-patches@gnu.org)
87358cwxot.fsf@cea.fr
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(+)

Toggle diff (32 lines)
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
--
2.38.1
N
N
Nicolas Goaziou wrote on 15 Jan 2023 19:26
(name . Matthieu Lemerre)(address . racin@free.fr)(address . 60820@debbugs.gnu.org)
87358br6wx.fsf@nicolasgoaziou.fr
Hello,

Matthieu Lemerre <racin@free.fr> writes:

Toggle quote (4 lines)
> 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.

Toggle quote (2 lines)
> +(define-public texlive-latex-totpages

The name should be texlive-totpages.

Toggle quote (9 lines)
> + (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,
--
Nicolas Goaziou
R
(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)(address . 60820@debbugs.gnu.org)
2038367541.192525317.1674510934926.JavaMail.zimbra@free.fr
Hello,

Toggle quote (4 lines)
> > +(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.

Toggle quote (9 lines)
> > + (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
N
N
Nicolas Goaziou wrote on 24 Jan 2023 14:16
(address . racin@free.fr)(address . 60820@debbugs.gnu.org)
87r0vknkcy.fsf@nicolasgoaziou.fr
Hello,

racin@free.fr writes:

Toggle quote (6 lines)
>> > +(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.

Toggle quote (12 lines)
>> > + (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.

Toggle quote (2 lines)
> 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,
--
Nicolas Goaziou
R
(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)(name . 60820)(address . 60820@debbugs.gnu.org)
2117265375.197499488.1674599137755.JavaMail.zimbra@free.fr
Hello,

Toggle quote (11 lines)
> >> > +(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.

Toggle quote (2 lines)
> 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

Toggle quote (3 lines)
> 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
N
N
Nicolas Goaziou wrote on 25 Jan 2023 17:35
(address . racin@free.fr)(name . 60820)(address . 60820@debbugs.gnu.org)
87fsbyo9ls.fsf@nicolasgoaziou.fr
Hello,

racin@free.fr writes:

Toggle quote (4 lines)
> 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,
--
Nicolas Goaziou
R
(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)(name . 60820)(address . 60820@debbugs.gnu.org)
1193870067.201946967.1674668566774.JavaMail.zimbra@free.fr
Hello,

Toggle quote (8 lines)
> 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
N
N
Nicolas Goaziou wrote on 27 Jan 2023 10:02
(address . racin@free.fr)(name . 60820)(address . 60820@debbugs.gnu.org)
878rhol59o.fsf@nicolasgoaziou.fr
Hello,

racin@free.fr writes:

Toggle quote (10 lines)
>> 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.

Toggle quote (2 lines)
> Sorry to bother you with my questions, as I am new to guix.

No problem!

Regards,
--
Nicolas Goaziou
N
N
Nicolas Goaziou wrote on 18 Apr 2023 15:33
(address . racin@free.fr)(name . 60820)(address . 60820-done@debbugs.gnu.org)
87ttxdjow1.fsf@nicolasgoaziou.fr
Hello,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

Toggle quote (12 lines)
> 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,
--
Nicolas Goaziou
Closed
?