From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id EOz5E1h22mUbEgAAe85BDQ:P1 (envelope-from ) for ; Sun, 25 Feb 2024 00:06:00 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id EOz5E1h22mUbEgAAe85BDQ (envelope-from ) for ; Sun, 25 Feb 2024 00:06:00 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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=1708815960; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to: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; bh=M4a7SGoSJ+GlVsZpcQ7plmZW7VrCIxRE1vXVBt/7+lI=; b=EFqX14zQNqUFV8fKTh4klEuTEHFeG9+zCOoMh/2/d56gjN1rVexOH1sycKfzapoGldNUdz 1okenPzEwvEklgto9NmUwS23oSJZ1dV3DYeMXU50zgiee7FhsiVNtrNV0ZgeAtw4bIINHA P+yPfFMgsp8fK0LZC0y0HvlSOtRXbqgTDH9tWNugFlqlUI2HHE/Ns29lGrQ5L3xPHhU3So jD87iPxzRCe46Y7q+wEn+bcgncfaXtDJUwLCAF716r0Iu3ikfd3ZmBgtfYMNzPPpuW48Gf WFfRWrkVb2xFMNtvcDI4jQn9V9xrLDjAhQwMfm5NBxURcN4QZn51nLntiPLbTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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-Seal: i=1; s=key1; d=yhetil.org; t=1708815960; a=rsa-sha256; cv=none; b=bF5xa8F1WnLPW/Y69YJ3cUtDylHC3gKwc3REUeT9Rr+5wYtw5rewWiFxTRrRLQyt+HzrWj mao4lmUZsDiyipslVEKKUphLZXWzDSSV+rEhT0BA9jFDbXZQncg3RVRf3MaF4YpMniChne GfZRCB9Tbd2ZquyoULk4gAOqoGHuDRahNtSYnc+5VxD/OhAy0uV6H+njGI/B0oeIVNJ6U7 V9b4J24Oeu+Kz2AyQmtLgUiQBhBeCh0a/XcYWW7i7zRIbCfBFlGmEfZusdjOkY6mUu2wsw jG3TJIRx6Csh7E+EdfJ2wKGSxPbExrKKeRMPGrdfCtA1U2JRunL6YSxpVY/BlQ== 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 2D56144389 for ; Sun, 25 Feb 2024 00:06:00 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1re15H-0000rC-0Q; Sat, 24 Feb 2024 18:05:31 -0500 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 1re15F-0000qE-2q for guix-devel@gnu.org; Sat, 24 Feb 2024 18:05:29 -0500 Received: from 1.mo575.mail-out.ovh.net ([46.105.41.146]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1re15C-0005OP-NW for guix-devel@gnu.org; Sat, 24 Feb 2024 18:05:28 -0500 Received: from director2.ghost.mail-out.ovh.net (unknown [10.109.148.110]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4Tj2XW2Gkzz1Dwd for ; Sat, 24 Feb 2024 23:05:15 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-khnpp (unknown [10.110.113.68]) by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 01D9D1FD7C for ; Sat, 24 Feb 2024 23:05:14 +0000 (UTC) Received: from ngraves.fr ([37.59.142.101]) by ghost-submission-6684bf9d7b-khnpp with ESMTPSA id NCtaOCp22mXxtC8AaRiQOA (envelope-from ) for ; Sat, 24 Feb 2024 23:05:14 +0000 X-OVh-ClientIp: 90.110.172.34 To: guix-devel@gnu.org Subject: Re: (almost) deterministic patchsets In-Reply-To: <87le7owkq2.fsf@ngraves.fr> References: <87le7owkq2.fsf@ngraves.fr> Date: Sun, 25 Feb 2024 00:05:14 +0100 Message-ID: <87ttlxh39x.fsf@ngraves.fr> MIME-Version: 1.0 Content-Type: text/plain X-Ovh-Tracer-Id: 8514899522031706677 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrfeelgddtiecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvufgjfhffkfggtgesthdtredttddttdenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeeiueegteefleffheeiieetueffheffgefftdeukefhheetfeehleduhfejjedugfenucffohhmrghinhepshhrrdhhthdpghhnuhdrohhrghenucfkphepuddvjedrtddrtddruddpledtrdduuddtrddujedvrdefgedpfeejrdehledrudegvddruddtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepghhuihigqdguvghvvghlsehgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeehpdhmohguvgepshhmthhpohhuth Received-SPF: pass client-ip=46.105.41.146; envelope-from=ngraves@ngraves.fr; helo=1.mo575.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, 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: , Reply-to: Nicolas Graves From: Nicolas Graves via "Development of GNU Guix and the GNU System distribution." Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.77 X-Spam-Score: -6.77 X-Migadu-Queue-Id: 2D56144389 X-Migadu-Scanner: mx13.migadu.com X-TUID: 56aJAvr90AJv This is basically done in https://git.sr.ht/~ngraves/dotfiles/commit/bd542512dfad2beccb4a6cdb2468f79aa869a55b Maybe some things need some polish, but the PoC is definitely here. Feel free to reuse this in upstream guix if you want. On 2024-02-13 14:35, Nicolas Graves wrote: > Hi ! > > I've written this (gpl3+) that should be able to fetch patchsets for > both guix and rde. This should be robust enough for guix/rde use IMO. > > (define-module (guix mbox-download) > #:use-module (guix packages) > #:use-module ((guix self) #:select (make-config.scm)) > #:use-module (guix modules) > #:use-module (guix monads) > #:use-module (gnu packages guile) > #:use-module (gnu packages tls) > #:use-module (gnu packages version-control) > #:use-module (guix store) > #:use-module (guix gexp) > #:use-module (guix records) > #:export (mbox-fetch > mbox-reference)) > > (define-record-type* > mbox-reference make-mbox-reference > mbox-reference? > (type mbox-reference-type) > (id mbox-reference-id) > (version mbox-reference-version)) > > (define* (mbox-fetch ref hash-algo hash #:optional name > #:key (system %current-system) guile) > > (define uri > (format > #f > (assoc-ref > '((gnu . "https://debbugs.gnu.org/cgi-bin/bugreport.cgi?bug=~a;mbox=yes") > (rde . "https://lists.sr.ht/~~abcdw/rde-devel/patches/~a/mbox")) > (mbox-reference-type ref)) > (mbox-reference-id ref))) > > (define modules > (cons `((guix config) => ,(make-config.scm)) > (delete '(guix config) > (source-module-closure '((guix build download) > (guix build utils)))))) > > (define build > (with-extensions (list guile-json-4 guile-gnutls) > (with-imported-modules modules > #~(begin > (use-modules (guix build utils) (guix build download)) > (let ((mbox #$(match-record ref > (type id version) > (format #f "~a-~a-~a.mbx" type id version)))) > (setenv "TMPDIR" (getcwd)) > (setenv "XDG_DATA_HOME" (getcwd)) > (invoke #$(file-append b4 "/bin/b4") > "-d" "-n" "--offline-mode" "--no-stdin" > "am" "--no-cover" "--no-cache" > "--use-local-mbox" > (url-fetch #$uri "mbox" #:verify-certificate? #f) > "--use-version" > (number->string #$(mbox-reference-version ref)) > "--no-add-trailers" > "--outdir" "." > "--mbox-name" mbox) > (install-file mbox #$output)))))) > > (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) > system))) > (gexp->derivation (or name > (match-record ref > (type id version) > (format #f "~a-~a-~a-mbox" type id version))) > build > ;; Use environment variables and a fixed script name so > ;; there's only one script in store for all the > ;; downloads. > #:system system > #:local-build? #t ;don't offload repo cloning > #:hash-algo hash-algo > #:hash hash > #:recursive? #t > #:guile-for-build guile))) > > > This can be used in such an example : > > (use-modules (guix mbox-download) (guix packages) (guix gexp) > (guix monads) (guix store) (guix derivations)) > > (with-store store > (run-with-store store > (mlet* %store-monad > ((drv (origin->derivation > (pk 'o (origin > (method mbox-fetch) > (uri (mbox-reference > (type 'rde) > (id 44893) > (version 4))) > (sha256 > (base32 "1rs09wxvdaxrk2zh6g23s9min76wjm9lw0a5pjklc7cfraasi7s9"))))))) > (return drv)))) > > Is guix interested in this, should I send a patch? What about renaming > this to patchset-reference instead of mbox-reference? > > My end-goal here is to use this to extend channels to channels with > patches, with something like this : > > (define* (instantiate-channel ch) > (match ch > ((name url ref patches) > (primitive-eval > `(channel > (name ',name) > ,@(if (null? patches) > `((url ,(find-home url))) > `((url ,(patched-source > (symbol->string name) > (git-checkout > (url (find-home url)) > (commit ref)) > (search-patches patches))))) > ,@(if ((@ (guix git) commit-id?) ref) > `((commit ,ref)) > `((branch ,ref))) > (introduction ,(assoc-ref channels-introductions name))))))) > > in the hypothesis where patched-source is exported from (guix transformations). -- Best regards, Nicolas Graves