summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-06-09 11:31:18 +0200
committerLudovic Courtès <ludo@gnu.org>2018-06-09 12:02:28 +0200
commit77a1aac6cccc79d7c8085762f610e22e6ebfb43b (patch)
treeb6f56970e5bd7ad7e1a6c8d191504c25f51f0e58
parentf6f2346f9b9387d449844fe5b3207ccbede069f4 (diff)
downloadguix-77a1aac6cccc79d7c8085762f610e22e6ebfb43b.tar.gz
pull: Record the URL, branch, and commit as a manifest entry property.
* guix/scripts/pull.scm (derivation->manifest-entry): Turn COMMIT into a
keyword parameter; add #:url and #:branch.  Add a 'source' property to
the manifest entry.
(build-and-install): Add #:url and #:branch and pass it to
'derivation->manifest-entry'.
(guix-pull): Adjust accordingly.
-rw-r--r--guix/scripts/pull.scm26
1 files changed, 21 insertions, 5 deletions
diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index c5ceebccb6..499de0ec45 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -199,8 +199,10 @@ modules in the old ~/.config/guix/latest style."
                  (list guile-json guile-git guile-bytestructures
                        guile-ssh gnutls)))
 
-(define (derivation->manifest-entry drv commit)
-  "Return a manifest entry for DRV, which represents Guix at COMMIT."
+(define* (derivation->manifest-entry drv
+                                     #:key url branch commit)
+  "Return a manifest entry for DRV, which represents Guix at COMMIT.  Record
+URL, BRANCH, and COMMIT as a property in the manifest entry."
   (mbegin %store-monad
     (what-to-build (list drv))
     (built-derivations (list drv))
@@ -212,10 +214,16 @@ modules in the old ~/.config/guix/latest style."
                           drv
                           (whole-package-for-legacy (string-append name "-"
                                                                    version)
-                                                    drv))))))))
+                                                    drv)))
+                (properties
+                 `((source (repository
+                            (version 0)
+                            (url ,url)
+                            (branch ,branch)
+                            (commit ,commit))))))))))
 
 (define* (build-and-install source config-dir
-                            #:key verbose? commit)
+                            #:key verbose? url branch commit)
   "Build the tool from SOURCE, and install it in CONFIG-DIR."
   (define update-profile
     (store-lift build-and-use-profile))
@@ -223,7 +231,10 @@ modules in the old ~/.config/guix/latest style."
   (mlet* %store-monad ((drv   (build-from-source source
                                                  #:commit commit
                                                  #:verbose? verbose?))
-                       (entry (derivation->manifest-entry drv commit)))
+                       (entry (derivation->manifest-entry drv
+                                                          #:url url
+                                                          #:branch branch
+                                                          #:commit commit)))
     (update-profile (string-append config-dir "/current")
                     (manifest (list entry)))))
 
@@ -306,6 +317,11 @@ certificates~%"))
                                     (canonical-package guile-2.2)))))
                  (run-with-store store
                    (build-and-install checkout (config-directory)
+                                      #:url url
+                                      #:branch (match ref
+                                                 (('branch . branch)
+                                                  branch)
+                                                 (_ #f))
                                       #:commit commit
                                       #:verbose?
                                       (assoc-ref opts 'verbose?))))))))))))