From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 03 16:27:41 2018 Received: (at 26608) by debbugs.gnu.org; 3 Sep 2018 20:27:41 +0000 Received: from localhost ([127.0.0.1]:44619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fwvRj-0006P4-8N for submit@debbugs.gnu.org; Mon, 03 Sep 2018 16:27:41 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fwvRg-0006Oo-VS for 26608@debbugs.gnu.org; Mon, 03 Sep 2018 16:27:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwvRZ-0000SM-R7 for 26608@debbugs.gnu.org; Mon, 03 Sep 2018 16:27:31 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52884) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwvRX-0000R7-Qu; Mon, 03 Sep 2018 16:27:28 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=48810 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fwvRX-0003Co-49; Mon, 03 Sep 2018 16:27:27 -0400 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Alex Sassmannshausen Subject: Re: bug#22629: =?utf-8?B?4oCcU3RhYmxl4oCd?= branch References: <87vb5vsffd.fsf@gnu.org> <87pny2iks2.fsf@gnu.org> <877ekagtg9.fsf@netris.org> <87zhx5msfl.fsf@pompo.co> <87lg8pccys.fsf_-_@netris.org> <87zhx59gh3.fsf@elephly.net> <875zzs9wzl.fsf@netris.org> <874lfcxd2v.fsf_-_@gnu.org> <87wos8lzcj.fsf@pompo.co> <878t4nqzqv.fsf@gnu.org> <87r2iau0wz.fsf@pompo.co> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 17 Fructidor an 226 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 03 Sep 2018 22:27:25 +0200 In-Reply-To: <87r2iau0wz.fsf@pompo.co> (Alex Sassmannshausen's message of "Mon, 03 Sep 2018 16:10:36 +0200") Message-ID: <87h8j6wclu.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26608 Cc: 26608@debbugs.gnu.org, Konrad Hinsen , 22629@debbugs.gnu.org, 32022@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Alex Sassmannshausen skribis: > Ludovic Court=C3=A8s 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 =E2=80=98latest-commit-with-substitutes-available=E2=80= =99 would use >> (git) and (guix ci) to find the latest commit for which substitutes of >> interest are available, and would return: >> >> (channel >> ;; =E2=80=A6 >> (commit "cabbag3")) ;the ideal commit The code below is an illustration of that. If you install it as ~/.config/guix/channels.scm, =E2=80=98guix pull=E2=80=99 will pull the late= st commit that was fully built on berlin.guixsd.org (see ), meaning that substitutes for Guix itself should be available, unless =E2=80=98guix publi= sh=E2=80=99 hasn=E2=80=99t =E2=80=9Cbaked=E2=80=9D them yet. It takes two GETs and ~1s to do that here. Ludo=E2=80=99. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=channels-test.scm Content-Description: the channels config (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))))) --=-=-=--