Commit Graph

87 Commits

Author SHA1 Message Date
Ludovic Courtès 323b58ac18
channels: ‘latest-channel-instances’ traverses user-provided channels first.
Previously, ‘latest-channel-instances’ would perform a depth-first
traversal of channels.  Since dependencies specified in ‘.guix-channel’
are usually less specific that those provided by the user, this would
lead to the use of instances corresponding to those less specific specs,
which in turn might declare dependencies that do not exist for the more
specific instances.

This commit changes ‘latest-channel-instances’ to perform a
breadth-first traversal, thereby giving user-supplied channels higher
precedence over dependencies found via ‘.guix-channel’.

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

* guix/channels.scm (latest-channel-instances)[ignore?]: Remove.
[instance-name, same-named?, more-specific?]: New procedures.
Rewrite as a breadth-first traversal using a regular loop.
* tests/channels.scm ("latest-channel-instances reads dependencies from most-specific instance"):
New test.

Change-Id: Iba518145cfd209f04293a56246dbfee3b714650b
2024-01-31 09:07:25 +01:00
Ludovic Courtès 344e39c928
profiles: Hooks honor the #:system parameter of ‘profile-derivation’.
Fixes <https://issues.guix.gnu.org/65225>.

* guix/profiles.scm (info-dir-file, package-cache-file)
(info-dir-file, ghc-package-cache-file, ca-certificate-bundle)
(emacs-subdirs, gdk-pixbuf-loaders-cache-file, glib-schemas)
(gtk-icon-themes, gtk-im-modules, linux-module-database)
(xdg-desktop-database, xdg-mime-database, fonts-dir-file)
(manual-database, manual-database/optional): Add optional #:system
parameter and pass it to ‘gexp->derivation’.
(profile-derivation): Pass HOOK a second parameter, SYSTEM.
* gnu/bootloader.scm (efi-bootloader-profile)[efi-bootloader-profile-hook]:
Add optional #:system parameter and pass it to ‘gexp->derivation’.
* guix/channels.scm (package-cache-file): Likewise.
* tests/profiles.scm ("profile-derivation, #:system, and hooks"): New
test.

Reported-by: Tobias Geerinckx-Rice <me@tobias.gr>
2023-10-28 00:17:24 +02:00
Josselin Poiret cacc0cb6ab
channels: Raise an error if dependency's introduction is malformed
* guix/channels.scm (sexp->channel-introduction): Do it.
2023-06-04 11:30:18 +02:00
Ludovic Courtès ae587c2ef0
guix: Strip #:use-module lists.
This was obtained by setting up this environment:

  guix shell -D guix --with-input=guile@3.0.9=guile-next \
    --with-commit=guile-next=e2ed33ef0445c867fe56c247054aa67e834861f2
    -- make -j5

then adding 'unused-module' to (@@ (guix build compiler) %warnings),
building, and checking all the "unused module" warnings and removing
those that were definitely unused.
2023-03-13 15:08:33 +01:00
Ludovic Courtès 3ab8559436
status: Print a hint when a 'package-cache' hook fails to build.
* guix/channels.scm (package-cache-file): Add 'channels' to the #:properties
list.
* guix/status.scm (print-build-event): Upon failure, display a hint when
the derivation is a 'package-cache' hook.
2023-02-11 00:09:40 +01:00
Ludovic Courtès e6c01420db
channels: 'channel->code' emits 'channel' field only when necessary.
* guix/channels.scm (channel->code): Emit 'commit' field only when it is
true.
2023-01-23 23:23:07 +01:00
Ludovic Courtès f36522416e
channels: Interpret the 'commit' field of channel as a tag or commit.
Previously the 'commit' field would always be interpreted as a commit
ID.  This change adds flexibility, allowing for things like:

  guix time-machine --commit=v1.2.0 -- describe

