diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-03-23 22:32:44 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-03-23 23:43:50 +0100 |
| commit | 9a2a20052a1a9c384a1b877d7c71d2d239f9467e (patch) | |
| tree | e63fda1b5dac94a569372d67b0a9ed986f9959c0 /tests | |
| parent | 7b150a24feb96bb803d4caf50846c6ac8b2c4ad0 (diff) | |
guix build: '--with-source' correctly matches versioned file names.
* guix/scripts/build.scm: Use the right 'package-name->name+version'
procedure. Fixes a regression introduced in
1b846da8c372bee78851439fd9e72b2499115e5a.
* tests/scripts-build.scm ("options->transformation, with-source, with
version"): New test.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/scripts-build.scm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/scripts-build.scm b/tests/scripts-build.scm index 94ddaf447be..cf9770e9520 100644 --- a/tests/scripts-build.scm +++ b/tests/scripts-build.scm | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #:use-module (guix packages) | 22 | #:use-module (guix packages) |
| 23 | #:use-module (guix scripts build) | 23 | #:use-module (guix scripts build) |
| 24 | #:use-module (guix ui) | 24 | #:use-module (guix ui) |
| 25 | #:use-module (guix utils) | ||
| 25 | #:use-module (gnu packages base) | 26 | #:use-module (gnu packages base) |
| 26 | #:use-module (gnu packages busybox) | 27 | #:use-module (gnu packages busybox) |
| 27 | #:use-module (ice-9 match) | 28 | #:use-module (ice-9 match) |
| @@ -49,6 +50,25 @@ | |||
| 49 | (add-to-store store "guix.scm" #t | 50 | (add-to-store store "guix.scm" #t |
| 50 | "sha256" s))))))) | 51 | "sha256" s))))))) |
| 51 | 52 | ||
| 53 | (test-assert "options->transformation, with-source, with version" | ||
| 54 | ;; Our pseudo-package is called 'guix.scm' so the 'guix.scm-2.0' source | ||
| 55 | ;; should be applicable, and its version should be extracted. | ||
| 56 | (let ((p (dummy-package "foo")) | ||
| 57 | (s (search-path %load-path "guix.scm"))) | ||
| 58 | (call-with-temporary-directory | ||
| 59 | (lambda (directory) | ||
| 60 | (let* ((f (string-append directory "/foo-42.0.tar.gz")) | ||
| 61 | (t (options->transformation `((with-source . ,f))))) | ||
| 62 | (copy-file s f) | ||
| 63 | (with-store store | ||
| 64 | (let ((new (t store p))) | ||
| 65 | (and (not (eq? new p)) | ||
| 66 | (string=? (package-name new) (package-name p)) | ||
| 67 | (string=? (package-version new) "42.0") | ||
| 68 | (string=? (package-source new) | ||
| 69 | (add-to-store store (basename f) #t | ||
| 70 | "sha256" f)))))))))) | ||
| 71 | |||
| 52 | (test-assert "options->transformation, with-source, no matches" | 72 | (test-assert "options->transformation, with-source, no matches" |
| 53 | ;; When a transformation in not applicable, a warning must be raised. | 73 | ;; When a transformation in not applicable, a warning must be raised. |
| 54 | (let* ((p (dummy-package "foobar")) | 74 | (let* ((p (dummy-package "foobar")) |
