From ffae5a7946912ffd69dd4b608576cf2d75931fb2 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sat, 13 Jul 2019 04:51:16 +0200 Subject: doc: Update gpg key fetching instructions. This mirrors the steps performed by etc/guix-install.sh. * doc/guix.texi (KEY-SERVER): Replace moribund SKS key servers with... (OPENPGP-SIGNING-KEY-URL): ...the TLS PKI of the future. (Binary Installation, USB Stick and DVD Installation): Update the @example gpg command to download the key directly from Savannah. --- doc/guix.texi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 3e0788ed3a..71befcef5c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11,7 +11,7 @@ @c Identifier of the OpenPGP key used to sign tarballs and such. @set OPENPGP-SIGNING-KEY-ID 3CE464558A84FDC69DB40CFB090B11993D9AEBB5 -@set KEY-SERVER pool.sks-keyservers.net +@set OPENPGP-SIGNING-KEY-URL https://sv.gnu.org/people/viewgpg.php?user_id=15145 @c Base URL for downloads. @set BASE-URL https://ftp.gnu.org/gnu/guix @@ -558,8 +558,8 @@ If that command fails because you do not have the required public key, then run this command to import it: @example -$ gpg --keyserver @value{KEY-SERVER} \ - --recv-keys @value{OPENPGP-SIGNING-KEY-ID} +$ wget @value{OPENPGP-SIGNING-KEY-URL} \ + -qO - | gpg --import - @end example @noindent @@ -1905,8 +1905,8 @@ If that command fails because you do not have the required public key, then run this command to import it: @example -$ gpg --keyserver @value{KEY-SERVER} \ - --recv-keys @value{OPENPGP-SIGNING-KEY-ID} +$ wget @value{OPENPGP-SIGNING-KEY-URL} \ + -qO - | gpg --import - @end example @noindent -- cgit v1.2.3 From 2a059ab9955d702bf803773bef7a218a9b6cd2da Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sat, 13 Jul 2019 05:20:01 +0200 Subject: doc: Increase VM memory size. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/guix.texi (Running Guix in a VM): Bump ‘-m‘ to 1 GiB to match its @item below, and have a chance of being usable, too. --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 71befcef5c..5a8ad7ebda 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -25547,7 +25547,7 @@ vm-image} on x86_64 hardware: @example $ qemu-system-x86_64 \ -net user -net nic,model=virtio \ - -enable-kvm -m 512 \ + -enable-kvm -m 1024 \ -device virtio-blk,drive=myhd \ -drive if=none,file=/tmp/qemu-image,id=myhd @end example -- cgit v1.2.3 From 53f21642729e4786141c072dd835b04cb85dfe28 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 13 Jul 2019 16:31:50 +0200 Subject: channels: Add optional directory to channel metadata. * guix/channels.scm (): Add directory slot. Update users. (read-channel-metadata-from-source): New function. (standard-module-derivation): Use it. * doc/guix.texi (Package Modules in a Subdirectory): New subsection. --- doc/guix.texi | 13 ++++++++ guix/channels.scm | 93 +++++++++++++++++++++++++++++++------------------------ 2 files changed, 65 insertions(+), 41 deletions(-) (limited to 'doc') diff --git a/doc/guix.texi b/doc/guix.texi index 5a8ad7ebda..458fca20af 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3921,6 +3921,19 @@ For the sake of reliability and maintainability, you should avoid dependencies on channels that you don't control, and you should aim to keep the number of dependencies to a minimum. +@cindex subdirectory, channels +@subsection Package Modules in a Sub-directory + +As a channel author, you may want to keep your channel modules in a +sub-directory. If your modules are in the sub-directory @file{guix}, you must +add a meta-data file @file{.guix-channel} that contains: + +@lisp +(channel + (version 0) + (directory "guix")) +@end lisp + @subsection Replicating Guix @cindex pinning, channels diff --git a/guix/channels.scm b/guix/channels.scm index e6bb9b891b..615ff14565 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2018, 2019 Ludovic Courtès ;;; Copyright © 2018 Ricardo Wurmus +;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -107,9 +108,10 @@ (checkout channel-instance-checkout)) (define-record-type - (channel-metadata version dependencies) + (channel-metadata version directory dependencies) channel-metadata? (version channel-metadata-version) + (directory channel-metadata-directory) (dependencies channel-metadata-dependencies)) (define (channel-reference channel) @@ -119,18 +121,18 @@ (#f `(branch . ,(channel-branch channel))) (commit `(commit . ,(channel-commit channel))))) -(define (read-channel-metadata instance) - "Return a channel-metadata record read from the channel INSTANCE's -description file, or return #F if the channel instance does not include the -file." - (let* ((source (channel-instance-checkout instance)) - (meta-file (string-append source "/.guix-channel"))) +(define (read-channel-metadata-from-source source) + "Return a channel-metadata record read from channel's SOURCE/.guix-channel +description file, or return #F if SOURCE/.guix-channel does not exist." + (let ((meta-file (string-append source "/.guix-channel"))) (and (file-exists? meta-file) - (and-let* ((raw (call-with-input-file meta-file read)) - (version (and=> (assoc-ref raw 'version) first)) - (dependencies (or (assoc-ref raw 'dependencies) '()))) + (let* ((raw (call-with-input-file meta-file read)) + (version (and=> (assoc-ref raw 'version) first)) + (directory (and=> (assoc-ref raw 'directory) first)) + (dependencies (or (assoc-ref raw 'dependencies) '()))) (channel-metadata version + directory (map (lambda (item) (let ((get (lambda* (key #:optional default) (or (and=> (assoc-ref item key) first) default)))) @@ -144,12 +146,18 @@ file." (commit (get 'commit)))))) dependencies)))))) +(define (read-channel-metadata instance) + "Return a channel-metadata record read from the channel INSTANCE's +description file, or return #F if the channel instance does not include the +file." + (read-channel-metadata-from-source (channel-instance-checkout instance))) + (define (channel-instance-dependencies instance) "Return the list of channels that are declared as dependencies for the given channel INSTANCE." (match (read-channel-metadata instance) (#f '()) - (($ version dependencies) + (($ version directory dependencies) dependencies))) (define* (latest-channel-instances store channels #:optional (previous-channels '())) @@ -230,36 +238,39 @@ of COMMIT at URL. Use NAME as the channel name." modules in SOURCE and that depend on DEPENDENCIES, a list of lowerable objects. The assumption is that SOURCE contains package modules to be added to '%package-module-path'." - ;; FIXME: We should load, say SOURCE/.guix-channel.scm, which would allow - ;; channel publishers to specify things such as the sub-directory where .scm - ;; files live, files to exclude from the channel, preferred substitute URLs, - ;; etc. - - (define build - ;; This is code that we'll run in CORE, a Guix instance, with its own - ;; modules and so on. That way, we make sure these modules are built for - ;; the right Guile version, with the right dependencies, and that they get - ;; to see the right (gnu packages …) modules. - (with-extensions dependencies - #~(begin - (use-modules (guix build compile) - (guix build utils) - (srfi srfi-26)) - - (define go - (string-append #$output "/lib/guile/" (effective-version) - "/site-ccache")) - (define scm - (string-append #$output "/share/guile/site/" - (effective-version))) - - (compile-files #$source go - (find-files #$source "\\.scm$")) - (mkdir-p (dirname scm)) - (symlink #$source scm) - scm))) - - (gexp->derivation-in-inferior name build core)) + + (let* ((metadata (read-channel-metadata-from-source source)) + (directory (and=> metadata channel-metadata-directory))) + + (define build + ;; This is code that we'll run in CORE, a Guix instance, with its own + ;; modules and so on. That way, we make sure these modules are built for + ;; the right Guile version, with the right dependencies, and that they get + ;; to see the right (gnu packages …) modules. + (with-extensions dependencies + #~(begin + (use-modules (guix build compile) + (guix build utils) + (srfi srfi-26)) + + (define go + (string-append #$output "/lib/guile/" (effective-version) + "/site-ccache")) + (define scm + (string-append #$output "/share/guile/site/" + (effective-version))) + + (let* ((subdir (if #$directory + (string-append "/" #$directory) + "")) + (source (string-append #$source subdir))) + (compile-files source go (find-files source "\\.scm$")) + (mkdir-p (dirname scm)) + (symlink (string-append #$source subdir) scm)) + + scm))) + + (gexp->derivation-in-inferior name build core))) (define* (build-from-source name source #:key core verbose? commit -- cgit v1.2.3 From 09a1f92f61d1ab11d2cf9f7a0983f4fc9f436f57 Mon Sep 17 00:00:00 2001 From: Jelle Licht Date: Tue, 23 Aug 2016 05:23:55 +0200 Subject: build: Add node-build-system. * guix/build/node-build-system.scm: New file. * guix/build-system/node.scm: New file. * guix/build/json.scm: New file. * doc/guix.texi: Document it. * Makefile.am: Added new files. Co-Authored-By: Julien Lepiller --- Makefile.am | 3 + doc/guix.texi | 11 ++ guix/build-system/node.scm | 135 ++++++++++++++ guix/build/json.scm | 387 +++++++++++++++++++++++++++++++++++++++ guix/build/node-build-system.scm | 166 +++++++++++++++++ 5 files changed, 702 insertions(+) create mode 100644 guix/build-system/node.scm create mode 100644 guix/build/json.scm create mode 100644 guix/build/node-build-system.scm (limited to 'doc') diff --git a/Makefile.am b/Makefile.am index 82eda6042a..9839bf27cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -125,6 +125,7 @@ MODULES = \ guix/build-system/guile.scm \ guix/build-system/haskell.scm \ guix/build-system/linux-module.scm \ + guix/build-system/node.scm \ guix/build-system/perl.scm \ guix/build-system/python.scm \ guix/build-system/ocaml.scm \ @@ -170,6 +171,7 @@ MODULES = \ guix/build/gnu-build-system.scm \ guix/build/gnu-dist.scm \ guix/build/guile-build-system.scm \ + guix/build/node-build-system.scm \ guix/build/perl-build-system.scm \ guix/build/python-build-system.scm \ guix/build/ocaml-build-system.scm \ @@ -182,6 +184,7 @@ MODULES = \ guix/build/haskell-build-system.scm \ guix/build/linux-module-build-system.scm \ guix/build/store-copy.scm \ + guix/build/json.scm \ guix/build/utils.scm \ guix/build/union.scm \ guix/build/profiles.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 458fca20af..6ed77fe267 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -6346,6 +6346,17 @@ the module (in the "arguments" form of a package using the linux-module-build-system, use the key #:linux to specify it). @end defvr +@defvr {Scheme Variable} node-build-system +This variable is exported by @code{(guix build-system node)}. It +implements the build procedure used by @uref{http://nodejs.org, +Node.js}, which implements an approximation of the @code{npm install} +command, followed by an @code{npm test} command. + +Which Node.js package is used to interpret the @code{npm} commands can +be specified with the @code{#:node} parameter which defaults to +@code{node}. +@end defvr + Lastly, for packages that do not need anything as sophisticated, a ``trivial'' build system is provided. It is trivial in the sense that it provides basically no support: it does not pull any implicit inputs, diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm new file mode 100644 index 0000000000..05c24c47d5 --- /dev/null +++ b/guix/build-system/node.scm @@ -0,0 +1,135 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2016 Jelle Licht +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build-system node) + #:use-module (guix store) + #:use-module (guix build json) + #:use-module (guix build union) + #:use-module (guix utils) + #:use-module (guix packages) + #:use-module (guix derivations) + #:use-module (guix search-paths) + #:use-module (guix build-system) + #:use-module (guix build-system gnu) + #:use-module (ice-9 match) + #:export (npm-meta-uri + %node-build-system-modules + node-build + node-build-system)) + +(define (npm-meta-uri name) + "Return a URI string for the metadata of node module NAME found in the npm +registry." + (string-append "https://registry.npmjs.org/" name)) + +(define %node-build-system-modules + ;; Build-side modules imported by default. + `((guix build node-build-system) + (guix build json) + (guix build union) + ,@%gnu-build-system-modules)) ;; TODO: Might be not needed + +(define (default-node) + "Return the default Node package." + ;; Lazily resolve the binding to avoid a circular dependency. + (let ((node (resolve-interface '(gnu packages node)))) + (module-ref node 'node))) + +(define* (lower name + #:key source inputs native-inputs outputs system target + (node (default-node)) + #:allow-other-keys + #:rest arguments) + "Return a bag for NAME." + (define private-keywords + '(#:source #:target #:node #:inputs #:native-inputs)) + + (and (not target) ;XXX: no cross-compilation + (bag + (name name) + (system system) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@inputs + + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(standard-packages))) + (build-inputs `(("node" ,node) + ,@native-inputs)) + (outputs outputs) + (build node-build) + (arguments (strip-keyword-arguments private-keywords arguments))))) + +(define* (node-build store name inputs + #:key + (npm-flags ''()) + (tests? #t) + (phases '(@ (guix build node-build-system) + %standard-phases)) + (outputs '("out")) + (search-paths '()) + (system (%current-system)) + (guile #f) + (imported-modules %node-build-system-modules) + (modules '((guix build node-build-system) + (guix build json) + (guix build union) + (guix build utils)))) + "Build SOURCE using NODE and INPUTS." + (define builder + `(begin + (use-modules ,@modules) + (node-build #:name ,name + #:source ,(match (assoc-ref inputs "source") + (((? derivation? source)) + (derivation->output-path source)) + ((source) + source) + (source + source)) + #:system ,system + #:npm-flags ,npm-flags + #:tests? ,tests? + #:phases ,phases + #:outputs %outputs + #:search-paths ',(map search-path-specification->sexp + search-paths) + #:inputs %build-inputs))) + + (define guile-for-build + (match guile + ((? package?) + (package-derivation store guile system #:graft? #f)) + (#f + (let* ((distro (resolve-interface '(gnu packages commencement))) + (guile (module-ref distro 'guile-final))) + (package-derivation store guile system #:graft? #f))))) + + (build-expression->derivation store name builder + #:inputs inputs + #:system system + #:modules imported-modules + #:outputs outputs + #:guile-for-build guile-for-build)) + +(define node-build-system + (build-system + (name 'node) + (description "The standard Node build system") + (lower lower))) diff --git a/guix/build/json.scm b/guix/build/json.scm new file mode 100644 index 0000000000..361ea76728 --- /dev/null +++ b/guix/build/json.scm @@ -0,0 +1,387 @@ +;;;; json.scm --- JSON reader/writer +;;;; Copyright (C) 2015 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 3 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +;;;; + +(define-module (guix build json) ;; originally (ice-9 json) + #:use-module (ice-9 match) + #:export (read-json write-json)) + +;; Snarfed from +;; https://github.com/cwebber/activitystuff/blob/master/activitystuff/contrib/json.scm +;; + +;;; +;;; Reader +;;; + +(define (json-error port) + (throw 'json-error port)) + +(define (assert-char port char) + "Read a character from PORT and throw an invalid JSON error if the +character is not CHAR." + (unless (eqv? (read-char port) char) + (json-error port))) + +(define (whitespace? char) + "Return #t if CHAR is a whitespace character." + (char-set-contains? char-set:whitespace char)) + +(define (consume-whitespace port) + "Discard characters from PORT until a non-whitespace character is +encountered.." + (match (peek-char port) + ((? eof-object?) *unspecified*) + ((? whitespace?) + (read-char port) + (consume-whitespace port)) + (_ *unspecified*))) + +(define (make-keyword-reader keyword value) + "Parse the keyword symbol KEYWORD as VALUE." + (let ((str (symbol->string keyword))) + (lambda (port) + (let loop ((i 0)) + (cond + ((= i (string-length str)) value) + ((eqv? (string-ref str i) (read-char port)) + (loop (1+ i))) + (else (json-error port))))))) + +(define read-true (make-keyword-reader 'true #t)) +(define read-false (make-keyword-reader 'false #f)) +(define read-null (make-keyword-reader 'null #nil)) + +(define (read-hex-digit port) + "Read a hexadecimal digit from PORT." + (match (read-char port) + (#\0 0) + (#\1 1) + (#\2 2) + (#\3 3) + (#\4 4) + (#\5 5) + (#\6 6) + (#\7 7) + (#\8 8) + (#\9 9) + ((or #\A #\a) 10) + ((or #\B #\b) 11) + ((or #\C #\c) 12) + ((or #\D #\d) 13) + ((or #\E #\e) 14) + ((or #\F #\f) 15) + (_ (json-error port)))) + +(define (read-utf16-character port) + "Read a hexadecimal encoded UTF-16 character from PORT." + (integer->char + (+ (* (read-hex-digit port) (expt 16 3)) + (* (read-hex-digit port) (expt 16 2)) + (* (read-hex-digit port) 16) + (read-hex-digit port)))) + +(define (read-escape-character port) + "Read escape character from PORT." + (match (read-char port) + (#\" #\") + (#\\ #\\) + (#\/ #\/) + (#\b #\backspace) + (#\f #\page) + (#\n #\newline) + (#\r #\return) + (#\t #\tab) + (#\u (read-utf16-character port)) + (_ (json-error port)))) + +(define (read-string port) + "Read a JSON encoded string from PORT." + (assert-char port #\") + (let loop ((result '())) + (match (read-char port) + ((? eof-object?) (json-error port)) + (#\" (list->string (reverse result))) + (#\\ (loop (cons (read-escape-character port) result))) + (char (loop (cons char result)))))) + +(define char-set:json-digit + (char-set #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)) + +(define (digit? char) + (char-set-contains? char-set:json-digit char)) + +(define (read-digit port) + "Read a digit 0-9 from PORT." + (match (read-char port) + (#\0 0) + (#\1 1) + (#\2 2) + (#\3 3) + (#\4 4) + (#\5 5) + (#\6 6) + (#\7 7) + (#\8 8) + (#\9 9) + (else (json-error port)))) + +(define (read-digits port) + "Read a sequence of digits from PORT." + (let loop ((result '())) + (match (peek-char port) + ((? eof-object?) + (reverse result)) + ((? digit?) + (loop (cons (read-digit port) result))) + (else (reverse result))))) + +(define (list->integer digits) + "Convert the list DIGITS to an integer." + (let loop ((i (1- (length digits))) + (result 0) + (digits digits)) + (match digits + (() result) + ((n . tail) + (loop (1- i) + (+ result (* n (expt 10 i))) + tail))))) + +(define (read-positive-integer port) + "Read a positive integer with no leading zeroes from PORT." + (match (read-digits port) + ((0 . _) + (json-error port)) ; no leading zeroes allowed + ((digits ...) + (list->integer digits)))) + +(define (read-exponent port) + "Read exponent from PORT." + (define (read-expt) + (list->integer (read-digits port))) + + (unless (memv (read-char port) '(#\e #\E)) + (json-error port)) + + (match (peek-char port) + ((? eof-object?) + (json-error port)) + (#\- + (read-char port) + (- (read-expt))) + (#\+ + (read-char port) + (read-expt)) + ((? digit?) + (read-expt)) + (_ (json-error port)))) + +(define (read-fraction port) + "Read fractional number part from PORT as an inexact number." + (let* ((digits (read-digits port)) + (numerator (list->integer digits)) + (denomenator (expt 10 (length digits)))) + (/ numerator denomenator))) + +(define (read-positive-number port) + "Read a positive number from PORT." + (let* ((integer (match (peek-char port) + ((? eof-object?) + (json-error port)) + (#\0 + (read-char port) + 0) + ((? digit?) + (read-positive-integer port)) + (_ (json-error port)))) + (fraction (match (peek-char port) + (#\. + (read-char port) + (read-fraction port)) + (_ 0))) + (exponent (match (peek-char port) + ((or #\e #\E) + (read-exponent port)) + (_ 0))) + (n (* (+ integer fraction) (expt 10 exponent)))) + + ;; Keep integers as exact numbers, but convert numbers encoded as + ;; floating point numbers to an inexact representation. + (if (zero? fraction) + n + (exact->inexact n)))) + +(define (read-number port) + "Read a number from PORT" + (match (peek-char port) + ((? eof-object?) + (json-error port)) + (#\- + (read-char port) + (- (read-positive-number port))) + ((? digit?) + (read-positive-number port)) + (_ (json-error port)))) + +(define (read-object port) + "Read key/value map from PORT." + (define (read-key+value-pair) + (let ((key (read-string port))) + (consume-whitespace port) + (assert-char port #\:) + (consume-whitespace port) + (let ((value (read-value port))) + (cons key value)))) + + (assert-char port #\{) + (consume-whitespace port) + + (if (eqv? #\} (peek-char port)) + (begin + (read-char port) + '(@)) ; empty object + (let loop ((result (list (read-key+value-pair)))) + (consume-whitespace port) + (match (peek-char port) + (#\, ; read another value + (read-char port) + (consume-whitespace port) + (loop (cons (read-key+value-pair) result))) + (#\} ; end of object + (read-char port) + (cons '@ (reverse result))) + (_ (json-error port)))))) + +(define (read-array port) + "Read array from PORT." + (assert-char port #\[) + (consume-whitespace port) + + (if (eqv? #\] (peek-char port)) + (begin + (read-char port) + '()) ; empty array + (let loop ((result (list (read-value port)))) + (consume-whitespace port) + (match (peek-char port) + (#\, ; read another value + (read-char port) + (consume-whitespace port) + (loop (cons (read-value port) result))) + (#\] ; end of array + (read-char port) + (reverse result)) + (_ (json-error port)))))) + +(define (read-value port) + "Read a JSON value from PORT." + (consume-whitespace port) + (match (peek-char port) + ((? eof-object?) (json-error port)) + (#\" (read-string port)) + (#\{ (read-object port)) + (#\[ (read-array port)) + (#\t (read-true port)) + (#\f (read-false port)) + (#\n (read-null port)) + ((or #\- (? digit?)) + (read-number port)) + (_ (json-error port)))) + +(define (read-json port) + "Read JSON text from port and return an s-expression representation." + (let ((result (read-value port))) + (consume-whitespace port) + (unless (eof-object? (peek-char port)) + (json-error port)) + result)) + + +;;; +;;; Writer +;;; + +(define (write-string str port) + "Write STR to PORT in JSON string format." + (define (escape-char char) + (display (match char + (#\" "\\\"") + (#\\ "\\\\") + (#\/ "\\/") + (#\backspace "\\b") + (#\page "\\f") + (#\newline "\\n") + (#\return "\\r") + (#\tab "\\t") + (_ char)) + port)) + + (display "\"" port) + (string-for-each escape-char str) + (display "\"" port)) + +(define (write-object alist port) + "Write ALIST to PORT in JSON object format." + ;; Keys may be strings or symbols. + (define key->string + (match-lambda + ((? string? key) key) + ((? symbol? key) (symbol->string key)))) + + (define (write-pair pair) + (match pair + ((key . value) + (write-string (key->string key) port) + (display ":" port) + (write-json value port)))) + + (display "{" port) + (match alist + (() #f) + ((front ... end) + (for-each (lambda (pair) + (write-pair pair) + (display "," port)) + front) + (write-pair end))) + (display "}" port)) + +(define (write-array lst port) + "Write LST to PORT in JSON array format." + (display "[" port) + (match lst + (() #f) + ((front ... end) + (for-each (lambda (val) + (write-json val port) + (display "," port)) + front) + (write-json end port))) + (display "]" port)) + +(define (write-json exp port) + "Write EXP to PORT in JSON format." + (match exp + (#t (display "true" port)) + (#f (display "false" port)) + ;; Differentiate #nil from '(). + ((and (? boolean? ) #nil) (display "null" port)) + ((? string? s) (write-string s port)) + ((? real? n) (display n port)) + (('@ . alist) (write-object alist port)) + ((vals ...) (write-array vals port)))) diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm new file mode 100644 index 0000000000..3c0ac2a12b --- /dev/null +++ b/guix/build/node-build-system.scm @@ -0,0 +1,166 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2015 David Thompson +;;; Copyright © 2016 Jelle Licht +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix build node-build-system) + #:use-module ((guix build gnu-build-system) #:prefix gnu:) + #:use-module (guix build json) + #:use-module (guix build union) + #:use-module (guix build utils) + #:use-module (ice-9 match) + #:use-module (ice-9 popen) + #:use-module (ice-9 regex) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:export (%standard-phases + node-build)) + +;; Commentary: +;; +;; Builder-side code of the standard Node/npm package build procedure. +;; +;; Code: + +(define* (read-package-data #:key (filename "package.json")) + (call-with-input-file filename + (lambda (port) + (read-json port)))) + +(define* (build #:key inputs #:allow-other-keys) + (define (build-from-package-json? package-file) + (let* ((package-data (read-package-data #:filename package-file)) + (scripts (assoc-ref package-data "scripts"))) + (assoc-ref scripts "build"))) + "Build a new node module using the appropriate build system." + ;; XXX: Develop a more robust heuristic, allow override + (cond ((file-exists? "gulpfile.js") + (invoke "gulp")) + ((file-exists? "gruntfile.js") + (invoke "grunt")) + ((file-exists? "Makefile") + (invoke "make")) + ((and (file-exists? "package.json") + (build-from-package-json? "package.json")) + (invoke "npm" "run" "build"))) + #t) + +(define* (link-npm-dependencies #:key inputs #:allow-other-keys) + (define (inputs->node-inputs inputs) + "Filter the directory part from INPUTS." + (filter (lambda (input) + (match input + ((name . _) (node-package? name)))) + inputs)) + (define (inputs->directories inputs) + "Extract the directory part from INPUTS." + (match inputs + (((names . directories) ...) + directories))) + (define (make-node-path root) + (string-append root "/lib/node_modules/")) + + (let ((input-node-directories (inputs->directories + (inputs->node-inputs inputs)))) + (union-build "node_modules" + (map make-node-path input-node-directories)) + #t)) + +(define configure link-npm-dependencies) + +(define* (check #:key tests? #:allow-other-keys) + "Run 'npm test' if TESTS?" + (if tests? + ;; Should only be enabled once we know that there are tests + (invoke "npm" "test")) + #t) + +(define (node-package? name) + "Check if NAME correspond to the name of an Node package." + (string-prefix? "node-" name)) + +(define* (install #:key outputs inputs #:allow-other-keys) + "Install the node module to the output store item. The module itself is +installed in a subdirectory of @file{node_modules} and its runtime dependencies +as defined by @file{package.json} are symlinked into a @file{node_modules} +subdirectory of the module's directory. Additionally, binaries are installed in +the @file{bin} directory." + (let* ((out (assoc-ref outputs "out")) + (target (string-append out "/lib")) + (binaries (string-append out "/bin")) + (data (read-package-data)) + (modulename (assoc-ref data "name")) + (binary-configuration (match (assoc-ref data "bin") + (('@ configuration ...) configuration) + ((? string? configuration) configuration) + (#f #f))) + (dependencies (match (assoc-ref data "dependencies") + (('@ deps ...) deps) + (#f #f)))) + (mkdir-p target) + (copy-recursively "." (string-append target "/node_modules/" modulename)) + ;; Remove references to dependencies + (delete-file-recursively + (string-append target "/node_modules/" modulename "/node_modules")) + (cond + ((string? binary-configuration) + (begin + (mkdir-p binaries) + (symlink (string-append target "/node_modules/" modulename "/" + binary-configuration) + (string-append binaries "/" modulename)))) + ((list? binary-configuration) + (for-each + (lambda (conf) + (match conf + ((key . value) + (begin + (mkdir-p (dirname (string-append binaries "/" key))) + (symlink (string-append target "/node_modules/" modulename "/" + value) + (string-append binaries "/" key)))))) + binary-configuration)) + (else + (symlink (string-append target "/node_modules/" modulename "/bin") + binaries))) + (when dependencies + (mkdir-p + (string-append target "/node_modules/" modulename "/node_modules")) + (for-each + (lambda (dependency) + (let ((dependency (car dependency))) + (symlink + (string-append (assoc-ref inputs (string-append "node-" dependency)) + "/lib/node_modules/" dependency) + (string-append target "/node_modules/" modulename + "/node_modules/" dependency)))) + dependencies)) + #t)) + + +(define %standard-phases + (modify-phases gnu:%standard-phases + (replace 'configure configure) + (replace 'build build) + (replace 'install install) + (delete 'check) + (add-after 'install 'check check) + (delete 'strip))) + +(define* (node-build #:key inputs (phases %standard-phases) + #:allow-other-keys #:rest args) + (apply gnu:gnu-build #:inputs inputs #:phases phases args)) -- cgit v1.2.3 From 21bec78357ff5b93a14107bbeb5798923162f4b8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 15 Jul 2019 11:51:43 +0200 Subject: doc: Generalize build procedures of HTML indexes. * doc/build.scm (html-manual-indexes)[build](sxml-index): Generalize; add a 'title' and a 'body' parameter and honor them. (language-index): New procedure. (write-index): Remove. (write-html): New procedure. Use 'write-html' and 'language-index'. --- doc/build.scm | 86 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 45 insertions(+), 41 deletions(-) (limited to 'doc') diff --git a/doc/build.scm b/doc/build.scm index e628a91048..c0952ecb89 100644 --- a/doc/build.scm +++ b/doc/build.scm @@ -424,10 +424,7 @@ from SOURCE." (define (guix-url path) (string-append #$%web-site-url path)) - (define (sxml-index language) - (define title - (translate "GNU Guix Reference Manual" language)) - + (define (sxml-index language title body) ;; FIXME: Avoid duplicating styling info from guix-artwork.git. `(html (@ (lang ,language)) (head @@ -458,45 +455,53 @@ from SOURCE." (a (@ (class "crumb") (href #$%web-site-url)) "Home")) - (main - (article - (@ (class "page centered-block limit-width")) - (h2 ,title) - (p (@ (class "post-metadata centered-text")) - #$version " — " - ,(seconds->string #$date language)) - - (div - (ul - (li (a (@ (href "html_node")) - "HTML, with one page per node")) - (li (a (@ (href - ,(string-append - #$manual - (if (string=? language - "en") - "" - (string-append "." - language)) - ".html"))) - "HTML, entirely on one page")) - ,@(if (member language '("ru" "zh_CN")) - '() - `((li (a (@ (href ,(string-append - #$manual - (if (string=? language "en") - "" - (string-append "." - language)) - ".pdf")))) - "PDF"))))))) + ,body (footer)))) - (define (write-index language file) + (define (language-index language) + (define title + (translate "GNU Guix Reference Manual" language)) + + (sxml-index + language title + `(main + (article + (@ (class "page centered-block limit-width")) + (h2 ,title) + (p (@ (class "post-metadata centered-text")) + #$version " — " + ,(seconds->string #$date language)) + + (div + (ul + (li (a (@ (href "html_node")) + "HTML, with one page per node")) + (li (a (@ (href + ,(string-append + #$manual + (if (string=? language + "en") + "" + (string-append "." + language)) + ".html"))) + "HTML, entirely on one page")) + ,@(if (member language '("ru" "zh_CN")) + '() + `((li (a (@ (href ,(string-append + #$manual + (if (string=? language "en") + "" + (string-append "." + language)) + ".pdf")))) + "PDF"))))))))) + + (define (write-html file sxml) (call-with-output-file file (lambda (port) (display "\n" port) - (sxml->xml (sxml-index language) port)))) + (sxml->xml sxml port)))) (setenv "GUIX_LOCPATH" #+(file-append glibc-utf8-locales "/lib/locale")) @@ -512,9 +517,8 @@ from SOURCE." (normalize language))) (mkdir-p directory) - (write-index language - (string-append directory - "/index.html"))) + (write-html (string-append directory "/index.html") + (language-index language))) '#$languages)))) (computed-file "html-indexes" build)) -- cgit v1.2.3 From e591541d36215eda3aa2d877578e00939001fb85 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 15 Jul 2019 12:33:07 +0200 Subject: doc: Build a top-level index of the manuals. Suggested by Julien Lepiller. * doc/build.scm (html-manual-indexes)[build]: Add 'with-extensions'. (translate): Actually honor DOMAIN. Add call to 'bindtextdomain' for ISO-CODES. (%iso639-languages): New variable. (language-code->name, top-level-index): New procedures. Add call to 'write-html' for OUTPUT/index.html. --- doc/build.scm | 360 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 204 insertions(+), 156 deletions(-) (limited to 'doc') diff --git a/doc/build.scm b/doc/build.scm index c0952ecb89..a2f353a090 100644 --- a/doc/build.scm +++ b/doc/build.scm @@ -34,6 +34,7 @@ (gnu packages gawk) (gnu packages gettext) (gnu packages guile) + (gnu packages iso-codes) (gnu packages texinfo) (gnu packages tex) (srfi srfi-19) @@ -183,7 +184,7 @@ makeinfo OPTIONS." (ice-9 match)) (define (normalize language) - ;; Normalize LANGUAGE. For instance, "zh_CN" become "zh-cn". + ;; Normalize LANGUAGE. For instance, "zh_CN" becomes "zh-cn". (string-map (match-lambda (#\_ #\-) (chr chr)) @@ -365,161 +366,208 @@ from SOURCE." (manual "guix") (date 1)) (define build - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (guix build utils) - (ice-9 match) - (ice-9 popen) - (sxml simple) - (srfi srfi-19)) - - (define (normalize language) ;XXX: deduplicate - ;; Normalize LANGUAGE. For instance, "zh_CN" become "zh-cn". - (string-map (match-lambda - (#\_ #\-) - (chr chr)) - (string-downcase language))) - - (define-syntax-rule (with-language language exp ...) - (let ((lang (getenv "LANGUAGE"))) - (dynamic-wind - (lambda () - (setenv "LANGUAGE" language) - (setlocale LC_MESSAGES)) - (lambda () exp ...) - (lambda () - (if lang - (setenv "LANGUAGE" lang) - (unsetenv "LANGUAGE")) - (setlocale LC_MESSAGES))))) - - ;; (put 'with-language 'scheme-indent-function 1) - (define* (translate str language - #:key (domain "guix-manual")) - (define exp - `(begin - (bindtextdomain "guix-manual" - #+(guix-manual-text-domain - source - languages)) - (write (gettext ,str "guix-manual")))) - - (with-language language - ;; Since the 'gettext' function caches msgid translations, - ;; regardless of $LANGUAGE, we have to spawn a new process each - ;; time we want to translate to a different language. Bah! - (let* ((pipe (open-pipe* OPEN_READ - #+(file-append guile-2.2 - "/bin/guile") - "-c" (object->string exp))) - (str (read pipe))) - (close-pipe pipe) - str))) - - (define (seconds->string seconds language) - (let* ((time (make-time time-utc 0 seconds)) - (date (time-utc->date time))) - (with-language language (date->string date "~e ~B ~Y")))) - - (define (guix-url path) - (string-append #$%web-site-url path)) - - (define (sxml-index language title body) - ;; FIXME: Avoid duplicating styling info from guix-artwork.git. - `(html (@ (lang ,language)) - (head - (title ,(string-append title " — GNU Guix")) - (meta (@ (charset "UTF-8"))) - (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))) - ;; Menu prefetch. - (link (@ (rel "prefetch") (href ,(guix-url "menu/index.html")))) - ;; Base CSS. - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/elements.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/common.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/messages.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/navbar.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/breadcrumbs.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/buttons.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/footer.css")))) - - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/page.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/post.css"))))) - (body - (header (@ (class "navbar")) - (h1 (a (@ (class "branding") - (href #$%web-site-url))) - (span (@ (class "a11y-offset")) - "Guix")) - (nav (@ (class "menu")))) - (nav (@ (class "breadcrumbs")) - (a (@ (class "crumb") - (href #$%web-site-url)) - "Home")) - ,body - (footer)))) - - (define (language-index language) - (define title - (translate "GNU Guix Reference Manual" language)) - - (sxml-index - language title - `(main - (article - (@ (class "page centered-block limit-width")) - (h2 ,title) - (p (@ (class "post-metadata centered-text")) - #$version " — " - ,(seconds->string #$date language)) - - (div - (ul - (li (a (@ (href "html_node")) - "HTML, with one page per node")) - (li (a (@ (href - ,(string-append - #$manual - (if (string=? language - "en") - "" - (string-append "." - language)) - ".html"))) - "HTML, entirely on one page")) - ,@(if (member language '("ru" "zh_CN")) - '() - `((li (a (@ (href ,(string-append - #$manual - (if (string=? language "en") - "" - (string-append "." - language)) - ".pdf")))) - "PDF"))))))))) - - (define (write-html file sxml) - (call-with-output-file file - (lambda (port) - (display "\n" port) - (sxml->xml sxml port)))) - - (setenv "GUIX_LOCPATH" - #+(file-append glibc-utf8-locales "/lib/locale")) - (setenv "LC_ALL" "en_US.utf8") - (setlocale LC_ALL "en_US.utf8") - - (bindtextdomain "guix-manual" - #+(guix-manual-text-domain source languages)) - - (for-each (lambda (language) - (define directory - (string-append #$output "/" - (normalize language))) - - (mkdir-p directory) - (write-html (string-append directory "/index.html") - (language-index language))) - '#$languages)))) + (with-extensions (list guile-json-3) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils) + (json) + (ice-9 match) + (ice-9 popen) + (sxml simple) + (srfi srfi-1) + (srfi srfi-19)) + + (define (normalize language) ;XXX: deduplicate + ;; Normalize LANGUAGE. For instance, "zh_CN" becomes "zh-cn". + (string-map (match-lambda + (#\_ #\-) + (chr chr)) + (string-downcase language))) + + (define-syntax-rule (with-language language exp ...) + (let ((lang (getenv "LANGUAGE"))) + (dynamic-wind + (lambda () + (setenv "LANGUAGE" language) + (setlocale LC_MESSAGES)) + (lambda () exp ...) + (lambda () + (if lang + (setenv "LANGUAGE" lang) + (unsetenv "LANGUAGE")) + (setlocale LC_MESSAGES))))) + + ;; (put 'with-language 'scheme-indent-function 1) + (define* (translate str language + #:key (domain "guix-manual")) + (define exp + `(begin + (bindtextdomain "guix-manual" + #+(guix-manual-text-domain + source + languages)) + (bindtextdomain "iso_639-3" ;language names + #+(file-append iso-codes + "/share/locale")) + (write (gettext ,str ,domain)))) + + (with-language language + ;; Since the 'gettext' function caches msgid translations, + ;; regardless of $LANGUAGE, we have to spawn a new process each + ;; time we want to translate to a different language. Bah! + (let* ((pipe (open-pipe* OPEN_READ + #+(file-append guile-2.2 + "/bin/guile") + "-c" (object->string exp))) + (str (read pipe))) + (close-pipe pipe) + str))) + + (define (seconds->string seconds language) + (let* ((time (make-time time-utc 0 seconds)) + (date (time-utc->date time))) + (with-language language (date->string date "~e ~B ~Y")))) + + (define (guix-url path) + (string-append #$%web-site-url path)) + + (define (sxml-index language title body) + ;; FIXME: Avoid duplicating styling info from guix-artwork.git. + `(html (@ (lang ,language)) + (head + (title ,(string-append title " — GNU Guix")) + (meta (@ (charset "UTF-8"))) + (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))) + ;; Menu prefetch. + (link (@ (rel "prefetch") (href ,(guix-url "menu/index.html")))) + ;; Base CSS. + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/elements.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/common.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/messages.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/navbar.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/breadcrumbs.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/buttons.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/footer.css")))) + + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/page.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/post.css"))))) + (body + (header (@ (class "navbar")) + (h1 (a (@ (class "branding") + (href #$%web-site-url))) + (span (@ (class "a11y-offset")) + "Guix")) + (nav (@ (class "menu")))) + (nav (@ (class "breadcrumbs")) + (a (@ (class "crumb") + (href #$%web-site-url)) + "Home")) + ,body + (footer)))) + + (define (language-index language) + (define title + (translate "GNU Guix Reference Manual" language)) + + (sxml-index + language title + `(main + (article + (@ (class "page centered-block limit-width")) + (h2 ,title) + (p (@ (class "post-metadata centered-text")) + #$version " — " + ,(seconds->string #$date language)) + + (div + (ul + (li (a (@ (href "html_node")) + "HTML, with one page per node")) + (li (a (@ (href + ,(string-append + #$manual + (if (string=? language + "en") + "" + (string-append "." + language)) + ".html"))) + "HTML, entirely on one page")) + ,@(if (member language '("ru" "zh_CN")) + '() + `((li (a (@ (href ,(string-append + #$manual + (if (string=? language "en") + "" + (string-append "." + language)) + ".pdf")))) + "PDF"))))))))) + + (define %iso639-languages + (vector->list + (assoc-ref (call-with-input-file + #+(file-append iso-codes + "/share/iso-codes/json/iso_639-3.json") + json->scm) + "639-3"))) + + (define (language-code->name code) + "Return the full name of a language from its ISO-639-3 code." + (let ((code (match (string-index code #\_) + (#f code) + (index (string-take code index))))) + (any (lambda (language) + (and (string=? (or (assoc-ref language "alpha_2") + (assoc-ref language "alpha_3")) + code) + (assoc-ref language "name"))) + %iso639-languages))) + + (define (top-level-index languages) + (define title + "GNU Guix Reference Manual") + (sxml-index + "en" title + `(main + (article + (@ (class "page centered-block limit-width")) + (h2 ,title) + (div + "The GNU Guix Reference Manual is available in the following +languages:\n" + (ul + ,@(map (lambda (language) + `(li (a (@ (href ,(normalize language))) + ,(translate + (language-code->name language) + language + #:domain "iso_639-3")))) + languages))))))) + + (define (write-html file sxml) + (call-with-output-file file + (lambda (port) + (display "\n" port) + (sxml->xml sxml port)))) + + (setenv "GUIX_LOCPATH" + #+(file-append glibc-utf8-locales "/lib/locale")) + (setenv "LC_ALL" "en_US.utf8") + (setlocale LC_ALL "en_US.utf8") + + (for-each (lambda (language) + (define directory + (string-append #$output "/" + (normalize language))) + + (mkdir-p directory) + (write-html (string-append directory "/index.html") + (language-index language))) + '#$languages) + + (write-html (string-append #$output "/index.html") + (top-level-index '#$languages)))))) (computed-file "html-indexes" build)) -- cgit v1.2.3 From fb8b99a5f559dffa6e5d370dcecbdc2e8feb3c8b Mon Sep 17 00:00:00 2001 From: Arne Babenhauserheide Date: Fri, 12 Jul 2019 23:43:33 +0200 Subject: doc: note how to install git send-email MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/contributing.texi (git send-email): Add install instructions. Signed-off-by: Ludovic Courtès --- doc/contributing.texi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/contributing.texi b/doc/contributing.texi index e00634eed4..7f2301409a 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -982,5 +982,6 @@ first send one message to @email{guix-patches@@gnu.org}, and then send subsequent patches to @email{@var{NNN}@@debbugs.gnu.org} to make sure they are kept together. See @uref{https://debbugs.gnu.org/Advanced.html, the Debbugs documentation} -for more information. +for more information. You can install @command{git send-email} with +@command{guix install git:send-email}. @c Debbugs bug: https://debbugs.gnu.org/db/15/15361.html -- cgit v1.2.3 From e3e9c191ed045234aa2929c12f6916eeb201744e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 16 Jul 2019 10:37:12 +0200 Subject: doc: Add 'images' directory next to HTML pages. * doc/build.scm (html-manual): Add images/ symlinks. --- doc/build.scm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/build.scm b/doc/build.scm index a2f353a090..7ba9f57bc9 100644 --- a/doc/build.scm +++ b/doc/build.scm @@ -177,6 +177,9 @@ makeinfo OPTIONS." #:languages languages #:date date)) + (define images + (texinfo-manual-images source)) + (define build (with-imported-modules '((guix build utils)) #~(begin @@ -228,7 +231,15 @@ makeinfo OPTIONS." "" (string-append "." language)) ".html") - opts))) + opts) + + ;; Make sure images are available. + (symlink #$images + (string-append #$output "/" (normalize language) + "/images")) + (symlink #$images + (string-append #$output "/" (normalize language) + "/html_node/images")))) '#$languages)))) (computed-file (string-append manual "-html-manual") build)) -- cgit v1.2.3 From 0636742b774876382da99b182ee39e4ac1944f48 Mon Sep 17 00:00:00 2001 From: Florian Pelz Date: Sat, 13 Jul 2019 08:29:26 +0200 Subject: doc: Reorder and clarify contributing instructions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/contributing.texi (Building from Git, Running Guix Before It Is Installed): Make instructions using Guix come first and clarify which code is an instruction and which is merely an example. Signed-off-by: Ludovic Courtès --- doc/contributing.texi | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'doc') diff --git a/doc/contributing.texi b/doc/contributing.texi index 7f2301409a..59917193f1 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -38,19 +38,6 @@ version from the Git repository: git clone https://git.savannah.gnu.org/git/guix.git @end example -When building Guix from a checkout, -the following packages are required in addition to those mentioned in -the installation instructions (@pxref{Requirements}). - -@itemize -@item @url{http://gnu.org/software/autoconf/, GNU Autoconf}; -@item @url{http://gnu.org/software/automake/, GNU Automake}; -@item @url{http://gnu.org/software/gettext/, GNU Gettext}; -@item @url{http://gnu.org/software/texinfo/, GNU Texinfo}; -@item @url{http://www.graphviz.org/, Graphviz}; -@item @url{http://www.gnu.org/software/help2man/, GNU Help2man (optional)}. -@end itemize - The easiest way to set up a development environment for Guix is, of course, by using Guix! The following command starts a new shell where all the dependencies and appropriate environment variables are set up to @@ -61,7 +48,22 @@ guix environment guix --pure @end example @xref{Invoking guix environment}, for more information on that command. -Extra dependencies can be added with @option{--ad-hoc}: + +If you are unable to use Guix when building Guix from a checkout, the +following are the required packages in addition to those mentioned in the +installation instructions (@pxref{Requirements}). + +@itemize +@item @url{http://gnu.org/software/autoconf/, GNU Autoconf}; +@item @url{http://gnu.org/software/automake/, GNU Automake}; +@item @url{http://gnu.org/software/gettext/, GNU Gettext}; +@item @url{http://gnu.org/software/texinfo/, GNU Texinfo}; +@item @url{http://www.graphviz.org/, Graphviz}; +@item @url{http://www.gnu.org/software/help2man/, GNU Help2man (optional)}. +@end itemize + +On Guix, extra dependencies can be added by instead running @command{guix +environment} with @option{--ad-hoc}: @example guix environment guix --pure --ad-hoc help2man git strace @@ -113,8 +115,8 @@ run @code{make install}. To do that, you first need to have an environment with all the dependencies available (@pxref{Building from Git}), and then simply prefix each command with @command{./pre-inst-env} (the @file{pre-inst-env} script lives in the -top build tree of Guix; it is generated by @command{./configure}), -as in@footnote{The @option{-E} flag to +top build tree of Guix; it is generated by @command{./configure}). +An example@footnote{The @option{-E} flag to @command{sudo} guarantees that @code{GUILE_LOAD_PATH} is correctly set such that @command{guix-daemon} and the tools it uses can find the Guile modules they need.}: @@ -125,7 +127,7 @@ $ ./pre-inst-env guix build hello @end example @noindent -Similarly, for a Guile session using the Guix modules: +Similarly, an example for a Guile session using the Guix modules: @example $ ./pre-inst-env guile -c '(use-modules (guix utils)) (pk (%current-system))' -- cgit v1.2.3