guix build: '--with-commit' makes recursive checkouts.

This was an omission from commit
024a6bfba9.

* guix/scripts/build.scm (transform-package-source-commit): Add
'recursive?' field to SOURCE.
* tests/scripts-build.scm ("options->transformation, with-branch")
("options->transformation, with-commit"): New tests.
This commit is contained in:
Ludovic Courtès 2019-03-13 10:26:31 +01:00 committed by Ludovic Courtès
parent 14328b81a2
commit 845c44012c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 51 additions and 1 deletions

View File

@ -342,7 +342,8 @@ strings like \"guile-next=cabba9e\" meaning that packages are built using
(if (< (string-length commit) 7) (if (< (string-length commit) 7)
commit commit
(string-take commit 7)))) (string-take commit 7))))
(source (git-checkout (url url) (commit commit))))) (source (git-checkout (url url) (commit commit)
(recursive? #t)))))
(let* ((replacements (evaluate-git-replacement-specs replacement-specs (let* ((replacements (evaluate-git-replacement-specs replacement-specs
replace)) replace))

View File

@ -20,6 +20,7 @@
#:use-module (guix tests) #:use-module (guix tests)
#:use-module (guix store) #:use-module (guix store)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix scripts build) #:use-module (guix scripts build)
#:use-module (guix ui) #:use-module (guix ui)
#:use-module (guix utils) #:use-module (guix utils)
@ -168,6 +169,54 @@
((("x" dep)) ((("x" dep))
(eq? (package-replacement dep) findutils))))))))))) (eq? (package-replacement dep) findutils)))))))))))
(test-equal "options->transformation, with-branch"
(git-checkout (url "https://example.org")
(branch "devel")
(recursive? #t))
(let* ((p (dummy-package "guix.scm"
(inputs `(("foo" ,grep)
("bar" ,(dummy-package "chbouib"
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://example.org")
(commit "cabba9e")))
(sha256 #f)))))))))
(t (options->transformation '((with-branch . "chbouib=devel")))))
(with-store store
(let ((new (t store p)))
(and (not (eq? new p))
(match (package-inputs new)
((("foo" dep1) ("bar" dep2))
(and (string=? (package-full-name dep1)
(package-full-name grep))
(string=? (package-name dep2) "chbouib")
(package-source dep2)))))))))
(test-equal "options->transformation, with-commit"
(git-checkout (url "https://example.org")
(commit "abcdef")
(recursive? #t))
(let* ((p (dummy-package "guix.scm"
(inputs `(("foo" ,grep)
("bar" ,(dummy-package "chbouib"
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://example.org")
(commit "cabba9e")))
(sha256 #f)))))))))
(t (options->transformation '((with-commit . "chbouib=abcdef")))))
(with-store store
(let ((new (t store p)))
(and (not (eq? new p))
(match (package-inputs new)
((("foo" dep1) ("bar" dep2))
(and (string=? (package-full-name dep1)
(package-full-name grep))
(string=? (package-name dep2) "chbouib")
(package-source dep2)))))))))
(test-equal "options->transformation, with-git-url" (test-equal "options->transformation, with-git-url"
(let ((source (git-checkout (url "https://example.org") (let ((source (git-checkout (url "https://example.org")
(recursive? #t)))) (recursive? #t))))