* Small texlive variant
@ 2016-01-15 15:21 Andreas Enge
2016-01-19 9:20 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Enge @ 2016-01-15 15:21 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 2193 bytes --]
Hello,
the first attached patch adds a small texlive variant. I spent quite some
time determining things to delete from texlive-texmf so that the result
would still be usable, but I am certain the result is not minimal in the
strict sense of the word. So I wondered whether the package should not be
called "texlive-small" instead, but we already have a certain convention
of using the suffix "-minimal" internally. I export the variable, but as
I see it, its main use will be as a native-input to build documentation
in packages. In my case, I am interested in pari-gp, which is modified
by the second patch to build its documentation. For testing, you may call
`./pre-inst-env guix build texlive-minimal`/bin/xdvi `./pre-inst-env guix build pari-gp`/share/pari/doc/tutorial
after applying the patches.
From texlive-texmf, I deleted the subdirectory "doc" (1753 MB) and "source"
(250 MB), and large chunks of "fonts", bringing it down from 1591 MB
to 116 MB. There are probably parts of the 267 MB of "tex" that could be
deleted as well, but I do not feel motivated to investigate further.
./pre-inst-env guix size texlive
/gnu/store/pjmxca0nww2bp6hkwz7cjlh4s26ymxs2-texlive-2015 4223.2 0.3 0.0%
/gnu/store/0wkmf926dv9ck8y1pk5p2lxw95kf7z9d-texlive-texmf-2015 4222.9 3710.3 87.9%
/gnu/store/0h4cs6krz1rsfjl17rpy5mjr3bfap5lp-texlive-bin-2015 507.2 49.5 1.2%
...
./pre-inst-env guix size texlive-minimal
/gnu/store/9flmncm9plf7y3bs6yj0nnpr7zlwagi2-texlive-minimal-2015 937.5 0.3 0.0%
/gnu/store/y8shfzsg82b37zlzx29bza686gcr5162-texlive-texmf-minimal-2015 937.1 428.4 45.7%
/gnu/store/0h4cs6krz1rsfjl17rpy5mjr3bfap5lp-texlive-bin-2015 507.2 49.5 5.3%
...
It should be possible to build texlive-minimal with a stripped-down variant
of texlive-bin, but I do not feel it is worth the effort.
The next thing to do would be to replace the occurrences of "texlive" in
packages by "texlive-minimal" (and to make sure they are in native-inputs),
to have the branch built by hydra and to check whether texlive-minimal is
not too minimal for building all documentation.
But before that, I am waiting for your comments.
Andreas
[-- Attachment #2: 0001-gnu-Add-texlive-minimal.patch --]
[-- Type: text/plain, Size: 7411 bytes --]
From f8a4aabcdf2ec156f42a87708078c065ad4fe43f Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas@enge.fr>
Date: Fri, 15 Jan 2016 16:00:47 +0100
Subject: [PATCH 1/2] gnu: Add texlive-minimal.
* gnu/packages/texlive.scm (texlive-texmf-minimal, texlive-minimal):
New variables.
---
gnu/packages/texlive.scm | 122 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 121 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/texlive.scm b/gnu/packages/texlive.scm
index 0b2dec4..319a52e 100644
--- a/gnu/packages/texlive.scm
+++ b/gnu/packages/texlive.scm
@@ -24,6 +24,7 @@
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
+ #:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages bash)
#:use-module (gnu packages compression)
@@ -45,7 +46,9 @@
#:use-module (gnu packages xorg)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages zip)
- #:autoload (gnu packages texinfo) (texinfo))
+ #:autoload (gnu packages texinfo) (texinfo)
+ #:use-module (ice-9 ftw)
+ #:use-module (srfi srfi-1))
(define texlive-extra-src
(origin
@@ -284,6 +287,123 @@ This package contains the complete TeX Live distribution.")
(license (license:fsf-free "http://tug.org/texlive/copying.html"))
(home-page "http://www.tug.org/texlive/")))
+
+;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
+;; in particular dropping documentation and fonts.
+(define-public texlive-texmf-minimal
+ (package (inherit texlive-texmf)
+ (name "texlive-texmf-minimal")
+ (arguments
+ (substitute-keyword-arguments
+ (package-arguments texlive-texmf)
+ ((#:modules modules)
+ `((ice-9 ftw)
+ (srfi srfi-1)
+ ,@modules))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'prune
+ (lambda _
+ (with-directory-excursion "texmf-dist"
+ (for-each delete-file-recursively
+ '("doc" "source" "tex4ht"))
+ ;; Delete all subdirectories of "fonts", except for those
+ ;; named "cm", that is, "afm/public/amsfonts/cm",
+ ;; "map/dvips/cm", "pk/ljfour/public/cm" (which is effectively
+ ;; all of "pk"), "source/public/cm", "tfm/public/cm" and
+ ;; "type1/public/amsfonts/cm".
+ ;; Inside "tfm", apparently more subdirectories are needed for
+ ;; successful bootstrapping of the formats, so we keep
+ ;; "tfm/public".
+ (with-directory-excursion "fonts"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "afm" "map" "pk"
+ "source" "tfm" "type1")))
+ (with-directory-excursion "afm"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "public")))
+ (with-directory-excursion "public"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "amsfonts")))
+ (with-directory-excursion "amsfonts"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "cm"))))))
+ (with-directory-excursion "map"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "dvips")))
+ (with-directory-excursion "dvips"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "cm")))))
+ (with-directory-excursion "source"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "public")))
+ (with-directory-excursion "public"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "cm")))))
+ (with-directory-excursion "tfm"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "public"))))
+ (with-directory-excursion "type1"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "public")))
+ (with-directory-excursion "public"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "amsfonts")))
+ (with-directory-excursion "amsfonts"
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ '("." ".." "cm"))))))))
+ #t))))))
+ (description
+ "TeX Live provides a comprehensive TeX document production system.
+It includes all the major TeX-related programs, macro packages, and fonts
+that are free software, including support for many languages around the
+world.
+
+This package contains a small subset of the texmf-dist data.")))
+
+
+;; texlive-minimal is the same as texlive, but using texlive-texmf-minimal
+;; instead of the full texlive-texmf. It can be used, for instance, as a
+;; native input to packages that need texlive to build their documentation.
+(define-public texlive-minimal
+ (package (inherit texlive)
+ (name "texlive-minimal")
+ (inputs
+ `(("texlive-texmf" ,texlive-texmf-minimal)
+ ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
+ (description
+ "TeX Live provides a comprehensive TeX document production system.
+It includes all the major TeX-related programs, macro packages, and fonts
+that are free software, including support for many languages around the
+world.
+
+This package contains a small working part of the TeX Live distribution.")))
+
+
(define-public rubber
(package
(name "rubber")
--
2.6.3
[-- Attachment #3: 0002-gnu-pari-gp-Build-documentation.patch --]
[-- Type: text/plain, Size: 1470 bytes --]
From b6c445622d5308c905b9fd7d799638335a627496 Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas@enge.fr>
Date: Fri, 15 Jan 2016 16:02:29 +0100
Subject: [PATCH 2/2] gnu: pari-gp: Build documentation.
* gnu/packages/algebra.scm (pari-gp)[native-inputs]: Add texlive-minimal.
[arguments]: Modify make-flags to build documentation.
---
gnu/packages/algebra.scm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index dd68381..0149db8 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -26,6 +26,7 @@
#:use-module (gnu packages perl)
#:use-module (gnu packages readline)
#:use-module (gnu packages flex)
+ #:use-module (gnu packages texlive)
#:use-module (gnu packages xorg)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
@@ -125,12 +126,13 @@ solve the shortest vector problem.")
(base32
"0c8l83a0gjq73r9hndsrzkypwxvnnm4pxkkzbg6jm95m80nzwh11"))))
(build-system gnu-build-system)
+ (native-inputs `(("texlive" ,texlive-minimal)))
(inputs `(("gmp" ,gmp)
("libx11" ,libx11)
("perl" ,perl)
("readline" ,readline)))
(arguments
- '(#:make-flags '("gp")
+ '(#:make-flags '("all")
;; FIXME: building the documentation requires tex; once this is
;; available, replace "gp" by "all"
#:test-target "dobench"
--
2.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Small texlive variant
2016-01-15 15:21 Small texlive variant Andreas Enge
@ 2016-01-19 9:20 ` Ludovic Courtès
2016-02-09 21:49 ` Andreas Enge
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2016-01-19 9:20 UTC (permalink / raw)
To: Andreas Enge; +Cc: guix-devel
Andreas Enge <andreas@enge.fr> skribis:
> the first attached patch adds a small texlive variant. I spent quite some
> time determining things to delete from texlive-texmf so that the result
> would still be usable, but I am certain the result is not minimal in the
> strict sense of the word. So I wondered whether the package should not be
> called "texlive-small" instead, but we already have a certain convention
> of using the suffix "-minimal" internally. I export the variable, but as
> I see it, its main use will be as a native-input to build documentation
> in packages. In my case, I am interested in pari-gp, which is modified
> by the second patch to build its documentation. For testing, you may call
> `./pre-inst-env guix build texlive-minimal`/bin/xdvi `./pre-inst-env guix build pari-gp`/share/pari/doc/tutorial
> after applying the patches.
That makes sense, and it’s already an improvement! I guess most of the
packages that currently depend on ‘texlive’ could switch to
‘texlive-minimal’ as well.
> From texlive-texmf, I deleted the subdirectory "doc" (1753 MB) and "source"
> (250 MB), and large chunks of "fonts", bringing it down from 1591 MB
> to 116 MB. There are probably parts of the 267 MB of "tex" that could be
> deleted as well, but I do not feel motivated to investigate further.
OK.
> ./pre-inst-env guix size texlive
> /gnu/store/pjmxca0nww2bp6hkwz7cjlh4s26ymxs2-texlive-2015 4223.2 0.3 0.0%
> /gnu/store/0wkmf926dv9ck8y1pk5p2lxw95kf7z9d-texlive-texmf-2015 4222.9 3710.3 87.9%
> /gnu/store/0h4cs6krz1rsfjl17rpy5mjr3bfap5lp-texlive-bin-2015 507.2 49.5 1.2%
> ...
>
> ./pre-inst-env guix size texlive-minimal
> /gnu/store/9flmncm9plf7y3bs6yj0nnpr7zlwagi2-texlive-minimal-2015 937.5 0.3 0.0%
> /gnu/store/y8shfzsg82b37zlzx29bza686gcr5162-texlive-texmf-minimal-2015 937.1 428.4 45.7%
> /gnu/store/0h4cs6krz1rsfjl17rpy5mjr3bfap5lp-texlive-bin-2015 507.2 49.5 5.3%
Yay! :-)
> It should be possible to build texlive-minimal with a stripped-down variant
> of texlive-bin, but I do not feel it is worth the effort.
>
> The next thing to do would be to replace the occurrences of "texlive" in
> packages by "texlive-minimal" (and to make sure they are in native-inputs),
> to have the branch built by hydra and to check whether texlive-minimal is
> not too minimal for building all documentation.
Agreed.
> From f8a4aabcdf2ec156f42a87708078c065ad4fe43f Mon Sep 17 00:00:00 2001
> From: Andreas Enge <andreas@enge.fr>
> Date: Fri, 15 Jan 2016 16:00:47 +0100
> Subject: [PATCH 1/2] gnu: Add texlive-minimal.
>
> * gnu/packages/texlive.scm (texlive-texmf-minimal, texlive-minimal):
> New variables.
[...]
> + (with-directory-excursion "texmf-dist"
> + (for-each delete-file-recursively
> + '("doc" "source" "tex4ht"))
> + ;; Delete all subdirectories of "fonts", except for those
> + ;; named "cm", that is, "afm/public/amsfonts/cm",
> + ;; "map/dvips/cm", "pk/ljfour/public/cm" (which is effectively
> + ;; all of "pk"), "source/public/cm", "tfm/public/cm" and
> + ;; "type1/public/amsfonts/cm".
> + ;; Inside "tfm", apparently more subdirectories are needed for
> + ;; successful bootstrapping of the formats, so we keep
> + ;; "tfm/public".
> + (with-directory-excursion "fonts"
> + (for-each delete-file-recursively
> + (lset-difference equal?
> + (scandir ".")
> + '("." ".." "afm" "map" "pk"
> + "source" "tfm" "type1")))
> + (with-directory-excursion "afm"
> + (for-each delete-file-recursively
> + (lset-difference equal?
> + (scandir ".")
> + '("." ".." "public")))
> + (with-directory-excursion "public"
> + (for-each delete-file-recursively
> + (lset-difference equal?
> + (scandir ".")
> + '("." ".." "amsfonts")))
This is a bit verbose. I think it would be nice to have a data
structure to describe what we are deleting, along these lines
(untested):
(define to-delete
'(("texmf-dist" except "doc" "source" "tex4ht")
("texmf-dist/afm" except "amsfonts")
;; …
))
(define (expand-file-specification spec)
(match spec
((directory) directory)
((directory 'except exceptions ...)
(map (cut string-append directory "/" <>)
(lset-difference string=?
(scandir directory)
(cons* "." ".." exceptions))))))
(with-directory-excursion out
(for-each delete-file-recursively
(map expand-file-specification to-delete)))
WDYT?
> From b6c445622d5308c905b9fd7d799638335a627496 Mon Sep 17 00:00:00 2001
> From: Andreas Enge <andreas@enge.fr>
> Date: Fri, 15 Jan 2016 16:02:29 +0100
> Subject: [PATCH 2/2] gnu: pari-gp: Build documentation.
>
> * gnu/packages/algebra.scm (pari-gp)[native-inputs]: Add texlive-minimal.
> [arguments]: Modify make-flags to build documentation.
[...]
> (build-system gnu-build-system)
> + (native-inputs `(("texlive" ,texlive-minimal)))
Doesn’t PARI want to use TeX at run time too? If that is the case, this
should go to ‘inputs’.
Otherwise LGTM.
Thanks for working on this thankless yet very useful task! :-)
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small texlive variant
2016-01-19 9:20 ` Ludovic Courtès
@ 2016-02-09 21:49 ` Andreas Enge
2016-02-11 10:45 ` Ludovic Courtès
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Enge @ 2016-02-09 21:49 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 562 bytes --]
On Tue, Jan 19, 2016 at 10:20:42AM +0100, Ludovic Courtès wrote:
> This is a bit verbose. I think it would be nice to have a data
> structure to describe what we are deleting, along these lines
> (untested):
I agree, computer science 101 tells us to use a function when repeating the
same sequence of statements on separate data. This is what I did in the new
attached patch; I also "flattened out" the deletion as you suggest.
However, the data structure thing was too complicated for me and I think not
really needed.
Comments are again welcome.
Andreas
[-- Attachment #2: 0001-gnu-Add-texlive-minimal.patch --]
[-- Type: text/plain, Size: 5047 bytes --]
From 8a2ebb8163c54f80f2a5e4708956b87b134ada85 Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas@enge.fr>
Date: Fri, 15 Jan 2016 16:00:47 +0100
Subject: [PATCH] gnu: Add texlive-minimal.
* gnu/packages/texlive.scm (texlive-texmf-minimal, texlive-minimal):
New variables.
---
gnu/packages/texlive.scm | 83 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 82 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/texlive.scm b/gnu/packages/texlive.scm
index 0b2dec4..f51f853 100644
--- a/gnu/packages/texlive.scm
+++ b/gnu/packages/texlive.scm
@@ -24,6 +24,7 @@
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
+ #:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages bash)
#:use-module (gnu packages compression)
@@ -45,7 +46,9 @@
#:use-module (gnu packages xorg)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages zip)
- #:autoload (gnu packages texinfo) (texinfo))
+ #:autoload (gnu packages texinfo) (texinfo)
+ #:use-module (ice-9 ftw)
+ #:use-module (srfi srfi-1))
(define texlive-extra-src
(origin
@@ -284,6 +287,84 @@ This package contains the complete TeX Live distribution.")
(license (license:fsf-free "http://tug.org/texlive/copying.html"))
(home-page "http://www.tug.org/texlive/")))
+
+;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
+;; in particular dropping documentation and fonts.
+(define-public texlive-texmf-minimal
+ (package (inherit texlive-texmf)
+ (name "texlive-texmf-minimal")
+ (arguments
+ (substitute-keyword-arguments
+ (package-arguments texlive-texmf)
+ ((#:modules modules)
+ `((ice-9 ftw)
+ (srfi srfi-1)
+ ,@modules))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'prune
+ (lambda _
+ (with-directory-excursion "texmf-dist"
+ (for-each delete-file-recursively
+ '("doc" "source" "tex4ht"))
+ ;; Delete all subdirectories of "fonts", except for those
+ ;; named "cm", that is, "afm/public/amsfonts/cm",
+ ;; "map/dvips/cm", "pk/ljfour/public/cm" (which is effectively
+ ;; all of "pk"), "source/public/cm", "tfm/public/cm" and
+ ;; "type1/public/amsfonts/cm".
+ ;; Inside "tfm", apparently more subdirectories are needed for
+ ;; successful bootstrapping of the formats, so we keep
+ ;; all of "tfm/public".
+ (let ((delete
+ ;; delete all files and directories in SUBDIR
+ ;; except for those given in the list EXCLUDE
+ (lambda (subdir exclude)
+ (with-directory-excursion subdir
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ (append '("." "..")
+ exclude)))))))
+ (delete "fonts" '("afm" "map" "pk" "source" "tfm" "type1"))
+ (delete "fonts/afm" '("public"))
+ (delete "fonts/afm/public" '("amsfonts"))
+ (delete "fonts/afm/public/amsfonts" '("cm"))
+ (delete "fonts/map" '("dvips"))
+ (delete "fonts/map/dvips" '("cm"))
+ (delete "fonts/source" '("public"))
+ (delete "fonts/source/public" '("cm"))
+ (delete "fonts/tfm" '("public"))
+ (delete "fonts/type1" '("public"))
+ (delete "fonts/type1/public" '("amsfonts"))
+ (delete "fonts/type1/public/amsfonts" '("cm"))))
+ #t))))))
+ (description
+ "TeX Live provides a comprehensive TeX document production system.
+It includes all the major TeX-related programs, macro packages, and fonts
+that are free software, including support for many languages around the
+world.
+
+This package contains a small subset of the texmf-dist data.")))
+
+
+;; texlive-minimal is the same as texlive, but using texlive-texmf-minimal
+;; instead of the full texlive-texmf. It can be used, for instance, as a
+;; native input to packages that need texlive to build their documentation.
+(define-public texlive-minimal
+ (package (inherit texlive)
+ (name "texlive-minimal")
+ (inputs
+ `(("texlive-texmf" ,texlive-texmf-minimal)
+ ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
+ (description
+ "TeX Live provides a comprehensive TeX document production system.
+It includes all the major TeX-related programs, macro packages, and fonts
+that are free software, including support for many languages around the
+world.
+
+This package contains a small working part of the TeX Live distribution.")))
+
+
(define-public rubber
(package
(name "rubber")
--
2.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: Small texlive variant
2016-02-09 21:49 ` Andreas Enge
@ 2016-02-11 10:45 ` Ludovic Courtès
2016-02-13 10:17 ` Andreas Enge
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2016-02-11 10:45 UTC (permalink / raw)
To: Andreas Enge; +Cc: guix-devel
Andreas Enge <andreas@enge.fr> skribis:
> On Tue, Jan 19, 2016 at 10:20:42AM +0100, Ludovic Courtès wrote:
>> This is a bit verbose. I think it would be nice to have a data
>> structure to describe what we are deleting, along these lines
>> (untested):
>
> I agree, computer science 101 tells us to use a function when repeating the
> same sequence of statements on separate data. This is what I did in the new
> attached patch; I also "flattened out" the deletion as you suggest.
>
> However, the data structure thing was too complicated for me and I think not
> really needed.
I think it was clearer and separated concerns better (filtering
vs. deleting.) :-)
The version you propose is acceptable too.
> From 8a2ebb8163c54f80f2a5e4708956b87b134ada85 Mon Sep 17 00:00:00 2001
> From: Andreas Enge <andreas@enge.fr>
> Date: Fri, 15 Jan 2016 16:00:47 +0100
> Subject: [PATCH] gnu: Add texlive-minimal.
>
> * gnu/packages/texlive.scm (texlive-texmf-minimal, texlive-minimal):
> New variables.
[...]
> + (with-directory-excursion "texmf-dist"
> + (for-each delete-file-recursively
> + '("doc" "source" "tex4ht"))
> + ;; Delete all subdirectories of "fonts", except for those
> + ;; named "cm", that is, "afm/public/amsfonts/cm",
This comment is too indented and redundant with the code below, I think.
> + (let ((delete
> + ;; delete all files and directories in SUBDIR
> + ;; except for those given in the list EXCLUDE
Make it an inner ‘define’, to reduce indentation.
Also the docstring should be below the formal parameter list, and should
be a sentence.
> + (lambda (subdir exclude)
I’d make exclude a keyword parameter, for clarity.
With these changes, it would look like:
(define* (delete directory #:key (except '()))
;; Delete all the files and directories in DIRECTORIES, except those
;; listed in in EXCEPT.
…)
How does that sound?
Thanks!
Ludo’.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Small texlive variant
2016-02-11 10:45 ` Ludovic Courtès
@ 2016-02-13 10:17 ` Andreas Enge
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Enge @ 2016-02-13 10:17 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]
Thanks for the comments!
On Thu, Feb 11, 2016 at 11:45:01AM +0100, Ludovic Courtès wrote:
> This comment is too indented and redundant with the code below, I think.
Okay, I kept a shorter and clearer comment.
> Make it an inner ‘define’, to reduce indentation.
Done.
> Also the docstring should be below the formal parameter list, and should
> be a sentence.
I took inspiration from other files; is it okay/required to start the
second line of a real docstring in the first column? I am attaching the patch
again mainly for that reason.
> > + (lambda (subdir exclude)
> I’d make exclude a keyword parameter, for clarity.
Well, I think it would make sense if the procedure were exported globally;
here it is really one with two parameters, so I am not following your advice.
I also made the texlive-texmf-minimal variable private. As mentioned quickly
on irc yesterday, I would like to do the same with texlive-texmf, to avoid
mistakes (someone mentioned they had installed texlive-texmf and texlive
into the same profile). As long as texlive-bin remains public, one can still
download texlive-bin (which takes a while to compile) from hydra and unpack
the data locally; the step from texlive-texmf to texlive is trivial and
consists only of adding symlinks.
What do you think?
Andreas
[-- Attachment #2: 0001-gnu-Add-texlive-minimal.patch --]
[-- Type: text/plain, Size: 4832 bytes --]
From 481a18d13e977ec259b6ab3dfc4bd9369fba5abd Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas@enge.fr>
Date: Fri, 15 Jan 2016 16:00:47 +0100
Subject: [PATCH] gnu: Add texlive-minimal.
* gnu/packages/texlive.scm (texlive-texmf-minimal, texlive-minimal):
New variables.
---
gnu/packages/texlive.scm | 78 ++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 76 insertions(+), 2 deletions(-)
diff --git a/gnu/packages/texlive.scm b/gnu/packages/texlive.scm
index 0b2dec4..a9673a0 100644
--- a/gnu/packages/texlive.scm
+++ b/gnu/packages/texlive.scm
@@ -24,6 +24,7 @@
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
+ #:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages bash)
#:use-module (gnu packages compression)
@@ -45,7 +46,9 @@
#:use-module (gnu packages xorg)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages zip)
- #:autoload (gnu packages texinfo) (texinfo))
+ #:autoload (gnu packages texinfo) (texinfo)
+ #:use-module (ice-9 ftw)
+ #:use-module (srfi srfi-1))
(define texlive-extra-src
(origin
@@ -226,7 +229,7 @@ This package contains the complete tree of texmf-dist data.")
(license (license:fsf-free "http://tug.org/texlive/copying.html"))
(home-page "http://www.tug.org/texlive/")))
-(define-public texlive
+(define texlive
(package
(name "texlive")
(version "2015")
@@ -284,6 +287,77 @@ This package contains the complete TeX Live distribution.")
(license (license:fsf-free "http://tug.org/texlive/copying.html"))
(home-page "http://www.tug.org/texlive/")))
+
+;; texlive-texmf-minimal is a pruned, small version of the texlive tree,
+;; in particular dropping documentation and fonts.
+(define-public texlive-texmf-minimal
+ (package (inherit texlive-texmf)
+ (name "texlive-texmf-minimal")
+ (arguments
+ (substitute-keyword-arguments
+ (package-arguments texlive-texmf)
+ ((#:modules modules)
+ `((ice-9 ftw)
+ (srfi srfi-1)
+ ,@modules))
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'prune
+ (lambda _
+ (define (delete subdir exclude)
+ "Delete all files and directories in SUBDIR except for those
+given in the list EXCLUDE."
+ (with-directory-excursion subdir
+ (for-each delete-file-recursively
+ (lset-difference equal?
+ (scandir ".")
+ (append '("." "..")
+ exclude)))))
+ (with-directory-excursion "texmf-dist"
+ (for-each delete-file-recursively
+ '("doc" "source" "tex4ht"))
+ ;; Delete all subdirectories of "fonts", except for "tfm" and
+ ;; any directories named "cm".
+ (delete "fonts" '("afm" "map" "pk" "source" "tfm" "type1"))
+ (delete "fonts/afm" '("public"))
+ (delete "fonts/afm/public" '("amsfonts"))
+ (delete "fonts/afm/public/amsfonts" '("cm"))
+ (delete "fonts/map" '("dvips"))
+ (delete "fonts/map/dvips" '("cm"))
+ (delete "fonts/source" '("public"))
+ (delete "fonts/source/public" '("cm"))
+ (delete "fonts/tfm" '("public"))
+ (delete "fonts/type1" '("public"))
+ (delete "fonts/type1/public" '("amsfonts"))
+ (delete "fonts/type1/public/amsfonts" '("cm")))
+ #t))))))
+ (description
+ "TeX Live provides a comprehensive TeX document production system.
+It includes all the major TeX-related programs, macro packages, and fonts
+that are free software, including support for many languages around the
+world.
+
+This package contains a small subset of the texmf-dist data.")))
+
+
+;; texlive-minimal is the same as texlive, but using texlive-texmf-minimal
+;; instead of the full texlive-texmf. It can be used, for instance, as a
+;; native input to packages that need texlive to build their documentation.
+(define-public texlive-minimal
+ (package (inherit texlive)
+ (name "texlive-minimal")
+ (inputs
+ `(("texlive-texmf" ,texlive-texmf-minimal)
+ ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
+ (description
+ "TeX Live provides a comprehensive TeX document production system.
+It includes all the major TeX-related programs, macro packages, and fonts
+that are free software, including support for many languages around the
+world.
+
+This package contains a small working part of the TeX Live distribution.")))
+
+
(define-public rubber
(package
(name "rubber")
--
2.6.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-02-13 10:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-15 15:21 Small texlive variant Andreas Enge
2016-01-19 9:20 ` Ludovic Courtès
2016-02-09 21:49 ` Andreas Enge
2016-02-11 10:45 ` Ludovic Courtès
2016-02-13 10:17 ` Andreas Enge
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.