Commit Graph

5635 Commits

Author SHA1 Message Date
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
Mathieu Othacehe 8f999e1ac2
channels: Add the channel branch in sexp->channel.
* guix/channels.scm (sexp->channel): Add the channel branch.
2021-03-10 16:53:51 +01:00
Mathieu Othacehe a831ff6bc3
inferior: Use a safe symlink monadic procedure.
This is a follow-up of 6ee7e3d26b.

* guix/inferior.scm (cached-channel-instance): Introduce "symlink/safe" and
use it instead of symlink. Remove the duplicated "file-exists?" call.
2021-03-10 13:09:23 +01:00
Mathieu Othacehe 8898eaec57
Revert "inferior: Break cached-channel-instance into two procedures."
This reverts commit 7d63b77551 because it raises
some concerns, see:
https://lists.gnu.org/archive/html/guix-devel/2021-03/msg00124.html.
2021-03-10 13:08:32 +01:00
Mathieu Othacehe 76bea3f8bc
ci: Remove hydra support.
This removes hydra support to use Cuirass as the only continuous integration
system.

* build-aux/hydra/gnu-system.scm: Remove it.
* build-aux/hydra/guix-modular.scm: Ditto.
* build-aux/hydra/guix.scm: Ditto.
* build-aux/cuirass/hydra-to-cuirass.scm: Ditto.
* Makefile.am (EXTRA_DIST): Update it.
(hydra-jobs.scm): Remove it.
(cuirass-jobs.scm): Update it.
* build-aux/hydra/evaluate.scm: Move it to ...
* build-aux/cuirass/evaluate.scm: ... here.
* build-aux/cuirass/guix-modular.scm: Remove it.
* build-aux/cuirass/gnu-system.scm: Ditto.
* guix/packages.scm (%hydra-supported-systems): Rename it to ...
(%cuirass-supported-systems): ... this variable.
* build-aux/check-final-inputs-self-contained: Adapt it.
* etc/release-manifest.scm: Ditto.
* gnu/ci.scm (package->alist): Remove it.
(derivation->job): New procedure.
(package-job, package-cross-job, cross-jobs, image-jobs, system-test-jobs,
tarball-jobs): Use it.
(guix-jobs): New procedure.
(hydra-jobs): Rename it to ...
(cuirass-jobs): ... this procedure.
2021-03-10 08:49:48 +01:00
Mathieu Othacehe 4399b1cf57
channels: Export channel-instance->sexp.
* guix/channels.scm (channel-instance->sexp): Export it.
2021-03-10 08:49:48 +01:00
Mathieu Othacehe 6ee7e3d26b
inferior: Fix concurrent cached-profile calls.
* guix/inferior.scm (cached-profile): Do not create the profile symlink if it
already exists.
2021-03-10 08:49:48 +01:00
Mathieu Othacehe 7d63b77551
inferior: Break cached-channel-instance into two procedures.
Break cached-channel-instance into two different procedures:
channels->cached-profile and instances->cached-profile operating respectively
on channels and channels instances.

* guix/inferior.scm (cached-channel-instance): Rename it into ...
(cached-profile): ... this new procedure.
(channels->cached-profile, instances->cached-profile): New procedures.
* guix/scripts/time-machine.scm (guix-time-machine): Adapt accordingly.
2021-03-10 08:49:48 +01:00
Christopher Baines f5ffb3bd9c
weather: Call lookup-narinfos with a custom progress reporter.
This means there's a useful progress bar when running guix weather.

* guix/scripts/weather.scm (report-server-coverage): Pass
 #:make-progress-reporter to lookup-narinfos.
2021-03-09 20:19:36 +00:00
Christopher Baines fd5b77503e
guix: substitutes: Make progress reporting configurable.
Rather than always outputting to (current-error-port) in
lookup-narinfos (which is called from within lookup-narinfos/diverse), take a
procedure which should return a progress reporter, and defer any output to
that.

