From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id UOIJD0dwy2UITwAAe85BDQ:P1 (envelope-from ) for ; Tue, 13 Feb 2024 14:36:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id UOIJD0dwy2UITwAAe85BDQ (envelope-from ) for ; Tue, 13 Feb 2024 14:36:07 +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=1707831366; 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:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=kSSgYBp+xQcndKnhr0dqidj/TqOPetl1OxjGXg/TrDE=; b=ISQRvPa2xcPDp/ylpIy6/t1Hma+a7Q/t88/4HNzL7fjutEFLaP8w2B/GzMuiC23ZcEA05o wTpx3ShdzWKH+Loxl2p0tOO4oVbqr89KOnwQYZqZyN+fRI/vavSfZUT4+ONvlyNtxeaGSx M7UKr2R/oqxDKAlBPSKu6jr3HkjCuINP0lXYx4oa3iQRFHcPHg3MTS9lkGFCv8sRHeJcfS iwF6k3JHqrNLKufuf46DdD4oAFzyHRUsk4mYqMFxjxhZWLSd2+s9NprpHjVUddADUaceGn YA0MfPktnYcYKvV+wxxLJOUem3GY0c/Yz5zR/7APJatAjTG90XomuI8Z5xmYOg== 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=1707831366; a=rsa-sha256; cv=none; b=nJcxTFVCYBpKr50vckvvnoqTuUMcNj9jOSpAzM4jADbHzFaRWYrKYelqH4SaRLhJ3ytyY5 G+asfXHnjCjqYPAVF2o6X+giWqbJd/CH7Z+PbA1nD3dJ0B/5STvCMIhUWkBEPXDe45fUfu dtFisr6MEsJfkAfHuw/GcsGs9hso2gghUF3Rc7y3FQO9+e2ErQc5RRAKx9u0Wo8rjB8GE7 i22SrGC/ZlC10xpsjWgQqcCmPOTnUn97THmjVtDN4CGYXZhzSJxQIWWDLBLrJE0+W7eQiO DGhkrZh1j3pSniheoceMbuo9cFox+n1cEewsxyL/7Rnfebl4GnnnJpKTs8BamA== 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 C84821D480 for ; Tue, 13 Feb 2024 14:36:06 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rZswf-0003Fo-Sc; Tue, 13 Feb 2024 08:35:34 -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 1rZswe-0003CM-ER for guix-devel@gnu.org; Tue, 13 Feb 2024 08:35:32 -0500 Received: from 9.mo561.mail-out.ovh.net ([87.98.184.141]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rZswb-0003wh-EW for guix-devel@gnu.org; Tue, 13 Feb 2024 08:35:32 -0500 Received: from director9.ghost.mail-out.ovh.net (unknown [10.109.139.172]) by mo561.mail-out.ovh.net (Postfix) with ESMTP id 4TZ2Py3DQqz1Dyt for ; Tue, 13 Feb 2024 13:35:18 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-qn854 (unknown [10.111.174.226]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 23E871FE8E for ; Tue, 13 Feb 2024 13:35:17 +0000 (UTC) Received: from ngraves.fr ([37.59.142.105]) by ghost-submission-6684bf9d7b-qn854 with ESMTPSA id JeooNxVwy2XswQAASL3IHw (envelope-from ) for ; Tue, 13 Feb 2024 13:35:17 +0000 X-OVh-ClientIp: 81.67.146.208 To: guix-devel@gnu.org Subject: (almost) deterministic patchsets Date: Tue, 13 Feb 2024 14:35:17 +0100 Message-ID: <87le7owkq2.fsf@ngraves.fr> MIME-Version: 1.0 Content-Type: text/plain X-Ovh-Tracer-Id: 8076642983106503221 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrudehgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecunecujfgurhephffvufffkfggtgesthdtredttddttdenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeekveeihefhtefghfeuteeuhfehledtfeffgfeuhffhueehffegiefgieeiieeiheenucffohhmrghinhepghhnuhdrohhrghdpshhrrdhhthenucfkphepuddvjedrtddrtddruddpkedurdeijedrudegiedrvddtkedpfeejrdehledrudegvddruddtheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepghhuihigqdguvghvvghlsehgnhhurdhorhhgpdfovfetjfhoshhtpehmohehiedupdhmohguvgepshhmthhpohhuth Received-SPF: pass client-ip=87.98.184.141; envelope-from=ngraves@ngraves.fr; helo=9.mo561.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: -5.48 X-Spam-Score: -5.48 X-Migadu-Queue-Id: C84821D480 X-Migadu-Scanner: mx12.migadu.com X-TUID: Rrw1XWL9Ke12 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