From patchwork Fri May 27 08:12:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 39626 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 8505E27BBEA; Fri, 27 May 2022 09:14:46 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 F0E9527BBE9 for ; Fri, 27 May 2022 09:14:45 +0100 (BST) Received: from localhost ([::1]:34120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nuV7N-0005UA-4j for patchwork@mira.cbaines.net; Fri, 27 May 2022 04:14:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nuV6g-0005SC-8j for guix-patches@gnu.org; Fri, 27 May 2022 04:14:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38734) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nuV6f-0007zJ-TS for guix-patches@gnu.org; Fri, 27 May 2022 04:14:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nuV6f-00006t-LG for guix-patches@gnu.org; Fri, 27 May 2022 04:14:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55615] [PATCH] gnu: Add r-pscbs. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 27 May 2022 08:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55615 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: zimoun Cc: 55615-done@debbugs.gnu.org Received: via spool by 55615-done@debbugs.gnu.org id=D55615.1653639239408 (code D ref 55615); Fri, 27 May 2022 08:14:01 +0000 Received: (at 55615-done) by debbugs.gnu.org; 27 May 2022 08:13:59 +0000 Received: from localhost ([127.0.0.1]:60864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuV6Z-00006T-V6 for submit@debbugs.gnu.org; Fri, 27 May 2022 04:13:59 -0400 Received: from sender4-of-o50.zoho.com ([136.143.188.50]:21044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nuV6U-00006G-Nr for 55615-done@debbugs.gnu.org; Fri, 27 May 2022 04:13:54 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1653639228; cv=none; d=zohomail.com; s=zohoarc; b=IVuC8vpZUcqjyPi0y2bwxEE1xgHy+PfgfLQUoCim9t+J0sYBxBFsdBe5HKWwYC1f9k1NAzPHWUzrDGkxo6raCYCqHTTcQ7hiKEMguJrNeNjk2MNFmWIbdRw9XhNi70VFTpTHJO/cjghIoRkoFH6mXMFBnPHQUjnrwJfBdae0sfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653639228; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=p8qobEBr/wT1stqG563gz0OiQsChMRrcDJXB53b33iU=; b=lu/2Rx7g4ovXQJrSTeBywn38dM8u27p9S+TIE+qOqK/lOWeT9pdoaV+uuWPtrda/zCtYmEypa83fwzEr00CJnp0qP1QSIQU4l9EWHTjJLudtNqds/FIb45/L3pTzykQDuCaIzgidLBtTHl0E4wHX5kLSK3G6eOpnHhe4YznGoqY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1653639228; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:In-reply-to:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To; bh=p8qobEBr/wT1stqG563gz0OiQsChMRrcDJXB53b33iU=; b=GIUkk2OfyHgPrfnw5nocYNNBjkOc7o6Wo8CGAARLSTs3ey69nlwJ82F6SgxuAaap fmEsXpHM9zMbib8g2TnkJ1tkeV0FTaiM5azKPKardNQsjuObBfTvMGI1hxMpLEgjBSq PLj/5L7eXMTpfPgrB6pmCx4n/56hDTbw4SO2DOdc= Received: from localhost (180-111-142-46.pool.kielnet.net [46.142.111.180]) by mx.zohomail.com with SMTPS id 165363922596519.946472904024745; Fri, 27 May 2022 01:13:45 -0700 (PDT) References: <20220524180850.3381234-1-zimon.toutoune@gmail.com> <87wneahb5b.fsf@elephly.net> User-agent: mu4e 1.6.10; emacs 28.1 From: Ricardo Wurmus Date: Fri, 27 May 2022 10:12:51 +0200 In-reply-to: X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Message-ID: <87zgj3cs09.fsf@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-Zoho-Virus-Status: 1 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" X-getmail-retrieved-from-mailbox: Patches zimoun writes: > Hi, > > On Tue, 24 May 2022 at 23:30, Ricardo Wurmus wrote: > >> Applied with formatting changes. Thanks! > > Indeed, sorry. I reformatted the output of "guix import" but then I > forgot to reformat again the phase modification (my bad!). And I ran > "guix lint" which reported nothing. But "guix style" reformats; > which I do not use (yet). > > Well, it is many manual error-prone steps. My questions are : > > 1. Could we adapted "guix import cran" to output something using the > format of "guix style"? How about this: From a10afc4c60ce734941c3c080cf13ec6636f0be33 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 27 May 2022 10:07:26 +0200 Subject: [PATCH] scripts/import: Use pretty printer from (guix scripts style). * guix/scripts/import.scm (guix-import): Use pretty-print-with-comments. (newline-rewriting-port): Remove procedure. --- guix/scripts/import.scm | 39 +++------------------------------------ 1 file changed, 3 insertions(+), 36 deletions(-) diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index fa79f3211e..62aa7bdbc5 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2012, 2013, 2014, 2020, 2021 Ludovic Courtès ;;; Copyright © 2014 David Thompson ;;; Copyright © 2018 Kyle Meyer -;;; Copyright © 2019 Ricardo Wurmus +;;; Copyright © 2019, 2022 Ricardo Wurmus ;;; Copyright © 2021 Simon Tournier ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2022 Philip McGrath @@ -25,6 +25,7 @@ (define-module (guix scripts import) #:use-module (guix ui) #:use-module (guix scripts) + #:use-module (guix scripts style) #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -32,41 +33,9 @@ (define-module (guix scripts import) #:use-module (srfi srfi-37) #:use-module (ice-9 format) #:use-module (ice-9 match) - #:use-module (ice-9 pretty-print) #:export (%standard-import-options guix-import)) - -;;; -;;; Helper. -;;; - -(define (newline-rewriting-port output) - "Return an output port that rewrites strings containing the \\n escape -to an actual newline. This works around the behavior of `pretty-print' -and `write', which output these as \\n instead of actual newlines, -whereas we want the `description' field to contain actual newlines -rather than \\n." - (define (write-string str) - (let loop ((chars (string->list str))) - (match chars - (() - #t) - ((#\\ #\n rest ...) - (newline output) - (loop rest)) - ((chr rest ...) - (write-char chr output) - (loop rest))))) - - (make-soft-port (vector (cut write-char <>) - write-string - (lambda _ #t) ; flush - #f - (lambda _ #t) ; close - #f) - "w")) - ;;; ;;; Command line options. @@ -119,9 +88,7 @@ (define-command (guix-import . args) ((importer args ...) (if (member importer importers) (let ((print (lambda (expr) - (pretty-print expr (newline-rewriting-port - (current-output-port)) - #:max-expr-width 80)))) + (pretty-print-with-comments (current-output-port) expr)))) (match (apply (resolve-importer importer) args) ((and expr (or ('package _ ...) ('let _ ...) -- 2.36.1