summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2018-01-29 16:21:43 +0100
committerDanny Milosavljevic <dannym@scratchpost.org>2018-01-29 16:26:35 +0100
commit25f1db8da205693bc5da8fe061f7b0219c893f56 (patch)
tree98e50c0e832a06b05792225037cf15631859ab97 /examples
parenta8c2a8fda6cc086f7056e92c1fbc781dcc9bd83a (diff)
downloadcuirass-25f1db8da205693bc5da8fe061f7b0219c893f56.tar
cuirass-25f1db8da205693bc5da8fe061f7b0219c893f56.tar.gz
examples: Use new API.
* examples/guix-track-git.scm (package->git-tracked): Add STORE parameter. (guix-jobs): Pass value for STORE parameter.
Diffstat (limited to 'examples')
-rw-r--r--examples/guix-track-git.scm28
1 files changed, 15 insertions, 13 deletions
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))))))))
;;;
@@ -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)))))