all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 34838@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludovic.courtes@inria.fr>
Subject: [bug#34838] [PATCH 5/6] guix build: '--with-commit' makes recursive checkouts.
Date: Wed, 13 Mar 2019 11:47:50 +0100	[thread overview]
Message-ID: <20190313104751.20758-5-ludo@gnu.org> (raw)
In-Reply-To: <20190313104751.20758-1-ludo@gnu.org>

From: Ludovic Courtès <ludovic.courtes@inria.fr>

This was an omission from commit
024a6bfba906742c136a47b4099f06880f1d3f15.

* 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.
---
 guix/scripts/build.scm  |  3 ++-
 tests/scripts-build.scm | 49 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 8ebcf79243..20929d6110 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -342,7 +342,8 @@ strings like \"guile-next=cabba9e\" meaning that packages are built using
                               (if (< (string-length commit) 7)
                                   commit
                                   (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
                                                        replace))
diff --git a/tests/scripts-build.scm b/tests/scripts-build.scm
index 4bf1e1a719..32876e956a 100644
--- a/tests/scripts-build.scm
+++ b/tests/scripts-build.scm
@@ -20,6 +20,7 @@
   #:use-module (guix tests)
   #:use-module (guix store)
   #:use-module (guix packages)
+  #:use-module (guix git-download)
   #:use-module (guix scripts build)
   #:use-module (guix ui)
   #:use-module (guix utils)
@@ -168,6 +169,54 @@
                        ((("x" dep))
                         (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"
   (let ((source (git-checkout (url "https://example.org")
                               (recursive? #t))))
-- 
2.21.0

  parent reply	other threads:[~2019-03-13 11:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13  9:57 [bug#34838] [PATCH 0/6] Add '--with-git-url' and make sure it composes well Ludovic Courtès
2019-03-13 10:47 ` [bug#34838] [PATCH 1/6] guix build: Add '--with-git-url' Ludovic Courtès
2019-03-13 10:47   ` [bug#34838] [PATCH 2/6] packages: Add 'package-input-rewriting/spec' Ludovic Courtès
2019-03-13 10:47   ` [bug#34838] [PATCH 3/6] guix build: Factorize 'package-git-url' Ludovic Courtès
2019-03-13 10:47   ` [bug#34838] [PATCH 4/6] guix build: Transformation options match packages by spec Ludovic Courtès
2019-03-13 10:47   ` Ludovic Courtès [this message]
2019-03-13 10:47   ` [bug#34838] [PATCH 6/6] guix build: '--with-branch' strips slashes from the version string Ludovic Courtès
2019-03-17 21:56 ` bug#34838: [PATCH 0/6] Add '--with-git-url' and make sure it composes well Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190313104751.20758-5-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=34838@debbugs.gnu.org \
    --cc=ludovic.courtes@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.