GNU bug report logs -
#26608
Provide --only-substitutes flag to "guix package --upgrade"
Previous Next
Full log
Message #40 received at 26608 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Alex Sassmannshausen <alex <at> pompo.co> skribis:
> Ludovic Courtès writes:
[...]
>> I just had a bright idea (yes!): this can be addressed by writing
>> something like this in ~/.config/guix/channels.scm:
>>
>> (map latest-commit-with-substitutes-available
>> %default-channels)
>>
>> The hypothetical ‘latest-commit-with-substitutes-available’ would use
>> (git) and (guix ci) to find the latest commit for which substitutes of
>> interest are available, and would return:
>>
>> (channel
>> ;; …
>> (commit "cabbag3")) ;the ideal commit
The code below is an illustration of that. If you install it as
~/.config/guix/channels.scm, ‘guix pull’ will pull the latest commit
that was fully built on berlin.guixsd.org (see
<https://berlin.guixsd.org/jobset/guix-modular-master>), meaning that
substitutes for Guix itself should be available, unless ‘guix publish’
hasn’t “baked” them yet.
It takes two GETs and ~1s to do that here.
Ludo’.
[channels-test.scm (text/plain, inline)]
(use-modules (guix http-client)
(json)
(srfi srfi-1)
(ice-9 match))
(define (latest-evaluations jobset)
"Return the latest evaluations of JOBSET."
(filter (lambda (json)
(string=? (hash-ref json "specification") jobset))
(json->scm
(http-fetch
"https://berlin.guixsd.org/api/evaluations?nr=30"))))
(define (evaluation-complete? number)
"Return true if evaluation NUMBER completed and all its builds were
successful."
(let ((builds (json->scm
(http-fetch
(string-append
"https://berlin.guixsd.org/api/latestbuilds?nr=30&evaluation="
(number->string number))))))
(every (lambda (build)
;; Zero means build success.
(= (hash-ref build "buildstatus") 0))
builds)))
(define (latest-commit-successfully-built)
"Return the latest commit for which substitutes are (potentially)
available."
(let* ((evaluations (latest-evaluations "guix-modular-master"))
(candidates (filter-map (lambda (json)
(match (hash-ref json "checkouts")
((checkout)
(cons (hash-ref json "id")
(hash-ref checkout "commit")))
(_ #f)))
evaluations)))
(any (match-lambda
((evaluation . commit)
(and (evaluation-complete? evaluation)
commit)))
candidates)))
;; Pull the latest commit fully built on berlin.guixsd.org.
;; WARNING: This could downgrade your system!
(list (channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(commit (pk 'commit (latest-commit-successfully-built)))))
This bug report was last modified 3 years and 298 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.