As this is now general purpose code, make the default behaviour to output
nothing. Maintain the current behaviour of the substitute script by moving the
progress reporter implementation there, and passing it in when calling
lookup-narinfos/diverse.

These changes should be generally useful, but I'm particularly looking at
getting guix weather to do progress reporting differently, with this new
flexibility.

* guix/substitutes.scm (fetch-narinfos): Take a procedure to make a
progress-reporter, and use that rather than the hardcoded behaviour.
(lookup-narinfos): Add #:make-progress-reporter keyword argument, and pass
this through to fetch-narinfos.
(lookup-narinfos/diverse): Add a #:make-progress-reporter keyword argument,
and pass this through to lookup-narinfos.
* guix/scripts/substitute.scm (process-query): Pass a progress-reporter to
lookup-narinfos/diverse.
2021-03-09 20:19:33 +00:00
Brice Waegeneire 236a882942
scripts: system: Activate system when switching generations.
Fixes <https://bugs.gnu.org/38884>.

* guix/scripts/system.scm (switch-to-system-generation): Load the
activate script for that generation.

squash! scripts: system: Activate system when switching generations.
2021-03-09 06:56:17 +01:00
Alexandros Theodotou 60d1df78ad
licenses: Add Zero-Clause BSD License.
* guix/licenses.scm (bsd-0): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-03-06 11:41:49 +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 3182539875
Revert "tests: Refer to '%derivation-cache' in the right module."
This reverts commit b1248016e0, which was
a mistake: the two '%derivation-cache' are two different things.  It
broke tests that use 'call-with-external-store'.
2021-03-06 11:41:48 +01:00
Christopher Baines 112692c0d5
guix: Split (guix substitutes) from (guix scripts substitute).
This means there's a module for working with substitutes, rather than all the
code sitting in the script. The need for this can be seen with the weather and
challenge scripts, that now don't have to use code from the substitute script,
but can instead use the substitute module.

The separation here between the actual functionality of the substitute script
and the underlying functionality used both there and elsewhere should make
maintenance easier moving forward.

This commit just moves code, none of the code should have been changed
significantly.

* guix/scripts/substitute.scm (%narinfo-cache-directory, %narinfo-ttl,
%narinfo-negative-ttl, %narinfo-transient-error-ttl, %unreachable-hosts): Move
variables to guix/substitutes.scm.
(narinfo-cache-file, cached-narinfo, cache-narinfo!, narinfo-request,
read-to-eof, call-with-connection-error-handling, fetch-narinfos,
lookup-narinfos, lookup-narinfos/diverse): Move procedures to
guix/substitutes.scm.
* guix/substitutes.scm: New file.
* Makefile.am: Add it.
* guix/narinfo.scm: Remove redundant module.
* guix/scripts/challenge.scm: Change (guix scripts substitute) to (guix
substitutes).
* guix/scripts/weather.scm: Change (guix scripts substitute) to (guix
substitutes).
2021-03-05 21:06:03 +00:00
Tobias Geerinckx-Rice d0f4283c44
pull: Expand help text for --{url,commit,branch}.
* guix/scripts/pull.scm (show-help): Document that ‘--url’, ‘--commit’,
and ‘--branch’ affect only the ‘guix’ channel (for now?).
2021-03-05 19:07:31 +01:00
Ludovic Courtès b1248016e0
tests: Refer to '%derivation-cache' in the right module.
* guix/tests.scm (call-with-external-store): Fix module name for
'%derivation-cache'.
2021-03-05 12:49:28 +01:00
Ludovic Courtès 9d349afaa1
download: 'url-fetch/tarbomb' and 'url-fetch/zipbomb' refer to native tools.
* guix/download.scm (url-fetch/tarbomb, url-fetch/zipbomb): Use
'ungexp-native' instead of 'ungexp' when referring to the decompression
tools.
2021-03-05 12:49:28 +01:00
Ludovic Courtès 6de3ef0d5e
gexp: Honor #:target in 'compiled-modules'.
* guix/gexp.scm (compiled-modules): Pass #:target to 'gexp->derivation'.
2021-03-05 12:49:28 +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 24b2b5f99a
openpgp: Remove now unnecessary procedure.
* guix/openpgp.scm (hash-algorithm-name): Remove.  This procedure has
been provided by Guile-Gcrypt since 0.3.0.
2021-03-02 23:12:37 +01:00
Mădălin Ionel Patrașcu 35814292b6
import/cran: Fix detection of Fortran files.
This fixes a bug whereby the Guix importer considers files like .f.* to be
Fortran files.

