[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: guix build: '--with-source' overrides the 'replacement' of a pack
From: |
Ludovic Courtès |
Subject: |
01/01: guix build: '--with-source' overrides the 'replacement' of a package. |
Date: |
Wed, 21 Dec 2016 22:50:38 +0000 (UTC) |
civodul pushed a commit to branch master
in repository guix.
commit 7c247809efe5d6a2a11617f41f45a2b6e8d6855f
Author: Ludovic Courtès <address@hidden>
Date: Wed Dec 21 23:46:44 2016 +0100
guix build: '--with-source' overrides the 'replacement' of a package.
* guix/scripts/build.scm (package-with-source): Set 'replacement' to #f.
* tests/scripts-build.scm ("options->transformation, with-source,
replacement"): New test.
---
guix/scripts/build.scm | 6 +++++-
tests/scripts-build.scm | 13 +++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 8c2c490..ccb4c27 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -151,7 +151,11 @@ the new package's version number from URI."
;; Use #:recursive? #t to allow for directories.
(source (download-to-store store uri
- #:recursive? #t))))))
+ #:recursive? #t))
+
+ ;; Override the replacement, otherwise '--with-source' would
+ ;; have no effect.
+ (replacement #f)))))
;;;
diff --git a/tests/scripts-build.scm b/tests/scripts-build.scm
index b324012..a1f684c 100644
--- a/tests/scripts-build.scm
+++ b/tests/scripts-build.scm
@@ -50,6 +50,19 @@
(add-to-store store "guix.scm" #t
"sha256" s)))))))
+(test-assert "options->transformation, with-source, replacement"
+ ;; Same, but this time the original package has a 'replacement' field. We
+ ;; expect that replacement to be set to #f in the new package.
+ (let* ((p (dummy-package "guix.scm" (replacement coreutils)))
+ (s (search-path %load-path "guix.scm"))
+ (t (options->transformation `((with-source . ,s)))))
+ (with-store store
+ (let ((new (t store p)))
+ (and (not (eq? new p))
+ (string=? (package-source new)
+ (add-to-store store "guix.scm" #t "sha256" s))
+ (not (package-replacement new)))))))
+
(test-assert "options->transformation, with-source, with version"
;; Our pseudo-package is called 'guix.scm' so the 'guix.scm-2.0' source
;; should be applicable, and its version should be extracted.