From 77a1aac6cccc79d7c8085762f610e22e6ebfb43b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 9 Jun 2018 11:31:18 +0200 Subject: 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. --- guix/scripts/pull.scm | 26 +++++++++++++++++++++----- 1 file 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 @@ (define (whole-package-for-legacy name modules) (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 @@ (define (derivation->manifest-entry drv commit) 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 @@ (define update-profile (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 @@ (define (use-le-certs? url) (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?)))))))))))) -- cgit v1.2.3