daemon: Add “git-download” built-in builder.

The new builder makes it possible to break cycles that occurs when the
fixed-output derivation for the source of a dependency of ‘git’ would
itself depend on ‘git’.

* guix/scripts/perform-download.scm (perform-git-download): New
procedure.
(perform-download): Move fixed-output derivation check to…
(guix-perform-download): … here.  Invoke ‘perform-download’ or
‘perform-git-download’ depending on what ‘derivation-builder’ returns.
* nix/libstore/builtins.cc (builtins): Add “git-download”.
* tests/derivations.scm ("built-in-builders"): Update.
("'git-download' built-in builder")
("'git-download' built-in builder, invalid hash")
("'git-download' built-in builder, invalid commit")
("'git-download' built-in builder, not found"): New tests.
This commit is contained in:
Ludovic Courtès 2023-09-11 14:22:44 +02:00 committed by Ludovic Courtès
parent 9d0e2002a5
commit 95f2123135
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 142 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/* GNU Guix --- Functional package management for GNU
Copyright (C) 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
Copyright (C) 2016-2019, 2023 Ludovic Courtès <ludo@gnu.org>
This file is part of GNU Guix.
@ -58,7 +58,8 @@ static void builtinDownload(const Derivation &drv,
static const std::map<std::string, derivationBuilder> builtins =
{
{ "download", builtinDownload }
{ "download", builtinDownload },
{ "git-download", builtinDownload }
};
derivationBuilder lookupBuiltinBuilder(const std::string & name)