From patchwork Sun Mar 23 07:28:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 40708 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A7C9227BBEA; Sun, 23 Mar 2025 07:30:51 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,FROM_SUSPICIOUS_NTLD,MAILING_LIST_MULTI, PDS_OTHER_BAD_TLD,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7C32527BBE2 for ; Sun, 23 Mar 2025 07:30:51 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1twFmw-0001Vj-AZ; Sun, 23 Mar 2025 03:30:30 -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 1twFmt-0001Re-KY for guix-patches@gnu.org; Sun, 23 Mar 2025 03:30:27 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1twFmt-00005E-9M; Sun, 23 Mar 2025 03:30:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=M4HrlWGLZ3dreItJ0Y4vmoicb+vbPDR/+AW9SX0g268=; b=IkUInJmx3/tDxFt7Rld9y4vOjGeArwIK5B90/gD4xsPLj6l439ZigCjf5ijV+TcipKIkW26S71/OzaCV9jrzeTRDcVY3jyGtujpn+5v4Q6hURDHB3mV1vPQKe43mA2Xllor8FeLrwc24XmUVSzhBHV4hWethnWHiPrrTB1z7ANYvpA+daI942WjtUwoEIpspWMdzCEG5GoD+8+nBOKVa09opUkPsjBUKufKAGSrGJyns73UwLju2osxEG59uRH8GP+sKCAF9X/mqJRqiprKiCWptK+2wtNm3fGhJybfIvYR2UmnAjzlV/rJgHYhYu6ajg/WsRva36H/Whgm//buCeQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1twFmr-0004RB-Ew; Sun, 23 Mar 2025 03:30:25 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH rust-team v3 11/17] scripts: import: Pass "--insert" to importers. Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sun, 23 Mar 2025 07:30:25 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77093 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77093@debbugs.gnu.org Cc: Hilton Chain , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 77093-submit@debbugs.gnu.org id=B77093.174271500016385 (code B ref 77093); Sun, 23 Mar 2025 07:30:25 +0000 Received: (at 77093) by debbugs.gnu.org; 23 Mar 2025 07:30:00 +0000 Received: from localhost ([127.0.0.1]:47349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1twFmR-0004G4-TR for submit@debbugs.gnu.org; Sun, 23 Mar 2025 03:30:00 -0400 Received: from mx.boiledscript.com ([88.99.243.112]:48278) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1twFm7-0004CK-1k for 77093@debbugs.gnu.org; Sun, 23 Mar 2025 03:29:39 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1742714977; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KhWp5HomxdIJw2k6eeh7hBQ+zY/Mq1YRWj1Fvj0R1go=; b=DglK9qV7ynnb7nB4FXJsewfUIGLyJWFMSliL0xRWcWUvxlgxQdnmpA2Hw+XO0TnqnleYb4 QTxp1Wd/YDsZet3IoHAL1jOV9rUuC+ShT69lOGMLawrjvz9d5b1nIlrKQsdIZJ6HzEhA41 cn+ARbRYdpa90UFQJKOdGZalEDKJL/envdX7GCTSMqzZqZUXYBdFXUR7Zp87gqhlWt3afb KFsyRp6A19vlvdwpbMgUKj7eSY0kfWpIJsOdqkIvt9FRNChqj+8FJu2S57dtYH76dnBJ1D W1zgkX+5ahWEW7riT9LkBv2qcDEHUjFsp3WsDPbR3I3dDArW331V38P8H3lLqQ== Date: Sun, 23 Mar 2025 15:28:33 +0800 Message-ID: <8484c437247c8527b4dea8cdda1f3c43bb981611.1742713356.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 X-MS-Reactions: disallow X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches So that importers can adjust the file before inserting. * guix/scripts/import.scm (%standard-import-options): Add ‘--file-to-insert’. (guix-import): Pass it to importers when ‘--insert’ is set. Change-Id: I8e7a18ee8e0f96d7fc5688a207a7a5390ad2fa30 --- guix/scripts/import.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index 6f6354928e..38349bff3a 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -31,6 +31,7 @@ (define-module (guix scripts import) #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) + #:use-module (srfi srfi-37) #:use-module (ice-9 format) #:use-module (ice-9 match) #:export (%standard-import-options @@ -41,7 +42,12 @@ (define-module (guix scripts import) ;;; Command line options. ;;; -(define %standard-import-options '()) +(define %standard-import-options + (list + ;; Hidden option for importer-specific file preprocessing. + (option '("file-to-insert") #f #t + (lambda (opt name arg result) + (alist-cons 'file-to-insert arg result))))) ;;; @@ -140,7 +146,10 @@ (define-command (guix-import . args) (newline port) (newline port) (close-port port))))))))) - (import-as-definitions importer args find-and-insert))) + (import-as-definitions importer + (cons (string-append "--file-to-insert=" file) + args) + find-and-insert))) ((importer args ...) (let ((print (lambda (expr) (leave-on-EPIPE