From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id oP+tG26xRmTh9gAASxT56A (envelope-from ) for ; Mon, 24 Apr 2023 18:42:22 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id aFW9G26xRmT6GgAA9RJhRA (envelope-from ) for ; Mon, 24 Apr 2023 18:42:22 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 04AA21C348 for ; Mon, 24 Apr 2023 18:42:22 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pqzGE-0007wp-2x; Mon, 24 Apr 2023 12:41:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqzGC-0007vC-MJ for guix-devel@gnu.org; Mon, 24 Apr 2023 12:41:52 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pqzG9-0008O2-Cf for guix-devel@gnu.org; Mon, 24 Apr 2023 12:41:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=Mz5l/qKHa4+mLeYBDdmxwjCNHGgKnACoa7eS2rq5938=; b=NUFfN6tpl2bpyD+REXND1iKoZ7ayFeRZi4qL33EnJAaVsAN7Nsg1NDY/ D91oN67wJ7urPHrFEOHZFwXnBu7qRnJGTzqCrM1AqygBpVtJdL5+fySqw +JOcw2alLLunF2IwBxE6BMixgCtm8ov2npUW0WApSJOxWbtShS7otr19M 8=; X-IronPort-AV: E=Sophos;i="5.99,223,1677538800"; d="scan'208";a="54232935" Received: from unknown (HELO ribbon) ([193.50.110.118]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Apr 2023 18:41:46 +0200 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Simon Tournier Cc: =?utf-8?Q?Bj=C3=B6rn_H=C3=B6fling?= , guix-devel@gnu.org, Lars-Dominik Braun Subject: Adding content-addressed URLs to https://guix.gnu.org/sources.json References: <20230312220021.22bfff4f@tangletp> <878rfwgbng.fsf@gnu.org> <86lej8y75p.fsf@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Quintidi 5 =?utf-8?Q?Flor=C3=A9al?= an 231 de la =?utf-8?Q?R=C3=A9volution=2C?= jour du Rossignol 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, 24 Apr 2023 18:41:45 +0200 In-Reply-To: <86lej8y75p.fsf@gmail.com> (Simon Tournier's message of "Mon, 03 Apr 2023 23:42:26 +0200") Message-ID: <87cz3t44hi.fsf_-_@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=192.134.164.104; envelope-from=ludovic.courtes@inria.fr; helo=mail3-relais-sop.national.inria.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1682354542; a=rsa-sha256; cv=none; b=TvmH3OCD3Rwz8ongGnCPyHpwW6Zd6ZT5uXD3eJblrNz0m1KcpOU/3A5ZCNvFfeyf0+Px6P QLJtA0qkNrR92fj5dEyF6/IqOLa9upChtNDBxyq1nt+zY2BMaEXvstMEhPdKS38/epanFe fIYE1sZCLuBBH46PEhf6OdwHivL5noChkON0lGq40RN1i2n8dbiUAJIlq6pX/BUuNCeqt/ S4BZUW+4mtLQGx5tSavigGPqZFVy9j+VALn0ZGyIdDmpiiQ/uHswb49gLqOPP2xBmzHbm6 G4nJ87TeVKl9Nb3s1zMxIpbh2jme2qUS0ogandQU71izU9FazsM/bfTQ4VPjbw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=inria.fr header.s=dc header.b=NUFfN6tp; dmarc=pass (policy=none) header.from=inria.fr; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1682354542; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Mz5l/qKHa4+mLeYBDdmxwjCNHGgKnACoa7eS2rq5938=; b=a1+ap9BIy5u+CJLcvXyH+Awtf0OpV70t9rJXunqV5OOYzz8EALeE+xBs0Et9IwRklfEAbR fLEDFNKUGIu0RiYK7BaM49q5UQjSArCimpejJyAUorJ4kJ2rnNDzY1Br2F3sOozxH1pAbt WKmbaZqLa4DvG83H1U109euYEM9tvtA0KnmKcwRAFcM4+5iHL00QvajgjP8jmmwzXTbGet 8/mXGMJ5ZTiDotxbCnxEM+aW1yx1m8EbmJaGJh3wNNOFeIYBzmEsFR/aSPrKMUoB0P2dr/ i3HgbmIAG9+EZzcnpZV2YSNwnvRFhivo355TDkv+9Jxn31VsSk/JE9Z1O+7kYw== X-Migadu-Spam-Score: -2.40 X-Spam-Score: -2.40 X-Migadu-Queue-Id: 04AA21C348 X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=inria.fr header.s=dc header.b=NUFfN6tp; dmarc=pass (policy=none) header.from=inria.fr; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-TUID: A5x6igDuUhMu --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Simon Tournier skribis: > On Thu, 16 Mar 2023 at 12:48, Ludovic Court=C3=A8s wrote: > >> 1. Reproducibility of past revisions. If we lose copies of the >> auto-generated tarballs, then OpenJDK in past revisions of Guix is >> irreparably lost. We should check whether/how to get them in >> Disarchive + SWH. > > The file sources.json that SWH ingests only contains original upstream > and not our copies. One step forward would be to also list the URL of > our tarball substitutes as the last mirror in sources.json. The patch below (against maintenance.git) does that. The result is something like this: --8<---------------cut here---------------start------------->8--- { "type": "url", "urls": [ "https://ftpmirror.gnu.org/gnu/zile/zile-2.6.2.tar.gz", "ftp://ftp.cs.tu-berlin.de/pub/gnu/zile/zile-2.6.2.tar.gz", "ftp://ftp.funet.fi/pub/mirrors/ftp.gnu.org/gnu/zile/zile-2.6.2.tar.gz", "http://ftp.gnu.org/pub/gnu/zile/zile-2.6.2.tar.gz", "https://bordeaux.guix.gnu.org/file/zile-2.6.2.tar.gz/sha256/0hf788zadm= wx0xp1dhrgqcfvhwnarh6h9b51va4dr2y9yfppvsvp", "https://ci.guix.gnu.org/file/zile-2.6.2.tar.gz/sha256/0hf788zadmwx0xp1= dhrgqcfvhwnarh6h9b51va4dr2y9yfppvsvp", "https://tarballs.nixos.org/sha256/0hf788zadmwx0xp1dhrgqcfvhwnarh6h9b51= va4dr2y9yfppvsvp" ], "integrity": "sha256-d+t9r/PJi9yI2qGsBA3MynK4HcMvwxZuB53Xpj5Cx0E=3D" }, --8<---------------cut here---------------end--------------->8--- How does that sound? Thanks, Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/hydra/build-package-metadata.scm b/hydra/build-package-metadata.scm index 6fa2173..1ddb409 100755 --- a/hydra/build-package-metadata.scm +++ b/hydra/build-package-metadata.scm @@ -30,6 +30,7 @@ (guix utils) (guix gexp) ((guix build download) #:select (maybe-expand-mirrors)) + ((guix base32) #:select (bytevector->nix-base32-string)) ((guix base64) #:select (base64-encode)) ((guix describe) #:select (current-profile)) ((guix config) #:select (%guix-version)) @@ -73,6 +74,27 @@ superseded packages." ;;; Required by 'origin->json' for 'computed-origin-method' corner cases (define gexp-references (@@ (guix gexp) gexp-references)) +(define %content-addressed-mirrors + ;; List of content-addressed mirrors. + ;; XXX: somewhat duplicated from (guix download) + (let ((guix-publish + (lambda (host) + (lambda (file hash) + ;; Files served by 'guix publish'. + (string-append "https://" host "/file/" + file "/" (symbol->string + (content-hash-algorithm hash)) + "/" (bytevector->nix-base32-string + (content-hash-value hash))))))) + + (list (guix-publish "bordeaux.guix.gnu.org") + (guix-publish "ci.guix.gnu.org") + (lambda (file hash) + (string-append "https://tarballs.nixos.org/" + (symbol->string (content-hash-algorithm hash)) + "/" (bytevector->nix-base32-string + (content-hash-value hash))))))) + (define (origin->json origin) "Return a list of JSON representations (an alist) of ORIGIN." (define method @@ -81,10 +103,17 @@ superseded packages." (define uri (origin-uri origin)) - (define (resolve urls) - (map uri->string - (append-map (cut maybe-expand-mirrors <> %mirrors) - (map string->uri urls)))) + (define (resolve urls hash) + (append (map uri->string + (append-map (cut maybe-expand-mirrors <> %mirrors) + (map string->uri urls))) + (if hash + (let ((file (origin-actual-file-name origin)) + (hash (origin-hash origin))) + (map (lambda (make-url) + (make-url file hash)) + %content-addressed-mirrors)) + '()))) (if (eq? method (@@ (guix packages) computed-origin-method)) ;; Packages in gnu/packages/gnuzilla.scm and gnu/packages/linux.scm @@ -118,7 +147,8 @@ superseded packages." (resolve (match uri ((? string? url) (list url)) - ((urls ...) urls))))))) + ((urls ...) urls)) + (origin-hash origin)))))) ((eq? git-fetch method) `(("git_url" . ,(git-reference-url uri)))) ((eq? svn-fetch method) --=-=-=--