all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Danny Milosavljevic <dannym@scratchpost.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Cuirass news
Date: Sat, 27 Jan 2018 18:27:16 +0100	[thread overview]
Message-ID: <20180127182716.36a0766f@scratchpost.org> (raw)
In-Reply-To: <20180126014630.56fefa68@scratchpost.org>

... and a fix to an example:

Note: I'm incapable of making the pass-through of the fetch-repository result
through

   (call-with-output-fdes 1 "/dev/null"
    (lambda () (fetch-repository spec))

work, thus disabled it.

diff --git a/examples/guix-track-git.scm b/examples/guix-track-git.scm
index e3531f0..f867c08 100644
--- a/examples/guix-track-git.scm
+++ b/examples/guix-track-git.scm
@@ -190,20 +190,22 @@ valid."
       (move->fdes port fdes)
       result)))
 
-(define* (package->git-tracked pkg #:key (branch "master") commit url)
+(define* (package->git-tracked store pkg #:key (branch "master") commit url)
   (let* ((source (package-source pkg))
          (uri (origin-uri source)))
-    (if (not branch) pkg
-        (let* ((spec (package->spec pkg #:branch branch #:commit commit #:url url))
-               (commit (call-with-output-fdes 1 "/dev/null"
-                                              (lambda () (fetch-repository spec))))
-               (url (or url (git-reference-url uri)))
-               (git-dir (string-append (%package-cachedir) "/" (url->file-name url)))
-               (hash (bytevector->nix-base32-string (file-hash git-dir)))
-               (source (origin (uri (git-reference (url url) (commit commit)))
-                              (method git-fetch)
-                              (sha256 (base32 hash)))))
-          (set-fields pkg ((package-source) source))))))
+    (if (not branch)
+        pkg
+        (let* ((spec (package->spec pkg #:branch branch #:commit commit #:url url)))
+          (let-values (((checkout commit)
+                        (fetch-repository store spec)))
+            (let* ((url (or url (git-reference-url uri)))
+                   ; maybe (string-append (%package-cachedir) "/" (url->file-name url))
+                   (git-dir checkout)
+                   (hash (bytevector->nix-base32-string (file-hash git-dir)))
+                   (source (origin (uri (git-reference (url url) (commit commit)))
+                                   (method git-fetch)
+                                   (sha256 (base32 hash)))))
+              (set-fields pkg ((package-source) source))))))))
 
 \f
 ;;;
@@ -215,7 +217,7 @@ valid."
          (pkg (specification->package name))
          (branch (or (assoc-ref arguments 'branch) "master"))
          (url (assoc-ref arguments 'url))
-         (pkg.git (package->git-tracked pkg #:branch branch #:url url))
+         (pkg.git (package->git-tracked store pkg #:branch branch #:url url))
          (system (or (assoc-ref arguments 'system) "x86_64-linux")))
     (parameterize ((%graft? #f))
       (list (package-job store (job-name pkg) pkg.git system)))))

  reply	other threads:[~2018-01-27 17:28 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 22:12 Cuirass news Ludovic Courtès
2018-01-25 10:55 ` Mathieu Othacehe
2018-01-25 10:59   ` Mathieu Othacehe
2018-01-25 13:09     ` Ludovic Courtès
2018-01-26 14:30       ` Danny Milosavljevic
2018-01-27 16:01         ` Ludovic Courtès
2018-01-27 17:18           ` Danny Milosavljevic
2018-01-27 19:12             ` Danny Milosavljevic
2018-01-28 21:47             ` Ludovic Courtès
2018-01-28 22:23               ` Danny Milosavljevic
2018-01-29  9:57               ` Andy Wingo
2018-02-08 13:37             ` Ludovic Courtès
2018-02-08 16:29               ` Danny Milosavljevic
2018-02-08 22:21                 ` Ludovic Courtès
2018-02-08 23:05                   ` Danny Milosavljevic
2018-02-09  6:17                     ` Gábor Boskovits
2018-02-09  9:41                     ` Ludovic Courtès
2018-02-09 11:29                       ` Danny Milosavljevic
2018-02-09 16:53                         ` Ludovic Courtès
2018-02-09 17:06                           ` Danny Milosavljevic
2018-02-10 11:18                             ` Ludovic Courtès
2018-02-13  9:12                               ` Danny Milosavljevic
2018-02-14 13:43                                 ` Ludovic Courtès
2018-02-14 23:17                                   ` Ludovic Courtès
2018-02-19 15:35                                     ` Danny Milosavljevic
2018-02-19 15:35                                       ` [PATCH] database: Simplify 'db-get-builds' Danny Milosavljevic
2018-02-19 17:52                                       ` [PATCH] database: db-get-builds: Inline output selection Danny Milosavljevic
2018-02-19 22:08                                       ` Cuirass news Danny Milosavljevic
2018-03-02 13:21                                         ` Ludovic Courtès
2018-03-02 22:06                                           ` Ludovic Courtès
2018-03-02 23:29                                           ` Danny Milosavljevic
2018-02-14 23:21                                   ` Ludovic Courtès
2018-01-25 21:06 ` Ricardo Wurmus
2018-01-26 11:12   ` Ludovic Courtès
2018-01-25 22:28 ` Danny Milosavljevic
2018-01-26 10:47   ` Ludovic Courtès
2018-01-28 12:33     ` Cuirass frontend Danny Milosavljevic
2018-01-29 17:42       ` Ludovic Courtès
2018-01-26  0:46 ` Cuirass news Danny Milosavljevic
2018-01-27 17:27   ` Danny Milosavljevic [this message]
2018-01-28 21:48     ` Ludovic Courtès
2018-01-26 17:55 ` Jan Nieuwenhuizen

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=20180127182716.36a0766f@scratchpost.org \
    --to=dannym@scratchpost.org \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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.