Commit graph

1877 commits

Author SHA1 Message Date
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