guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/02: guix build: '--with-source' correctly matches versioned file name


From: Ludovic Courtès
Subject: 01/02: guix build: '--with-source' correctly matches versioned file names.
Date: Wed, 23 Mar 2016 22:44:23 +0000

civodul pushed a commit to branch master
in repository guix.

commit 9a2a20052a1a9c384a1b877d7c71d2d239f9467e
Author: Ludovic Courtès <address@hidden>
Date:   Wed Mar 23 22:32:44 2016 +0100

    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.
---
 guix/scripts/build.scm  |    6 +++++-
 tests/scripts-build.scm |   20 ++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index b25bf50..9a6b427 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -24,7 +24,11 @@
   #:use-module (guix derivations)
   #:use-module (guix packages)
   #:use-module (guix grafts)
-  #:use-module (guix utils)
+
+  ;; Use the procedure that destructures "NAME-VERSION" forms.
+  #:use-module ((guix utils) #:hide (package-name->name+version))
+  #:use-module ((guix build utils) #:select (package-name->name+version))
+
   #:use-module (guix monads)
   #:use-module (guix gexp)
   #:autoload   (guix http-client) (http-fetch http-get-error?)
diff --git a/tests/scripts-build.scm b/tests/scripts-build.scm
index 94ddaf4..cf9770e 100644
--- a/tests/scripts-build.scm
+++ b/tests/scripts-build.scm
@@ -22,6 +22,7 @@
   #:use-module (guix packages)
   #:use-module (guix scripts build)
   #:use-module (guix ui)
+  #:use-module (guix utils)
   #:use-module (gnu packages base)
   #:use-module (gnu packages busybox)
   #:use-module (ice-9 match)
@@ -49,6 +50,25 @@
                        (add-to-store store "guix.scm" #t
                                      "sha256" s)))))))
 
+(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.
+  (let ((p (dummy-package "foo"))
+        (s (search-path %load-path "guix.scm")))
+    (call-with-temporary-directory
+     (lambda (directory)
+       (let* ((f (string-append directory "/foo-42.0.tar.gz"))
+              (t (options->transformation `((with-source . ,f)))))
+         (copy-file s f)
+         (with-store store
+           (let ((new (t store p)))
+             (and (not (eq? new p))
+                  (string=? (package-name new) (package-name p))
+                  (string=? (package-version new) "42.0")
+                  (string=? (package-source new)
+                            (add-to-store store (basename f) #t
+                                          "sha256" f))))))))))
+
 (test-assert "options->transformation, with-source, no matches"
   ;; When a transformation in not applicable, a warning must be raised.
   (let* ((p (dummy-package "foobar"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]