From patchwork Fri May 5 21:30:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 1476 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 8B5DD27BBE9; Fri, 5 May 2023 22:31:25 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,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 27FAD27BBE2 for ; Fri, 5 May 2023 22:31:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pv319-00018r-05; Fri, 05 May 2023 17:31:07 -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 1pv316-00016u-MW for guix-patches@gnu.org; Fri, 05 May 2023 17:31:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pv316-0006Xl-AL for guix-patches@gnu.org; Fri, 05 May 2023 17:31:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pv314-0000EH-5r; Fri, 05 May 2023 17:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63320] [PATCH 0/2] Rewrite 'arguments' to gexps with 'guix style -S arguments' Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: julien@lepiller.eu, guix-patches@gnu.org Resent-Date: Fri, 05 May 2023 21:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 63320 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63320@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Julien Lepiller X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Julien Lepiller Received: via spool by submit@debbugs.gnu.org id=B.1683322250857 (code B ref -1); Fri, 05 May 2023 21:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 May 2023 21:30:50 +0000 Received: from localhost ([127.0.0.1]:57667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pv30r-0000Dk-Ks for submit@debbugs.gnu.org; Fri, 05 May 2023 17:30:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:50950) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pv30m-0000DU-FS for submit@debbugs.gnu.org; Fri, 05 May 2023 17:30:47 -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 1pv30k-0000qH-BA for guix-patches@gnu.org; Fri, 05 May 2023 17:30:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pv30i-0006At-I5; Fri, 05 May 2023 17:30:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=tWcNMre0NgGbwW23xkvMp3uQRUcrb4qmZ0V7ZWqgyUI=; b=LgqjxXyEljEAEf SxfcjfZ9lRWLV21kIIBVo0kQYfQB+RpV1f5HIlb2tw/YMW8XPI1j29rI/VQOoORmxJESukoOcrlLa gqDE848hU6PyCsnna6pJ9pLe3zo9bXv4wShQxxojgIlxnbLV658ATzdjlUtyU3Dneg8bbqvtukrT0 Tzg2ZbQYC/ASqySOLfeD4ghmYAe6jV0wL7SE0dx1AUFzOLyAH+TZxx78EUXmtBpa6qG7z8VaRRGMc NHpqzWn4HcJzKKMmi9UCN2rPNGhT4QkVFIxAq7JbDSjgmpq1rwe2xVloHR36/qgoHDOOkAI+k4agf lCmkuSFKMHik/PPJGbww==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pv30i-0003xr-3g; Fri, 05 May 2023 17:30:40 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 5 May 2023 23:30:19 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 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 Hello Guix! When preparing , I didn’t consider converting ‘arguments’ from sexps to gexps a priority. In practice, we’ve been doing that manually ever since but there’s a sort of a “contamination” aspect: due to inheritance, we often have to be careful enough to convert multiple packages at once or to not change anything, or we end up with gexp records inside sexps¹. Automation appears to be overdue. The attached patches add ‘guix style -S arguments’, which rewrites ‘arguments’ from sexps to gexps. The change doesn’t involve any rebuild, so we could even run it en masse on the whole repo and be done with it. Some caveats: • The reader in (guix read-print) doesn’t support sexp comments (#;), which are used in a couple of packages. Thus, ./pre-inst-env guix style -S arguments which traverses all the packages eventually chokes on it. • The pretty printer does not insert a newline after #:phases, which makes the space for (modify-phases …) expressions sometimes too narrow. (This is not new; try ‘./pre-inst-env guix style PACKAGE’.) • More generally, the pretty printer’s output still has occasional glitches, sufficiently that running ‘guix style -S arguments’ on the whole repo may not be a good idea at the moment. • Some modules lack #:use-module (guix gexp), but this has to be added manually. • We might want an optional conservative policy to leave arguments that would not use gexps unchanged. For instance, we could leave (arguments '(#:tests? #f)) unchanged instead of rewriting it to (arguments (list #:tests? #f)). Thoughts? Ludo’. ¹ This is what prompted Chris to improve error detection: . Ludovic Courtès (2): style: Add 'arguments' styling rule. DRAFT news: Add entry to 'guix style -S arguments'. doc/guix.texi | 51 ++++++++++++ etc/news.scm | 16 ++++ guix/scripts/style.scm | 173 ++++++++++++++++++++++++++++++++++++++++- tests/style.scm | 136 ++++++++++++++++++++++++++++++++ 4 files changed, 375 insertions(+), 1 deletion(-) base-commit: 3c91f4ca490a7ac56dc0aebbca9c4bf4df201877