diff options
Diffstat (limited to 'guix')
54 files changed, 498 insertions, 530 deletions
diff --git a/guix/android-repo-download.scm b/guix/android-repo-download.scm index 9d8937ddc0..5ff3e7edd4 100644 --- a/guix/android-repo-download.scm +++ b/guix/android-repo-download.scm @@ -78,9 +78,6 @@ generic name if unset." (define zlib (module-ref (resolve-interface '(gnu packages compression)) 'zlib)) - (define guile-json - (module-ref (resolve-interface '(gnu packages guile)) 'guile-json-3)) - (define gnutls (module-ref (resolve-interface '(gnu packages tls)) 'gnutls)) @@ -102,7 +99,7 @@ generic name if unset." (define build (with-imported-modules modules - (with-extensions (list guile-json gnutls) ;for (guix swh) + (with-extensions (list gnutls) #~(begin (use-modules (guix build android-repo) (guix build utils) diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm index 630b99e2bf..28403a1960 100644 --- a/guix/build-system/asdf.scm +++ b/guix/build-system/asdf.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca> -;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net> +;;; Copyright © 2019, 2020 Guillaume Le Vaillant <glv@posteo.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -54,12 +54,14 @@ ;; Imported build-side modules `((guix build asdf-build-system) (guix build lisp-utils) + (guix build union) ,@%gnu-build-system-modules)) (define %asdf-build-modules ;; Used (visible) build-side modules '((guix build asdf-build-system) (guix build utils) + (guix build union) (guix build lisp-utils))) (define (default-lisp implementation) @@ -210,7 +212,7 @@ set up using CL source package conventions." (define base-arguments (if target-is-source? (strip-keyword-arguments - '(#:tests? #:asd-file #:lisp #:asd-system-name #:test-asd-file) + '(#:tests? #:asd-files #:lisp #:asd-systems #:test-asd-file) (package-arguments pkg)) (package-arguments pkg))) @@ -278,8 +280,8 @@ set up using CL source package conventions." (lambda* (store name inputs #:key source outputs (tests? #t) - (asd-file #f) - (asd-system-name #f) + (asd-files ''()) + (asd-systems ''()) (test-asd-file #f) (phases '(@ (guix build asdf-build-system) %standard-phases)) @@ -289,12 +291,17 @@ set up using CL source package conventions." (imported-modules %asdf-build-system-modules) (modules %asdf-build-modules)) - (define system-name - (or asd-system-name - (string-drop - ;; NAME is the value returned from `package-full-name'. - (hyphen-separated-name->name+version name) - (1+ (string-length lisp-type))))) ; drop the "<lisp>-" prefix. + ;; FIXME: The definition of 'systems' is pretty hacky. + ;; Is there a more elegant way to do it? + (define systems + (if (null? (cadr asd-systems)) + `(quote + ,(list + (string-drop + ;; NAME is the value returned from `package-full-name'. + (hyphen-separated-name->name+version name) + (1+ (string-length lisp-type))))) ; drop the "<lisp>-" prefix. + asd-systems)) (define builder `(begin @@ -309,8 +316,8 @@ set up using CL source package conventions." (derivation->output-path source)) ((source) source) (source source)) - #:asd-file ,(or asd-file (string-append system-name ".asd")) - #:asd-system-name ,system-name + #:asd-files ,asd-files + #:asd-systems ,systems #:test-asd-file ,test-asd-file #:system ,system #:tests? ,tests? diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm index 25dd031962..6ad855cab2 100644 --- a/guix/build/asdf-build-system.scm +++ b/guix/build/asdf-build-system.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca> +;;; Copyright © 2020 Guillaume Le Vaillant <glv@posteo.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,6 +20,7 @@ (define-module (guix build asdf-build-system) #:use-module ((guix build gnu-build-system) #:prefix gnu:) #:use-module (guix build utils) + #:use-module (guix build union) #:use-module (guix build lisp-utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -41,14 +43,22 @@ ;; ;; Code: -(define %object-prefix "/lib") +(define %object-prefix "/lib/common-lisp") (define (%lisp-source-install-prefix) - (string-append %source-install-prefix "/" (%lisp-type) "-source")) + (string-append %source-install-prefix "/" (%lisp-type))) (define %system-install-prefix (string-append %source-install-prefix "/systems")) +(define (main-system-name output) + (let ((package-name (package-name->name+version + (strip-store-file-name output))) + (lisp-prefix (string-append (%lisp-type) "-"))) + (if (string-prefix? lisp-prefix package-name) + (string-drop package-name (string-length lisp-prefix)) + package-name))) + (define (lisp-source-directory output name) (string-append output (%lisp-source-install-prefix) "/" name)) @@ -71,6 +81,13 @@ to it's binary output." (define (source-asd-file output name asd-file) (string-append (lisp-source-directory output name) "/" asd-file)) +(define (find-asd-files output name asd-files) + (if (null? asd-files) + (find-files (lisp-source-directory output name) "\\.asd$") + (map (lambda (asd-file) + (source-asd-file output name asd-file)) + asd-files))) + (define (copy-files-to-output out name) "Copy all files from the current directory to OUT. Create an extra link to any system-defining files in the source to a convenient location. This is @@ -107,9 +124,10 @@ if it's present in the native-inputs." (package-name->name+version (strip-store-file-name output))) (define (no-prefix pkgname) - (if (string-index pkgname #\-) - (string-drop pkgname (1+ (string-index pkgname #\-))) - pkgname)) + (let ((index (string-index pkgname #\-))) + (if index + (string-drop pkgname (1+ index)) + pkgname))) (define parent (match (assoc package-name inputs (lambda (key alist-car) @@ -125,9 +143,10 @@ if it's present in the native-inputs." (define parent-source (and parent (string-append parent "/share/common-lisp/" - (string-take parent-name - (string-index parent-name #\-)) - "-source"))) + (let ((index (string-index parent-name #\-))) + (if index + (string-take parent-name index) + parent-name))))) (define (first-subdirectory directory) ; From gnu-build-system. "Return the file name of the first sub-directory of DIRECTORY." @@ -146,122 +165,83 @@ if it's present in the native-inputs." (with-directory-excursion source-directory (copy-files-to-output output package-name))) -(define* (copy-source #:key outputs asd-system-name #:allow-other-keys) +(define* (copy-source #:key outputs asd-systems #:allow-other-keys) "Copy the source to the library output." (let* ((out (library-output outputs)) - (install-path (string-append out %source-install-prefix))) - (copy-files-to-output out asd-system-name) + (install-path (string-append out %source-install-prefix)) + (system-name (main-system-name out))) + (copy-files-to-output out system-name) ;; Hide the files from asdf (with-directory-excursion install-path - (rename-file "source" (string-append (%lisp-type) "-source")) + (rename-file "source" (%lisp-type)) (delete-file-recursively "systems"))) #t) -(define* (build #:key outputs inputs asd-file asd-system-name +(define* (configure #:key inputs #:allow-other-keys) + ;; Create a directory having the configuration files for + ;; all the dependencies in 'etc/common-lisp/'. + (let ((out (string-append (getcwd) "/.cl-union"))) + (match inputs + (((name . directories) ...) + (union-build out (filter directory-exists? directories) + #:create-all-directories? #t + #:log-port (%make-void-port "w")))) + (setenv "CL_UNION" out) + (setenv "XDG_CONFIG_DIRS" (string-append out "/etc"))) + #t) + +(define* (build #:key outputs inputs asd-files asd-systems #:allow-other-keys) "Compile the system." (let* ((out (library-output outputs)) - (source-path (lisp-source-directory out asd-system-name)) + (system-name (main-system-name out)) + (source-path (string-append out (%lisp-source-install-prefix))) (translations (wrap-output-translations `(,(output-translation source-path out)))) - (asd-file (source-asd-file out asd-system-name asd-file))) - + (asd-files (find-asd-files out system-name asd-files))) (setenv "ASDF_OUTPUT_TRANSLATIONS" (replace-escaped-macros (format #f "~S" translations))) - (setenv "HOME" out) ; ecl's asdf sometimes wants to create $HOME/.cache - - (compile-system asd-system-name asd-file) - - ;; As above, ecl will sometimes create this even though it doesn't use it - - (let ((cache-directory (string-append out "/.cache"))) - (when (directory-exists? cache-directory) - (delete-file-recursively cache-directory)))) + (compile-systems asd-systems asd-files)) #t) -(define* (check #:key tests? outputs inputs asd-file asd-system-name +(define* (check #:key tests? outputs inputs asd-files asd-systems test-asd-file #:allow-other-keys) "Test the system." (let* ((out (library-output outputs)) - (asd-file (source-asd-file out asd-system-name asd-file)) + (system-name (main-system-name out)) + (asd-files (find-asd-files out system-name asd-files)) (test-asd-file (and=> test-asd-file - (cut source-asd-file out asd-system-name <>)))) + (cut source-asd-file out system-name <>)))) (if tests? - (test-system asd-system-name asd-file test-asd-file) + (test-system (first asd-systems) asd-files test-asd-file) (format #t "test suite not run~%"))) #t) -(define* (create-asd-file #:key outputs - inputs - asd-file - asd-system-name - #:allow-other-keys) - "Create a system definition file for the built system." - (let*-values (((out) (library-output outputs)) - ((_ version) (package-name->name+version - (strip-store-file-name out))) - ((new-asd-file) (string-append - (library-directory out) - "/" (normalize-string asd-system-name) - ".asd"))) - - (make-asd-file new-asd-file - #:system asd-system-name - #:version version - #:inputs inputs - #:system-asd-file asd-file)) - #t) - -(define* (symlink-asd-files #:key outputs #:allow-other-keys) - "Create an extra reference to the system in a convenient location." - (let* ((out (library-output outputs))) - (for-each - (lambda (asd-file) - (receive (new-asd-file asd-file-directory) - (bundle-asd-file out asd-file) - (mkdir-p asd-file-directory) - (symlink asd-file new-asd-file) - ;; Update the source registry for future phases which might want to - ;; use the newly compiled system. - (prepend-to-source-registry - (string-append asd-file-directory "/")))) - - (find-files (string-append out %object-prefix) "\\.asd$"))) - #t) +(define* (create-asdf-configuration #:key inputs outputs #:allow-other-keys) + "Create the ASDF configuration files for the built systems." + (let* ((system-name (main-system-name (assoc-ref outputs "out"))) + (out (library-output outputs)) + (conf-dir (string-append out "/etc/common-lisp")) + (deps-conf-dir (string-append (getenv "CL_UNION") "/etc/common-lisp")) + (source-dir (lisp-source-directory out system-name)) + (lib-dir (string-append (library-directory out) "/" system-name))) + (make-asdf-configuration system-name conf-dir deps-conf-dir + source-dir lib-dir) + #t)) (define* (cleanup-files #:key outputs #:allow-other-keys) "Remove any compiled files which are not a part of the final bundle." - (let ((out (library-output outputs))) - (match (%lisp-type) - ("sbcl" - (for-each - (lambda (file) - (unless (string-suffix? "--system.fasl" file) - (delete-file file))) - (find-files out "\\.fasl$"))) - ("ecl" - (for-each delete-file - (append (find-files out "\\.fas$") - (find-files out "\\.o$"))))) - - (with-directory-excursion (library-directory out) - (for-each - (lambda (file) - (rename-file file - (string-append "./" (basename file)))) - (find-files ".")) - (for-each delete-file-recursively - (scandir "." - (lambda (file) - (and - (directory-exists? file) - (string<> "." file) - (string<> ".." file))))))) + (let* ((out (library-output outputs)) + (cache-directory (string-append out "/.cache"))) + ;; Remove the cache directory in case the lisp implementation wrote + ;; something in there when compiling or testing a system. + (when (directory-exists? cache-directory) + (delete-file-recursively cache-directory))) #t) (define* (strip #:rest args) @@ -280,15 +260,14 @@ if it's present in the native-inputs." (define %standard-phases (modify-phases gnu:%standard-phases (delete 'bootstrap) - (delete 'configure) - (delete 'install) + (replace 'configure configure) + (add-before 'configure 'copy-source copy-source) (replace 'build build) - (add-before 'build 'copy-source copy-source) (replace 'check check) - (replace 'strip strip) - (add-after 'check 'create-asd-file create-asd-file) - (add-after 'create-asd-file 'cleanup cleanup-files) - (add-after 'cleanup 'create-symlinks symlink-asd-files))) + (add-after 'check 'create-asdf-configuration create-asdf-configuration) + (add-after 'create-asdf-configuration 'cleanup cleanup-files) + (delete 'install) + (replace 'strip strip))) (define* (asdf-build #:key inputs (phases %standard-phases) diff --git a/guix/build/lisp-utils.scm b/guix/build/lisp-utils.scm index f6d9168c48..8a02cb68dd 100644 --- a/guix/build/lisp-utils.scm +++ b/guix/build/lisp-utils.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca> +;;; Copyright © 2020 Guillaume Le Vaillant <glv@posteo.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,19 +29,17 @@ %lisp-type %source-install-prefix lisp-eval-program - compile-system + compile-systems test-system replace-escaped-macros generate-executable-wrapper-system generate-executable-entry-point generate-executable-for-system - %bundle-install-prefix - bundle-asd-file wrap-output-translations prepend-to-source-registry build-program build-image - make-asd-file + make-asdf-configuration valid-char-set normalize-string library-output)) @@ -65,9 +64,6 @@ ;; link farm for system definition (.asd) files. (define %source-install-prefix "/share/common-lisp") -(define (%bundle-install-prefix) - (string-append %source-install-prefix "/" (%lisp-type) "-bundle-systems")) - (define (library-output outputs) "If a `lib' output exists, build things there. Otherwise use `out'." (or (assoc-ref outputs "lib") (assoc-ref outputs "out"))) @@ -81,38 +77,6 @@ "Replace invalid characters in STR with a hyphen." (string-join (string-tokenize str valid-char-set) "-")) -(define (normalize-dependency dependency) - "Normalize the name of DEPENDENCY. Handles dependency definitions of the -dependency-def form described by -<https://common-lisp.net/project/asdf/asdf.html#The-defsystem-grammar>. -Assume that any symbols in DEPENDENCY will be in upper-case." - (match dependency - ((':VERSION name rest ...) - `(:version ,(normalize-string name) ,@rest)) - ((':FEATURE feature-specification dependency-specification) - `(:feature - ,feature-specification - ,(normalize-dependency dependency-specification))) - ((? string? name) (normalize-string name)) - (require-specification require-specification))) - -(define (inputs->asd-file-map inputs) - "Produce a hash table of the form (system . asd-file), where system is the -name of an ASD system, and asd-file is the full path to its definition." - (alist->hash-table - (filter-map - (match-lambda - ((_ . path) - (let ((prefix (string-append path (%bundle-install-prefix)))) - (and (directory-exists? prefix) - (match (find-files prefix "\\.asd$") - ((asd-file) - (cons - (string-drop-right (basename asd-file) 4) ; drop ".asd" - asd-file)) - (_ #f)))))) - inputs))) - (define (wrap-output-translations translations) `(:output-translations ,@translations @@ -143,70 +107,26 @@ with PROGRAM." "--eval" "(quit)")) (_ (error "The LISP provided is not supported at this time.")))) -(define (asdf-load-all systems) - (map (lambda (system) - `(asdf:load-system ,system)) - systems)) - -(define (compile-system system asd-file) - "Use a lisp implementation to compile SYSTEM using asdf. Load ASD-FILE -first." +(define (compile-systems systems asd-files) + "Use a lisp implementation to compile the SYSTEMS using asdf. +Load ASD-FILES first." (lisp-eval-program `((require :asdf) - (asdf:load-asd (truename ,asd-file) :name ,(normalize-string system)) - (asdf:operate 'asdf:compile-bundle-op ,system)))) - -(define (system-dependencies system asd-file) - "Return the dependencies of SYSTEM, as reported by -asdf:system-depends-on. First load the system's ASD-FILE." - (define deps-file ".deps.sexp") - (define program - `((require :asdf) - (asdf:load-asd (truename ,asd-file) :name ,(normalize-string system)) - (with-open-file - (stream ,deps-file :direction :output) - (format stream - "~s~%" - (asdf:system-depends-on - (asdf:find-system ,system)))))) - - (dynamic-wind - (lambda _ - (lisp-eval-program program)) - (lambda _ - (call-with-input-file deps-file read)) - (lambda _ - (when (file-exists? deps-file) - (delete-file deps-file))))) - -(define (compiled-system system) - (let ((system (basename system))) ; this is how asdf handles slashes - (match (%lisp-type) - ("sbcl" (string-append system "--system")) - (_ system)))) - -(define* (generate-system-definition system - #:key version dependencies component?) - `(asdf:defsystem - ,(normalize-string system) - ,@(if component? - '(:class asdf/bundle:prebuilt-system) - '()) - :version ,version - :depends-on ,dependencies - ,@(if component? - `(:components ((:compiled-file ,(compiled-system system)))) - '()) - ,@(if (string=? "ecl" (%lisp-type)) - `(:lib ,(string-append system ".a")) - '()))) - -(define (test-system system asd-file test-asd-file) - "Use a lisp implementation to test SYSTEM using asdf. Load ASD-FILE first. + ,@(map (lambda (asd-file) + `(asdf:load-asd (truename ,asd-file))) + asd-files) + ,@(map (lambda (system) + `(asdf:compile-system ,system)) + systems)))) + +(define (test-system system asd-files test-asd-file) + "Use a lisp implementation to test SYSTEM using asdf. Load ASD-FILES first. Also load TEST-ASD-FILE if necessary." (lisp-eval-program `((require :asdf) - (asdf:load-asd (truename ,asd-file) :name ,(normalize-string system)) + ,@(map (lambda (asd-file) + `(asdf:load-asd (truename ,asd-file))) + asd-files) ,@(if test-asd-file `((asdf:load-asd (truename ,test-asd-file))) ;; Try some likely files. @@ -237,6 +157,7 @@ created a \"SYSTEM-exec\" system which contains the entry program." :executable t :compression t)) '()) + (asdf:load-asd (truename ,(string-append system "-exec.asd"))) (asdf:operate ',type ,(string-append system "-exec"))))) (define (generate-executable-wrapper-system system dependencies) @@ -271,79 +192,30 @@ ENTRY-PROGRAM for SYSTEM within the current directory." (declare (ignorable arguments)) ,@entry-program)))))))) -(define (generate-dependency-links registry system) - "Creates a program which populates asdf's source registry from REGISTRY, an -alist of dependency names to corresponding asd files. This allows the system -to locate its dependent systems." - `(progn - (asdf/source-registry:ensure-source-registry) - ,@(map (match-lambda - ((name . asd-file) - `(setf - (gethash ,name - asdf/source-registry:*source-registry*) - ,(string->symbol "#p") - ,asd-file))) - registry))) - -(define* (make-asd-file asd-file - #:key system version inputs - (system-asd-file #f)) - "Create an ASD-FILE for SYSTEM@VERSION, appending a program to allow the -system to find its dependencies, as described by GENERATE-DEPENDENCY-LINKS." - (define dependencies - (let ((deps - (system-dependencies system system-asd-file))) - (if (eq? 'NIL deps) - '() - (map normalize-dependency deps)))) - - (define lisp-input-map - (inputs->asd-file-map inputs)) - - (define dependency-name - (match-lambda - ((':version name _ ...) name) - ((':feature _ dependency-specification) - (dependency-name dependency-specification)) - ((? string? name) name) - (_ #f))) - - (define registry - (filter-map hash-get-handle - (make-list (length dependencies) - lisp-input-map) - (map dependency-name dependencies))) - - ;; Ensure directory exists, which might not be the case for an .asd without components. - (mkdir-p (dirname asd-file)) - (call-with-output-file asd-file - (lambda (port) - (display - (replace-escaped-macros - (format #f "~y~%~y~%" - (generate-system-definition - system - #:version version - #:dependencies dependencies - ;; Some .asd don't have components, and thus they don't generate any .fasl. - #:component? (match (%lisp-type) - ("sbcl" (pair? (find-files (dirname asd-file) - "--system\\.fasl$"))) - ("ecl" (pair? (find-files (dirname asd-file) - "\\.fasb$"))) - (_ (error "The LISP provided is not supported at this time.")))) - (generate-dependency-links registry system))) - port)))) - -(define (bundle-asd-file output-path original-asd-file) - "Find the symlinked bundle file for ORIGINAL-ASD-FILE by looking in -OUTPUT-PATH/share/common-lisp/LISP-bundle-systems/<system>.asd. Returns two -values: the asd file itself and the directory in which it resides." - (let ((bundle-asd-path (string-append output-path - (%bundle-install-prefix)))) - (values (string-append bundle-asd-path "/" (basename original-asd-file)) - bundle-asd-path))) +(define (make-asdf-configuration name conf-dir deps-conf-dir source-dir lib-dir) + (let ((registry-dir (string-append + conf-dir "/source-registry.conf.d")) + (translations-dir (string-append + conf-dir "/asdf-output-translations.conf.d")) + (deps-registry-dir (string-append + deps-conf-dir "/source-registry.conf.d")) + (deps-translations-dir (string-append + deps-conf-dir + "/asdf-output-translations.conf.d"))) + (mkdir-p registry-dir) + (when (directory-exists? deps-registry-dir) + (copy-recursively deps-registry-dir registry-dir)) + (with-output-to-file (string-append registry-dir "/50-" name ".conf") + (lambda _ + (format #t "~y~%" `(:tree ,source-dir)))) + + (mkdir-p translations-dir) + (when (directory-exists? deps-translations-dir) + (copy-recursively deps-translations-dir translations-dir)) + (with-output-to-file (string-append translations-dir "/50-" name ".conf") + (lambda _ + (format #t "~y~%" `((,source-dir :**/ :*.*.*) + (,lib-dir :**/ :*.*.*))))))) (define (replace-escaped-macros string) "Replace simple lisp forms that the guile writer escapes, for example by @@ -368,6 +240,7 @@ will run ENTRY-PROGRAM, a list of Common Lisp expressions in which `arguments' has been bound to the command-line arguments which were passed. Link in any asd files from DEPENDENCY-PREFIXES to ensure references to those libraries are retained." + (setenv "XDG_CONFIG_DIRS" (string-append (library-output outputs) "/etc")) (generate-executable program #:dependencies dependencies #:dependency-prefixes dependency-prefixes @@ -388,6 +261,7 @@ retained." "Generate an image, possibly standalone, which contains all DEPENDENCIES, placing the result in IMAGE.image. Link in any asd files from DEPENDENCY-PREFIXES to ensure references to those libraries are retained." + (setenv "XDG_CONFIG_DIRS" (string-append (library-output outputs) "/etc")) (generate-executable image #:dependencies dependencies #:dependency-prefixes dependency-prefixes @@ -416,20 +290,15 @@ references to those libraries are retained." (mkdir-p bin-directory) (with-directory-excursion bin-directory (generate-executable-wrapper-system name dependencies) - (generate-executable-entry-point name entry-program)) - - (prepend-to-source-registry - (string-append bin-directory "/")) - - (setenv "ASDF_OUTPUT_TRANSLATIONS" - (replace-escaped-macros - (format - #f "~S" - (wrap-output-translations - `(((,bin-directory :**/ :*.*.*) - (,bin-directory :**/ :*.*.*))))))) - - (generate-executable-for-system type name #:compress? compress?) + (generate-executable-entry-point name entry-program) + (setenv "ASDF_OUTPUT_TRANSLATIONS" + (replace-escaped-macros + (format + #f "~S" + (wrap-output-translations + `(((,bin-directory :**/ :*.*.*) + (,bin-directory :**/ :*.*.*))))))) + (generate-executable-for-system type name #:compress? compress?)) (let* ((after-store-prefix-index (string-index out-file #\/ @@ -445,9 +314,11 @@ references to those libraries are retained." (symlink asd-file (string-append hidden-asd-links "/" (basename asd-file)))) - (find-files (string-append path (%bundle-install-prefix)) + (find-files (string-append path %source-install-prefix "/" + (%lisp-type)) "\\.asd$"))) dependency-prefixes)) (delete-file (string-append bin-directory "/" name "-exec.asd")) - (delete-file (string-append bin-directory "/" name "-exec.lisp")))) + (delete-file (string-append bin-directory "/" name "-exec.lisp")) + (delete-file (string-append bin-directory "/" name "-exec.fasl")))) diff --git a/guix/ci.scm b/guix/ci.scm index 02eb90e6c3..7a03befc7c 100644 --- a/guix/ci.scm +++ b/guix/ci.scm @@ -19,7 +19,6 @@ (define-module (guix ci) #:use-module (guix http-client) - #:use-module (guix json) #:use-module (json) #:use-module (srfi srfi-1) #:use-module (ice-9 match) diff --git a/guix/cve.scm b/guix/cve.scm index ae9cca2341..57b8459d01 100644 --- a/guix/cve.scm +++ b/guix/cve.scm @@ -19,7 +19,6 @@ (define-module (guix cve) #:use-module (guix utils) #:use-module (guix http-client) - #:use-module (guix json) #:use-module (guix i18n) #:use-module ((guix diagnostics) #:select (formatted-message)) #:use-module (json) diff --git a/guix/git-download.scm b/guix/git-download.scm index 90634a8c4c..8e575e3b5f 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2017 Mathieu Lirzin <mthl@gnu.org> ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> @@ -85,7 +85,7 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." 'tar))))) (define guile-json - (module-ref (resolve-interface '(gnu packages guile)) 'guile-json-3)) + (module-ref (resolve-interface '(gnu packages guile)) 'guile-json-4)) (define guile-zlib (module-ref (resolve-interface '(gnu packages guile)) 'guile-zlib)) diff --git a/guix/git.scm b/guix/git.scm index 7f8f9addfb..637936c16a 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -39,6 +39,7 @@ #:export (%repository-cache-directory honor-system-x509-certificates! + url-cache-directory with-repository with-git-error-handling false-if-git-not-found diff --git a/guix/import/cpan.scm b/guix/import/cpan.scm index 085467b871..fd940415a2 100644 --- a/guix/import/cpan.scm +++ b/guix/import/cpan.scm @@ -28,7 +28,6 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (json) - #:use-module (guix json) #:use-module (gcrypt hash) #:use-module (guix store) #:use-module (guix utils) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 796a7641e9..f87c89163c 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -24,7 +24,6 @@ #:use-module ((guix download) #:prefix download:) #:use-module (gcrypt hash) #:use-module (guix http-client) - #:use-module (guix json) #:use-module (guix import json) #:use-module (guix import utils) #:use-module ((guix licenses) #:prefix license:) diff --git a/guix/import/gem.scm b/guix/import/gem.scm index a2d99ddbca..3fe240f36a 100644 --- a/guix/import/gem.scm +++ b/guix/import/gem.scm @@ -22,7 +22,7 @@ (define-module (guix import gem) #:use-module (ice-9 match) #:use-module (srfi srfi-1) - #:use-module (guix json) + #:use-module (json) #:use-module ((guix download) #:prefix download:) #:use-module (guix import utils) #:use-module (guix import json) diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm index a4a2489688..15116e349d 100644 --- a/guix/import/pypi.scm +++ b/guix/import/pypi.scm @@ -46,7 +46,7 @@ #:use-module (guix import utils) #:use-module ((guix download) #:prefix download:) #:use-module (guix import json) - #:use-module (guix json) + #:use-module (json) #:use-module (guix packages) #:use-module (guix upstream) #:use-module ((guix licenses) #:prefix license:) diff --git a/guix/json.scm b/guix/json.scm deleted file mode 100644 index 3e3a28b749..0000000000 --- a/guix/json.scm +++ /dev/null @@ -1,83 +0,0 @@ -;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> -;;; -;;; 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 <http://www.gnu.org/licenses/>. - -(define-module (guix json) - #:use-module (json) - #:use-module (srfi srfi-9)) - -;;; Commentary: -;;; -;;; Helpers to map JSON objects to SRFI-9 records. Taken from (guix swh). -;;; This module is superseded by 'define-json-mapping' as found since version -;;; 4.2.0 of Guile-JSON and will be removed once migration is complete. -;;; -;;; Code: - -(define-syntax define-as-needed - (lambda (s) - "Define the given syntax rule unless (json) already provides it." - (syntax-case s () - ((_ (macro args ...) body ...) - (if (module-defined? (resolve-interface '(json)) - (syntax->datum #'macro)) - #'(eval-when (expand load eval) - ;; Re-export MACRO from (json). - (module-re-export! (current-module) '(macro))) - #'(begin - ;; Using Guile-JSON < 4.2.0, so provide our own MACRO. - (define-syntax-rule (macro args ...) - body ...) - (eval-when (expand load eval) - (module-export! (current-module) '(macro))))))))) - -(define-syntax-rule (define-json-reader json->record ctor spec ...) - "Define JSON->RECORD as a procedure that converts a JSON representation, -read from a port, string, or hash table, into a record created by CTOR and -following SPEC, a series of field specifications." - (define (json->record input) - (let ((table (cond ((port? input) - (json->scm input)) - ((string? input) - (json-string->scm input)) - ((or (null? input) (pair? input)) - input)))) - (let-syntax ((extract-field (syntax-rules () - ((_ table (field key json->value)) - (json->value (assoc-ref table key))) - ((_ table (field key)) - (assoc-ref table key)) - ((_ table (field)) - (assoc-ref table - (symbol->string 'field)))))) - (ctor (extract-field table spec) ...))))) - -;; For some reason we cannot just have colliding definitions of -;; 'define-json-mapping' (that leads to a build failure in users of this -;; module), hence the use of 'define-as-needed'. -(define-as-needed (define-json-mapping rtd ctor pred json->record - (field getter spec ...) ...) - "Define RTD as a record type with the given FIELDs and GETTERs, à la SRFI-9, -and define JSON->RECORD as a conversion from JSON to a record of this type." - (begin - (define-record-type rtd - (ctor field ...) - pred - (field getter) ...) - - (define-json-reader json->record ctor - (field spec ...) ...))) diff --git a/guix/nar.scm b/guix/nar.scm index 6bb2ea5b96..a23af2e5de 100644 --- a/guix/nar.scm +++ b/guix/nar.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> ;;; ;;; This file is part of GNU Guix. @@ -156,7 +156,8 @@ protected from GC." (define* (restore-one-item port #:key acl (verify-signature? #t) (lock? #t) (log-port (current-error-port))) - "Restore one store item from PORT; return its file name on success." + "Restore one store item of a nar bundle read from PORT; return its file name +on success." (define (assert-valid-signature signature hash file) ;; Bail out if SIGNATURE, which must be a string as produced by @@ -251,11 +252,11 @@ a signature")) (define* (restore-file-set port #:key (verify-signature? #t) (lock? #t) (log-port (current-error-port))) - "Restore the file set read from PORT to the store. The format of the data -on PORT must be as created by 'export-paths'---i.e., a series of Nar-formatted -archives with interspersed meta-data joining them together, possibly with a -digital signature at the end. Log progress to LOG-PORT. Return the list of -files restored. + "Restore the file set (\"nar bundle\") read from PORT to the store. The +format of the data on PORT must be as created by 'export-paths'---i.e., a +series of Nar-formatted archives with interspersed meta-data joining them +together, possibly with a digital signature at the end. Log progress to +LOG-PORT. Return the list of files restored. When LOCK? is #f, assume locks for the files to be restored are already held. This is the case when the daemon calls a build hook. diff --git a/guix/scripts.scm b/guix/scripts.scm index 8534948892..9792aaebe9 100644 --- a/guix/scripts.scm +++ b/guix/scripts.scm @@ -34,7 +34,12 @@ #:use-module (srfi srfi-19) #:use-module (srfi srfi-37) #:use-module (ice-9 match) - #:export (args-fold* + #:export (synopsis + category + define-command + %command-categories + + args-fold* parse-command-line maybe-build build-package @@ -50,6 +55,61 @@ ;;; ;;; Code: +;; Syntactic keywords. +(define synopsis 'command-synopsis) +(define category 'command-category) + +(define-syntax define-command-categories + (syntax-rules (G_) + "Define command categories." + ((_ name assert-valid (identifiers (G_ synopses)) ...) + (begin + (define-public identifiers + ;; Define and export syntactic keywords. + (list 'syntactic-keyword-for-command-category)) + ... + + (define-syntax assert-valid + ;; Validate at expansion time that we're passed a valid category. + (syntax-rules (identifiers ...) + ((_ identifiers) #t) + ...)) + + (define name + ;; Alist mapping category name to synopsis. + `((identifiers . synopses) ...)))))) + +;; Command categories. +(define-command-categories %command-categories + assert-valid-command-category + (main (G_ "main commands")) + (development (G_ "software development commands")) + (packaging (G_ "packaging commands")) + (plumbing (G_ "plumbing commands")) + (internal (G_ "internal commands"))) + +(define-syntax define-command + (syntax-rules (category synopsis) + "Define the given command as a procedure along with its synopsis and, +optionally, its category. The synopsis becomes the docstring of the +procedure, but both the category and synopsis are meant to be read (parsed) by +'guix help'." + ;; The (synopsis ...) form is here so that xgettext sees those strings as + ;; translatable. + ((_ (name . args) + (synopsis doc) body ...) + (define (name . args) + doc + body ...)) + ((_ (name . args) + (category cat) (synopsis doc) + body ...) + (begin + (assert-valid-command-category cat) + (define (name . args) + doc + body ...))))) + (define (args-fold* args options unrecognized-option-proc operand-proc . seeds) "A wrapper on top of `args-fold' that does proper user-facing error reporting." diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm index f3b86fba14..02557ce454 100644 --- a/guix/scripts/archive.scm +++ b/guix/scripts/archive.scm @@ -355,7 +355,10 @@ output port." ;;; Entry point. ;;; -(define (guix-archive . args) +(define-command (guix-archive . args) + (category plumbing) + (synopsis "manipulate, export, and import normalized archives (nars)") + (define (lines port) ;; Return lines read from PORT. (let loop ((line (read-line port)) diff --git a/guix/scripts/authenticate.scm b/guix/scripts/authenticate.scm index f1fd8ee895..37e6cef53c 100644 --- a/guix/scripts/authenticate.scm +++ b/guix/scripts/authenticate.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -17,7 +17,7 @@ ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (guix scripts authenticate) - #:use-module (guix config) + #:use-module (guix scripts) #:use-module (guix base16) #:use-module (gcrypt pk-crypto) #:use-module (guix pki) @@ -39,16 +39,9 @@ ;; Read a gcrypt sexp from a port and return it. (compose string->canonical-sexp read-string)) -(define (read-hash-data port key-type) - "Read sha256 hash data from PORT and return it as a gcrypt sexp. KEY-TYPE -is a symbol representing the type of public key algo being used." - (let* ((hex (read-string port)) - (bv (base16-string->bytevector (string-trim-both hex)))) - (bytevector->hash-data bv #:key-type key-type))) - -(define (sign-with-key key-file port) - "Sign the hash read from PORT with KEY-FILE, and write an sexp that includes -both the hash and the actual signature." +(define (sign-with-key key-file sha256) + "Sign the hash SHA256 (a bytevector) with KEY-FILE, and write an sexp that +includes both the hash and the actual signature." (let* ((secret-key (call-with-input-file key-file read-canonical-sexp)) (public-key (if (string-suffix? ".sec" key-file) (call-with-input-file @@ -58,18 +51,18 @@ both the hash and the actual signature." (leave (G_ "cannot find public key for secret key '~a'~%") key-file))) - (data (read-hash-data port (key-type public-key))) + (data (bytevector->hash-data sha256 + #:key-type (key-type public-key))) (signature (signature-sexp data secret-key public-key))) (display (canonical-sexp->string signature)) #t)) -(define (validate-signature port) - "Read the signature from PORT (which is as produced above), check whether -its public key is authorized, verify the signature, and print the signed data -to stdout upon success." - (let* ((signature (read-canonical-sexp port)) - (subject (signature-subject signature)) - (data (signature-signed-data signature))) +(define (validate-signature signature) + "Validate SIGNATURE, a canonical sexp. Check whether its public key is +authorized, verify the signature, and print the signed data to stdout upon +success." + (let* ((subject (signature-subject signature)) + (data (signature-signed-data signature))) (if (and data subject) (if (authorized-key? subject) (if (valid-signature? signature) @@ -85,12 +78,13 @@ to stdout upon success." ;;; -;;; Entry point with 'openssl'-compatible interface. We support this -;;; interface because that's what the daemon expects, and we want to leave it -;;; unmodified currently. +;;; Entry point. ;;; -(define (guix-authenticate . args) +(define-command (guix-authenticate . args) + (category internal) + (synopsis "sign or verify signatures on normalized archives (nars)") + ;; Signature sexps written to stdout may contain binary data, so force ;; ISO-8859-1 encoding so that things are not mangled. See ;; <http://bugs.gnu.org/17312> for details. @@ -101,22 +95,14 @@ to stdout upon success." (with-fluids ((%default-port-encoding "ISO-8859-1") (%default-port-conversion-strategy 'error)) (match args - ;; As invoked by guix-daemon. - (("rsautl" "-sign" "-inkey" key "-in" hash-file) - (call-with-input-file hash-file - (lambda (port) - (sign-with-key key port)))) - ;; As invoked by Nix/Crypto.pm (used by Hydra.) - (("rsautl" "-sign" "-inkey" key) - (sign-with-key key (current-input-port))) - ;; As invoked by guix-daemon. - (("rsautl" "-verify" "-inkey" _ "-pubin" "-in" signature-file) + (("sign" key-file hash) + (sign-with-key key-file (base16-string->bytevector hash))) + (("verify" signature-file) (call-with-input-file signature-file (lambda (port) - (validate-signature port)))) - ;; As invoked by Nix/Crypto.pm (used by Hydra.) - (("rsautl" "-verify" "-inkey" _ "-pubin") - (validate-signature (current-input-port))) + (validate-signature (string->canonical-sexp + (read-string port)))))) + (("--help") (display (G_ "Usage: guix authenticate OPTION... Sign or verify the signature on the given file. This tool is meant to diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 6286a43c02..25418661b9 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -945,7 +945,10 @@ needed." ;;; Entry point. ;;; -(define (guix-build . args) +(define-command (guix-build . args) + (category packaging) + (synopsis "build packages or derivations without installing them") + (define opts (parse-command-line args %options (list %default-options))) diff --git a/guix/scripts/challenge.scm b/guix/scripts/challenge.scm index 624f51b200..39bd2c1c0f 100644 --- a/guix/scripts/challenge.scm +++ b/guix/scripts/challenge.scm @@ -475,7 +475,10 @@ Challenge the substitutes for PACKAGE... provided by one or more servers.\n")) ;;; Entry point. ;;; -(define (guix-challenge . args) +(define-command (guix-challenge . args) + (category packaging) + (synopsis "challenge substitute servers, comparing their binaries") + (with-error-handling (let* ((opts (parse-command-line args %options (list %default-options) #:build-options? #f)) diff --git a/guix/scripts/container.scm b/guix/scripts/container.scm index 8041d64b6b..2369437043 100644 --- a/guix/scripts/container.scm +++ b/guix/scripts/container.scm @@ -20,6 +20,7 @@ (define-module (guix scripts container) #:use-module (ice-9 match) #:use-module (guix ui) + #:use-module (guix scripts) #:export (guix-container)) (define (show-help) @@ -46,7 +47,10 @@ Build and manipulate Linux containers.\n")) (proc (string->symbol (string-append "guix-container-" name)))) (module-ref module proc))) -(define (guix-container . args) +(define-command (guix-container . args) + (category development) + (synopsis "run code in containers created by 'guix environment -C'") + (with-error-handling (match args (() diff --git a/guix/scripts/copy.scm b/guix/scripts/copy.scm index 274620fc1e..2780d4fbe9 100644 --- a/guix/scripts/copy.scm +++ b/guix/scripts/copy.scm @@ -170,7 +170,10 @@ Copy ITEMS to or from the specified host over SSH.\n")) ;;; Entry point. ;;; -(define (guix-copy . args) +(define-command (guix-copy . args) + (category plumbing) + (synopsis "copy store items remotely over SSH") + (with-error-handling (let* ((opts (parse-command-line args %options (list %default-options))) (source (assoc-ref opts 'source)) diff --git a/guix/scripts/deploy.scm b/guix/scripts/deploy.scm index 4a68197620..1b5be307be 100644 --- a/guix/scripts/deploy.scm +++ b/guix/scripts/deploy.scm @@ -136,7 +136,8 @@ Perform the deployment specified by FILE.\n")) (machine-display-name machine)))) -(define (guix-deploy . args) +(define-command (guix-deploy . args) + (synopsis "deploy operating systems on a set of machines") (define (handle-argument arg result) (alist-cons 'file arg result)) diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm index bc868ffbbf..c3667516eb 100644 --- a/guix/scripts/describe.scm +++ b/guix/scripts/describe.scm @@ -304,7 +304,8 @@ text. The hyperlink links to a web view of COMMIT, when available." ;;; Entry point. ;;; -(define (guix-describe . args) +(define-command (guix-describe . args) + (synopsis "describe the channel revisions currently used") (let* ((opts (args-fold* args %options (lambda (opt name arg result) (leave (G_ "~A: unrecognized option~%") diff --git a/guix/scripts/download.scm b/guix/scripts/download.scm index 589f62da9d..ce8dd8b02c 100644 --- a/guix/scripts/download.scm +++ b/guix/scripts/download.scm @@ -156,7 +156,10 @@ and 'base16' ('hex' and 'hexadecimal' can be used as well).\n")) ;;; Entry point. ;;; -(define (guix-download . args) +(define-command (guix-download . args) + (category packaging) + (synopsis "download a file to the store and print its hash") + (define (parse-options) ;; Return the alist of option values. (args-fold* args %options diff --git a/guix/scripts/edit.scm b/guix/scripts/edit.scm index 43f3011869..49c9d945b6 100644 --- a/guix/scripts/edit.scm +++ b/guix/scripts/edit.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2016, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015, 2016, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2015 Mathieu Lirzin <mthl@gnu.org> ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com> ;;; @@ -78,7 +78,10 @@ line." (search-path* %load-path (location-file location)))) -(define (guix-edit . args) +(define-command (guix-edit . args) + (category packaging) + (synopsis "view and edit package definitions") + (define (parse-arguments) ;; Return the list of package names. (args-fold* args %options diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 1fb3505307..ad50281eb2 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -678,7 +678,10 @@ message if any test fails." ;;; Entry point. ;;; -(define (guix-environment . args) +(define-command (guix-environment . args) + (category development) + (synopsis "spawn one-off software environments") + (with-error-handling (let* ((opts (parse-args args)) (pure? (assoc-ref opts 'pure)) diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index ab7c13315f..043273f491 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -220,7 +220,9 @@ is deprecated; use '-D'~%")) ;;; Entry point. ;;; -(define (guix-gc . args) +(define-command (guix-gc . args) + (synopsis "invoke the garbage collector") + (define (parse-options) ;; Return the alist of option values. (parse-command-line args %options (list %default-options) diff --git a/guix/scripts/git.scm b/guix/scripts/git.scm index bc829cbe99..4436d8a6e0 100644 --- a/guix/scripts/git.scm +++ b/guix/scripts/git.scm @@ -19,6 +19,7 @@ (define-module (guix scripts git) #:use-module (ice-9 match) #:use-module (guix ui) + #:use-module (guix scripts) #:export (guix-git)) (define (show-help) @@ -45,7 +46,10 @@ Operate on Git repositories.\n")) (proc (string->symbol (string-append "guix-git-" name)))) (module-ref module proc))) -(define (guix-git . args) +(define-command (guix-git . args) + (category plumbing) + (synopsis "operate on Git repositories") + (with-error-handling (match args (() diff --git a/guix/scripts/graph.scm b/guix/scripts/graph.scm index 73d9269de2..d7a08a4fe1 100644 --- a/guix/scripts/graph.scm +++ b/guix/scripts/graph.scm @@ -565,7 +565,10 @@ Emit a representation of the dependency graph of PACKAGE...\n")) ;;; Entry point. ;;; -(define (guix-graph . args) +(define-command (guix-graph . args) + (category packaging) + (synopsis "view and query package dependency graphs") + (with-error-handling (define opts (parse-command-line args %options diff --git a/guix/scripts/hash.scm b/guix/scripts/hash.scm index 9b4f419a24..797b99f053 100644 --- a/guix/scripts/hash.scm +++ b/guix/scripts/hash.scm @@ -116,7 +116,10 @@ and 'base16' ('hex' and 'hexadecimal' can be used as well).\n")) ;;; Entry point. ;;; -(define (guix-hash . args) +(define-command (guix-hash . args) + (category packaging) + (synopsis "compute the cryptographic hash of a file") + (define (parse-options) ;; Return the alist of option values. (parse-command-line args %options (list %default-options) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index c6cc93fad8..0a3863f965 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2012, 2013, 2014, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2014 David Thompson <davet@gnu.org> ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com> ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net> @@ -21,6 +21,7 @@ (define-module (guix scripts import) #:use-module (guix ui) + #:use-module (guix scripts) #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -98,7 +99,10 @@ Run IMPORTER with ARGS.\n")) (newline) (show-bug-report-information)) -(define (guix-import . args) +(define-command (guix-import . args) + (category packaging) + (synopsis "import a package definition from an external repository") + (match args (() (format (current-error-port) diff --git a/guix/scripts/install.scm b/guix/scripts/install.scm index d88e86e77a..894e60f9da 100644 --- a/guix/scripts/install.scm +++ b/guix/scripts/install.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -66,7 +66,9 @@ This is an alias for 'guix package -i'.\n")) %transformation-options %standard-build-options))) -(define (guix-install . args) +(define-command (guix-install . args) + (synopsis "install packages") + (define (handle-argument arg result arg-handler) ;; Treat all non-option arguments as package specs. (values (alist-cons 'install arg result) diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 5168a1ca17..979d4f8363 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -157,7 +157,10 @@ run the checkers on all packages.\n")) ;;; Entry Point ;;; -(define (guix-lint . args) +(define-command (guix-lint . args) + (category packaging) + (synopsis "validate package definitions") + (define (parse-options) ;; Return the alist of option values. (parse-command-line args %options (list %default-options) diff --git a/guix/scripts/offload.scm b/guix/scripts/offload.scm index 1e0e9d7905..3dc8ccefcb 100644 --- a/guix/scripts/offload.scm +++ b/guix/scripts/offload.scm @@ -39,6 +39,7 @@ #:select (fcntl-flock set-thread-name)) #:use-module ((guix build utils) #:select (which mkdir-p)) #:use-module (guix ui) + #:use-module (guix scripts) #:use-module (guix diagnostics) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -725,7 +726,10 @@ machine." ;;; Entry point. ;;; -(define (guix-offload . args) +(define-command (guix-offload . args) + (category plumbing) + (synopsis "set up and operate build offloading") + (define request-line-rx ;; The request format. See 'tryBuildHook' method in build.cc. (make-regexp "([01]) ([a-z0-9_-]+) (/[[:graph:]]+.drv) ([[:graph:]]*)")) diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 9d6881fdaf..379e6a3ac6 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -1089,7 +1089,10 @@ Create a bundle of PACKAGE.\n")) ;;; Entry point. ;;; -(define (guix-pack . args) +(define-command (guix-pack . args) + (category development) + (synopsis "create application bundles") + (define opts (parse-command-line args %options (list %default-options))) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index ac8dedb5f3..4eb968a49b 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -941,7 +941,9 @@ processed, #f otherwise." ;;; Entry point. ;;; -(define (guix-package . args) +(define-command (guix-package . args) + (synopsis "manage packages and profiles") + (define (handle-argument arg result arg-handler) ;; Process non-option argument ARG by calling back ARG-HANDLER. (if arg-handler diff --git a/guix/scripts/perform-download.scm b/guix/scripts/perform-download.scm index df787a9940..8d409092ba 100644 --- a/guix/scripts/perform-download.scm +++ b/guix/scripts/perform-download.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,6 +18,7 @@ (define-module (guix scripts perform-download) #:use-module (guix ui) + #:use-module (guix scripts) #:use-module (guix derivations) #:use-module ((guix store) #:select (derivation-path? store-path?)) #:use-module (guix build download) @@ -91,14 +92,15 @@ actual output is different from that when we're doing a 'bmCheck' or (leave (G_ "refusing to run with elevated privileges (UID ~a)~%") (getuid)))) -(define (guix-perform-download . args) - "Perform the download described by the given fixed-output derivation. +(define-command (guix-perform-download . args) + (category internal) + (synopsis "perform download described by fixed-output derivations") -This is an \"out-of-band\" download in that this code is executed directly by -the daemon and not explicitly described as an input of the derivation. This -allows us to sidestep bootstrapping problems, such downloading the source code -of GnuTLS over HTTPS, before we have built GnuTLS. See -<http://bugs.gnu.org/22774>." + ;; This is an "out-of-band" download in that this code is executed directly + ;; by the daemon and not explicitly described as an input of the derivation. + ;; This allows us to sidestep bootstrapping problems, such as downloading + ;; the source code of GnuTLS over HTTPS before we have built GnuTLS. See + ;; <https://bugs.gnu.org/22774>. (define print-build-trace? (match (getenv "_NIX_OPTIONS") diff --git a/guix/scripts/processes.scm b/guix/scripts/processes.scm index 35698a0216..b4ca7b1687 100644 --- a/guix/scripts/processes.scm +++ b/guix/scripts/processes.scm @@ -223,7 +223,9 @@ List the current Guix sessions and their processes.")) ;;; Entry point. ;;; -(define (guix-processes . args) +(define-command (guix-processes . args) + (category plumbing) + (synopsis "list currently running sessions") (define options (args-fold* args %options (lambda (opt name arg result) diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm index 61542f83a0..4eaf961ab2 100644 --- a/guix/scripts/publish.scm +++ b/guix/scripts/publish.scm @@ -1013,7 +1013,10 @@ methods, return the applicable compression." ;;; Entry point. ;;; -(define (guix-publish . args) +(define-command (guix-publish . args) + (category packaging) + (synopsis "publish build results over HTTP") + (with-error-handling (let* ((opts (args-fold* args %options (lambda (opt name arg result) diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 3b980b8f3f..bb1b560a22 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -751,7 +751,9 @@ Use '~/.config/guix/channels.scm' instead.")) channels))) -(define (guix-pull . args) +(define-command (guix-pull . args) + (synopsis "pull the latest revision of Guix") + (with-error-handling (with-git-error-handling (let* ((opts (parse-command-line args %options diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index efada1df5a..4a71df28d1 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2015 Alex Kost <alezost@gmail.com> @@ -496,7 +496,10 @@ all are dependent packages: ~{~a~^ ~}~%") ;;; Entry point. ;;; -(define (guix-refresh . args) +(define-command (guix-refresh . args) + (category packaging) + (synopsis "update existing package definitions") + (define (parse-options) ;; Return the alist of option values. (parse-command-line args %options (list %default-options) diff --git a/guix/scripts/remove.scm b/guix/scripts/remove.scm index 2f06ea4f37..a46ad04d56 100644 --- a/guix/scripts/remove.scm +++ b/guix/scripts/remove.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -63,7 +63,9 @@ This is an alias for 'guix package -r'.\n")) %standard-build-options))) -(define (guix-remove . args) +(define-command (guix-remove . args) + (synopsis "remove installed packages") + (define (handle-argument arg result arg-handler) ;; Treat all non-option arguments as package specs. (values (alist-cons 'remove arg result) diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm index 0ea9c3655c..3c79e89f8d 100644 --- a/guix/scripts/repl.scm +++ b/guix/scripts/repl.scm @@ -137,7 +137,10 @@ call THUNK." (loop))))))) -(define (guix-repl . args) +(define-command (guix-repl . args) + (category plumbing) + (synopsis "read-eval-print loop (REPL) for interactive programming") + (define opts (args-fold* args %options (lambda (opt name arg result) diff --git a/guix/scripts/search.scm b/guix/scripts/search.scm index 827b2eb7a9..0c9e6af07b 100644 --- a/guix/scripts/search.scm +++ b/guix/scripts/search.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -57,7 +57,9 @@ This is an alias for 'guix package -s'.\n")) (member "load-path" (option-names option))) %standard-build-options))) -(define (guix-search . args) +(define-command (guix-search . args) + (synopsis "search for packages") + (define (handle-argument arg result) ;; Treat all non-option arguments as regexps. (cons `(query search ,(or arg "")) diff --git a/guix/scripts/show.scm b/guix/scripts/show.scm index a2b0030a63..535d03c1a6 100644 --- a/guix/scripts/show.scm +++ b/guix/scripts/show.scm @@ -57,7 +57,9 @@ This is an alias for 'guix package --show='.\n")) (member "load-path" (option-names option))) %standard-build-options))) -(define (guix-show . args) +(define-command (guix-show . args) + (synopsis "show information about packages") + (define (handle-argument arg result) ;; Treat all non-option arguments as regexps. (cons `(query show ,arg) diff --git a/guix/scripts/size.scm b/guix/scripts/size.scm index c42f4f7782..e46983382a 100644 --- a/guix/scripts/size.scm +++ b/guix/scripts/size.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com> ;;; ;;; This file is part of GNU Guix. @@ -298,7 +298,10 @@ Report the size of the PACKAGE or STORE-ITEM, with its dependencies.\n")) ;;; Entry point. ;;; -(define (guix-size . args) +(define-command (guix-size . args) + (category packaging) + (synopsis "profile the on-disk size of packages") + (with-error-handling (let* ((opts (parse-command-line args %options (list %default-options) #:build-options? #f)) diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 117d824449..26613df68f 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -20,6 +20,7 @@ (define-module (guix scripts substitute) #:use-module (guix ui) + #:use-module (guix scripts) #:use-module (guix store) #:use-module (guix utils) #:use-module (guix combinators) @@ -1095,8 +1096,10 @@ default value." (unless (string->uri uri) (leave (G_ "~a: invalid URI~%") uri))) -(define (guix-substitute . args) - "Implement the build daemon's substituter protocol." +(define-command (guix-substitute . args) + (category internal) + (synopsis "implement the build daemon's substituter protocol") + (define print-build-trace? (match (or (find-daemon-option "untrusted-print-extended-build-trace") (find-daemon-option "print-extended-build-trace")) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index b75b0e5b60..bd5f84fc5b 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2019 Christopher Baines <mail@cbaines.net> ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu> +;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il> ;;; ;;; This file is part of GNU Guix. ;;; @@ -956,9 +957,11 @@ Some ACTIONS support additional ARGS.\n")) (display (G_ " --save-provenance save provenance information")) (display (G_ " - --share=SPEC for 'vm', share host file system according to SPEC")) + --share=SPEC for 'vm' and 'container', share host file system with + read/write access according to SPEC")) (display (G_ " - --expose=SPEC for 'vm', expose host file system according to SPEC")) + --expose=SPEC for 'vm' and 'container', expose host file system + directory as read-only according to SPEC")) (display (G_ " -N, --network for 'container', allow containers to access the network")) (display (G_ " @@ -1250,7 +1253,9 @@ argument list and OPTS is the option alist." ;; need an operating system configuration file. (else (process-action command args opts)))) -(define (guix-system . args) +(define-command (guix-system . args) + (synopsis "build and deploy full operating systems") + (define (parse-sub-command arg result) ;; Parse sub-command ARG and augment RESULT accordingly. (if (assoc-ref result 'action) diff --git a/guix/scripts/time-machine.scm b/guix/scripts/time-machine.scm index 441673b780..0d27414702 100644 --- a/guix/scripts/time-machine.scm +++ b/guix/scripts/time-machine.scm @@ -128,7 +128,9 @@ Execute COMMAND ARGS... in an older version of Guix.\n")) ;;; Entry point. ;;; -(define (guix-time-machine . args) +(define-command (guix-time-machine . args) + (synopsis "run commands from a different revision") + (with-error-handling (with-git-error-handling (let* ((opts (parse-args args)) diff --git a/guix/scripts/upgrade.scm b/guix/scripts/upgrade.scm index d2784669be..8c7abd133a 100644 --- a/guix/scripts/upgrade.scm +++ b/guix/scripts/upgrade.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> ;;; ;;; This file is part of GNU Guix. @@ -67,7 +67,9 @@ This is an alias for 'guix package -u'.\n")) %transformation-options %standard-build-options))) -(define (guix-upgrade . args) +(define-command (guix-upgrade . args) + (synopsis "upgrade packages to their latest version") + (define (handle-argument arg result arg-handler) ;; Accept at most one non-option argument, and treat it as an upgrade ;; regexp. diff --git a/guix/scripts/weather.scm b/guix/scripts/weather.scm index 3035ff6ca8..6a2582c997 100644 --- a/guix/scripts/weather.scm +++ b/guix/scripts/weather.scm @@ -495,7 +495,9 @@ SERVER. Display information for packages with at least THRESHOLD dependents." ;;; Entry point. ;;; -(define (guix-weather . args) +(define-command (guix-weather . args) + (synopsis "report on the availability of pre-built package binaries") + (define (package-list opts) ;; Return the package list specified by OPTS. (let ((files (filter-map (match-lambda diff --git a/guix/self.scm b/guix/self.scm index 6a1640acdf..02ef982c7c 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -49,7 +49,7 @@ (module-ref (resolve-interface module) variable)))) (match-lambda ("guile" (ref '(gnu packages guile) 'guile-3.0/libgc-7)) - ("guile-json" (ref '(gnu packages guile) 'guile-json-3)) + ("guile-json" (ref '(gnu packages guile) 'guile-json-4)) ("guile-ssh" (ref '(gnu packages ssh) 'guile-ssh)) ("guile-git" (ref '(gnu packages guile) 'guile-git)) ("guile-sqlite3" (ref '(gnu packages guile) 'guile-sqlite3)) diff --git a/guix/swh.scm b/guix/swh.scm index a343ccfdd7..0b765cc743 100644 --- a/guix/swh.scm +++ b/guix/swh.scm @@ -22,7 +22,6 @@ #:use-module (guix build utils) #:use-module ((guix build syscalls) #:select (mkdtemp!)) #:use-module (web uri) - #:use-module (guix json) #:use-module (web client) #:use-module (web response) #:use-module (json) diff --git a/guix/ui.scm b/guix/ui.scm index 9513f42b93..115d9801b2 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -15,6 +15,7 @@ ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com> ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -60,6 +61,7 @@ ;; Avoid "overrides core binding" warning. delete)) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-9 gnu) #:use-module (srfi srfi-11) #:use-module (srfi srfi-19) #:use-module (srfi srfi-26) @@ -545,8 +547,9 @@ There is NO WARRANTY, to the extent permitted by law. Report bugs to: ~a.") %guix-bug-report-address) (format #t (G_ " ~a home page: <~a>") %guix-package-name %guix-home-page-url) - (display (G_ " -General help using GNU software: <http://www.gnu.org/gethelp/>")) + (format #t (G_ " +General help using Guix and GNU software: <~a>") + "https://guix.gnu.org/help/") (newline)) (define (augmented-system-error-handler file) @@ -1236,31 +1239,27 @@ separator between subsequent columns." (define* (show-manifest-transaction store manifest transaction #:key dry-run?) "Display what will/would be installed/removed from MANIFEST by TRANSACTION." - (define (package-strings names versions outputs) - (tabulate (zip (map (lambda (name output) - (if (string=? output "out") - name - (string-append name ":" output))) - names outputs) - versions) + (define* (package-strings names versions outputs #:key old-versions) + (tabulate (stable-sort + (zip (map (lambda (name output) + (if (string=? output "out") + name + (string-append name ":" output))) + names outputs) + (if old-versions + (map (lambda (old new) + (if (string=? old new) + (G_ "(dependencies or package changed)") + (string-append old " " → " " new))) + old-versions versions) + versions)) + (lambda (x y) + (string<? (first x) (first y)))) #:initial-indent 3)) (define → ;an arrow that can be represented on stderr (right-arrow (current-error-port))) - (define (upgrade-string names old-version new-version outputs) - (tabulate (zip (map (lambda (name output) - (if (string=? output "out") - name - (string-append name ":" output))) - names outputs) - (map (lambda (old new) - (if (string=? old new) - (G_ "(dependencies or package changed)") - (string-append old " " → " " new))) - old-version new-version)) - #:initial-indent 3)) - (let-values (((remove install upgrade downgrade) (manifest-transaction-effects manifest transaction))) (match remove @@ -1283,8 +1282,8 @@ separator between subsequent columns." (((($ <manifest-entry> name old-version) . ($ <manifest-entry> _ new-version output item)) ..1) (let ((len (length name)) - (downgrade (upgrade-string name old-version new-version - output))) + (downgrade (package-strings name new-version output + #:old-versions old-version))) (if dry-run? (format (current-error-port) (N_ "The following package would be downgraded:~%~{~a~%~}~%" @@ -1301,9 +1300,8 @@ separator between subsequent columns." (((($ <manifest-entry> name old-version) . ($ <manifest-entry> _ new-version output item)) ..1) (let ((len (length name)) - (upgrade (upgrade-string name - old-version new-version - output))) + (upgrade (package-strings name new-version output + #:old-versions old-version))) (if dry-run? (format (current-error-port) (N_ "The following package would be upgraded:~%~{~a~%~}~%" @@ -1992,6 +1990,44 @@ optionally contain a version number and an output name, as in these examples: (G_ "Try `guix --help' for more information.~%")) (exit 1)) +;; Representation of a 'guix' command. +(define-immutable-record-type <command> + (command name synopsis category) + command? + (name command-name) + (synopsis command-synopsis) + (category command-category)) + +(define (source-file-command file) + "Read FILE, a Scheme source file, and return either a <command> object based +on the 'define-command' top-level form found therein, or #f if FILE does not +contain a 'define-command' form." + (define command-name + (match (string-split file #\/) + ((_ ... "guix" "scripts" name) + (list (file-sans-extension name))) + ((_ ... "guix" "scripts" first second) + (list first (file-sans-extension second))))) + + ;; The strategy here is to parse FILE. This is much cheaper than a + ;; technique based on run-time introspection where we'd load FILE and all + ;; the modules it depends on. + (call-with-input-file file + (lambda (port) + (let loop () + (match (read port) + (('define-command _ ('synopsis synopsis) + _ ...) + (command command-name synopsis 'main)) + (('define-command _ + ('category category) ('synopsis synopsis) + _ ...) + (command command-name synopsis category)) + ((? eof-object?) + #f) + (_ + (loop))))))) + (define (command-files) "Return the list of source files that define Guix sub-commands." (define directory @@ -2003,28 +2039,51 @@ optionally contain a version number and an output name, as in these examples: (cut string-suffix? ".scm" <>)) (if directory - (scandir directory dot-scm?) + (map (cut string-append directory "/" <>) + (scandir directory dot-scm?)) '())) (define (commands) - "Return the list of Guix command names." - (map (compose (cut string-drop-right <> 4) - basename) - (command-files))) + "Return the list of commands, alphabetically sorted." + (filter-map source-file-command (command-files))) (define (show-guix-help) (define (internal? command) (member command '("substitute" "authenticate" "offload" "perform-download"))) + (define (display-commands commands) + (let* ((names (map (lambda (command) + (string-join (command-name command))) + commands)) + (max-width (reduce max 0 (map string-length names)))) + (for-each (lambda (name command) + (format #t " ~a ~a~%" + (string-pad-right name max-width) + (G_ (command-synopsis command)))) + names + commands))) + + (define (category-predicate category) + (lambda (command) + (eq? category (command-category command)))) + (format #t (G_ "Usage: guix COMMAND ARGS... Run COMMAND with ARGS.\n")) (newline) (format #t (G_ "COMMAND must be one of the sub-commands listed below:\n")) - (newline) - ;; TODO: Display a synopsis of each command. - (format #t "~{ ~a~%~}" (sort (remove internal? (commands)) - string<?)) + + (let ((commands (commands)) + (categories (module-ref (resolve-interface '(guix scripts)) + '%command-categories))) + (for-each (match-lambda + (('internal . _) + #t) ;hide internal commands + ((category . synopsis) + (format #t "~% ~a~%" (G_ synopsis)) + (display-commands (filter (category-predicate category) + commands)))) + categories)) (show-bug-report-information)) (define (run-guix-command command . args) |