all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Guile snippet to get latest "guix pull" commit with prebuilt binaries
@ 2019-02-04 23:09 Pierre Neidhardt
  2019-02-05  4:58 ` swedebugia
  2019-02-12 16:34 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Pierre Neidhardt @ 2019-02-04 23:09 UTC (permalink / raw)
  To: help-guix

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

Hi,

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? :)

@Ludo: Seems like I cannot send you emails directly, maybe I'm being
marked as spam?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Guile snippet to get latest "guix pull" commit with prebuilt binaries
  2019-02-04 23:09 Guile snippet to get latest "guix pull" commit with prebuilt binaries Pierre Neidhardt
@ 2019-02-05  4:58 ` swedebugia
  2019-02-12 16:34 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: swedebugia @ 2019-02-05  4:58 UTC (permalink / raw)
  To: help-guix, Pierre Neidhardt

Pierre Neidhardt <mail@ambrevar.xyz> skrev: (5 februari 2019 00:09:46 CET)
>
>@Ludo: Seems like I cannot send you emails directly, maybe I'm being
>marked as spam?

I also could not send to ludo at gnu dot org about a week ago and ended up sending a notice to his work email instead. 
don't know if that worked better but it was not rejected by the postmaster.


-- 
Sent from my k-9 mail for Android.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Guile snippet to get latest "guix pull" commit with prebuilt binaries
  2019-02-04 23:09 Guile snippet to get latest "guix pull" commit with prebuilt binaries Pierre Neidhardt
  2019-02-05  4:58 ` swedebugia
@ 2019-02-12 16:34 ` Ludovic Courtès
  2019-02-12 19:22   ` Pierre Neidhardt
  1 sibling, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2019-02-12 16:34 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

Hello!

Pierre Neidhardt <mail@ambrevar.xyz> 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):


[-- Attachment #2: the file --]
[-- Type: text/plain, Size: 1894 bytes --]

(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)))))

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]


It looks for a commit for which Guix itself is built.

Use with care as this could prevent you from getting security updates!

Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Guile snippet to get latest "guix pull" commit with prebuilt binaries
  2019-02-12 16:34 ` Ludovic Courtès
@ 2019-02-12 19:22   ` Pierre Neidhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Neidhardt @ 2019-02-12 19:22 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 84 bytes --]

This is great, thanks for sharing!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-12 19:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 23:09 Guile snippet to get latest "guix pull" commit with prebuilt binaries Pierre Neidhardt
2019-02-05  4:58 ` swedebugia
2019-02-12 16:34 ` Ludovic Courtès
2019-02-12 19:22   ` Pierre Neidhardt

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.