Commit graph

1929 commits

Author SHA1 Message Date
Attila Lendvai e11517052b
services: configuration: Support (field1 maybe-number "") format.
As opposed to explicitly using 'disabled as value, or using the
(field1 (maybe-number) "") format.

It's mostly the work of Maxime Devos shared under #54674, with some
modifications by Attila Lendvai.

* gnu/services/configuration.scm (normalize-field-type+def): New function.
(define-configuration-helper) (define-configuration): Support new field
format.
* tests/services/configuration.scm (config-with-maybe-number->string): New
function.
("maybe value serialization of the instance"): New test.
("maybe value serialization of the instance, unspecified"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-15 00:25:21 +02:00
Ludovic Courtès 7046e77721
system: <operating-system> compiler truly honors the 'system' argument.
Fixes <https://issues.guix.gnu.org/55951>.

* gnu/system.scm (operating-system-compiler): Parameterize
'%current-system' and '%current-target-system' before calling
'operating-system-derivation'.
* tests/system.scm ("lower-object, %current-system sensitivity"): New
test.
2022-06-15 00:25:20 +02:00
Antero Mejr 7041fe0646
packages: Add 'specifications->packages'.
* gnu/packages.scm (specifications->packages): New procedure.
* guix/scripts/home/import.scm (manifest+configuration-files->code): Use it.
* tests/home-import.scm (match-home-environment-no-services)
(match-home-environment-no-services-nor-packages)
(match-home-environment-bash-service)
(match-home-environment-bash-service-with-alias): Adjust 'packages'
field accordingly.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-06-06 22:43:30 +02:00
Lars-Dominik Braun 143141726e
import: hackage: Filter upper/mixed case dependencies too.
* guix/import/hackage.scm (filter-dependencies): Convert OWN-NAMES
to lowercase before filtering.
(hackage-module->sexp): Remove #f from OWN-NAMES, which is used for
unnamed (default) libraries.
* tests/hackage.scm (test-cabal-internal-library-ignored): Add mismatched
uppercase letters.
2022-06-06 13:26:51 +02:00
Lars-Dominik Braun dedfcaa8e2
import: hackage: Filter internal libraries from inputs and native-inputs.
Fixes <https://issues.guix.gnu.org/54760>.

* guix/import/hackage.scm (filter-dependencies): Support multiple
OWN-NAMES.
(hackage-module->sexp): Filter OWN-NAMES from HACKAGE-DEPENDENCIES and
HACKAGE-NATIVE-DEPENDENCIES.
* tests/hackage.scm (test-cabal-internal-library-ignored): New variable.
("hackage->guix-package test internal libraries are ignored"): New testcase.
2022-06-06 13:26:45 +02:00
Lars-Dominik Braun c3fbaee345
import: cabal: Support library names
* guix/import/cabal.scm (make-cabal-parser): Add name to section.
(is-lib): Add optional name to regular expression.
(lex-rx-res): Support selecting different substring.
(lex-lib): Match 2nd substring from IS-LIB.
(lex-line): Adapt to changes for lex-lib.
(cabal-library): Add name field and export CABAL-LIBRARY-NAME.
(eval): Remove special case for 'library, which is not required any more.
(make-cabal-section): Move special case for LIBRARY.
* tests/hackage.scm (test-read-cabal-library-name): New variable.
("read-cabal test 1"): Adapt testcase to changed internal structure.
("read-cabal test: library name"): New testcase.
2022-06-06 13:26:45 +02:00
Lars-Dominik Braun f4763ec37d
import: cabal: Document failing syntax through tests.
* tests/hackage.scm (test-read-cabal-brackets-newline): New variable.
(test-cabal-no-final-newline): Likewise.
("hackage->guix-package test without final newline",
"read-cabal test: property brackets on new line"): New tests.
2022-06-06 13:26:45 +02:00
Lars-Dominik Braun e3337f35af
import: cabal: Allow curly bracket before else statement.
* guix/import/cabal.scm (is-else): Turn into procedure.
(lex-line): Move IS-ELSE…
(lex-word): …here.
* tests/hackage.scm (test-cabal-elif-brackets): Extend testcase.
2022-06-06 13:26:45 +02:00
Lars-Dominik Braun 001e0bac99
import: cabal: Allow properties without space between key and value.
* guix/import/cabal.scm (lex-word): Add colon to delimiters.
* tests/hackage.scm (test-cabal-property-no-space): New variable.
("hackage->guix-package test properties without space"): New test.
2022-06-06 13:26:45 +02:00
Lars-Dominik Braun 0972feaff1
import: cabal: Allow curly brackets in more positions.
* guix/import/cabal.scm (is-layout-property): Do not expect end of line.
(lex-layout-property): Check for newline.
(lex-property): Stop reading on closing curly bracket.
* tests/hackage.scm (test-read-cabal-2): New variable.
("read-cabal test: if brackets on the same line"): New test.
2022-06-06 13:26:45 +02:00
Lars-Dominik Braun 2c5d18e421
import: cabal: Support elif statement.
Fixes <https://issues.guix.gnu.org/54752>.

* guix/import/cabal.scm (make-cabal-parser): Replace if-then-else grammar case with elif-else, modify if-then accordingly.
(is-elif): New procedure.
(lex-elif): Likewise.
(is-id): Add elif keyword.
(lex-word): Add test for elif.
* tests/hackage.scm (test-cabal-if): New variale.
(test-cabal-else): Likewise.
(test-cabal-elif): Likewise.
(test-cabal-elif-brackets): Likewise.
(match-ghc-elif): Likewise.
("hackage->guix-package test lonely if statement",
"hackage->guix-package test else statement",
"hackage->guix-package test elif statement",
"hackage->guix-package test elif statement with brackets"): New tests.
2022-06-06 13:26:09 +02:00
Ludovic Courtès 8eb17cebc1
home: services: Add 'lookup-home-service-types' procedure.
* gnu/home/services.scm (lookup-home-service-types): New procedure.
* tests/home-services.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2022-06-04 12:04:24 +02:00
zimoun 104b4e25ab
cache: Catch invalid 'last-expiry-cleanup'.
Fixes <http://issues.guix.gnu.org/55638>.

* guix/cache.scm (maybe-remove-expired-cache-entries)[last-expiry-date]:
Use 'get-string-all' + 'string->number' instead of 'read'; ignore
invalid numbers.
* tests/cache.scm ("maybe-remove-expired-cache-entries, empty cache")
("maybe-remove-expired-cache-entries, corrupted cache"): New tests.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-06-04 12:04:23 +02:00
Ludovic Courtès 2acc83daa5
shell: '--export-manifest -D x -D y' generates a valid manifest.
* guix/scripts/shell.scm (manifest->code*): Add missing 'list' in
generated 'concatenate-manifests' call.
* tests/guix-shell-export-manifest.sh: Add test.
2022-06-01 22:22:19 +02:00
Maxim Cournoyer 4f18b13436
gnu: Remove python2-matplotlib.
* gnu/packages/python-xyz.scm (python2-matplotlib): Delete variable.
* tests/profiles.scm ("package->manifest-entry, search paths"): Use python 3
matplotlib in test.
2022-05-31 14:53:34 -04:00
Ludovic Courtès 61d4f9e89d
tests: Adjust crate importer test to spdx changes.
This is a followup to 95b0544fcf.

* tests/crate.scm ("licenses: MIT/Apache-2.0 AND BSD-2-Clause"): Adjust
expected result.
2022-05-30 16:34:39 +02:00
Josselin Poiret d276a7dd61
tests: Fix wrong target triplets.
* tests/gexp.scm (ungexp + ungexp-native,
input list + ungexp-native,
input list splicing + ungexp-native-splicing,
gexp list splicinng + ungexp-splicing,
gexp->derivation, cross-compilation,
gexp->derivation, ungexp-native,
gexp->derivation, ungexp + ungexp-native,
gexp->derivation, ungexp-native + composed gexps): Change
mips64el-linux to mips64el-linux-gnu.
* tests/guix-pack.sh: Change arm-unknown-linux-gnueabihf to
arm-linux-gnueabihf.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-05-25 09:28:43 +02:00
Josselin Poiret aaf547824e
scripts: package: Transform before creating manifest entries.
* guix/scripts/package.scm (options->installable): Add TRANSFORM
argument, to be able to directly transform the new packages before
creating their manifest entries.
(process-actions): Remove transform-entry, and step3, transforming
directly in step2.
* tests/guix-package.sh: Add test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-05-23 16:24:46 +02:00
Philip McGrath 903c82583e
import: Add Elm importer.
* guix/import/elm.scm, guix/scripts/import/elm.scm: New files.
* Makefile.am (MODULES): Add them.
* guix/scripts/import.scm (importers): Add "elm".
* doc/guix.texi (Invoking guix import): Document Elm importer.
* doc/contributing.texi (Elm Packages): Mention it.
* tests/elm.scm ("(guix import elm)"): New test group.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-05-22 01:07:52 +02:00
Philip McGrath aefcfdd0ae
guix: Add elm-build-system.
* gnu/packages/patches/elm-offline-package-registry.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/elm.scm (elm): Use it.
* guix/build-system/elm.scm, guix/build/elm-build-system.scm,
tests/elm.scm: New files.
* Makefile.scm (MODULES, SCM_TESTS): Add them.
* doc/guix.texi (Build Systems): Document 'elm-build-system'.
* doc/contributing.texi (Elm Packages): New section. Document naming
conventions and utilities.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-05-22 01:07:51 +02:00
Ludovic Courtès a4994d7393
inferior: Close duplicate socketpair file descriptor.
* guix/inferior.scm (open-bidirectional-pipe): Pass SOCK_CLOEXEC to
'socketpair'.
* tests/inferior.scm ("close-inferior"): Add test.
2022-05-20 18:46:07 +02:00
Ludovic Courtès 3ae7632ca0
tests: Ensure test OpenPGP keys never expire.
All these keys had expiration dates.  'tests/keys/ed25519.pub' expired
on 2022-04-24.

Fixes <https://issues.guix.gnu.org/55506>.

* tests/keys/ed25519.pub, tests/keys/ed25519-2.pub,
tests/keys/ed25519-3.pub: Remove expiration date.
2022-05-18 23:20:21 +02:00
Ludovic Courtès 3948ac25b1
services: Make <service-type> 'description' field mandatory.
* gnu/services.scm (<service-type>)[description]: Remove default value.
* tests/services.scm: Add 'description' field to each 'service-type' form.
2022-05-18 22:29:54 +02:00
Ludovic Courtès 0f024554e6
transformations: Preserve transformation order in package property.
Fixes <https://issues.guix.gnu.org/54942>.
Reported by SeerLite <seerlite@nixnet.email>.

* guix/transformations.scm (options->transformation)
[package-with-transformation-properties]: Add call to 'reverse'.
* tests/transformations.scm ("options->transformation, property order"):
New test.
2022-05-05 23:56:58 +02:00
Ludovic Courtès 774f8804ba
gexp: Add 'references-file'.
* gnu/services/base.scm (references-file): Remove.
* guix/gexp.scm (references-file): New procedure.
* tests/gexp.scm ("references-file"): New test.
2022-05-01 21:30:34 +02:00
Ludovic Courtès c1719a0adf
publish: Send uncached narinfo replies from the main thread.
Fixes <https://issues.guix.gnu.org/54723>.
Reported by Guillaume Le Vaillant <glv@posteo.net>.

Regression introduced in f743f2046b.

With commit f743f2046b, responses to
pipelined GETs would end up being written concurrently by many threads.
Thus the body of those responses could be interleaved and garbled.

* guix/scripts/publish.scm: Revert
f743f2046b.
* tests/publish.scm ("/*.narinfo pipeline"): New test.
2022-04-29 18:07:17 +02:00
Ludovic Courtès d4af1ff177
tests: Adjust 'guix home' test to 'home-files-service-type' changes.
This is a followup to 5832d9fb60.

* tests/guix-home.sh: Change "config" to ".config" in
'home-files-service-type' extension.
2022-04-19 18:07:49 +02:00
Ludovic Courtès c9cded0955
style: Correctly read dots in pairs and improper lists.
Until now dots were read as symbols.

* guix/scripts/style.scm (read-with-comments)[dot]: New variable.
[dot?, reverse/dot]: New procedures.
Use 'reverse/dot' instead of 'reverse' when reading lists.
* tests/style.scm ("read-with-comments: dot notation")
("((a . 1) (b . 2))", "(a b c . boom)"): New tests.
2022-04-14 14:48:20 +02:00
Ludovic Courtès ec6a585ee2
services: Test 'shepherd-service-upgrade' with transient services.
This is a followup to eeb8ac43c8.

* tests/services.scm ("shepherd-service-upgrade: transient service"):
New test.
2022-04-10 01:24:30 +02:00
Ludovic Courtès e25eca35ff
services: herd: Adjust to <live-service> changes.
This is a followup to a2c759c830.

* guix/scripts/system/reconfigure.scm (running-services): Fill in the
'transient?' field of <live-service>.
* tests/services.scm ("shepherd-service-upgrade: one unchanged, one upgraded, one new")
("shepherd-service-upgrade: service depended on is not unloaded")
("shepherd-service-upgrade: obsolete services that depend on each
other"): Adjust calls to 'live-service'.
2022-04-10 01:15:13 +02:00
Ludovic Courtès 20691c70cf
tests: 'guix shell --export-manifest' test no longer needs networking.
* tests/guix-shell-export-manifest.sh: Use '--with-input' rather than
'--with-latest' as the latter would crash in the absence of network
access.
2022-04-08 18:14:35 +02:00
Ludovic Courtès c42b7baf13
shell: Add '--export-manifest'.
* guix/scripts/shell.scm (show-help, %options): Add '--export-manifest'.
(manifest-entry-version-prefix, manifest->code*)
(export-manifest): New procedures.
(guix-shell): Honor '--export-manifest'.
* tests/guix-shell-export-manifest.sh: New file.
* Makefile.am (SH_TESTS): Add it.
* doc/guix.texi (Invoking guix shell): Document '--export-manifest'.
(Invoking guix environment): Link to it.
(Invoking guix pack): Likewise.
2022-04-04 22:58:04 +02:00
Ludovic Courtès f54f2aa9df
packages: Add 'package-unique-version-prefix'.
* gnu/packages.scm (package-unique-version-prefix): New procedure.
* guix/scripts/package.scm (manifest-entry-version-prefix): Use it.
* tests/packages.scm ("package-unique-version-prefix, gcc@8")
("package-unique-version-prefix, grep"): New tests.
2022-04-04 22:58:03 +02:00
Efraim Flashner 67213a2759
download: Use https for main KDE source.
* guix/download.scm (%mirrors)[kde]: Use https URIs for main KDE mirrors.
* tests/lint.scm ("mirror-url: kde suggestion"): New test.
2022-03-29 14:43:14 +03:00
Ludovic Courtès 6da2a5a565
home: import: Properly parse aliases that contain quotes.
* guix/scripts/home/import.scm (generate-bash-configuration+modules):
Define 'alias-rx'.
[bash-alias->pair]: Use it.
* tests/home-import.scm (match-home-environment-bash-service-with-alias):
New variable.
("manifest->code: Bash service with aliases"): New test.
2022-03-20 19:02:41 +01:00
Ludovic Courtès 094a2cfbe4
guix home: Add 'container' command.
* guix/scripts/home.scm (show-help, %options): Add '--network',
'--share', and '--expose'.
(not-config?, user-shell, spawn-home-container): New procedures.
(%default-system-profile): New variable.
(perform-action): Add #:file-system-mappings, #:container-command,
and #:network?; honor them.
(process-action): Adjust accordingly.
(guix-home)[parse-sub-command]: Add "container".
[parse-args]: New procedure.
Use it instead of 'parse-command-line'.
* tests/guix-home.sh: Add tests.
* doc/guix.texi (Declaring the Home Environment): Mention 'guix home
container' as a way to test configuration.
(Invoking guix home): Document it.
2022-03-19 18:51:09 +01:00
Ludovic Courtès 25261cbf96
guix home: Implement the 'extension-graph' and 'shepherd-graph' actions.
Until now these two actions were silently ignored.

* guix/scripts/home.scm (show-help, %options): Add "--graph-backend".
(%default-options): Add 'graph-backend' key.
(export-extension-graph, export-shepherd-graph): New procedures.
(perform-action): Add #:graph-backend parameter.  Add cases for the
'extension-graph' and 'shepherd-graph' actions.
(process-action): Pass #:graph-backend to 'perform-action'.
* guix/scripts/system.scm (service-node-type)
(shepherd-service-node-type): Export
* tests/guix-home.sh: Add tests.
* doc/guix.texi (Invoking guix home): Document it.
2022-03-18 16:03:33 +01:00
Ludovic Courtès 47960b5526
system: Improve 'read-boot-parameters' incompatibility diagnostic.
Previously, when reading an incompatible "parameters" file, 'guix
system' would print a warning and then crash with a wrong-type-arg
backtrace because code expects 'read-boot-parameters' to always return a
<boot-parameters> record.

* gnu/system.scm (read-boot-parameters): Upon incompatibility, raise an
error instead of returning #f.  Also raise a '&fix-hint' condition.
* tests/boot-parameters.scm ("read, construction, mandatory fields"):
Define 'test-read-boot-parameters' as a macro; expect
'formatted-message?' exceptions rather than #f returns.
2022-03-16 15:48:52 +01:00
Ludovic Courtès 00dfff84c6
packages: 'modify-inputs' preserves outputs in 'replace' clauses.
Fixes <https://issues.guix.gnu.org/53915>.
Reported by Gordon Quad <gordon@niflheim.info>.

* guix/packages.scm (replace-input): Preserve the outputs of INPUT by
default.
* tests/packages.scm ("modify-inputs, replace, extra output"): New test.
2022-03-16 15:48:51 +01:00
Ludovic Courtès e3801126a9
tests: Exercise 'modify-inputs' with a 'replace' clause.
* tests/packages.scm ("modify-inputs, replace")
("modify-inputs, replace, change output"): New tests.
2022-03-16 15:48:51 +01:00
Maxime Devos 2e5c3d91fe
gexp: Correctly handle #$output in 'gexp->approximate-sexp'.
This addresses the following backtrace from
"guix lint -c wrapper-inputs hostapd":

Backtrace:ostapd@2.10 [wrapper-inputs]...
[...]
    174:9  3 (gexp->approximate-sexp #<gexp (modify-phases %standard?>)
In srfi/srfi-1.scm:
   586:17  2 (map1 (#<gexp-output out> #<gexp-input "pkg-config":o?>))
In guix/gexp.scm:
   175:16  1 (_ _)
In ice-9/boot-9.scm:
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" #<gexp-output out>)'.

* guix/gexp.scm (gexp->approximate-sexp): Handle the case where 'reference' is
  a <gexp-output>,, by returning (*approximate*).
* tests/gexp.scm ("gexp->approximate-sexp, outputs"): Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-13 23:20:07 +01:00
Maxime Devos 5aec62ee0f
gexp: Correctly handle unquoting S-exp objects.
This fixes a false-positive in the linter:

  guix lint -c 'wrapper-inputs' libaio

* guix/gexp.scm (gexp->approximate-sexp): Allow the 'thing' in <gexp-input> to
  be a sexp, without approximation, by testing if it is a record.
* tests/gexp.scm ("unquoted sexp (not a gexp!)"): Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-03-13 23:18:14 +01:00
Maxime Devos 88e44f7e16
lint: check-tests-true: Allow #:tests? #t for some build systems.
emacs-build-system sets #:tests? #f by default, so the linter shouldn't warn
if #:tests? #t is set for packages using emacs-build-system.  Likewise for
texlive-build-system.

* guix/lint.scm (check-tests-true): Do not warn if the build system
  is emacs-build-system or texlive-build-system.
* tests/lint.scm
  ("tests-true: #:tests? #t acceptable for emacs packages")
  ("tests-true: #:tests? #t acceptable for texlive packages"): New tests.

Fixes: <https://issues.guix.gnu.org/50299>
Reported-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-03-11 23:34:47 -05:00
Ludovic Courtès 5fabaf1128
tests: Check 'guix home reconfigure' for a second generation.
* tests/guix-home.sh: Invoke "guix home reconfigure" a second time with
a modify config file and check the result.
2022-03-10 11:43:14 +01:00
Ludovic Courtès 26e67e0280
tests: Simplify use of 'local-file' in 'tests/guix-home.sh'.
* tests/guix-home.sh: Remove 'current-filename' trickery since
'local-file' resolves file names relative to the containing file.
2022-03-10 11:43:14 +01:00
Ludovic Courtès 7b7e32d5ad
tests: Make sure 'guix home reconfigure' backs up files.
* tests/guix-home.sh: Create ~/.bashrc and ~/.config/test.conf prior to
'reconfigure' and check whether they were backed up.
2022-03-10 11:43:14 +01:00
Ludovic Courtès 1cad347618
derivations: Coalesce inputs that have the same output path.
Fixes <https://issues.guix.gnu.org/54209>.

* guix/derivations.scm (coalesce-duplicate-inputs): Use the output paths
of DRV as a hash table key.
* tests/derivations.scm ("derivation with duplicate fixed-output
inputs"): Expect a single input for FINAL.
("derivation with equivalent fixed-output inputs"): New test.
2022-03-07 22:49:27 +01:00
Ludovic Courtès 667f21aea0
tests: Adjust to (guix import github) changes.
This is a followup to a8d3033da6.

* tests/import-github.scm (call-with-releases): Mock
'open-connection-for-uri'.
2022-03-07 22:49:27 +01:00
Ludovic Courtès 049aefddb2
tests: Add (guix http-client) tests.
* tests/http-client.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* .dir-locals.el (scheme-mode): Add 'with-http-server'.
2022-03-06 22:49:46 +01:00
Maxim Cournoyer 4a3b8f4d59
system: Add a version field to the <boot-parameters> record.
This version field exposes the (already present) version information of a boot
parameters file.

* gnu/system.scm (%boot-parameters-version): New variable.
(<boot-parameters>)[version]: New field.
(read-boot-parameters): Use it.
(operating-system-boot-parameters-file): Likewise.
* tests/boot-parameters.scm (test-read-boot-parameters): Use
%boot-parameters-version as the default version value in the template.
2022-03-01 10:30:17 -05:00
Ludovic Courtès 0ca26437cb
guix build: Warn when attempting to build an unsupported package.
Fixes <https://issues.guix.gnu.org/51801>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* guix/scripts/build.scm (options->derivations)[warn-if-unsupported]:
New procedure.
[compute-derivation]: Use it.
* tests/guix-build.sh: Add test.
2022-02-18 14:14:38 +01:00
Ludovic Courtès 5a57313918
profiles: 'profile-derivation' rejects unsupported packages.
Previously user-facing commands would happily start building packages
even if they do not support that system.  With this change, all the
user-facing commands reject unsupported packages without going further.

* guix/profiles.scm (profile-derivation): Add #:allow-unsupported-packages?.
Define 'check-supported-packages' and honor #:allow-unsupported-packages?.
* tests/guix-pack.sh, tests/guix-package.sh, tests/guix-shell.sh: Ensure
that unsupported packages are rejected.
* tests/guix-system.sh: Pass "--system=armhf-linux" when attempting to
build gnu/system/examples/asus-c201.tmpl.
2022-02-18 14:14:38 +01:00
Ludovic Courtès 0572737a62
packages: 'package-transitive-supported-systems' ignores '%current-target-system'.
Previously 'package-transitive-supported-systems' would enter an
infinite loop over the cross-compilation tool chain if
%CURRENT-TARGET-SYSTEM was set.

* guix/packages.scm (package-transitive-supported-systems)[supported-systems-procedure]:
Pass explicit SYSTEM and TARGET parameters.
* tests/packages.scm ("supported-package? vs. %current-target-system"):
New test.
2022-02-18 14:14:38 +01:00
Ludovic Courtès ca155a20ae
gexp: Preserve source location for #~ and #$ read extensions.
Read hash extensions preserve source location info as source properties
on their result.  However, in Guile 3.0.8, that location would be
dismissed, leading 'local-file' to fail to resolve file names relative
to the source directory.

Fixes <https://issues.guix.gnu.org/54003>.
Reported by Aleksandr Vityazev <avityazev@posteo.org>.

* guix/gexp.scm <eval-when> [read-syntax-redefined?, read-procedure]
[read-syntax*]: New variables.
[read-ungexp]: Adjust to expect either sexps or syntax objects.
[read-gexp]: Call 'read-procedure'.
* tests/gexp.scm ("local-file, relative file name, within gexp")
("local-file, relative file name, within gexp, compiled"): New tests.
2022-02-16 16:49:26 +01:00
Ludovic Courtès 7f6dd3be3d
gexp: 'computed-file' always uses a native Guile.
Fixes a regression whereby, when cross-compiling, 'computed-file' would
use a cross-compiled Guile as its builder, which would fail to run.

Regression introduced in af57d1bf6c (the
problem had always been there but was hidden before behind the (not guile)
condition.)

* guix/gexp.scm (computed-file-compiler): For 'guile', pass #:target #f.
* tests/gexp.scm ("lower-object, computed-file, #:target"): New test.
2022-02-15 09:33:59 +01:00
Ludovic Courtès 6adce1538d
publish: Do not sign the URL/Compression/FileSize narinfo fields.
This will allow mirror operators to alter these non-normative bits of a
narinfo without having to resign narinfos.

* guix/scripts/publish.scm (narinfo-string): Remove
URL/Compression/FileSize from BASE-INFO.  Move them after "Signature".
* tests/publish.scm ("/*.narinfo")
("/*.narinfo with properly encoded '+' sign")
("/*.narinfo with lzip + gzip")
("with cache, lzip + gzip"): Adjust accordingly.
* tests/substitute.scm ("query narinfo with signature over relevant subset"):
New test.
2022-02-14 11:23:56 +01:00
Ludovic Courtès ca87601dd9
git-authenticate: Ensure the target is a descendant of the introductory commit.
Fixes a bug whereby authentication of a commit *not* descending from the
introductory commit could succeed, provided the commit verifies the
authorization invariant.

In the example below, A is a common ancestor of the introductory commit
I and of commit X.  Authentication of X would succeed, even though it is
not a descendant of I, as long as X is authorized according to the
'.guix-authorizations' in A:

   X   	 I
    \   /
      A

This is because, 'authenticate-repository' would not check whether X
descends from I, and the call (commit-difference X I) would return X.

In practice that only affects forks because it means that ancestors of
the introductory commit already contain a '.guix-authorizations' file.

* guix/git-authenticate.scm (authenticate-repository): Add call to
'commit-descendant?'.
* tests/channels.scm ("authenticate-channel, not a descendant of introductory commit"):
New test.
* tests/git-authenticate.scm ("authenticate-repository, target not a descendant of intro"):
New test.
* tests/guix-git-authenticate.sh: Expect earlier test to fail since
9549f0283a is not a descendant of
$intro_commit.  Add new test targeting an ancestor of the introductory
commit, and another test targeting the v1.2.0 commit.
* doc/guix.texi (Specifying Channel Authorizations): Add a sentence.
2022-02-14 11:23:08 +01:00
Ludovic Courtès 87d49346f3
git: Add 'commit-descendant?'.
* guix/git.scm (commit-descendant?): New procedure.
* tests/git.scm ("commit-descendant?"): New test.
2022-02-14 11:23:07 +01:00
Ludovic Courtès 36cb04df96
git-authenticate: Test introductory commit signature verification.
These tests mimic similar tests already in 'tests/channels.scm', but
without using the higher-level 'authenticate-channel'.

* tests/git-authenticate.scm ("introductory commit, valid signature")
("introductory commit, missing signature")
("introductory commit, wrong signature"): New tests.
2022-02-14 11:23:07 +01:00
Ludovic Courtès 0f1cb02362
tests: Adjust pypi test to recent changes.
This is a followup to 00762a4c4c.

* tests/pypi.scm ("pypi->guix-package, no wheel"): Guard against
'error?' instead of 'quit'.
2022-02-11 23:51:39 +01:00
Ludovic Courtès bc1ad69605
tests: Pass #:guile to 'computed-file' & co.
Fixes a regression introduced in
af57d1bf6c whereby tests would end up
building the world.

* guix/gexp.scm (mixed-text-file): Add #:guile parameter and honor it.
* tests/gexp.scm ("mixed-text-file"): Pass #:guile to 'mixed-text-file'.
("file-union"): Pass #:guile to 'file-union'.
("lower-object, computed-file"): Pass #:guile to 'computed-file'.
("lower-object, computed-file + grafts"): Likewise.
* tests/packages.scm ("origin->derivation, single file with snippet"):
Likewise.
* tests/profiles.scm ("profile-derivation, ordering & collisions"):
Likewise.
* guix/tests.scm (test-file): Likewise.
2022-02-11 23:51:39 +01:00
Liliana Marie Prikler 45082b9a8c
tests: Assert that cyclic graphs can be produced.
* tests/graph.scm ("package DAG, oops it was a cycle"): New test.
2022-02-05 08:02:30 +01:00
Vivien Kraus bac9f8302c
import: pypi: Convert hyphens to underscores in PyPI URLs if needed.
* guix/import/pypi.scm (find-project-url): New function.
(make-pypi-sexp): Use find-project-url.
* tests/pypi.scm (foo-json): New procedure.
(test-json-1, test-json-2): Define in terms of it.
("find-project-url, with numpy", "find-project-url, uWSGI"):
("find-project-url, flake8-array-spacing")
("find-project-url, foo/goo"): New tests.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2022-01-26 17:54:58 +01:00
Ludovic Courtès ccda88a070
package: Honor '--dry-run' when target profile is already in store.
Fixes <https://issues.guix.gnu.org/53267>.
Reported by Tirifto <tirifto@posteo.cz>.

Regression introduced in 65ffb9388c.

In the (unlikely) case where the profile we're targeting with "guix
upgrade -n" or similar is already built, a new profile generation would
be created and linked to despite the use of '-n'.  This is because
65ffb9388c assumed that dry-run behavior
would be handled solely by the build handler, which is not the case when
there's nothing to build.

* guix/scripts/package.scm (build-and-use-profile): Reintroduce #:dry-run?
and honor it.
(process-actions): Pass #:dry-run? to 'build-and-use-profile'.
* tests/guix-package-net.sh: Add test.
2022-01-19 22:07:54 +01:00
Ludovic Courtès 435ffae2f2
tests: Adjust to gzip as the default log compression.
This is a followup to 575e52ac2b.

* tests/publish.scm ("/log/NAME"): Expect a gzip-encoded log.
2022-01-19 22:07:54 +01:00
Maxim Cournoyer 276f40fdc3
Merge branch 'version-1.4.0'
With resolved conflicts in:
	gnu/packages/gnome.scm
	gnu/packages/openstack.scm
	gnu/packages/python-xyz.scm
2022-01-17 11:47:09 -05:00
Pierre Langlois 24c3485bb3
tests: Fix file-needed/recursive on aarch64-linux.
Fixes: <https://issues.guix.gnu.org/52943>.

* tests/gremlin.scm (file-needed/recursive)[ground-truth]: On aarch64-linux,
remove the dynamic linker from this list.
2022-01-16 20:21:27 -08:00
Ludovic Courtès 686f2eae34
tests: Clean up after 'tests/guix-package-net.sh'.
* tests/guix-package-net.sh: Remove second 'trap' line.  Change first
'trap' line to remove "$module_dir" and *.lock files.
2022-01-16 23:56:56 +01:00
Ludovic Courtès a1037aa87b
tests: Clean up after 'tests/guix-graph.sh'.
Fixes a regression introduced in
a773c3142d, which would lead the first
'trap' to be ignored, thereby leaving 't-guix-graph-*' directories
behind it.

* tests/guix-graph.sh: Remove first 'trap' line that had no effect;
replace second 'trap' line.
2022-01-16 23:56:56 +01:00
Maxime Devos 81f036bfd2
import/github: Test it.
* Makefile.am (SCM_TESTS): Register new tests.
* guix/import/github.scm
  (%github-api): New variable.
  (fetch-releases-or-tags): Use the new variable.
* tests/import-github.scm: New file with tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-16 23:56:56 +01:00
Brendan Tildesley 7f8a896c5f
utils: Fix wrap-script argument handling.
* guix/build/utils.scm (wrap-script):
Don't add (car cl) one too many times, cl its self contains it's car.
Split the aguments string with string-tokenize to avoid leaving an empty
string argument when there should be none. These two bugs seemed to
be partially cancelling each other out so that scripts still worked when
ran with no arguments.

* tests/build-utils.scm: Adjust wrap-script to above changes.
Add two tests to ensure the command line arguments appear identical to a
script and its wrapped version.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2022-01-10 11:44:29 -05:00
Ludovic Courtès 5d9a5e2301
style: '-S format' canonicalizes comments.
* guix/scripts/style.scm (canonicalize-comment): New procedure.
(pretty-print-with-comments): Add #:format-comment. and honor it.
(object->string*): Add 'args' and honor them.
(format-package-definition): Pass #:format-comment to
'object->string*'.
* tests/style.scm ("pretty-print-with-comments, canonicalize-comment"):
New test.
2022-01-10 14:59:26 +01:00
Ludovic Courtès c4fe13c294
style: Add '--styling' option.
* guix/scripts/style.scm (format-package-definition): New procedure.
(%options, show-help): Add "--styling".
(%default-options): Add 'styling-procedure'.
(guix-style): Honor it.
* tests/style.scm (with-test-package)
("input labels, 'safe' policy")
("input labels, 'safe' policy, nothing changed")
("input labels, margin comment")
("input labels, margin comment on long list")
("input labels, line comment")
("input labels, modify-inputs and margin comment"): Pass "-S inputs".
* etc/indent-code.el: Remove.
* doc/contributing.texi (Formatting Code): Mention "guix style" instead
of "etc/indent-code.el".
(Submitting Patches): Add item for "guix style".
* doc/guix.texi (Invoking guix style): Document "-S" and update.
2022-01-10 14:59:26 +01:00
Ludovic Courtès 6f892630ae
style: Add support for "newline forms".
This allows us to express cases where a newline should be inserted
immediately after the head symbol of a list.

* guix/scripts/style.scm (%newline-forms): New variable.
(newline-form?): New procedure.
(pretty-print-with-comments): Handle "newline forms".
* tests/style.scm: Add test.
2022-01-10 14:59:18 +01:00
Ludovic Courtès 208a7aa17b
style: Allow special forms to be scoped.
* guix/scripts/style.scm (vhashq): Add clause for 'lst, and change
default clause.
(%special-forms): Add context for 'add-after and 'add-before.  Add
'replace.
(prefix?, special-form-lead): New procedures.
(special-form?): Remove.
(pretty-print-with-comments): Add 'context' to the threaded state.
Adjust 'print-sequence' and adjust 'loop' calls accordingly.
* tests/style.scm: Add tests for 'replace.
2022-01-10 14:25:59 +01:00
Ludovic Courtès 97d0055edb
style: Improve pretty printer and add tests.
* guix/scripts/style.scm (vhashq): New macro.
(%special-forms): New variable.
(special-form?): New procedure.
(pretty-print-with-comments): Add many clauses and tweak existing
rules.
* tests/style.scm (test-pretty-print): New macro.
<top level>: Add 'test-pretty-print' tests.
2022-01-10 14:25:59 +01:00
Ludovic Courtès e7ad192de0
gremlin: Adjust tests for i686 and beyond.
Fixes <https://issues.guix.gnu.org/52752>.
Reported by Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>.

* tests/gremlin.scm ("file-needed/recursive"): Augment the list of vDSO
names.
2022-01-14 22:39:24 +01:00
Ludovic Courtès 641b599d0b
import: texlive: Remove labels from 'propagated-inputs' field.
* guix/import/texlive.scm (tlpdb->package): Remove labels from
'propagated-inputs' field.
* tests/texlive.scm ("texlive->guix-package"): Adjust accordingly.
2022-01-13 23:11:19 +01:00
Ricardo Wurmus 10b2ad7dbf
tests: Fix texlive test by sorting locations.
* tests/texlive.scm ("texlive->guix-package"): Correct order of locations.
2022-01-11 20:26:39 +01:00
Chris Marusich 6a2050b1e1
tests: Fix file-needed/recursive on powerpc64le-linux.
Fixes: <https://issues.guix.gnu.org/52940>.

* tests/gremlin.scm (file-needed/recursive): Consider two entries to be
equivalent not when they are the same string, but rather when they refer to
the same file.
[ground-truth]: In addition to strings that begin with "linux-vdso.so", remove
strings that begin with "linux-vdso64.so".
2022-01-08 15:51:22 -08:00
Sarah Morgensen 9f526f5dad
upstream: Support updating and fetching 'git-fetch' origins.
Updaters need to be modified to return 'git-reference' objects.
This patch modifies the 'generic-git' and 'minetest' updater,
but others might need to be modified as well.

* guix/git.scm (git-reference->git-checkout): New procedure.
* guix/upstream.scm (package-update/git-fetch): New procedure.
  (<upstream-source>)[urls]: Document it can be a 'git-reference'.
  (%method-updates): Add 'git-fetch' mapping.
  (update-package-source): Support 'git-reference' sources.
  (upstream-source-compiler/url-fetch): Split off from ...
  (upstream-source-compiler): ... this, and call ...
  (upstream-source-compiler/git-fetch): ... this new procedure if the URL
  field contains a 'git-reference'.
* guix/import/git.scm
  (latest-git-tag-version): Always return two values and document that the tag
  is returned as well.
  (latest-git-release)[urls]: Use the 'git-reference' instead of the
  repository URL.
* guix/import/minetest.scm (latest-minetest-release)[urls]: Don't wrap the
  'git-reference' in a list.
* tests/minetest.scm (upstream-source->sexp): Adjust to new convention.

Co-authored-by: Maxime Devos <maximedevos@telenet.be>
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-06 16:27:30 +01:00
Arjan Adriaanse d7fb57bcd5
home: import: Fix handling of manifest entries with specific output.
specification->package fails on manifest entries with specific outputs,
resulting in an invalid home configuration.  This changes the import command
to use specification->package+output instead.

* guix/scripts/home/import.scm (manifest+configuration-files->code): Make sure
manifest entries with specific output are also handled.
* tests/home-import.scm: Specify output in home environment manifest entry.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-01-05 23:44:18 +01:00
Ricardo Wurmus 6226df77ee
tests: Add failing tests for changed-inputs on new style inputs.
* tests/upstream.scm ("changed-inputs returns changes to plain input list",
"changed-inputs returns changes to all plain input lists"): New tests.
2022-01-05 21:17:58 +01:00
Ricardo Wurmus a6bf1c108e
tests: Add tests for changed-inputs on old-style inputs.
All these tests pass, because they only test the old-style input alists with
labels.

* tests/upstream.scm ("changed-inputs returns no changes",
"changed-inputs returns changes to labelled input list",
"changed-inputs returns changes to all labelled input lists"): New tests.
2022-01-05 21:17:54 +01:00
zimoun 8646f1f7a5
guix hash: Allow '--exclude-vcs' option using 'git' serializer.
* guix/scripts/hash.scm (git-hash): Use '#:select?' with
'git-hash-directory'.
* tests/guix-hash.sh: Adjust accordingly.

Signed-off-by: Timothy Sample <samplet@ngyro.com>
2022-01-04 20:37:29 -05:00
Ludovic Courtès d090e9c37d
transformations: Add '--tune'.
* guix/transformations.scm (tuning-compiler)
(tuned-package, tunable-package?, package-tuning)
(transform-package-tuning)
(build-system-with-tuning-compiler): New procedures.
(%transformations): Add 'tune'.
(%transformation-options): Add "--tune".
* tests/transformations.scm ("options->transformation, tune")
("options->transformations, tune, wrong micro-architecture"): New
tests.
* doc/guix.texi (Package Transformation Options): Document '--tune'.
2022-01-01 15:23:24 +01:00
Mathieu Othacehe 05a9d1f378
Remove VM generation dead-code.
This code duplicates the (gnu system image) and (gnu build image) code. Using
VM for image generation is not needed, not portable and really slow. Remove
all the VM image generation code to make sure that only the image API is used.

* gnu/build/vm.scm: Remove it. Move the qemu-command procedure to ...
* gnu/build/marionette.scm: ... here.
* gnu/local.mk (GNU_SYSTEM_MODULES): Adapt it.
* tests/modules.scm: Ditto.
* gnu/tests/install.scm: Ditto.
* gnu/system/vm.scm: Adapt it and remove expression->derivation-in-linux-vm,
qemu-img, system-qemu-image/shared-store and system-docker-image procedures.
* doc/guix.texi (G-Expressions): Adapt it.
2021-12-23 10:54:00 +01:00
Attila Lendvai 9ebc9ca070
tests: Move keys into ./tests/keys/ and add a third ed25519 key.
The third key will be used in an upcoming commit.

Rename public keys to .pub.

* guix/tests/gnupg.scm (%ed25519-3-public-key-file): New variable.
(%ed25519-3-secret-key-file): New variable.
(%ed25519-2-public-key-file): Renamed from %ed25519bis-public-key-file.
(%ed25519-2-secret-key-file): Renamed from %ed25519bis-secret-key-file.
* tests/keys/ed25519-3.key: New file.
* tests/keys/ed25519-3.sec: New file.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2021-12-22 10:53:19 +01:00
Xinglu Chen f21c70bc9a
import: elpa: Support ‘upstream-name’ property.
* guix/import/elpa.scm: (guix-package->elpa-name): New procedure.
  (latest-release): Use it.
* tests/elpa.scm ("guix-package->elpa-name: without 'upstream-name' property")
  ("guix-package->elpa-name: with 'upstream-name' property"): Test it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-12-18 22:51:55 +01:00
Vagrant Cascadian 5f547a5c42
lint: Adjust patch file length check.
With the switch to "ustar" format in commit
bdf5c16ac0, the maximum file length has
increased.

* guix/lint.scm (check-patch-file-names): Adjust margin used to check for
  patch file lengths. Increase allowable patch file length appropriate to new
  tar format. Extend warning to explain that long files may break 'make dist'.
* tests/lint.scm: Update tests accordingly.
2021-12-17 21:04:25 -08:00
Tobias Geerinckx-Rice 10ceb3e846
import: cran: Fix description->package test.
This follows up on commit 5cd1019488.

* tests/cran.scm (description): Include a very long line.
(description->package): Update the golden description to match the
paragraph filling now performed by BEAUTIFY-DESCRIPTION.
2021-12-18 04:09:47 +01:00
zimoun 28ffdc5cc8
guix hash: Add git serializer.
* guix/scripts/hash.scm (git-hash): New procedure.
(%options): Use it.
* tests/guix-hash.sh: Test it.
* doc/guix.texi: Update.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-12-17 17:29:34 +01:00
zimoun 05c962594c
guix hash: Add 'serializer' option.
* guix/scripts/hash.scm (%options): Deprecate 'recursive', add 'serializer'.
(%default-options): Add 'serializer'.
(nar-hash): New procedure.
(default-hash): New procedure.
(guix-hash)[file-hash]: Use them.
(show-help): Adjust.
* tests/guix-hash.scm: Adjust.
* doc/guix.texi: Update.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-12-17 17:29:34 +01:00
zimoun 6e08f07f20
guix hash: Support several files.
* guix/scripts/hash.scm (guix-hash): Allow several files.
[file-hash]: Catch system-error.
[formatted-hash]: New procedure.
* tests/guix-hash.sh: Add test.
* doc/guix.texi (Invoking guix hash): Mention "one or more files".

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-12-17 17:29:34 +01:00
Mathieu Othacehe 32750e8c3e
Merge remote-tracking branch 'signed/master' into core-updates 2021-12-10 21:49:25 +01:00
Ludovic Courtès 7197710121
shell: When using '-D -f', '-D' has no effect on remaining packages.
Fixes <https://issues.guix.gnu.org/52093>.
Reported by Konrad Hinsen <konrad.hinsen@fastmail.net>.

* guix/scripts/shell.scm (%options): In "--file" handler, add call to
'ensure-ad-hoc'.
* tests/guix-shell.sh: Add test.
2021-12-10 15:32:44 +01:00
Ricardo Wurmus 9bc0f45df5
Merge remote-tracking branch 'origin/master' into core-updates-frozen 2021-12-05 19:17:41 +01:00
Xinglu Chen 39f4ef59ff
build-system: haskell: Add ‘hackage-uri’ procedure.
* guix/build-system/haskell (hackage-uri): New procedure.
* guix/import/hackage.scm (hackage-module->sexp, latest-release): Use it.
* tests/hackage.scm (match-ghc-foo, match-ghc-foo-6, match-ghc-foo-revision,
match-ghc-foo-import): Adjust accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-12-01 17:53:25 +01:00
Ludovic Courtès 6b30eb189e
gexp: 'file-append' correctly handles bases without an expander.
This fixes this use case:

  (file-append (let-system ...) ...)

* guix/gexp.scm (file-append-compiler): When BASE lacks an expander,
delegate to LOWERED.
* tests/gexp.scm ("let-system in file-append"): New test.
2021-11-27 23:06:17 +01:00
Ludovic Courtès f9b1bb916c
daemon: Read substitute nar size as 'unsigned long long'.
Fixes <https://issues.guix.gnu.org/46212>.
Reported by Christopher Baines <mail@cbaines.net>.

Previously, the nar size returned by 'guix substitute' would be read as
an 'int'; thus, values above 2^31 - 1 would be read and then stored as
negative integers in the database.

Regression introduced in 9dfa20a22a.

* nix/libstore/build.cc (SubstitutionGoal::finished): Use templatized
'string2Int' instead of 'std::atoi' to get an 'unsigned long long',
which is the type of 'hash.second'.
* tests/store.scm ("substitute and large size"): New test.
2021-11-25 00:17:21 +01:00