* guix/channels.scm (channel-reference): Use 'tag-or-commit' rather than 'commit'.
* guix/inferior.scm (channel-full-commit): Likewise.
* doc/guix.texi (Invoking guix pull): Document it.
(Invoking guix time-machine): Likewise.
2022-10-17 09:37:27 +02:00
Ludovic Courtès 5bc4b8e8e3
channels: Warn about missing introductions.
* guix/channels.scm (latest-channel-instance): Warn when CHANNEL has no
introduction and CHECKOUT contains '.guix-authorizations'.
2022-10-04 18:15:35 +02:00
Ludovic Courtès 60e0aae89c
channels: Consider news files as UTF-8-encoded by default.
Partly fixes <https://issues.guix.gnu.org/57039>.
Reported by Pierre-Henry Fröhring <contact@phfrohring.com>.

Previously, news file would be read using the current locale encoding.
This could lead to a test failure in 'tests/channels.scm' (in a test
that expects some Unicode-capable encoding) in case tests were run in a
non-Unicode locale.

* guix/channels.scm (channel-news-for-commit): Make port for NEWS-FILE
UTF-8 by default.
2022-08-09 15:59:09 +02:00
Ludovic Courtès 64a070717c
channels: Add 'repository->guix-channel'.
* guix/channels.scm (repository->guix-channel): New procedure.
* guix/scripts/describe.scm (display-checkout-info): Use it instead of
the (git) interface, and adjust accordingly.
2022-08-09 15:16:06 +02:00
Ludovic Courtès c9fbd40785
channels: Emit version 3 profiles.
Fixes <https://issues.guix.gnu.org/56441>.
Reported by zimoun <zimon.toutoune@gmail.com>.

Fixes a bug introduced in 4ff12d1de7 with
version 4 of the manifest format.  A new 'guix time-machine' would
create a v4 manifest; when targeting an old revision (v3),
'generate-package-cache' would fail to read that manifest and abort.
Furthermore, an old Guix living in a new profile with a v4 manifest
would be unable to describe itself via (guix describe).

* guix/channels.scm (package-cache-file): Add 'format-version' field to
PROFILE.
(channel-instances->derivation): Pass #:format-version to
'profile-derivation'.
2022-07-08 23:58:11 +02:00
Josselin Poiret f404112007
channels: Print backtrace when generating package cache fails.
* guix/channels.scm (package-cache-file): Add a throw handler around
the generate-package-cache call, and print backtrace in it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2022-06-16 12:50:06 +02:00
Brice Waegeneire b891f8519d
channels: Add 'branch' to 'channel->code' output.
* guix/channels.scm (channel->code): Add 'branch' to output.
2021-12-25 19:12:37 +01:00
Ludovic Courtès 778c1fb4ea
channels: 'channel-news-entry-commit' correctly resolves annotated tags.
Previously, 'channel-news-entry-commit' would return the tag ID rather
than the commit ID when the news entry was referred to via an annotated
tag.

Reported by Xinglu Chen <public@yoctocell.xyz>.

* guix/channels.scm (resolve-channel-news-entry-tag): Check whether the
reference points to annotated tag; resolve it if it does.
* tests/channels.scm ("channel-news, annotated tag"): New test.
2021-09-18 19:37:45 +02:00
Christopher Baines 34985fb6ae
channels: Add a #:system argument to channel-instances->manifest.
This allows computing a manifest for a specific system. Previously this was
possible, but only through changing %current-system, which caused the
derivation to be computed using that system as well (so computing a derivation
for aarch64-linux on x86_64-linux would require running aarch64-linux code).

This new argument adds the possibility of computing derivations for non-native
systems, without having to run non-native code.

I'm looking at this as it will enable the Guix Data Service to compute channel
instance derivations without relying on QEMU emulation for non-native
systems (it should be faster as well).