The expression "\\.f(90|95)?" would match a lot of files containing ".f"
although they are not Fortran files.  Instead we should only consider files
with this *suffix*.

* guix/import/cran.scm (directory-needs-fortran?): Only check for suffixes.

Co-authored-by: Ricardo Wurmus <rekado@elephly.net>
2021-03-01 22:40:41 +01:00
Xinglu Chen af978312e5
import: hackage: Accept optional version parameter.
* guix/import/hackage.scm (hackage-recursive-import): Add the VERSION key.
  Make REPO a key.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-03-01 17:45:51 +01:00
Ludovic Courtès f293705d7e
serialization: Micro-optimize string literal output in 'write-file-tree'.
This reduces allocations and bit twiddling in the loop.

* guix/serialization.scm (write-literal-strings): New macro.
(write-file-tree): Use it in lieu of 'write-string' calls where applicable.
2021-03-01 17:45:51 +01:00
Ludovic Courtès 9ce78f27a0
environment: Allow compilation with Guile 2.2.
Fixes <https://bugs.gnu.org/46826>.
Reported by cage <cage-dev@twistfold.it>.

* guix/scripts/environment.scm (guix-environment): Move 'manifest'
definition before expression.
2021-03-01 17:45:50 +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 46bb1a41ae
syscalls: Define MS_RELATIME.
* guix/build/syscalls.scm (MS_RELATIME): New variable.
2021-02-25 11:29:35 +01:00
Mathieu Othacehe 4dfce0115f
describe: Make sure package-channels always returns a list.
* guix/describe.scm (package-channels): Return an empty list if the file
origin could not be determined.
2021-02-25 10:24:11 +01:00
Mathieu Othacehe b6c7e5af02
describe: Add missing include.
This is a follow-up of 17fbd5a5c9.

* guix/describe.scm: Add "channel-name" to (guix channels) autoload.
2021-02-25 10:19:32 +01:00
Mathieu Othacehe 17fbd5a5c9
describe: Add package-channels.
* guix/describe.scm (package-channels): New procedure.
(package-provenance): Rewrite using package-channels procedure.
2021-02-25 10:11:25 +01:00
zimoun e68ae7f00e
guix: scripts: Fix corner cases of hint for option typo.
* guix/scripts.scm (option-hint): Fix corner cases.
(parse-command-line)[parse-options-from]: Remove 'string?' check
introduced in 11f11d7ecb.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2021-02-24 23:50:13 +01:00
Ludovic Courtès ee3226e9d5
substitute: Ensure backtraces go to file descriptor 4.
Fixes <https://bugs.gnu.org/46362>.
Reported by Zhu Zihao <all_but_last@163.com>.

