[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/452: guix: import: Update texlive importer according to new build sys
From: |
guix-commits |
Subject: |
03/452: guix: import: Update texlive importer according to new build system. |
Date: |
Fri, 9 Jun 2023 13:42:46 -0400 (EDT) |
ngz pushed a commit to branch tex-team-next
in repository guix.
commit 79499fba7a26b0e816f025f38d54d334aefcffb4
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
AuthorDate: Fri May 5 17:22:03 2023 +0200
guix: import: Update texlive importer according to new build system.
* guix/import/texlive.scm (tlpdb->package): Generate a package that doesn't
need SIMPLE-TEXLIVE-PACKAGE.
* guix/import/utils.scm (package->definition): Remove special case for
`simple-texlive-package'.
* tests/texlive.scm (%fake-tlpdb): Add test data.
("texlive->guix-package"): Update test.
("texlive->guix-package, no docfiles"): New test.
---
guix/import/texlive.scm | 42 +++++++++++++-----------
guix/import/utils.scm | 3 --
tests/texlive.scm | 86 +++++++++++++++++++++++++++++++++++++------------
3 files changed, 89 insertions(+), 42 deletions(-)
diff --git a/guix/import/texlive.scm b/guix/import/texlive.scm
index 086cd363a9..e5fcb7adf8 100644
--- a/guix/import/texlive.scm
+++ b/guix/import/texlive.scm
@@ -275,33 +275,37 @@ of those files are returned that are unexpectedly
installed."
store ref (string-append name
"-svn-multi-checkout")))))
(values
`(package
- (inherit (simple-texlive-package
- ,name
- (list ,@dirs)
- (base32
- ,(bytevector->nix-base32-string
- (let-values (((port get-hash) (open-sha256-port)))
- (write-file source port)
- (force-output port)
- (get-hash))))
- ,@(if (assoc-ref data 'srcfiles) '() '(#:trivial? #true))))
- ;; package->definition in (guix import utils) expects to see a
- ;; version field.
- (version ,version)
+ (name ,name)
+ (version (number->string %texlive-revision))
+ (source (texlive-origin
+ name version
+ (list ,@(sort locs string<))
+ (base32
+ ,(bytevector->nix-base32-string
+ (let-values (((port get-hash) (open-sha256-port)))
+ (write-file source port)
+ (force-output port)
+ (get-hash))))))
+ ,@(if (assoc-ref data 'docfiles)
+ '((outputs '("out" "doc")))
+ '())
+ (build-system texlive-build-system)
,@(match filtered-depends
(() '())
(inputs
`((propagated-inputs
- (list ,@(map
+ (list ,@(map-in-order
(lambda (tex-name)
(let ((name (guix-name tex-name)))
(string->symbol name)))
- inputs))))))
- ,@(or (and=> (assoc-ref data 'name)
+ ;; Sort inputs alphabetically.
+ (reverse inputs)))))))
+ (home-page
+ ,(or (and=> (or (assoc-ref data 'catalogue)
+ (assoc-ref data 'name))
(lambda (name)
- `((home-page ,(string-append "https://ctan.org/pkg/"
- name)))))
- '((home-page "https://www.tug.org/texlive/")))
+ (string-append "https://ctan.org/pkg/" name)))
+ "https://www.tug.org/texlive/"))
(synopsis ,(assoc-ref data 'shortdesc))
(description ,(and=> (assoc-ref data 'longdesc) beautify-description))
(license ,(and=> (assoc-ref data 'catalogue-license)
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index e9a0a7ecd7..5176f12a31 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -436,10 +436,7 @@ APPEND-VERSION?/string is a string, append this string."
(match guix-package
((or
('package ('name name) ('version version) . rest)
- ('package ('inherit ('simple-texlive-package name . _))
- ('version version) . rest)
('let _ ('package ('name name) ('version version) . rest)))
-
`(define-public ,(string->symbol
(cond
((string? append-version?/string)
diff --git a/tests/texlive.scm b/tests/texlive.scm
index 7d7ad332b4..1493fc87bb 100644
--- a/tests/texlive.scm
+++ b/tests/texlive.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2022 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2023 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -31,7 +32,15 @@
(test-begin "texlive")
(define %fake-tlpdb
- '(("stricttex"
+ '(("example"
+ . ((name . "example")
+ (shortdesc . "Typeset examples...")
+ (longdesc . "The package makes it easier...")
+ (runfiles
+ .
+ ("texmf-dist/tex/latex/example/example.sty"))
+ (catalogue-license . "gpl")))
+ ("stricttex"
. ((name
. "stricttex")
(shortdesc
@@ -69,7 +78,7 @@ theorems and proofs, centered or non-justified text, and
listing computer
code; Specialized macros for easily constructing ruled tables. TeXsis was
originally developed for physicists, but others may also find it useful. It is
completely compatible with Plain TeX.")
- (depend . ("cm" "hyphen-base" "knuth-lib" "plain" "tex"))
+ (depend . ("tex" "plain" "knuth-lib" "hyphen-base" "cm"))
(docfiles
. ("texmf-dist/doc/man/man1/texsis.1"
"texmf-dist/doc/man/man1/texsis.man1.pdf"
@@ -158,6 +167,40 @@ completely compatible with Plain TeX.")
"texmf-dist/tex/texsis/config/texsis.ini"))
(catalogue-license . "lppl")))))
+(test-assert "texlive->guix-package, no docfiles"
+ ;; Replace network resources with sample data.
+ (mock ((guix build svn) svn-fetch
+ (lambda* (url revision directory
+ #:key (svn-command "svn")
+ (user-name #f)
+ (password #f)
+ (recursive? #t))
+ (mkdir-p directory)
+ (with-output-to-file (string-append directory "/foo")
+ (lambda ()
+ (display "source")))))
+ (let ((result (texlive->guix-package "example"
+ #:package-database
+ (lambda _ %fake-tlpdb))))
+ (match result
+ (('package
+ ('name "texlive-example")
+ ('version _)
+ ('source ('texlive-origin
+ 'name 'version
+ ('list "tex/latex/example/")
+ ('base32 (? string? hash))))
+ ('build-system 'texlive-build-system)
+ ('home-page (? string?))
+ ('synopsis (? string?))
+ ('description (? string?))
+ ('license _))
+ #true)
+ (_
+ (begin
+ (format #t "~s~%" result)
+ (pk 'fail result #f)))))))
+
(test-assert "texlive->guix-package"
;; Replace network resources with sample data.
(mock ((guix build svn) svn-fetch
@@ -174,27 +217,30 @@ completely compatible with Plain TeX.")
#:package-database
(lambda _ %fake-tlpdb))))
(match result
- (`(package
- (inherit (simple-texlive-package
- "texlive-texsis"
- (list "bibtex/bst/texsis/"
- "doc/man/man1/"
+ (('package
+ ('name "texlive-texsis")
+ ('version _)
+ ('source ('texlive-origin
+ 'name 'version
+ ('list "bibtex/bst/texsis/"
+ "doc/man/man1/texsis.1"
+ "doc/man/man1/texsis.man1.pdf"
"doc/otherformats/texsis/base/"
"tex/texsis/base/"
"tex/texsis/config/")
- (base32 ,(? string? hash))
- #:trivial? #t))
- (version ,_)
- (propagated-inputs
- (list texlive-cm
- texlive-hyphen-base
- texlive-knuth-lib
- texlive-plain
- texlive-tex))
- (home-page ,(? string?))
- (synopsis ,(? string?))
- (description ,(? string?))
- (license lppl))
+ ('base32 (? string? hash))))
+ ('outputs ''("out" "doc"))
+ ('build-system 'texlive-build-system)
+ ('propagated-inputs
+ ('list 'texlive-cm
+ 'texlive-hyphen-base
+ 'texlive-knuth-lib
+ 'texlive-plain
+ 'texlive-tex))
+ ('home-page (? string?))
+ ('synopsis (? string?))
+ ('description (? string?))
+ ('license 'lppl))
#true)
(_
(begin
- 04/452: guix: import: Improve home-page generation in texlive importer., (continued)
- 04/452: guix: import: Improve home-page generation in texlive importer., guix-commits, 2023/06/09
- 06/452: guix: import: Fix multiple licenses output in texlive importer., guix-commits, 2023/06/09
- 01/452: guix: texlive-build-system: Improvements on non-trivial packages., guix-commits, 2023/06/09
- 05/452: guix: import: texlive use full file names for generic directories., guix-commits, 2023/06/09
- 08/452: gnu: texlive-latex-blindtext -> texlive-blindtext., guix-commits, 2023/06/09
- 09/452: gnu: texlive-latex-dinbrief -> texlive-dinbrief., guix-commits, 2023/06/09
- 12/452: gnu: texlive-latex-trimspaces -> texlive-trimspaces., guix-commits, 2023/06/09
- 10/452: gnu: Add texlive-everypage., guix-commits, 2023/06/09
- 11/452: gnu: texlive-latex-draftwatermark -> texlive-draftwatermark., guix-commits, 2023/06/09
- 07/452: gnu: texlive-latex-l3kernel -> texlive-l3kernel., guix-commits, 2023/06/09
- 03/452: guix: import: Update texlive importer according to new build system.,
guix-commits <=
- 14/452: gnu: texlive-latex-eqparbox -> texlive-eqparbox., guix-commits, 2023/06/09
- 23/452: gnu: Add texlive-lualatex-math., guix-commits, 2023/06/09
- 17/452: gnu: Add texlive-minitoc., guix-commits, 2023/06/09
- 20/452: gnu: Add texlive-mfirstuc., guix-commits, 2023/06/09
- 15/452: gnu: texlive-latex-etoc -> texlive-etoc., guix-commits, 2023/06/09
- 28/452: gnu: Add texlive-refstyle., guix-commits, 2023/06/09
- 30/452: gnu: Add texlive-breakurl., guix-commits, 2023/06/09
- 31/452: gnu: Add texlive-chngcntr., guix-commits, 2023/06/09
- 32/452: gnu: Add texlive-multido., guix-commits, 2023/06/09
- 34/452: gnu: Add texlive-showexpl., guix-commits, 2023/06/09