[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Guile snippet to get latest "guix pull" commit with prebuilt binarie
Re: Guile snippet to get latest "guix pull" commit with prebuilt binaries
Tue, 12 Feb 2019 17:34:54 +0100
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Pierre Neidhardt <address@hidden> skribis:
> Ludo told me he had a Guile snippet to find the last Guix commits with
> enough(?) pre-built binaries. (Which is quite useful for a "guix pull".)
> Ludo, anyone, would you like to share? :)
Here’s the file you’d drop as ~/.config/guix/channels.scm or pass to
‘guix pull -C’ (it expects Guile-JSON 1.x):
(use-modules (guix http-client)
(define (latest-evaluations jobset)
"Return the latest evaluations of JOBSET."
(filter (lambda (json)
(string=? (hash-ref json "specification") jobset))
(define (evaluation-complete? number)
"Return true if evaluation NUMBER completed and all its builds were
(let ((builds (json->scm
(every (lambda (build)
;; Zero means build success.
(= (hash-ref build "buildstatus") 0))
"Return the latest commit for which substitutes are (potentially)
(let* ((evaluations (latest-evaluations "guix-modular-master"))
(candidates (filter-map (lambda (json)
(match (hash-ref json "checkouts")
(cons (hash-ref json "id")
(hash-ref checkout "commit")))
((evaluation . commit)
(and (evaluation-complete? evaluation)
;; Pull the latest commit fully built on berlin.guixsd.org.
;; WARNING: This could downgrade your system!
(commit (pk 'commit (latest-commit-successfully-built)))))
It looks for a commit for which Guix itself is built.
Use with care as this could prevent you from getting security updates!