Previously, backtraces due to uncaught exceptions would always to go
file descriptor 2; the daemon would read it and error out with something
like:

  error: got unexpected path `Backtrace:' from substituter

This patch fixes that by ensuring backtraces are properly displayed on
file descriptor 4.

* guix/scripts/substitute.scm (with-redirected-error-port): New macro.
(guix-substitute): Use 'with-redirected-error-port' instead of 'parameterize'.
2021-02-24 23:44:10 +01:00
Ludovic Courtès e2572aa950
substitute: Do not unwind stack traces upon uncaught exceptions.
This is similar to commit a168c3e4f8.

* guix/scripts/substitute.scm (with-networking): Use
'with-throw-handler' instead of 'catch'.
2021-02-24 23:44:10 +01:00
Ludovic Courtès b288d0e749
ui: Bug-report URL in '--help' can be translated.
* guix/ui.scm (show-bug-report-information): Add "/en" to the help URL
and pass it to 'G_'.
2021-02-24 23:44:10 +01:00
Leo Prikler a1fd8f01b2
guix: renpy-build-system: Quote data directory.
This prevents generated launchers and desktop files from inadvertently
crashing if the directory name contains a space.

* gnu/build/renpy-build-system.scm (install, install-desktop-file): Use ~s
to format data directory.
2021-02-24 00:37:37 +01:00
Leo Famulari 56733080c4
packages: Improve the docstring of PACKAGE/INHERIT.
* guix/packages.scm (package/inherit): Try to clarify the docstring.
2021-02-23 14:12:34 -05:00
Ludovic Courtès 0a912b3a43
store: Micro-optimize object cache lookup.
This avoids a closure allocation when 'lookup-cached-object' is called.

* guix/store.scm (lookup-cached-object): Avoid optional/keyword
arguments and inline.
(%mcached): Adjust accordingly.
2021-02-23 15:24:49 +01:00
Ludovic Courtès fcde4e10b8
gexp: Reduce allocations in 'gexp-attribute'.
* guix/gexp.scm (gexp-attribute): Use 'fold' and 'fold/tree' instead of
'append-map'.
2021-02-23 15:24:49 +01:00
Ludovic Courtès c8bd5fa59c
gexp: Reduce allocations while traversing lists.
This reduces the total amount of memory allocated by 8% when running
"guix build qemu -d --no-grafts".

* guix/gexp.scm (fold/tree): New procedure.
(gexp-inputs)[interesting?]: New procedure.
[add-reference-inputs]: Change (lst ...) clause to (? pair? lst), and
use 'fold/tree' to recurse into it.
(gexp-inputs)[add-reference-output]: Likewise, and remove
plain (lst ...) clause.
Call 'fold'.
(gexp->sexp)[reference->sexp]: In the list case, avoid boxing and
recursive call when the object has a plain non-aggregate type.
2021-02-23 15:24:49 +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 a26006ff72
gexp: Keep 'lower-inputs' private.
It had been made public in 6b6298ae39 but
it's no longer needed since 779aa003fb.

* guix/gexp.scm (lower-inputs): Do not export.
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 bde7929bd0
gexp: Micro-optimize sexp serialization.
* guix/gexp.scm (sexp->string): New procedure.
(gexp->derivation): Use it instead of 'object->string'.
2021-02-23 15:24:48 +01:00
Ludovic Courtès 70b33d8898
store: Object cache profiling shows the number of entries.
* guix/store.scm (record-cache-lookup!): Add 'size' variable; keep it
up-to-date and display it.
2021-02-23 15:24:47 +01:00
Ludovic Courtès db45712a67
grafts: Inline 'grafting?' and 'set-grafting'.
As for 'current-target-system' & co., this makes sure we don't
needlessly allocate closures.

* guix/grafts.scm (grafting?, set-grafting): Inline.
2021-02-23 15:24:47 +01:00
Ludovic Courtès 11f11d7ecb
scripts: Don't trigger option hints for short options.
Previously, 'guix install foo -r bar' would crash with a backtrace
because NAME would be #\r (a character instead of a string).

* guix/scripts.scm (parse-command-line)[parse-options-from]: Call
'option-hint' only when NAME is a string.
2021-02-22 23:42:08 +01:00
Ludovic Courtès e8fc373900
profiles: Fix typo in manifest comment.
* guix/build/profiles.scm (build-profile): Fix typo.
2021-02-22 23:42:08 +01:00