From patchwork Mon Apr 28 16:23:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hilton Chain X-Patchwork-Id: 42114 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 2BC8F27BC49; Mon, 28 Apr 2025 17:33:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 C97D227BC4A for ; Mon, 28 Apr 2025 17:33:51 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u9RPk-0007qj-AN; Mon, 28 Apr 2025 12:33:04 -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 1u9ROx-0007b3-5a for guix-patches@gnu.org; Mon, 28 Apr 2025 12:32:16 -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 1u9ROv-0004OR-H6; Mon, 28 Apr 2025 12:32:14 -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=lJnRrnFaiY5jXSN0km3mx1CAOIuh7tR5wqLgJ+wKbVA=; b=uWdbB2SQonioMb/ZjdI6aqZouASqek9dexP7U/DbF1sDAuDrCp5z05Vn5m2+/bSgbAqsL4gVMK1NPfvQv7UKIR+DfpT1FhO6Pzil5Xkd0sQ4+9SVu6G7lEHNmU0obxqMUo4cJ2n3Ra5P+Yujxa6PgxaVPBJN37oqLrjGu3ZKLZFsJ0Y8mRHRU+l9XZlHQvWUAuNVKPLa9c45HLXaYeWKx4PkC6MolMEb1KAYB1aU1nkucglQ8E2tcCbb48MfgLc8aYtPECGm1QU9rz0uJ3alRvtRhWa9hLrG5WU5hCJ5QofkXJyH0rjzEgelEsky8Ghx+N519Muy3wINkLajzHJyiA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u9ROt-0003Ht-51; Mon, 28 Apr 2025 12:32:11 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77093] [PATCH v4 rust-team 04/22] 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: Mon, 28 Apr 2025 16:32:11 +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.174585788612101 (code B ref 77093); Mon, 28 Apr 2025 16:32:11 +0000 Received: (at 77093) by debbugs.gnu.org; 28 Apr 2025 16:31:26 +0000 Received: from localhost ([127.0.0.1]:32823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u9ROA-000396-GP for submit@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:26 -0400 Received: from mail.boiledscript.com ([49.12.134.184]:38414) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u9RO6-00038I-RG for 77093@debbugs.gnu.org; Mon, 28 Apr 2025 12:31:23 -0400 From: Hilton Chain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=mail; t=1745857881; 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=5GEsfFOr78z58i5/gVbrTubp5uOTjB/en2s+rLpth4M=; b=jhRytA0nZZ8O3SQhkZYtcO7NK0W+RMzXfJq0+MRY4g7WPrHj4qUx5nbvHZs2frCYjfi8Ma JJeOlZSfyL3/RfwX/6p2xahxsOhzvD3I0vD/olrtzev9LOwwhZWDWgzfFFxAMY1bJEjc0m /31mAWAeVuWvx4509axrzTIGQJN+8tFe9ZfNa3zpofbyiGnn2R0AvONvvHrBUjanK8x4Ur SSF/1s+mKQcq4AB9vMDRsQl5FWBXQK/UeO00i8TQHekSokFOOWO7ScT5sgaFE4AyWtxG+W eukiIBDTrawI6/ZW+VsYK1b8lgZZR5Kyb1VqCck3irX39jX/nvq2TZ5YHRaKRA== Date: Tue, 29 Apr 2025 00:23:01 +0800 Message-ID: <193c85a4094b2a8a68136bd98a1665a54140933a.1745855744.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 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 1242fb0b66..c620911893 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))))) ;;; @@ -151,7 +157,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