From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id oMINJnqIkGJ+tAAAbAwnHQ (envelope-from ) for ; Fri, 27 May 2022 10:14:50 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eLPgJXqIkGI+vQAAauVa8A (envelope-from ) for ; Fri, 27 May 2022 10:14:50 +0200 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 D6FD123A1C for ; Fri, 27 May 2022 10:14:47 +0200 (CEST) Received: from localhost ([::1]:34120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nuV7O-0005UA-9t for larch@yhetil.org; Fri, 27 May 2022 04:14:46 -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 Content-Type: multipart/mixed; boundary="=-=-=" 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653639289; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=p8qobEBr/wT1stqG563gz0OiQsChMRrcDJXB53b33iU=; b=Fvf6yDlQrDs67f63RKgU/FCgncxDKKRXayWwPXiGD84BNwfE9C5fkn2risPsoMZyBcHWwd YA1Mcb+Y2hFm8yr76cNJSwhAI/BmaHScKFgvLbqU0WgtK15ixaUGy6DZZz/7SjVrLiHymd +pTBdMVzegq0i7oU90pMgWmXBBLWWN/XlDZoLZZGaust3F1ro6Qh+5iDuy23owIOpLC9eW zxJsHYEDI+pC1MPHiBU/q9dqBkPfaEUuFJ6up+cS0kDO86oNCd4LLp4Arx+n/GrpAyaJY0 VFG/f8b4qFa/nsYiEm18XLAw/NaBt3pQ3JFFSw+czSi7+6asxtn74roRuvKFig== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1653639289; a=rsa-sha256; cv=fail; b=RzJQjvs6fqmRMt7kzjocDL4qbZ/3KBTyYXA8hnxf6MN/pOLXG9oI2/P7H3tY2QItnU6Zo3 5/yO2nwGpfkyz5ofdmCdbVz3Henlj6A8GU6hLlZnUTErSyWopiLZpjceho0ToiFD0s/rRe nU2L5z4jwSoIIJQUfC9z9tYRL3+AV7uiVmh494LbZbSPi7ewp71XGykltiwJHN53f9EV0V 0WyDKm2o0boJuL+5q+/nMTly588MrmHIiyfCr2aGG8k5K1Ra/ROiOJ3ToyLVPYml3Bd3Y7 EfZC4H/j6fysv6x5CKvgpdOMXWKE7C6pvRTYjc8h6Coterk3EY26IHYwiOKufQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elephly.net header.s=zoho header.b=GIUkk2Of; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 0.66 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elephly.net header.s=zoho header.b=GIUkk2Of; arc=reject ("signature check failed: fail, {[1] = sig:zohomail.com:reject}"); dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: D6FD123A1C X-Spam-Score: 0.66 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4EZuoZ90tmh7 --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-scripts-import-Use-pretty-printer-from-guix-scripts-.patch Content-Transfer-Encoding: quoted-printable >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 styl= e). * 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 =C2=A9 2012, 2013, 2014, 2020, 2021 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2014 David Thompson ;;; Copyright =C2=A9 2018 Kyle Meyer -;;; Copyright =C2=A9 2019 Ricardo Wurmus +;;; Copyright =C2=A9 2019, 2022 Ricardo Wurmus ;;; Copyright =C2=A9 2021 Simon Tournier ;;; Copyright =C2=A9 2021 Xinglu Chen ;;; Copyright =C2=A9 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)) =20 - -;;; -;;; 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 _ ...) --=20 2.36.1 --=-=-= Content-Type: text/plain -- Ricardo --=-=-=--