me
/
guix
Archived
1
0
Fork 0
Commit Graph

1689 Commits (07f2e4993b5b80008273de0bb756659321e74183)

Author SHA1 Message Date
Xinglu Chen cfec09a992
import: hackage: Prefix licenses with 'license:'.
* guix/import/hackage.scm (string->license): Prefix the value of the license
field with ‘license:’.
* tests/hackage.scm (match-ghc-foo, match-ghc-foo-6, match-ghc-foo-revision):
Adjust accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-05-22 23:39:27 +02:00
Ludovic Courtès bc4d81d267
lint: archival: Lookup content in Disarchive database.
* guix/lint.scm (lookup-disarchive-spec): New procedure.
(check-archival): When 'lookup-content' returns #f, call
'lookup-disarchive-spec'.  Call 'lookup-directory' on the result of
'lookup-directory'.
* guix/download.scm (%disarchive-mirrors): Make public.
* tests/lint.scm ("archival: missing content"): Set
'%disarchive-mirrors'.
("archival: content unavailable but disarchive available"): New test.
2021-05-22 23:13:11 +02:00
Maxim Cournoyer b7297d66c5
services: configuration: Add a define-maybe/no-serialization syntax.
Before this change, using define-maybe along define-configuration with the
no-serialization syntactic keyword would result in the following warning:

  warning: possibly unbound variable `VARIABLE-NAME'

This change introduces the define-maybe/no-serialization variant that does
away with defining a serialization helper procedure, which makes it possible
to avoid the above warning.

* gnu/services/configuration.scm (define-maybe/no-serialization): New syntax.
(define-maybe-helper): New procedure.
(define-maybe): Define syntax using the above procedure.
* tests/services/configuration.scm (tests): Fix module name.
(custom-number-serializer): Do not print to standard output.
(maybe-number?, serialize-maybe-number): New procedures defined via the
define-maybe macro.
(config-with-maybe-number): New configuration.
(serialize-number): New procedure.
("maybe value serialization"): New test.
(maybe-string?): New procedure defined via the define-maybe/no-serialization
macro.
(config-with-maybe-string/no-serialization): New configuration.
("maybe value without serialization no procedure bound"): New test.
2021-05-17 23:27:39 -04:00
Ludovic Courtès 938ffcbb05
publish: Add '--negative-ttl'.
* guix/scripts/publish.scm (show-help, %options): Add '--negative-ttl'.
(render-narinfo, render-narinfo/cached, make-request-handler): Add #:negative-ttl
and honor it.
(run-publish-server): Add #:narinfo-negative-ttl and honor it.
(guix-publish): Honor '--negative-ttl'.
* tests/publish.scm ("negative TTL", "no negative TTL"): New tests.
2021-05-16 23:28:11 +02:00
Christopher Baines 97d615b176
inferior: Support querying package replacements.
I'm looking at this to help with adding support for looking up package
replacements to store in the Guix Data Service.

* guix/inferior.scm (inferior-package-replacement): New procedure.
* tests/inferior.scm ("inferior-package-replacement"): New test.
2021-05-15 12:14:47 +01:00
Maxim Cournoyer a77e3a5846
services: configuration: Add tests.
* tests/services/configuration.scm: New file.
* Makefile.am (SCM_TESTS): Register it.
2021-05-08 01:04:31 -04:00
Maxim Cournoyer 2354d79b88
tests: go: Remove duplicate go-version->git-ref test.
The duplicate test being removed has not much value given that
go-version->git-ref is a no-op for version strings not matching the
%go-pseudo-version-rx regexp; that case is already tested by the test above.

* tests/go.scm ("go-version omited 'v' character"): Remove test.

Reported-by: Tobias Geerinckx-Rice <me@tobias.gr>
2021-05-05 00:58:04 -04:00
Tobias Geerinckx-Rice 9f0bdfd186
tests: go: Fix typos in test descriptions.
* tests/go.scm: Fix ‘embeded’ typos.
2021-05-04 22:48:27 +02:00
Ludovic Courtès 9dc1c591a4
inferior: Make sure test refers to guile@3.0.
* tests/inferior.scm ("inferior-package-inputs"): Compare with
GUILE-3.0-LATEST since that's what 'lookup-inferior-packages' returns.
2021-04-29 01:22:04 +02:00
Ludovic Courtès 524c9800af
diagnostics, ui: Adjust to 'read-error' and 'syntax-error' in Guile 3.0.6.
* 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.
2021-04-29 01:22:04 +02:00
Ludovic Courtès d95168321f
import: Remove Nix importer.
This importer has suffered from bitrot and no longer works with current
Nix and Nixpkgs.  See <https://bugs.gnu.org/32339> and
<https://bugs.gnu.org/36255>.

* guix/import/snix.scm, guix/scripts/import/nix.scm,
tests/snix.scm: Remove.
* Makefile.am (MODULES, SCM_TESTS): Remove them.
* guix/scripts/import.scm (importers): Remove "nix".
* build-aux/test-env.in: Remove NIXPKGS variable.
* configure.ac: Remove '--with-nixpkgs' option.
* doc/guix.texi (Invoking guix import): Remove bit about "guix import
nix".
* etc/completion/fish/guix.fish: Likewise.
2021-04-20 12:13:16 +02:00
Xinglu Chen c68070e4ee
lint: Warn about underscores in package names.
As per section '16.4.2 Package Naming' in the manual, use hyphens
instead of underscores in package names.

* guix/lint.scm (check-name): Check whether the package name contains
underscores.
* tests/lint.scm ("name: use underscore in package name"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-16 23:25:23 +02:00
Mark H Weaver 1bab9b9f17
grafts: Support rewriting UTF-16 and UTF-32 store references.
Partially fixes <https://bugs.gnu.org/33848>.

* guix/build/graft.scm (replace-store-references): Add support for
finding and rewriting UTF-16 and UTF-32 store references.
* tests/grafts.scm: Add tests.
2021-04-15 03:22:55 -04:00
Ludovic Courtès b18f45c21f
Add (guix ipfs).
This module allows for communicating with the IPFS
gateway over the HTTP interface.  The commit has been
cherry-picked from <https://issues.guix.gnu.org/33899>.

The procedures for adding and restoring file trees have
been removed as according to a reply issue 33899, a different
format will be used.  The procedure 'add-data' has been
exported as it will be used in the system test for IPFS.

* guix/ipfs.scm: New file.
* Makefile.am (MODULES): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-04-12 18:42:22 +02:00
Maxim Cournoyer a8b927a562
import: go: Add an option to use pinned versions.
The ability to pin versions is handy when having to deal to packages that
bootstrap themselves through a chain of former versions.  Not using pinned
versions in these case could introduce dependency cycles.

* guix/build-system/go.scm (guix)
(%go-version-rx): Rename to...
(%go-pseudo-version-rx): ... this.  Simplify the regular expression, which in
turns makes it more robust.
* guix/build-system/go.scm (go-version->git-ref): Adjust following the above
rename.
(go-pseudo-version?): New predicate.
(go-module-latest-version): Rename to ...
(go-module-version-string): ... this.  Rename goproxy-url argument to just
goproxy.  Add a VERSION keyword argument, update docstring and adjust to have
it used.
(go-module-available-versions): New procedure.
(%go.mod-require-directive-rx): Document regexp.
(parse-go.mod): Harmonize the way dependencies are recorded to a list of lists
rather than a list of pairs, as done for other importers.  Rewrite to directly pass
multiple values rather than a record object.  Filter the replaced modules in a
functional style.
(go-module->guix-package): Add docstring.
[version, pin-versions?]: New arguments.  Rename the GOPROXY-URL argument to
GOPROXY.  Adjust to the new returned value of fetch-go.mod, which is a string.
Fail when the provided version doesn't exist.  Return a list dependencies and
their versions when in pinned versions mode, else just the dependencies.
(go-module-recursive-import)[version, pin-versions?]: New arguments.
Honor the new arguments and guard against network errors.
* guix/scripts/import/go.scm (%default-options): Register a default value for
the goproxy argument.
(show-help): Document that a version can be specified.  Remove the --version
argument and add a --pin-versions argument.
(%options)[version]: Remove option.
[pin-versions]: Add option.
(guix-import-go): Adjust so the version provided from the module name is
honored, along the new pin-versions? argument.
* tests/go.scm: Adjust and add new tests.
2021-04-09 22:41:32 -04:00
Maxim Cournoyer 6aee902eaf
import: go: Improve synopsis and description parsing.
* guix/import/go.scm (%strict-tokenizer?): Set parameter to #t.
(go-path-escape): Redefine to prevent inlining.
(http-get*): Replace by ...
(http-fetch*): this ...
(json-fetch*): New procedure.
(go.pkg.dev-info): Use http-fetch*.
(go-package-licenses): Rewrite in terms of go.pkg.dev-info.
(go-package-description): Likewise.
(go-package-synopsis): Likewise.
(fetch-go.mod): Use the memoized http-fetch*.
(parse-go.mod): Adjust to receive content as a string.
(fetch-module-meta-data): Adjust to use http-fetch*.
(go-module->guix-package): Adjust to the modified fetch-go.mod return value.
[inputs]: Use propagated inputs, which is the most common situations for Go
libraries.
[description]: Beautify description.
[licenses]: Do no check for #f.  The result of the license parsing is always a
list.
* tests/go.scm: Adjust following above changes.
2021-04-09 22:41:31 -04:00
Ludovic Courtès 2d73086262
daemon: 'guix substitute' replies on FD 4.
This avoids the situation where error messages would unintentionally go
to stderr and be wrongfully interpreted as a reply by the daemon.

Fixes <https://bugs.gnu.org/46362>.
This is a followup to ee3226e9d5.

* guix/scripts/substitute.scm (display-narinfo-data): Add 'port'
parameter and honor it.
(process-query): Likewise.
(process-substitution): Likewise.
(%error-to-file-descriptor-4?, with-redirected-error-port): Remove.
(%reply-file-descriptor): New variable.
(guix-substitute): Remove use of 'with-redirected-error-port'.  Define
'reply-port' and pass it to 'process-query' and 'process-substitution'.
* nix/libstore/build.cc (SubstitutionGoal::handleChildOutput): Swap
'builderOut' and 'fromAgent'.
* nix/libstore/local-store.cc (LocalStore::getLineFromSubstituter):
Likewise.
* tests/substitute.scm <top level>: Set '%reply-file-descriptor'
rather than '%error-to-file-descriptor-4?'.
2021-04-09 17:46:38 +02:00
Ludovic Courtès ceeea60bbc
gnu-maintenance: Recognize more source tarball naming schemes.
* guix/gnu-maintenance.scm (%package-name-rx): Add ".src" and ".orig"
suffixes.
* tests/gnu-maintenance.scm ("release-file?"): Add mpg321 and bvi
examples.
("tarball->version"): New test.
2021-04-05 12:03:09 +02:00
Cees de Groot c536f0b217
tests: Make 'publish' test umask-insensitive.
Fixes <https://bugs.gnu.org/47239>.
Reported by Konrad Hinsen <konrad.hinsen@fastmail.net>.

* tests/publish.scm ("with cache"): Pass the result of 'stat:perms' to
'logand' to be umask-insensitive.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-03-31 15:36:48 +02:00
Ludovic Courtès 1575da6062
gnu-maintenance: Recognize "-source" tarball suffix.
Fixes <https://bugs.gnu.org/47398>.
Reported by Léo Le Bouter <lle-bout@zaclys.net>.

* guix/gnu-maintenance.scm (%tarball-rx): Add "-[Ss]ource" suffix.
* tests/gnu-maintenance.scm ("release-file?"): Add exiv2 example.
2021-03-29 23:33:40 +02:00
Chris Marusich a16eb6c5f9
Add powerpc64le-linux as a supported Guix architecture.
This makes powerpc64le-linux a supported architecture for Guix, but not for
Guix System.

* Makefile.am (SUPPORTED_SYSTEMS): Add an entry for powerpc64le-linux.
* etc/guix-install.sh (chk_sys_arch): Same.
* guix/packages.scm (%supported-systems): Same.
* m4/guix.m4 (GUIX_ASSERT_SUPPORTED_SYSTEM): Same.
* tests/guix-build.sh (all_systems): Same.
2021-03-23 23:19:57 -07:00
Ludovic Courtès 1710e8cb59
gnu-maintenance: Accept underscores as package/version separators.
Fixes <https://bugs.gnu.org/47256>.
Reported by Léo Le Bouter <lle-bout@zaclys.net>.

* guix/gnu-maintenance.scm (%tarball-rx, %package-name-rx): Accept
underscore as the package/version separator in tarball names.
* tests/gnu-maintenance.scm ("release-file?"): Add "mediainfo" test.
2021-03-20 22:29:14 +01:00
Leo Famulari 0d8d499036
tests: Make the STORE test more robust in a "pure" environment.
Otherwise, the test crashes (not fails) when run in `guix environment --pure guix`.

Fixes <https://bugs.gnu.org/46445>.

* tests/store.scm (%shell): Fallback to "/bin/sh".
2021-03-18 15:16:07 -04:00
Tobias Geerinckx-Rice 5cbfddcb59
tests: Remove obsolete comment.
This follows up on commit c05ceaf2b6.

* tests/lint.scm: Remove comment.

Reported by morgansmith in #guix.
2021-03-13 16:03:22 +01:00
Ludovic Courtès d028aef31c
import: go: Compute the hash of Git checkouts.
* guix/import/go.scm (vcs-file?, file-hash, git-checkout-hash): New
procedures.
(vcs->origin): Use 'git-checkout-hash' in the 'git case.
2021-03-10 18:01:48 +01:00
Katherine Cox-Buday 02e2e093e8
import: Add Go importer.
This patch adds a 'guix import go' command.

* doc/guix.texi (Requirements): Mention Guile-Lib dependency.
(Invoking guix import): Document 'guix import go'.
* gnu/packages/package-management.scm (guix)[inputs, propagated-inputs]:
Add GUILE-LIB.
* guix/self.scm (compiled-guix)[guile-lib]: New variable.
[dependencies]: Add it.
(specification->package): Add "guile-lib".
* guix/build-system/go.scm (go-version->git-ref): New procedure.
* guix/import/go.scm, guix/scripts/import/go.scm, tests/go.scm: New files.
* guix/scripts/import.scm: Declare subcommand guix import go
* po/guix/POTFILES.in: Add 'guix/scripts/import/go.scm'.
* Makefile.am (MODULES): Add 'guix/import/go.scm' and
'guix/scripts/import/go.scm'.
(SCM_TESTS): Add 'tests/go.scm'.

Co-Authored-By: Helio Machado <0x2b3bfa0@gmail.com>
Co-Authored-By: Francois Joulaud <francois.joulaud@radiofrance.com>
Co-Authored-By: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Co-Authored-by: Ludovic Courtès <ludo@gnu.org>
2021-03-10 18:01:48 +01:00
Maxime Devos c05ceaf2b6
tests: do not hard code HTTP ports
Previously, test cases could fail if some process was listening
at a hard-coded port.  This patch eliminates most of these potential
failures, by automatically assigning an unbound port.  This should
allow for building multiple guix trees in parallel outside a build
container, though this is currently untested.

The test "home-page: Connection refused" in tests/lint.scm still
hardcodes port 9999, however.

* guix/tests/http.scm
  (http-server-can-listen?): remove now unused procedure.
  (%http-server-port): default to port 0, meaning the OS
  will automatically choose a port.
  (open-http-server-socket): remove the false statement claiming
  this procedure is exported and also return the allocated port
  number.
  (%local-url): raise an error if the port is obviously unbound.
  (call-with-http-server): set %http-server-port to the allocated
  port while the thunk is called.
* tests/derivations.scm: adjust test cases to use automatically
  assign a port.  As there is no risk of a port conflict now,
  do not make any tests conditional upon 'http-server-can-listen?'
  anymore.
* tests/elpa.scm: likewise.
* tests/lint.scm: likewise, and add a TODO comment about a port
  that is still hard-coded.
* tests/texlive.scm: likewise.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-03-06 11:41:48 +01:00
Ludovic Courtès 90ea8b16eb
profiles: 'package->manifest-entry' preserves transformations by default.
Previously, transformations applied from a manifest (rather than via
"guix install") would be lost.  This change fixes that and simplifies
things.

Reported by zimoun at
<https://lists.gnu.org/archive/html/guix-devel/2021-02/msg00153.html>.

* guix/profiles.scm (default-properties): New procedure.
(package->manifest-entry): Use it for #:properties.
* guix/scripts/pack.scm (guix-pack)[with-transformations]: Remove.
Remove caller.
* guix/scripts/package.scm (transaction-upgrade-entry): Remove calls to
'manifest-entry-with-transformations'.
* tests/guix-package.sh: Add test.
* tests/transformations.scm ("options->transformation + package->manifest-entry"):
New test.
2021-03-05 12:49:27 +01:00
Ludovic Courtès 9fc4e94986
gexp: #:references-graphs refers to non-native derivations.
Fixes a regression introduced in
c6d6aee6659acb293eb33f498fdac3b47a19a48, where #:reference-graphs would
end up referring to native inputs.

This would notably break the compilation of systems using a childhurd,
because they would attempt to build the 'hurd' package natively.

* guix/gexp.scm (lower-reference-graphs)[tuple->gexp-input]: Honor TARGET.
* tests/gexp.scm ("gexp->derivation #:references-graphs cross-compilation"):
New test.
2021-03-03 14:19:25 +01:00
Ludovic Courtès 7e9d9f28e9
syscalls: Add 'mounts' and the <mount> record type.
* guix/build/syscalls.scm (<mount>): New record type.
(option-string->mount-flags, mount-flags)
(octal-decode, mounts): New procedures.
(mount-points): Rewrite in terms of 'mount'.
* tests/syscalls.scm ("mounts"): New test.
2021-02-25 11:29:35 +01:00
Ludovic Courtès b57de6fea1
gexp: Micro-optimize 'gexp->sexp' and 'lower-inputs'.
* guix/gexp.scm (lower-inputs, gexp->sexp): Change keyword parameters to
positional parameters.  Adjust callers accordingly.
* tests/gexp.scm (gexp->sexp*, "gexp->file"): Adjust accordingly.
2021-02-23 15:24:48 +01:00
Ludovic Courtès 4fa9d48fd4
gexp: 'gexp-inputs' returns both native and non-native inputs.
This avoids double traversal of references and extra bookkeeping,
thereby further reducing memory allocations.

* guix/gexp.scm (lower-gexp): Include only one call to 'lower-inputs'.
(gexp-inputs): Remove #:native? parameter.
[set-gexp-input-native?]: New procedure.
[add-reference-inputs]: Use it.
(gexp-native-inputs): Remove.
* tests/gexp.scm (gexp-native-inputs): Remove.
(gexp-input->tuple): Include 'gexp-input-native?'.
("let-system")
("let-system, nested")
("ungexp + ungexp-native")
("ungexp + ungexp-native, nested")
("ungexp + ungexp-native, nested, special mixture")
("input list")
("input list + ungexp-native")
("input list splicing")
("input list splicing + ungexp-native-splicing")
("gexp list splicing + ungexp-splicing"): Adjust accordingly.
2021-02-23 15:24:48 +01:00
Ludovic Courtès fc6d6aee66
gexp: 'gexp-inputs' returns a list of <gexp-input> records.
This slightly reduces memory allocation.

* guix/gexp.scm (lower-inputs): Expect a list of <gexp-input> rather
than a list of tuples.
(lower-reference-graphs)[tuple->gexp-input]: New procedure.
Use it.
(gexp-inputs): Return a list of <gexp-input> rather than a list of
tuples.
* tests/gexp.scm (gexp-input->tuple): New procedure.
("one input package")
("one input package, dotted list")
("one input origin")
("one local file")
("one local file, symlink")
("one plain file")
("two input packages, one derivation, one file")
("file-append")
("file-append, output")
("file-append, nested")
("let-system")
("let-system, nested")
("ungexp + ungexp-native")
("ungexp + ungexp-native, nested")
("ungexp + ungexp-native, nested, special mixture")
("input list")
("input list + ungexp-native")
("input list splicing")
("input list splicing + ungexp-native-splicing")
("gexp list splicing + ungexp-splicing"): Adjust accordingly.
2021-02-23 15:24:48 +01:00
Ludovic Courtès 9a38bed2cf
packages: 'package-field-location' handles 'search-path' returning #f.
Fixes <https://bugs.gnu.org/46390>.
Reported by zimoun <zimon.toutoune@gmail.com>.

This is similar to the fix in d10474c38d.

* guix/packages.scm (package-field-location): Handle FILE not in %LOAD-PATH.
* tests/guix-lint.sh: Add test.
2021-02-22 12:07:45 +01:00
Mathieu Othacehe 6e8cdf1d26
scripts: system: Accept <image> records as input.
* guix/scripts/system.scm (system-derivation-for-action): Replace "os"
argument by "image". Remove "image-size", "image-type", "label" and
"volatile-root?"  arguments.
(perform-action): Ditto.
(process-action): Construct the <image> record and pass it to "perform-action"
procedure.
* tests/guix-system.sh: Adapt accordingly.
* gnu/system/images/hurd.scm: Return the default image.
* gnu/system/images/novena.scm: Ditto.
* gnu/system/images/pine64.scm: Ditto.
* gnu/system/images/pinebook-pro.scm Ditto.
2021-02-17 10:57:02 +01:00
Mathieu Othacehe ee2a5da80a
scripts: system: Remove 'vm-image' command.
Remove the 'vm-image' command that has been superseded by the 'image'
command.

* gnu/system/vm.scm (system-qemu-image): Remove it.
* guix/scripts/system.scm (system-derivation-for-action): Mark 'vm-image'
command as deprecated and use the image API to produce the VM image.
(perform-action, show-help): Adapt accordingly.
* tests/guix-system.sh: Ditto.
* doc/guix.texi (Invoking guix system,
Running Guix in a VM): Ditto.
* etc/completion/fish/guix.fish: Ditto.
* etc/completion/zsh/_guix: Ditto.
2021-02-17 10:52:28 +01:00
Simon South db6b9d2f4b
services: Add transmission-daemon service.
* gnu/services/file-sharing.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
* po/packages/POTFILES.in: Add it.
* tests/services/file-sharing.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
* doc/guix.texi (File-Sharing Services): New section.

Signed-off-by: 宋文武 <iyzsong@member.fsf.org>
2021-02-12 15:11:36 +08:00
zimoun 9505b54a4f
utils: Add string distance.
* guix/utils.scm (string-distance): New procedure.
(string-closest): New procedure.
* tests/utils.scm ("string-distance", "string-closest"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-02-03 12:41:28 +01:00
Ludovic Courtès 9fd7b050e2
guix package: Add '--export-manifest'.
* guix/scripts/package.scm (export-manifest): New procedure.
(show-help, %options): Add '--export-manifest'.
(process-query): Honor it.
* guix/build/profiles.scm (build-profile): Mention it.
* tests/guix-package.sh: Test it.
* doc/guix.texi (Invoking guix package): Document it.
2021-02-01 17:32:35 +01:00
Ludovic Courtès 579506e272
utils: Add 'version-unique-prefix'.
* guix/utils.scm (version-unique-prefix): New procedure.
* tests/utils.scm ("version-unique-prefix"): New test.
2021-02-01 17:32:34 +01:00
Ludovic Courtès b41e21488f
profiles: Add 'manifest->code'.
* guix/profiles.scm (manifest->code): New procedure.
* tests/profiles.scm ("manifest->code, simple")
("manifest->code, simple, versions")
("manifest->code, transformations"): New tests.
2021-02-01 17:32:31 +01:00
Ludovic Courtès 73744725dd
tests: Optimize 'fold-available-packages' test.
This test goes from 58s to 10s wall-clock time.

Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

* tests/packages.scm ("fold-available-packages with/without cache"):
Remove 'find-duplicates'.  Add 'list->set*' and use it instead of
'find-duplicates', 'delete-duplicates', and 'lset='.
2021-02-01 16:07:18 +01:00
Ludovic Courtès 13a7d2a538
database: Validate #:nar-size and #:time when registering store items.
* guix/store/database.scm (assert-integer): New procedure.
(update-or-insert): Use it to validate NAR-SIZE and TIME.
* tests/store-database.scm ("sqlite-register with incorrect size"): New
test.
2021-01-31 21:49:58 +01:00
Ludovic Courtès b84152439c
guix system: Test 'extension-graph' and 'shepherd-graph'.
* tests/guix-system.sh: Test 'guix system extension-graph' and 'guix
system shepherd-graph'.
2021-01-30 15:36:58 +01:00
Ludovic Courtès 7df3ab0f0d
store: Add 'find-roots' RPC.
* guix/serialization.scm (read-string-pairs): New procedure.
* guix/store.scm (read-arg): Add support for 'string-pairs'.
(find-roots): New procedure.
* tests/store.scm ("add-indirect-root and find-roots"): New test.
2021-01-22 08:36:03 +01:00
Ludovic Courtès 5225732b9b
swh: Test proper handling of null visit snapshot URL.
* tests/swh.scm (%origin): Change "visits_url" to "origin_visits_url".
(%visits): New variable.
("origin-visit, no snapshots"): New test.
2021-01-21 11:22:08 +01:00
Ludovic Courtès 98d3abe744
repl: Fix exception handling for interpreted code.
The 'stack' variable could be #f when code is interpreted, which in
practice happens when running in "legacy" mode--i.e., when
'open-inferior' invokes "guile" instead of "guix repl".

* guix/repl.scm (send-repl-response)[handle-exception]: Check whether
STACK is true before passing it to 'stack->frames'.
* tests/inferior.scm ("&inferior-exception, legacy mode"): New test.
2021-01-21 00:14:38 +01:00
Ludovic Courtès 074a201c33
inferior: Add 'inferior-eval-with-store' tests.
* tests/inferior.scm ("inferior-eval-with-store, exception")
("inferior-eval-with-store, not a procedure"): New tests.
2021-01-21 00:14:38 +01:00
Ludovic Courtès 9ab817b2a4
transformations: Add '--with-latest'.
* guix/upstream.scm (upstream-source-compiler): New procedure.
(%updaters): Set! it.
* guix/transformations.scm (transform-package-latest): New procedure.
(%transformations): Add 'with-latest'.
(%transformation-options, show-transformation-options-help/detailed):
Add '--with-latest'.
* tests/transformations.scm ("options->transformation, with-latest"):
New test.
* doc/guix.texi (Package Transformation Options): Document it.
2021-01-19 17:45:39 +01:00
JOULAUD François 4d79f072cc
environment: Fix '--root' option with relative file name.
The path normalization of `--root` option of `guix environment` was
buggy as it appended full argument after normalized directory. This
patch fixes it.

* guix/scripts/environment.scm (register-gc-root): Fix gc-root path
normalization.
* tests/guix-environment.sh: Add test.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-01-19 17:45:38 +01:00
Mathieu Othacehe e74baa1245
system: Rename 'disk-image' command 'image'.
* guix/scripts/system.scm (system-derivation-for-action): Rename 'disk-image'
command 'image'. Warn when using the now deprecated 'disk-image' command.
(show-help): Adapt accordingly.
(guix-system): Ditto.
* tests/guix-system.sh: Ditto.
* gnu/system/examples/bare-hurd.tmpl: Ditto.
* doc/guix.texi (Building the Installation Image,
Building the Installation Image for ARM Boards,
Invoking guix pack,
Invoking guix system): Adapt documentation.
2021-01-19 17:16:56 +01:00
Simon South 181f290aa2
services: openntpd: Remove support for deprecated "-s" option.
* gnu/services/networking.scm (openntpd-configuration): Remove
"allow-large-adjustment?" field.
(openntpd-shepherd-service): Remove use of "allow-large-adjustment?"
configuration field and "-s" daemon option.
* tests/networking.scm (%openntpd-conf-sample): Remove
"allow-large-adjustment?" field.
* doc/guix.texi (Networking Services)[openntpd-service-type]: Remove
"allow-large-adjustment?" field from sample configuration.
[openntpd-configuration]: Remove description of "allow-large-adjustment?"
field.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-01-16 23:30:59 +01:00
Christopher Baines 681af17460
guix: Move narinfo code from substitute script to module.
This separation between the code for dealing with narinfos from the code doing
that for a purpose should make things clearer, and better support components
other that the substitute script in using this code.

This is just moving the code around, no code should have been significantly
changed.

* guix/scripts/substitute.scm (<narinfo>): Move record type to (guix narinfo).
(fields->alist, narinfo-hash-algorithm+value, narinfo-hash->sha256,
narinfo-signature->canonical-sexp, narinfo-maker, read-narinfo,
narinfo-sha256, valid-narinfo?, write-narinfo, narinfo->string,
string->narinfo, equivalent-narinfo?, supported-compression?,
compresses-better?, narinfo-best-uri): Move procedures to (guix narinfo).
(%compression-methods): Move variable to (guix narinfo).
* guix/narinfo.scm: New file.
* Makefile.am (MODULES): Add it.
* po/guix/POTFILES.in: Add 'guix/narinfo.scm'.
2021-01-16 11:51:03 +00:00
Ludovic Courtès 23862011c3
tests: Fix JSON syntax error in 'crate.scm'.
This issue is caught with Guile-JSON 4.4.1, but not by 4.3.2.

* tests/crate.scm (test-root-dependencies): Add missing comma.
2021-01-13 22:42:49 +01:00
Ludovic Courtès d288a4de7d
publish: Add support for zstd compression.
* guix/scripts/publish.scm (compress-nar)[write-compressed-file]: New
procedure.
Use it for 'gzip' and 'lzip'.  Add 'zstd.
(nar-response-port, string->compression-type): Add case for 'zstd'.
* tests/publish.scm (zstd-supported?): New procedure.
("/nar/zstd/*"): New test.
* doc/guix.texi (Invoking guix publish): Document zstd compression.
(Base Services): Add cross-reference to the above node.
2021-01-13 22:24:19 +01:00
Ludovic Courtès db0cecdf6b
utils: Support zstd compression via Guile-zstd.
* guix/utils.scm (lzip-port): Return a single value.
(zstd-port): New procedure.
(decompressed-port, compressed-output-port): Add 'zstd' case.
* tests/utils.scm (test-compression/decompression): Test 'zstd' when
the (zstd) module is available.
2021-01-13 22:24:19 +01:00
Ludovic Courtès 0d04658710
utils: Remove 'compressed-output-port'.
This procedure was unused except in one test.

* guix/utils.scm (compressed-port): Remove.
* tests/utils.scm (test-compression/decompression): Rewrite to use
'compressed-output-port' instead.
2021-01-13 22:24:19 +01:00
Ludovic Courtès 0d22fc8d36
services: shepherd: 'shepherd-service-type' requires documentation.
* gnu/services/shepherd.scm (shepherd-service-type): Require a
'description' form.
* gnu/services/base.scm (root-file-system-service-type)
(rngd-service-type, host-name-service-type):
(virtual-terminal-service-type, console-keymap-service-type)
(syslog-service-type, swap-service-type)
(kmscon-service-type): Add description.
* gnu/services/networking.scm (dhcp-client-service-type): Likewise.
* gnu/system/install.scm (cow-store-service-type): Likewise.
* gnu/system/linux-container.scm (dummy-networking-service-type):
Likewise.
* gnu/system/mapped-devices.scm (device-mapping-service-type):
Likewise.
* tests/guix-system.sh: Likewise.
2021-01-13 22:24:18 +01:00
Ludovic Courtès ed63b7f87e
guix hash: Honor '-H' when used alongside '-r'.
* guix/scripts/hash.scm (guix-hash): When 'recursive? is true, use
'open-hash-port' instead of 'open-sha256-port'.
* tests/guix-hash.sh: Add test for 'guix hash -r -H sha512'.
2021-01-04 11:51:48 +01:00
Ludovic Courtès e38d90d497
transformations: Add '--with-patch'.
Suggested by Philippe Swartvagher <philippe.swartvagher@inria.fr>.

* guix/transformations.scm (transform-package-patches): New procedure.
(%transformations): Add it as 'with-patch'.
(%transformation-options, show-transformation-options-help/detailed):
Add '--with-patch'.
* tests/transformations.scm ("options->transformation, with-patch"): New
test.
* doc/guix.texi (Package Transformation Options): Document it.
2020-12-27 17:23:40 +01:00
Ricardo Wurmus 5aae614868
import/utils: alist->package: Handle SPDX license names only as fallback.
Fixes <https://bugs.gnu.org/45453>.

* guix/import/utils.scm (alist->package): Find plain license names in (guix
licenses) first, and only fall back to SPDX names on error.
* tests/import-utils.scm ("alist->package with SPDX license name 1/2",
"alist->package with SPDX license name 2/2"): New tests.
2020-12-27 12:06:49 +01:00
Miguel Ángel Arruga Vivas f00e68ace0
system: Allow separated /boot and encrypted root.
* gnu/bootloader/grub.scm (grub-configuration-file): New parameter
store-crypto-devices.
[crypto-devices]: New helper function.
[builder]: Use crypto-devices.
* gnu/machine/ssh.scm (roll-back-managed-host): Use
boot-parameters-store-crypto-devices to provide its contents to the
bootloader configuration generation process.
* gnu/tests/install.scm (%encrypted-root-not-boot-os,
%encrypted-root-not-boot-os): New os declaration.
(%encrypted-root-not-boot-installation-script): New script, whose contents
were initially taken from %encrypted-root-installation-script.
(%test-encrypted-root-not-boot-os): New test.
* gnu/system.scm (define-module): Export
operating-system-bootoader-crypto-devices and
boot-parameters-store-crypto-devices.
(<boot-parameters>): Add field store-crypto-devices.
(read-boot-parameters): Parse store-crypto-devices field.
[uuid-sexp->uuid]: New helper function extracted from
device-sexp->device.
(operating-system-bootloader-crypto-devices): New function.
(operating-system-bootcfg): Use
operating-system-bootloader-crypto-devices to provide its contents to
the bootloader configuration generation process.
(operating-system-boot-parameters): Add store-crypto-devices to the
generated boot-parameters.
(operating-system-boot-parameters-file): Likewise to the file with
the serialized structure.
* guix/scripts/system.scm (reinstall-bootloader): Use
boot-parameters-store-crypto-devices to provide its contents to the
bootloader configuration generation process.
* tests/boot-parameters.scm (%default-store-crypto-devices): New
variable.
(%grub-boot-parameters, test-read-boot-parameters): Use
%default-store-crypto-devices.
(tests store-crypto-devices): New tests.
2020-12-21 18:41:11 +01:00
Ludovic Courtès 5275512870
tests: Check the effect of '--without-tests' on implicit inputs.
* tests/transformations.scm ("options->transformation, without-tests"):
Ensure TAR has #:tests? #f.
2020-12-21 17:47:35 +01:00
Ludovic Courtès 9608f4003d
tests: Fix malformed JSON.
Guile-JSON 4.3.2 would parse in spite of these typos, but 4.4.1 is
stricter.

* tests/swh.scm (%directory-entries): Add missing comma.
* tests/cve-sample.json: Likewise.
2020-12-21 17:47:35 +01:00
Ludovic Courtès 3c799ccb98
tests: Make sure substituted items are deduplicated.
* tests/store.scm ("substitute, deduplication"): New test.
2020-12-19 23:25:01 +01:00
Ludovic Courtès 77a1efed9e
tests: Check the mtime and permissions of substituted items.
* tests/store.scm ("substitute")
("substitute + build-things with output path")
("substitute + build-things with specific output"): Call 'canonical-file?'.
* tests/substitute.scm ("substitute, authorized key"): Check the mtime
and permissions of "substitute-retrieved".
2020-12-19 23:25:01 +01:00
Ludovic Courtès 9dfa20a22a
daemon: Let 'guix substitute' perform hash checks.
This way, the hash of the store item can be computed as it is restored,
thereby avoiding an additional file tree traversal ('hashPath' call)
later on in the daemon.  Consequently, it should reduce latency between
subsequent substitute downloads.

This is a followup to 5ff521452b.

* guix/scripts/substitute.scm (narinfo-hash-algorithm+value): New
procedure.
(process-substitution): Wrap INPUT into a hash input port, 'hashed', and
read from it.  Compare the actual and expected hashes, and print a
"hash-mismatch" status line when they differ.  When they match, print
not just "success" but also the nar hash and size.
* nix/libstore/build.cc (class SubstitutionGoal)[expectedHashStr]:
Remove.
(SubstitutionGoal::finished): Tokenize 'status'.  Parse it and handle
"success" and "hash-mismatch" accordingly.  Call 'hashPath' only when
the returned hash is not SHA256.
(SubstitutionGoal::handleChildOutput): Remove 'expectedHashStr'
handling.
* tests/substitute.scm ("substitute, invalid hash"): Rename to...
("substitute, invalid narinfo hash"): ... this.
("substitute, invalid hash"): New test.
2020-12-19 23:25:00 +01:00
Ludovic Courtès 6d955f1731
tests: Check the build trace for hash mismatches on substitutes.
* tests/store.scm ("substitute, corrupt output hash, build trace"): New
test.
2020-12-19 23:25:00 +01:00
Ludovic Courtès 7530e491b5
deduplicate: Create the '.links' directory lazily.
This avoids repeated (mkdir-p "/gnu/store/.links") calls when
deduplicating lots of files.

* guix/store/deduplication.scm (deduplicate): Remove initial call to
'mkdir-p'.  Add ENOENT case in 'link' exception handler.  Reindent.
* tests/store-deduplication.scm ("deduplicate, ENOSPC"): Check
for (<= links 4) to account for the initial 'link' call.
2020-12-15 17:32:12 +01:00
Ludovic Courtès 3169c93903
database: Remove 'register-path'.
* guix/store/database.scm (register-path): Remove.
* tests/store-database.scm ("register-path"): Rename to...
("register-items"): ... this, and use 'register-items' instead of
'register-path'.
("register-path, directory"): Rename to...
("register-items, directory"): ... this, and use 'register-items'
instead of 'register-path'.
("register-path with unregistered references"): Rename to...
("sqlite-register with unregistered references"): ... this.
2020-12-15 17:32:11 +01:00
Ludovic Courtès 0682cc5936
database: Remove #:deduplicate? and #:reset-timestamps? from 'register-path'.
* guix/store/database.scm (register-path): Remove #:deduplicate?
and #:reset-timestamps?.
* guix/scripts/system.scm (copy-item): Adjust accordingly.
* tests/store-database.scm ("register-path")
("register-path, directory"): Call 'reset-timestamps'.
2020-12-15 17:32:11 +01:00
Ludovic Courtès 6a060ff27f
store-copy: 'populate-store' can optionally deduplicate files.
Until now deduplication was performed as an additional pass after
copying files, which involve re-traversing all the files that had just
been copied.

* guix/store/deduplication.scm (copy-file/deduplicate): New procedure.
* tests/store-deduplication.scm ("copy-file/deduplicate"): New test.
* guix/build/store-copy.scm (populate-store): Add #:deduplicate?
parameter and honor it.
* tests/gexp.scm ("gexp->derivation, store copy"): Pass #:deduplicate? #f
to 'populate-store'.
* gnu/build/image.scm (initialize-root-partition): Pass #:deduplicate?
to 'populate-store'.  Pass #:deduplicate? #f to 'register-closure'.
* gnu/build/vm.scm (root-partition-initializer): Likewise.
* gnu/build/install.scm (populate-single-profile-directory): Pass
 #:deduplicate? #f to 'populate-store'.
* gnu/build/linux-initrd.scm (build-initrd): Likewise.
* guix/scripts/pack.scm (self-contained-tarball)[import-module?]: New
procedure.
[build]: Pass it as an argument to 'source-module-closure'.
* guix/scripts/pack.scm (squashfs-image)[build]: Wrap in
'with-extensions'.
* gnu/system/linux-initrd.scm (expression->initrd)[import-module?]: New
procedure.
[builder]: Pass it to 'source-module-closure'.
* gnu/system/install.scm (cow-store-service-type)[import-module?]: New
procedure.  Pass it to 'source-module-closure'.
2020-12-15 17:32:10 +01:00
Ludovic Courtès 7b8d239ec2
store-copy: 'populate-store' resets timestamps.
Until now, 'populate-store' would reset permissions but not timestamps,
so callers would resort to going through an extra directory traversal to
reset timestamps.

* guix/build/store-copy.scm (reset-permissions): Remove.
(copy-recursively): New procedure.
(populate-store): Pass #:keep-permissions? to 'copy-recursively'.
Remove call to 'reset-permissions'.
* tests/gexp.scm ("gexp->derivation, store copy"): In BUILD-DRV, check
whether 'populate-store' canonicalizes permissions and timestamps.
* gnu/build/image.scm (initialize-root-partition): Pass #:reset-timestamps? #f
to 'register-closure'.
* gnu/build/vm.scm (root-partition-initializer): Likewise.
2020-12-15 17:32:10 +01:00
Ludovic Courtès 2718c29c3f
nar: Deduplicate files right as they are restored.
This avoids having to traverse and re-read the files that we have just
restored, thereby reducing I/O.

* guix/serialization.scm (dump-file): New procedure.
(restore-file): Add #:dump-file parameter and honor it.
* guix/store/deduplication.scm (tee, dump-file/deduplicate): New
procedures.
* guix/nar.scm (restore-one-item): Pass #:dump-file to 'restore-file'.
(finalize-store-file): Pass #:deduplicate? #f to 'register-items'.
* tests/nar.scm <top level>: Call 'setenv' to set "NIX_STORE".
2020-12-15 17:32:09 +01:00
Ludovic Courtès ed7d02f7c1
serialization: 'restore-file' sets canonical timestamp and permissions.
* guix/serialization.scm (restore-file): Set the permissions and mtime
of FILE.
* guix/nar.scm (finalize-store-file): Pass #:reset-timestamps? #f to
'register-items'.
* tests/nar.scm (rm-rf): Add 'chmod' calls to ensure files are writable.
("write-file + restore-file with symlinks"): Ensure every file in OUTPUT
passes 'canonical-file?'.
* tests/guix-archive.sh: Run "chmod -R +w" before "rm -rf".
2020-12-15 17:32:09 +01:00
Ludovic Courtès 465d2cb286
serialization: 'fold-archive' notifies about directory processing completion.
* guix/serialization.scm (fold-archive): Call PROC with a
'directory-complete tag when done with a directory.
(restore-file): Handle it.
* guix/scripts/archive.scm (list-contents): Likewise.
* guix/scripts/challenge.scm (archive-contents): Likewise.
* tests/nar.scm ("write-file-tree + fold-archive"): Adjust accordingly.
2020-12-15 17:32:09 +01:00
Giacomo Leidi 371ba7b4be
guix: Add globstar support.
* guix/glob.scm (string->sglob)
(glob-match?): Add globstar support.
* tests/glob.scm: Update accordingly.

Signed-off-by: Jelle Licht <jlicht@fsfe.org>
2020-12-09 22:25:17 +01:00
Ludovic Courtès 799f066768
import: opam: Adjust test to latest 'opam->guix-package' changes.
This is a followup to a8dccd4bdc, which
broke the test.

* guix/import/opam.scm (get-opam-repository): Prevent inlining.
* tests/opam.scm ("opam->guix-package"): Mock 'get-opam-repository'.
2020-12-08 22:58:37 +01:00
Ludovic Courtès 711df9ef3c
daemon: Run 'guix substitute --substitute' as an agent.
This avoids spawning one substitute process per substitution.

* nix/libstore/build.cc (class Worker)[substituter]: New field.
[outPipe, logPipe, pid]: Remove.
(class SubstitutionGoal)[expectedHashStr, status, substituter]: New fields.
(SubstitutionGoal::timedOut): Adjust to check 'substituter'.
(SubstitutionGoal::tryToRun): Remove references to 'outPipe' and
'logPipe'.  Run "guix substitute --substitute" as an 'Agent'.  Send the
request with 'writeLine'.
(SubstitutionGoal::finished): Likewise.
(SubstitutionGoal::handleChildOutput): Change to fill in
'expectedHashStr' and 'status'.
(SubstitutionGoal::handleEOF): Call 'wakeUp' unconditionally.
(SubstitutionGoal::~SubstitutionGoal): Adjust to check 'substituter'.
* guix/scripts/substitute.scm (process-substitution): Write "success\n"
to stdout upon success.
(%error-to-file-descriptor-4?): New variable.
(guix-substitute): Set 'current-error-port' to file descriptor 4
unless (%error-to-file-descriptor-4?) is false.
Remove "--substitute" arguments.  Loop reading line from stdin.
* tests/substitute.scm <top level>: Call '%error-to-file-descriptor-4?'.
(request-substitution): New procedure.
("substitute, no signature")
("substitute, invalid hash")
("substitute, unauthorized key")
("substitute, authorized key")
("substitute, unauthorized narinfo comes first")
("substitute, unsigned narinfo comes first")
("substitute, first narinfo is unsigned and has wrong hash")
("substitute, first narinfo is unsigned and has wrong refs")
("substitute, two invalid narinfos")
("substitute, narinfo with several URLs"): Adjust to new "guix
substitute --substitute" calling convention.
2020-12-08 22:30:08 +01:00
Ludovic Courtès 79c6614f58
daemon: Use 'Agent' to spawn 'guix substitute --query'.
* nix/libstore/local-store.hh (RunningSubstituter): Remove.
(LocalStore)[runningSubstituter]: Change to unique_ptr<Agent>.
[setSubstituterEnv, didSetSubstituterEnv]: Remove.
[getLineFromSubstituter, getIntLineFromSubstituter]: Take an 'Agent'.
* nix/libstore/local-store.cc (LocalStore::~LocalStore): Remove
reference to 'runningSubstituter'.
(LocalStore::setSubstituterEnv, LocalStore::startSubstituter): Remove.
(LocalStore::getLineFromSubstituter): Adjust to 'run' being an 'Agent'.
(LocalStore::querySubstitutablePaths): Spawn substituter agent if
needed.  Adjust to 'Agent' interface.
(LocalStore::querySubstitutablePathInfos): Likewise.
* nix/libstore/build.cc (SubstitutionGoal::tryToRun): Remove call to
'setSubstituterEnv' and add 'setenv' call for "_NIX_OPTIONS" instead.
(SubstitutionGoal::finished): Remove 'readLine' call for 'dummy'.
* guix/scripts/substitute.scm (%allow-unauthenticated-substitutes?):
Remove second argument to 'make-parameter'.
(process-query): Call 'warn-about-missing-authentication'
when (%allow-unauthenticated-substitutes?) is #t.
(guix-substitute): Wrap body in 'parameterize'.  Set 'guix-warning-port'
too.  No longer exit when 'substitute-urls' returns the empty list.  No
longer print newline initially.
* tests/substitute.scm (test-quit): Parameterize 'current-error-port' to
account for the port changes in 'guix-substitute'.
2020-12-08 22:30:08 +01:00
Julien Lepiller 15ee1b8317
guix: opam: Pass default repository to recursive importer.
* guix/import/opam.scm (opam->guix-package): Rename #:repository key
to #:repo.
(opam-recursive-import): Pass #:repo keyword.
* tests/opam.scm (opam->guix-package): Rename #:repository to #:repo.
2020-12-08 16:40:30 +01:00
Chris Marusich d8ae785205
tests: lint: Add origin patch file name test cases.
In particular, "<origin> patches: same file name -> no warnings" would
have caught the issue which was fixed in commit
21887021b9.

* tests/lint.scm (patches: file names): Rename this test case...
("file patches: different file name -> warning"): ... to this.
("file patches: same file name -> no warnings")
("<origin> patches: different file name -> warning")
("<origin> patches: same file name -> no warnings"): New test cases.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-12-07 12:48:26 +01:00
Leo Prikler 07340cbebc
profiles: Delete duplicate manifest entries in packages->manifest.
* gnu/profiles.scm (packages->manifest): Delete duplicate entries.
* tests/profiles.scm ("packages->manifest, no duplicates"): New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-12-07 12:48:26 +01:00
Leo Prikler f5d952c5f5
profiles: Remove duplicates in manifest transactions.
Fixes <https://bugs.gnu.org/23874>.
Reported by Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>.

* guix/profiles.scm (manifest-transaction-effects): Delete duplicates in
install and remove.  Let multiple upgrades and downgrades shadow previous
transactions of the same kind.
* tests/profiles.scm
("manifest-transaction-effects no double install or upgrades")
("manifest-transaction-effects no double downgrade")
("manifest-transaction-effects no double removal"): New tests.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-12-07 12:48:25 +01:00
Ludovic Courtès e3065ec117
import: crate: Skip tests when Guile-Semver is missing.
* guix/import/crate.scm: Add comment for the 'module-autoload!' calls.
* tests/crate.scm (have-guile-semver?): New variable.
("crate->guix-package", "cargo-recursive-import")
("cargo-recursive-import-hoors-existing-packages"): Skip when
HAVE-GUILE-SEMVER? is false.
2020-12-04 16:59:26 +01:00
Paul Garlick a67b82475d
tests: pack-relocatable: Ensure commands can run in the current namespace.
* tests/guix-pack-relocatable (run_without_store): Use subshell to run
commands in the current namespace.  This avoids shell syntax and parsing
errors.
2020-12-04 13:12:08 +00:00
Hartmut Goebel 054e308f5d
import: crate: Use existing package satisfying semver requirement.
If a package satisfying the dependency's semver requirement already exists,
use it. Prior to this change the highest version matching the semver
requirement was used (and imported in case it was not defined as package
already).

When resolving a dependency (now done in `sort-map-dependencies`), first
search for a package matching the semver requirement and only if this fails
reach out for a crate.

* guix/import/crate.scm (crate->guix-package)[find-package-version]: New
  function. [dependency-name+version]: New function.
  [sort-map-dependencies]: Use it instead of lambda function.

* tests/crate.scm (test-doctool-crate, test-doctool-dependencies): New
  variables.
  ("self-test …", "cargo-recursive-import-hoors-existing-packages"): New
  tests.
2020-12-02 22:09:23 +01:00
Hartmut Goebel 45584061a9
import: crate: Trim version for names after left-most non-zero part.
This complies to how versions are matched for caret requirements in crates:
An update is allowed if the new version number does not modify the left-most
non-zero digit in the major, minor, patch grouping.

* guix/import/crate.scm (version->semver-prefix): New function.
  (make-crate-sexp)[format-inputs]: Use it.
  (make-crate-sexp): Use it to pass shorter version to package->definition.
* guix/import/utils.scm (package->definition): Change optional parameter
  APPEND-VERSION? into APPEND-VERSION?/STRING. If it is a string, append its
  value to name.
* tests/crate.scm: Adjust tests accordingly.
2020-12-02 22:09:23 +01:00
Hartmut Goebel 9a48e35be8
import: utils: Trim patch version from names.
This remove the patch version from generated package names. For example
'rust-my-crate-1.1.2' now becomes 'rust-my-crate-1.1'.

* guix/import/utils.scm (package->definition): Trim patch version from
  generated package names.
* tests/crate.scm: (cargo>guix-package, cargo-recursive-import): Likewise.
2020-12-02 22:09:23 +01:00
Martin Becze 50fbb3f032
import: crate: Parameterized importing of dev dependencies.
The recursive crate importer will now include development dependencies only
for the top level package, but not for any of the recursively imported
packages.  Also #:skip-build will be false for the top-most package.

* guix/import/crate.scm (make-crate-sexp): Add the key BUILD?.
  (crate->guix-package): Add the key INCLUDE-DEV-DEPS?.
  (crate-recursive-import): Likewise.
* guix/scripts/import/crate.scm (guix-import-crate): Likewise.
* tests/crate.scm (cargo-recursive-import): Likewise.
2020-12-02 22:09:23 +01:00
Martin Becze 269c1db41b
import: crate: Use guile-semver to resolve module versions.
* guix/import/crate.scm: Add guile-semver as a soft dependency.
  (make-crate-sexp): Don't allow other keys. Add '#:skip-build?' to build
  system args. Pass a VERSION argument to 'cargo-inputs'.
  (crate->guix-package): Use guile-semver to resolve the correct module
  versions. Treat "build" dependencies as normal dependencies.
  (crate-name->package-name): Reuse the procedure 'guix-name' instead of
  duplicating its logic.
* guix/import/utils.scm (package-names->package-inputs): Implement
  handling of (name version) pairs.
* guix/scripts/import/crate.scm (guix-import-crate): Use
  crate-recursive-import instead of duplicate code.
* tests/crate.scm (recursive-import): Change test packages versions to be
  distinguishable. Add version data to the test. Check created symbols, too.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
2020-12-02 22:09:23 +01:00
Martin Becze bea3b17739
import: utils: 'recursive-import' accepts an optional version parameter.
This adds a key VERSION to 'recursive-import' and moves the parameter REPO to
a key. This also changes all the places that rely on 'recursive-import'.

* guix/import/utils.scm (recursive-import): Add the VERSION key. Make REPO a
  key.
  (package->definition): Add optional 'append-version?'.
* guix/scripts/import/crate.scm (guix-import-crate): Add the VERSION key.
* guix/import/crate.scm (crate->guix-package): Add the VERSION key.
  (crate-recursive-import): Pass VERSION to recursive-import, remove now
  unnecessary code.
* guix/import/cran.scm (cran->guix-package, cran-recursive-import): Change the
  REPO parameter to a key.
* guix/import/elpa.scm (elpa->guix-package, elpa-recursive-import): Likewise.
* guix/import/gem.scm (gem->guix-package, recursive-import): Likewise.
* guix/import/opam.scm (opam-recurive-import): Likewise.
* guix/import/pypi.scm (pypi-recursive-import): Likewise.
* guix/import/stackage.scm (stackage-recursive-import): Likewise.
* guix/scripts/import/cran.scm (guix-import-cran): Likewise.
* guix/scripts/import/elpa.scm (guix-import-elpa): Likewise.
* tests/elpa.scm (eval-test-with-elpa): Likewise.
* tests/import-utils.scm (recursive-import): Likewise.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
2020-12-02 22:09:23 +01:00
Timothy Sample 464b1fffb0
lint: Add 'check-haskell-stackage' checker.
* guix/lint.scm (check-haskell-stackage): New procedure.
(%network-dependent-checkers): Add 'haskell-stackage' checker.
* guix/import/hackage.scm (%hackage-url): New variable.
(hackage-source-url, hackage-cabal-url): Use it in place of a
hard-coded string.
* guix/import/stackage.scm (%stackage-url): Make it a parameter.
(stackage-lts-info-fetch): Update accordingly.
* tests/lint.scm ("hackage-stackage"): New test.
2020-11-21 22:11:36 -05:00
Ludovic Courtès 4f156c259f
lint: Add 'patch-headers' checker.
* guix/lint.scm (check-patch-headers): New procedure.
(%local-checkers): Add 'patch-headers' checker.
* tests/lint.scm ("patch headers: no warnings")
("patch headers: missing comment", "patch headers: empty")
("patch headers: patch not found"): New tests.
2020-11-21 12:39:14 +01:00
Ludovic Courtès ac435c14a6
store-database: Add test checking the directory mtime after 'register-path'.
* tests/store-database.scm ("register-path, directory"): New test.
2020-11-21 12:39:14 +01:00
Ludovic Courtès 977eb5d023
Properly deal with build directories containing '~'.
Fixes <https://bugs.gnu.org/44626>.
Reported by Vagrant Cascadian <vagrant@debian.org>.

* tests/build-utils.scm ("wrap-script, simple case"): Pass
SCRIPT-CONTENTS to 'display' rather than 'format'.
* gnu/services/base.scm (file-system->shepherd-service-name)
[valid-characters, mount-point]: New variables.
Filter out invalid store file name characters from the mount point of
FILE-SYSTEM.
2020-11-16 11:21:42 +01:00
Ludovic Courtès d754757628
publish: Create files in the cache as #o644.
Reported by Ricardo Wurmus <rekado@elephly.net>.

* guix/scripts/publish.scm (compress-nar): Add 'chmod' call to ensure
PORT is #o644, in the uncompressed case.
(bake-narinfo+nar): Likewise for the narinfo file.
* tests/publish.scm ("with cache"): Check permissions on CACHED and NAR.
2020-11-09 23:27:09 +01:00
Ludovic Courtès 9e2523c25f
tests: Test "guix system search .".
This is a followup to 0c5d0c57d3.

* tests/guix-system.sh: Run "guix system search .".
2020-11-06 16:38:12 +01:00
Ludovic Courtès ca465a9c84
gexp: Warn when importing (guix config) or (ice-9 …).
While importing those modules from the host system is valid, it is often
a mistake that introduces non-reproducibility.  This patch prints a
warning when that happens.

* guix/gexp.scm (gexp-attribute): Add #:validate parameter and honor it.
(gexp-modules)[validate-modules]: New procedure.
Pass it to 'gexp-attribute'.
* tests/gexp.scm ("gexp-modules, warning"): New test.
2020-11-05 16:13:50 +01:00
Ludovic Courtès 18fc84bce8
gexp: Store the source code location in <gexp>.
* guix/gexp.scm (<gexp>)[location]: New field.
(gexp-location): New procedure.
(write-gexp): Print the location of GEXP.
(gexp->derivation): Adjust call to 'make-gexp'.
(gexp): Likewise.
2020-11-05 16:13:50 +01:00