Subject: Re: bug#40518: guix pull: Dependency guix-packages-base fails

From: Ludovic Courtès <[email-masked]>
Date: Fri, 10 Apr 2020 10:31:46 +0200

Hi,

[email-masked] skribis:

>> It could be an out-of-memory (OOM) condition: this build phase is
>> unfortunately very demanding currently (at least 2 GiB or RAM I think).
>> How much RAM do you have?
>
> I think we have a winner. This is running on a VM and I just realized it
> it only runs with 500MB of ram.

OK.

> So, if I am understanding correctly, for some reason the original pull
> didn't have an available substitute; however, when I later tried again
> the new HEAD referenced a guix-packages-base which *did* have a
> substitute available?

That’s probably what happened, yes: if someone just pushed to repo, then
substitutes aren’t available yet; a few minutes later, they’re
available.

You can drop the attached file in ~/.config/guix/channels.scm to pull
from the latest commit that has been fully built (which is not exactly
equivalent to “substitutes available”, but as close to it as it gets):

--8<---------------cut here---------------start------------->8---
(use-modules (guix ci)
             (srfi srfi-1)
             (ice-9 match))

(define (latest-commit-successfully-built)
  "Return the latest commit for which substitutes are (potentially)
available."
  (let* ((evaluations (filter (lambda (evaluation)
                                (and (evaluation-complete? evaluation)
                                     (string=? "guix-modular-master"
                                               (evaluation-spec
                                                evaluation))))
                              (latest-evaluations "https://ci.guix.gnu.org"))))
    (any (lambda (evaluation)
           (match (evaluation-checkouts evaluation)
             ((checkout)
              (checkout-commit checkout))
             (_ #f)))
         evaluations)))

;; 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)))))
--8<---------------cut here---------------end--------------->8---

Use with care! If the ci.guix.gnu.org is lagging or compromised, you
could find yourself not upgrading at all, or not upgrading to the latest
commit.

Ludo’.