aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-09-11 15:28:09 +0200
committerLudovic Courtès <ludo@gnu.org>2023-09-26 17:36:58 +0200
commit13b0cf85eb31e1b1ea674debbbfb0f35a32d1374 (patch)
treed8560901ccd8d540f05dc342532d183e7ddb418f /tests
parentc4a1d69a6966aea71114c1aba0eab161139ff6fe (diff)
downloadguix-13b0cf85eb31e1b1ea674debbbfb0f35a32d1374.tar
guix-13b0cf85eb31e1b1ea674debbbfb0f35a32d1374.tar.gz
git-download: Use “builtin:git-download” when available.
Fixes <https://issues.guix.gnu.org/63331>. Longer-term this will remove Git from the derivation graph when its sole use is to perform a checkout for a fixed-output derivation, thereby breaking dependency cycles that can arise in these situations. * guix/git-download.scm (git-fetch): Rename to… (git-fetch/in-band): … this. Deal with GIT or GUILE being #f. (git-fetch/built-in, built-in-builders*, git-fetch): New procedures. * tests/builders.scm ("git-fetch, file URI"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/builders.scm29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/builders.scm b/tests/builders.scm
index 0b5577c7a3..619caa5f31 100644
--- a/tests/builders.scm
+++ b/tests/builders.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014, 2015, 2018, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2015, 2018-2019, 2021, 2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
;;;
;;; This file is part of GNU Guix.
@@ -20,6 +20,7 @@
(define-module (tests builders)
#:use-module (guix download)
+ #:use-module (guix git-download)
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
#:use-module (guix build gnu-build-system)
@@ -31,9 +32,12 @@
#:use-module (guix base32)
#:use-module (guix derivations)
#:use-module (gcrypt hash)
+ #:use-module ((guix hash) #:select (file-hash*))
#:use-module (guix tests)
+ #:use-module (guix tests git)
#:use-module (guix packages)
#:use-module (gnu packages bootstrap)
+ #:use-module ((ice-9 ftw) #:select (scandir))
#:use-module (ice-9 match)
#:use-module (ice-9 textual-ports)
#:use-module (srfi srfi-1)
@@ -84,6 +88,29 @@
(and (file-exists? out)
(valid-path? %store out))))
+(test-equal "git-fetch, file URI"
+ '("." ".." "a.txt" "b.scm")
+ (let ((nonce (random-text)))
+ (with-temporary-git-repository directory
+ `((add "a.txt" ,nonce)
+ (add "b.scm" "#t")
+ (commit "Commit.")
+ (tag "v1.0.0" "The tag."))
+ (run-with-store %store
+ (mlet* %store-monad ((hash
+ -> (file-hash* directory
+ #:algorithm (hash-algorithm sha256)
+ #:recursive? #t))
+ (drv (git-fetch
+ (git-reference
+ (url (string-append "file://" directory))
+ (commit "v1.0.0"))
+ 'sha256 hash
+ "git-fetch-test")))
+ (mbegin %store-monad
+ (built-derivations (list drv))
+ (return (scandir (derivation->output-path drv)))))))))
+
(test-assert "gnu-build-system"
(build-system? gnu-build-system))