# GNU Guix --- Functional package management for GNU # Copyright © 2022 Ludovic Courtès # # 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 . # # Test 'guix shell --export-manifest'. # guix shell --version tmpdir="t-guix-manifest-$$" trap 'rm -r "$tmpdir"' EXIT mkdir "$tmpdir" manifest="$tmpdir/manifest.scm" # Basics. guix shell --export-manifest guile-bootstrap > "$manifest" test "$(guix build -m "$manifest")" = "$(guix build guile-bootstrap)" guix shell -m "$manifest" --bootstrap -- \ "$SHELL" -c 'guix package --export-manifest -p "$GUIX_ENVIRONMENT"' > \ "$manifest.second" for m in "$manifest" "$manifest.second" do grep -v '^;' < "$m" > "$m.new" # filter out comments mv "$m.new" "$m" done cat "$manifest" cat "$manifest.second" cmp "$manifest" "$manifest.second" # Manifest for a profile. guix shell --bootstrap guile-bootstrap -r "$tmpdir/profile" -- \ guile --version test -x "$tmpdir/profile/bin/guile" guix shell -p "$tmpdir/profile" --export-manifest > "$manifest.second" guix shell --export-manifest guile-bootstrap > "$manifest" cat "$manifest.second" cmp "$manifest" "$manifest.second" rm "$tmpdir/profile" # Combining manifests. guix shell --export-manifest -m "$manifest" gash gash-utils \ > "$manifest.second" guix build -m "$manifest.second" -d | \ grep "$(guix build guile-bootstrap -d)" guix build -m "$manifest.second" -d | \ grep "$(guix build gash -d)" # Package transformation option. guix shell --export-manifest guile guix \ --with-input=guile-json@3=guile-json > "$manifest" grep 'options->transformation' "$manifest" grep '(with-input . "guile-json@3=guile-json")' "$manifest" # Development manifest. guix shell --export-manifest -D guile git > "$manifest" grep 'package->development-manifest' "$manifest" grep '"guile"' "$manifest" guix build -m "$manifest" -d | \ grep "$(guix build -e '(@@ (gnu packages commencement) gcc-final)' -d)" guix build -m "$manifest" -d | \ grep "$(guix build git -d)" guix shell --export-manifest -D guile -D python-itsdangerous > "$manifest" guix build -m "$manifest" -d | grep "$(guix build libffi -d)" guix build -m "$manifest" -d | \ grep "$(guix build -e '(@ (gnu packages python) python)' -d)" # Test various combinations to make sure generated code uses interfaces # correctly. for options in \ "coreutils grep sed" \ "gsl openblas gcc-toolchain --tune" \ "guile -m $manifest.previous" \ "git:send-email gdb guile:debug" \ "git -D coreutils" do guix shell --export-manifest $options > "$manifest" cat "$manifest" guix shell -m "$manifest" -n mv "$manifest" "$manifest.previous" done case for the new syntax. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2022-12-02records: 'match-record' checks fields at macro-expansion time.Ludovic Courtès This allows 'match-record' to be more efficient (field offsets are computed at compilation time) and to report unknown fields at macro-expansion time. * guix/records.scm (map-fields): New macro. (define-record-type*)[rtd-identifier]: New procedure. Define TYPE as a macro and use a separate identifier for the RTD. (lookup-field, match-record-inner): New macros. (match-record): Rewrite in terms of 'match-error-inner'. * tests/records.scm ("match-record, simple") ("match-record, unknown field"): New tests. * gnu/services/cuirass.scm (cuirass-shepherd-service): Rename 'log-file' local variable to 'main-log-file'. * gnu/services/getmail.scm (serialize-getmail-configuration-file): Move after <getmail-configuration-file> definition. 2022-07-01tests: Add sanitizer test.Ludovic Courtès * tests/records.scm ("define-record-type* & sanitize without default value"): New test. 2021-08-12records: Support field sanitizers.Ludovic Courtès * guix/records.scm (make-syntactic-constructor): Add #:sanitizers. [field-sanitizer]: New procedure. [wrap-field-value]: Honor F's sanitizer. (define-record-type*)[field-sanitizer]: New procedure. Pass #:sanitizer to 'make-syntactic-constructor'. * tests/records.scm ("define-record-type* & sanitize") ("define-record-type* & sanitize & thunked"): New tests. 2021-04-29diagnostics, ui: Adjust to 'read-error' and 'syntax-error' in Guile 3.0.6.Ludovic Courtès * guix/diagnostics.scm (source-properties->location): Add clause for vectors. * guix/ui.scm (report-load-error): Tweak 'read-error' handling for 3.0.6. * tests/guix-package.sh: Relax regexp for the "unbound variable" diagnostic check. * tests/guix-system.sh: Adjust "missing closing paren" check for 3.0.6. * tests/records.scm (location-alist): New procedure. ("define-record-type* & wrong field specifier") ("define-record-type* & wrong field specifier, identifier") ("define-record-type* & duplicate initializers"): Use it. 2020-01-16records: Improve reporting of "invalid field specifier" errors.Ludovic Courtès Previously users would just see: error: invalid field specifier without source location or hints. * guix/records.scm (expand): Add optional 'parent-form' parameter and pass it to 'syntax-violation' when it is true. (make-syntactic-constructor): Pass S as a third argument to 'report-invalid-field-specifier'. * guix/ui.scm (report-load-error): For 'syntax-error', show SUBFORM or FORM in the message. * tests/records.scm ("define-record-type* & wrong field specifier"): Add a 'subform' parameter and adjust test accordingly. ("define-record-type* & wrong field specifier, identifier"): New test. * tests/guix-system.sh: Add test.