* guix/channels.scm (build-from-source): Add #:system argument and pass to
build.
(build-channel-instance): Add system argument and pass to build-from-source.
(channel-instance-derivations): Add #:system argument and pass to
build-channel-instance, also rename system to current-system-value.
(channel-instances->manifest): Add #:system argument and pass to
channel-instance-derivations.
2021-05-12 08:34:07 +01:00
Ludovic Courtès a514b4ab19
channels: Build user channels with '-O1'.
This should noticeably speed up compilation for channels with many files.

* guix/channels.scm (standard-module-derivation)[build]: Define
'optimizations-for-level' and '-O1'.  Pass #:optimization-options to
'compile-files'.
2021-04-12 18:44:09 +02: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 4399b1cf57
channels: Export channel-instance->sexp.
* guix/channels.scm (channel-instance->sexp): Export it.
2021-03-10 08:49:48 +01:00
Ludovic Courtès 29009fdb2d
channels: Consider the current channel commit as authentic.
Fixes <https://bugs.gnu.org/45895>.

When the ~/.cache/guix/authentication is empty, this change allows
authentication to start at the current commit, as shown by 'guix
describe', instead of starting from the introductory commit, which would
take more and more time (there's currently 18K commits per year).

* guix/git-authenticate.scm (authenticate-repository): Add #:authentic-commits.
[authenticated-commits]: Append it.
* guix/channels.scm (authenticate-channel)[authentic-commits]: New
variable.  Pass it to 'authenticate-repository'.
2021-02-04 09:23:39 +01:00
Ludovic Courtès 316fc2acbb
channels: Record 'guix' channel metadata in (guix config).
Partially fixes <https://bugs.gnu.org/45896>.

* guix/config.scm.in (%channel-metadata): New variable.
* guix/describe.scm (channel-metadata): Use it.
(current-channels): New procedure.
(current-profile-entries): Clarify docstring.
* guix/self.scm (compiled-guix): Add #:channel-metadata and pass it to
'make-config.scm'.
(make-config.scm): Add #:channel-metadata and define '%channel-metadata'
in the generated file.
(guix-derivation): Add #:channel-metadata and pass it to 'compiled-guix'.
* guix/channels.scm (build-from-source): Replace 'name', 'source', and
'commit' parameters with 'instance'.  Pass #:channel-metadata to BUILD.
(build-channel-instance): Adjust accordingly.
* build-aux/build-self.scm (build-program): Add #:channel-metadata
and pass it to 'guix-derivation'.
(build): Add #:channel-metadata and pass it to 'build-program'.
* guix/scripts/describe.scm (display-profile-info): Add optional
'channels' parameter.  Pass it to 'display-profile-content'.
(display-profile-content): Add optional 'channels' parameter and honor
it.  Iterate on CHANNELS rather than on the manifest entries of
PROFILE.
(guix-describe): When PROFILE is #f, call 'current-channels' and pass it
to 'display-profile-info', unless it returns the empty list.
2021-02-04 09:23:39 +01:00
Ludovic Courtès aedbc5ff32
guix package: Add '--export-channels'.
* guix/channels.scm (sexp->channel): Export.
* guix/describe.scm: Use (guix channels).
(manifest-entry-provenance): New procedure.
* guix/scripts/package.scm (channel=?, export-channels): New
procedures.
(show-help, %options): Add '--export-channels'.
(process-query): Honor it.
* build-aux/build-self.scm (build-program)[select?]: Exclude (guix
channels) to account for the (guix describe) change above.
* doc/guix.texi (Invoking guix package): Document it.
2021-02-01 17:32:35 +01:00
Ludovic Courtès 60d72f5364
channels: Add 'channel->code'.
* guix/channels.scm (channel->code): New procedure, taken from...
* guix/scripts/describe.scm (channel->sexp): ... here.
Adjust callers accordingly.
2021-02-01 17:32:35 +01:00
Ludovic Courtès 1b88b7bad2
guix describe: Use 'manifest-entry-channel'.
* guix/channels.scm (manifest-entry-channel): Export.
* guix/scripts/describe.scm (display-profile-content): Use it.
2021-02-01 17:32:35 +01:00
Ludovic Courtès a47f16a874
channels: Add the channel name to channel sexps.
* guix/channels.scm (channel-instance->sexp): Add 'name'.
(sexp->channel): Extract the name from SEXP, using the optional argument
as a fallback.
2021-02-01 17:32:35 +01:00
Ludovic Courtès 9272cc700e
channels: Factorize 'manifest-entry-channel' and channel serialization.
* guix/channels.scm (sexp->channel, manifest-entry-channel): New
procedures.
(profile-channels): Replace lambda by 'manifest-entry-channel'.
(channel-instance->sexp): New procedure.
(channel-instances->manifest)[instance->entry]: Use
'channel-instance->sexp' instead of inline code.
2021-02-01 17:32:35 +01:00
Ludovic Courtès 246c0c60da
ci: Add missing imports.
This is a followup to 041a9466ea.

* guix/ci.scm: Add missing imports.
* guix/channels.scm: Remove (guix ci) import.
2021-01-31 21:49:58 +01:00
Mathieu Othacehe 041a9466ea
guix: channels: Introduce "channel-with-substitutes-available".
* guix/channels.scm (find-latest-commit-with-substitutes,
channel-with-substitutes-available): New procedures.
* guix/scripts/pull.scm (guix-pull): Move "channel-list" call inside the
%current-system parameter scope.
* doc/guix.texi (Channels with substitutes): New section.
2021-01-31 18:36:42 +01:00
Zhu Zihao 16c7472b33
channels: Expose the default channel in %default-channel.
* guix/channels(%default-guix-channel): New variable taken from the inner of
%default-channels.

(%default-channels): Refactored.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2020-11-28 00:06:14 +01:00
Ludovic Courtès 6c46e477eb
channels: Address test failure.
Fixes <https://bugs.gnu.org/43940>.
Reported by Maxim Cournoyer <maxim.cournoyer@gmail.com>.

The "channel-instances->manifest" test would fail since
1d4ab335b22a93e01c2eb1eb3e93fc6534157040: 'quiet-guile' would be passed #f
as GUILE, and thus 'package-version' would fail with wrong-type-arg.

* guix/channels.scm (whole-package-for-legacy): Pass #:guile to
'whole-package'.
* tests/channels.scm ("channel-instances->manifest"): Remove 'test-expect-fail'.
2020-10-12 11:28:56 +02:00
Ludovic Courtès d51bfe242f
Use 'formatted-message' instead of '&message' where appropriate.
* gnu.scm (%try-use-modules): Use 'formatted-message' instead of
'&message'.
* gnu/machine/digital-ocean.scm (maybe-raise-unsupported-configuration-error):
Likewise.
* gnu/machine/ssh.scm (machine-check-file-system-availability): Likewise.
(machine-check-building-for-appropriate-system): Likewise.
(deploy-managed-host): Likewise.
(maybe-raise-unsupported-configuration-error): Likewise.
* gnu/packages.scm (search-patch): Likewise.
* gnu/services.scm (%service-with-default-value): Likewise.
(files->etc-directory): Likewise.
(fold-services): Likewise.
* gnu/system.scm (locale-name->definition*): Likewise.
* gnu/system/mapped-devices.scm (check-device-initrd-modules): Likewise.
(check-luks-device): Likewise.
* guix/channels.scm (latest-channel-instance): Likewise.
* guix/cve.scm (json->cve-items): Likewise.
* guix/git-authenticate.scm (commit-signing-key): Likewise.
(commit-authorized-keys): Likewise.
(authenticate-commit): Likewise.
(verify-introductory-commit): Likewise.
* guix/remote.scm (remote-pipe-for-gexp): Likewise.
* guix/scripts/graph.scm (assert-package): Likewise.
* guix/scripts/offload.scm (private-key-from-file*): Likewise.
* guix/ssh.scm (authenticate-server*): Likewise.
(open-ssh-session): Likewise.
(remote-inferior): Likewise.
* guix/ui.scm (matching-generations): Likewise.
* guix/upstream.scm (package-update): Likewise.
* tests/channels.scm ("latest-channel-instances, missing introduction for 'guix'"):
Catch 'formatted-message?'.
("authenticate-channel, wrong first commit signer"): Likewise.
* tests/lint.scm ("patches: not found"): Adjust message string.
* tests/packages.scm ("patch not found yields a run-time error"): Catch
'formatted-message?'.
* guix/lint.scm (check-patch-file-names): Handle 'formatted-message?'.
(check-derivation): Ditto.
2020-07-25 19:11:37 +02:00
Ludovic Courtès f9a8dd053c
utils: Move '&fix-hint' to (guix diagnostics).
* guix/utils.scm (&fix-hint): Move to...
* guix/diagnostics.scm (&fix-hint): ... here.
* gnu.scm: Adjust imports accordingly.
* gnu/system/mapped-devices.scm: Likewise.
* guix/channels.scm: Likewise.
* guix/profiles.scm: Likewise.
* guix/scripts/system/reconfigure.scm: Likewise.
* guix/ssh.scm: Likewise.
2020-07-25 19:11:36 +02:00
Ludovic Courtès 838f2bdfa8
git-authenticate: Factorize 'authenticate-repository'.
* guix/git-authenticate.scm (repository-cache-key)
(verify-introductory-commit, authenticate-repository): New procedures.
* guix/channels.scm (verify-introductory-commit): Remove.
(authenticate-channel): Rewrite in terms of 'authenticate-repository'.
2020-07-11 11:51:52 +02:00
Ludovic Courtès d774c7b121
channels: Dependencies listed in '.guix-channel' can have an introduction.
Suggested by Ricardo Wurmus and Simon Tournier.

* guix/channels.scm (sexp->channel-introduction): New procedure.
(read-channel-metadata): Use it.
(profile-channels)[sexp->channel-introduction]: Remove.
* tests/channels.scm ("latest-channel-instances, authenticate dependency"):
New test.
* doc/guix.texi (Channels)[Declaring Channel Dependencies]: Augment example.
2020-07-01 23:34:51 +02:00
Ludovic Courtès 471550c28c
channels: Save and interpret 'introduction' field in provenance data.
With this change, profiles created by 'guix pull' & co. include channel
introductions as part of the channel metadata of each manifest entry.

* guix/channels.scm (channel-instances->manifest)[instance->entry]: Add
'introduction' field when CHANNEL has an introduction.
(profile-channels)[sexp->channel-introduction]: New procedure.
Use it to initialize the 'introduction' field.
2020-07-01 23:34:51 +02:00
Ludovic Courtès 22a9699257
channels: Remove 'signature' from <channel-introduction>.
In the end signing the commit/key pair does not buy us much.  Someone
publishing a valid but different commit/key pair would effectively be
publishing a different channel, which could be a fork (made by a former
authorized developer) or simply a mirror.  In the latter case, there's
nothing to be gained by publishing a different commit/key pair.

* guix/channels.scm (<channel-introduction>)[signature]: Remove.
(make-channel-introduction): Adjust accordingly.
2020-07-01 23:34:51 +02:00
Ludovic Courtès 8b7d982e6a
channels: Make channel introductions public.
* guix/channels.scm (<channel-introduction>): Rename constructor to
'%make-channel-introduction'.
(make-channel-introduction): New procedure.
* tests/channels.scm ("authenticate-channel, wrong first commit signer")
("authenticate-channel, .guix-authorizations"): Use
'make-channel-introduction' without '@@' and without third argument.
* doc/guix.texi (Channels)[Channel Authentication, Specifying Channel
Authorizations]: New subsections.
2020-07-01 23:34:51 +02:00
Ludovic Courtès 6577682a6c
channels: Add 'openpgp-fingerprint->bytevector'.
* guix/channels.scm (openpgp-fingerprint->bytevector): New procedure.
(openpgp-fingerprint): New macro.
(%guix-channel-introduction): Use it.
2020-07-01 23:34:50 +02:00
Ludovic Courtès ead5c46147
channels: Error out when the 'guix' channel lacks an introduction.
* guix/channels.scm (latest-channel-instance): Raise an error instead of
warning when 'guix is unauthenticated.
* tests/channels.scm ("latest-channel-instances, missing introduction for 'guix'"):
New test.
2020-06-28 23:26:53 +02:00
Ludovic Courtès e4a4287c5f
channels: 'authenticate-channel' doesn't check relation with intro commit.
Fixes <https://bugs.gnu.org/41908>.
Reported by Jan Nieuwenhuizen <janneke@gnu.org>.

The relation check imposed an extra restriction that was unnecessary:
it's enough to authenticate the set difference between the closure of
START-COMMIT and that of END-COMMIT.  Any attempt to jump to an
unrelated commit would lead to the authentication failure of one commit
on the way.

* guix/channels.scm (authenticate-channel): Remove extra
'commit-relation' check when (null? commits).
2020-06-21 17:36:40 +02:00
Ludovic Courtès 4ae762af76
channels: Warn when pulling from a mirror.
* guix/channels.scm (<channel-metadata>)[url]: New field.
(read-channel-metadata): Initialize it.
(read-channel-metadata-from-source): Likewise.
(channel-instance-primary-url): New procedure.
(latest-channel-instances): Compare CHANNEL's URL against it.
* doc/guix.texi (Channels)[Primary URL]: New subsection.
2020-06-17 19:32:43 +02:00
Ludovic Courtès a9eeeaa6ae
pull: Add '--disable-authentication'.
* guix/channels.scm (latest-channel-instance): Add #:authenticate? and
honor it.
(latest-channel-instances): Likewise.
* guix/scripts/pull.scm (%default-options): Add 'authenticate-channels?'.
(show-help, %options): Add '--disable-authentication'.
(guix-pull): Pass #:authenticate? to 'latest-channel-instances'.
* doc/guix.texi (Invoking guix pull): Document it.
2020-06-16 16:10:47 +02:00
Ludovic Courtès c3f6f564e9
channels: Automatically add introduction for the official 'guix' channel.
This is useful when people run "guix time-machine -C channels.scm",
where 'channels.scm' misses channel introductions.

* guix/channels.scm (%default-channel-url): New variable.
(%default-channels): Use it.
(ensure-default-introduction): New procedure.
(latest-channel-instance): Call it.
2020-06-16 16:10:47 +02:00
Ludovic Courtès 5bafc70d1e
channels: Make 'validate-pull' call right after clone/pull.
This should come before patching, authentication, etc.

* guix/channels.scm (latest-channel-instance): Add #:validate-pull
parameter and honor it.  Return a single value: the instance.
(ensure-forward-channel-update): Change 'instance' parameter to 'commit'
and adjust accordingly.
(latest-channel-instances): Adjust to 'latest-channel-instance' changes.
* guix/scripts/pull.scm (warn-about-backward-updates): Change 'instance'
parameter to 'commit' and adjust accordingly.
* tests/channels.scm ("latest-channel-instances #:validate-pull"):
Likewise.
2020-06-16 16:10:47 +02:00
Ludovic Courtès 43badf261f
channels: 'latest-channel-instance' authenticates Git checkouts.
Fixes <https://bugs.gnu.org/22883>.

* guix/channels.scm (<channel>)[introduction]: New field.
(<channel-introduction>): New record type.
(%guix-channel-introduction): New variable.
(%default-channels): Use it.
(<channel-metadata>)[keyring-reference]: New field.
(%default-keyring-reference): New variable.
(read-channel-metadata, read-channel-metadata-from-source): Initialize
the 'keyring-reference' field.
(commit-short-id, verify-introductory-commit)
(authenticate-channel): New procedures.
(latest-channel-instance): Call 'authenticate-channel' when CHANNEL has
an introduction.
* tests/channels.scm (gpg+git-available?, commit-id-string): New
procedures.
("authenticate-channel, wrong first commit signer"):
("authenticate-channel, .guix-authorizations"): New tests.
* doc/guix.texi (Invoking guix pull): Mention authentication.
2020-06-16 16:10:47 +02:00
Ludovic Courtès 9744cc7b46
pull: Protect against downgrade attacks.
* guix/scripts/pull.scm (%default-options): Add 'validate-pull'.
(%options, show-help): Add '--allow-downgrades'.
(warn-about-backward-updates): New procedure.
(guix-pull): Pass #:current-channels and #:validate-pull to
'latest-channel-instances'.
* guix/channels.scm (ensure-forward-channel-update): Add hint for
when (channel-commit channel) is true.
* doc/guix.texi (Invoking guix pull): Document '--allow-downgrades'.
2020-05-25 00:00:28 +02:00
Ludovic Courtès 872898f768
channels: 'latest-channel-instances' guards against non-forward updates.
* guix/channels.scm (latest-channel-instance): Add #:starting-commit and
pass it to 'update-cached-checkout'.  Return the commit relation as a
second value.
(ensure-forward-channel-update): New procedure.
(latest-channel-instances): Add #:current-channels and #:validate-pull.
[current-commit]: New procedure.
Pass #:starting-commit to 'latest-channel-instance'.  When the returned
relation is true, call VALIDATE-PULL.
(latest-channel-derivation): Add #:current-channels and #:validate-pull.
Pass them to 'latest-channel-instances*'.
* tests/channels.scm ("latest-channel-instances #:validate-pull"): New
test.
2020-05-25 00:00:28 +02:00
Ludovic Courtès 8d1d56578a
git: 'update-cached-checkout' returns the commit relation.
* guix/git.scm (update-cached-checkout): Add #:starting-commit
parameter.  Call 'commit-relation' when #:starting-commit is true.
Always return the relation or #f as the third value.
(latest-repository-commit): Adjust accordingly.
* guix/import/opam.scm (get-opam-repository): Likewise.
* tests/channels.scm ("latest-channel-instances includes channel dependencies")
("latest-channel-instances excludes duplicate channel dependencies"):
Update mock of 'update-cached-checkout' accordingly.
2020-05-25 00:00:28 +02:00
Ludovic Courtès 9b049de84e
channels: 'latest-channel-instances' doesn't leak internal state.
* guix/channels.scm (latest-channel-instances): Remove
'previous-channels' argument.  Introduce 'loop' and use it.
2020-05-25 00:00:28 +02:00
Ludovic Courtès 9db8836916
channels: 'build-from-source' restores '%guile-for-build'.
Not restoring it would cause problems when running:

  guix time-machine --commit=6298c3ffd9654d3231a6f25390b056483e8f407c

or similar because the target Guix would be built with 2.2, and then
we'd erroneously go on and attempt build the profile with 2.2.  This
would fail because profile dependencies such as "guile-gdbm-ffi" now
target 3.0.

* guix/channels.scm (call-with-guile): New procedure.
(with-guile): New macro.
(build-from-source): Use it instead of calling 'set-guile-for-build'
just once.  This ensures that '%guile-for-build' is restored
afterwards.
2020-05-15 12:27:10 +02:00
Ludovic Courtès 2050734717
channels: Move quirks and patches to (guix quirks).
* guix/channels.scm (apply-patches): Don't access <patch> record
directly; use 'applicable-patch?' and 'apply-patch' instead.
(<patch>, syscalls-reexports-local-variables?)
(guile-2.2.4, %quirks, %bug-41028-patch, %patches): Move to...
* guix/quirks.scm: ... here.  New file.
(apply-patch, applicable-patch?): New procedures.
2020-05-15 00:01:39 +02:00