From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id RFE1MRnV92AgIQAAgWs5BA (envelope-from ) for ; Wed, 21 Jul 2021 10:04:41 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0ERQLBnV92APHQAAbx9fmQ (envelope-from ) for ; Wed, 21 Jul 2021 08:04:41 +0000 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 7E97619B48 for ; Wed, 21 Jul 2021 10:04:40 +0200 (CEST) Received: from localhost ([::1]:50190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m67Db-0002R8-Hm for larch@yhetil.org; Wed, 21 Jul 2021 04:04:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m670Q-0008DS-52 for guix-patches@gnu.org; Wed, 21 Jul 2021 03:51:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52768) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m670P-0004Fz-Ni for guix-patches@gnu.org; Wed, 21 Jul 2021 03:51:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m670P-00069D-IP for guix-patches@gnu.org; Wed, 21 Jul 2021 03:51:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49531] [PATCH core-updates 0/4] import: {utils, go, crate}: Emit new-style package inputs. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 21 Jul 2021 07:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49531 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 49531@debbugs.gnu.org, Efraim Flashner Received: via spool by 49531-submit@debbugs.gnu.org id=B49531.162685386023624 (code B ref 49531); Wed, 21 Jul 2021 07:51:01 +0000 Received: (at 49531) by debbugs.gnu.org; 21 Jul 2021 07:51:00 +0000 Received: from localhost ([127.0.0.1]:36081 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m670N-00068y-Sv for submit@debbugs.gnu.org; Wed, 21 Jul 2021 03:51:00 -0400 Received: from out2.migadu.com ([188.165.223.204]:33368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m670K-00068p-Um for 49531@debbugs.gnu.org; Wed, 21 Jul 2021 03:50:58 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1626853855; 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: in-reply-to:in-reply-to:references:references; bh=uEGWv3hff4kFlZWWIpz0Im3CotvodbLXUtL/DfgcLAA=; b=EKt8ef5c48nwDgckBPmpPs7vq+VrY7/l0pu0EMeZGJX6o6haVV7/pvfFTJ5LpHPGWFvviF 2F7k75eKmmSha/Bqe522kz/RGkSCsOn51RjznxyRB8ROU+xxZwi9FMG0oXYbGPGJe9y/cY 9N1MgwtJ6BcHU3SuHaXheZ+3nuG03gw= From: Sarah Morgensen References: <598b53d80d66a229502d235507047a7717a15e8d.1626067919.git.iskarian@mgsn.dev> <87lf60isie.fsf_-_@gnu.org> Date: Wed, 21 Jul 2021 00:50:53 -0700 In-Reply-To: <87lf60isie.fsf_-_@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Tue, 20 Jul 2021 23:29:13 +0200") Message-ID: <864kcot89u.fsf_-_@mgsn.dev> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Auth-User: iskarian@mgsn.dev 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1626854681; 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=uEGWv3hff4kFlZWWIpz0Im3CotvodbLXUtL/DfgcLAA=; b=ZcNnosndyHielNg0dJ2c3rBBPcjy3Oqf3Faqy8viHJSIBSuzPxT5CxD4SLOI156txYcgBx L4KwJcVAN3515dafo2pq9L9y8w+xHOMedzlmVNHQ8kyy0xqhA7SidTexIqsMGYo1E0HlZV ntCsyOsY5W6fEbBt+8NoAvWKCIP5DFLfE3w8h2qbLapDL5FZwL2YsIWxA3qoZLVJQKNvwn Bpy6BlmMSYvG7yQmNj1AsRYEpmABlobdwOk8OrXMbK4DDr2MgNioMqmpgSL9XqMbbkovPJ Ia6e0RKjny41G2afB1cVcQXstDxj9Ze9ppc3vMdrvxSiqya+OdD/W/eLqy4kFQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626854681; a=rsa-sha256; cv=none; b=YkAIYwsbm0H+ZkraGaQb5K0SHuPFVHLnMNfNWlfWLOSk5guHXO68L0j0cGFD2VbyFoL/YU DAK4H++Hs+OXH842o1hLkBt9VWcZb3yZQdSEMgfJbLG0OEJzUtYs2jgczvummt+9H1p55Y e5suA1NOHZzSK5Cx/KHsfj+vrZQ2rKusUqw8d8DkO2o7yLE5BOLTW8AUnetyimVLJaKBrq 6EHZhPPhM9xN0kjB8kcbrls6REoAOpUrCyJtY3NSHNX7Cv6nIMwBgunN7b8Yzh12IonWhT IUQP+Vd8vL81xE5/jmPTE79rwK5GN4+MIQDHXZqyWVR3f+WEcQjFdvbTBiUs6Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=EKt8ef5c; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=EKt8ef5c; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 7E97619B48 X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: h6Mj28OHh74i --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi all, Ludovic Court=C3=A8s writes: > And then, how do we handle the transition? I=E2=80=99m not enthusiastic = about > customizing =E2=80=98guix style=E2=80=99 for Rust packages; should we emb= ark on manual > changes of the 2.4K Rust packages? I've attached a patch below that's a first pass at handling #:cargo-inputs in `guix style`. I didn't handle any input modification shenanigans, but I don't think any packages do that with #:cargo-inputs & co., or if so it's just a few which can be manually updated. The result of running it on #:cargo-inputs/#:cargo-development-inputs packages: 14 files changed, 9424 insertions(+), 12009 deletions(-) gnu/packages/crates-graphics.scm | 1006 +-- gnu/packages/crates-gtk.scm | 658 +- gnu/packages/crates-io.scm | 17471 ++++++++++++++++------------------= --- gnu/packages/crypto.scm | 4 +- gnu/packages/gnome.scm | 90 +- gnu/packages/rust-apps.scm | 672 +- gnu/packages/security-token.scm | 30 +- gnu/packages/sequoia.scm | 124 +- gnu/packages/shells.scm | 1088 ++- gnu/packages/syndication.scm | 38 +- gnu/packages/terminals.scm | 50 +- gnu/packages/text-editors.scm | 60 +- gnu/packages/video.scm | 100 +- gnu/packages/web.scm | 42 +- -- Sarah --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=handle-cargo-inputs.patch Content-Transfer-Encoding: quoted-printable Content-Description: handle-cargo-inputs.patch diff --git a/guix/packages.scm b/guix/packages.scm index d3fa72fd09..26e82050f8 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -108,6 +108,7 @@ package-superseded deprecated-package package-field-location + package-argument-location =20 this-package-input this-package-native-input @@ -515,9 +516,9 @@ object." (name old-name) (properties `((superseded . ,p))))) =20 -(define (package-field-location package field) - "Return the source code location of the definition of FIELD for PACKAGE,= or -#f if it could not be determined." +(define (package-part-location package proc) + "Return the source code location of the part of PACKAGE returned by (PROC +PACKAGE), or #f if it could not be determined." (match (package-location package) (($ file line column) (match (search-path %load-path file) @@ -530,17 +531,16 @@ object." (go-to-location port line column) (match (read port) (('package inits ...) - (let ((field (assoc field inits))) - (match field - ((_ value) - (let ((loc (and=3D> (source-properties value) - source-properties->location))) - (and loc - ;; Preserve the original file name, which m= ay be a - ;; relative file name. - (set-field loc (location-file) file)))) - (_ - #f)))) + (match (proc inits) + (#f + #f) + (value + (let ((loc (and=3D> (source-properties value) + source-properties->location))) + (and loc + ;; Preserve the original file name, which may= be a + ;; relative file name. + (set-field loc (location-file) file)))))) (_ #f))))) (lambda _ @@ -550,6 +550,29 @@ object." #f))) (_ #f))) =20 +(define (package-field-location package field) + "Return the source code location of the definition of FIELD for PACKAGE,= or +#f if it could not be determined." + (package-part-location + package + (lambda (p) + (match (assoc field p) + ((_ value) value) + (_ #f))))) + +(define (package-argument-location package argument) + "Return the source code location of the definition of keyword ARGUMENT f= or +PACKAGE, or #f if it could not be determined." + (package-part-location + package + (lambda (p) + (match (assoc 'arguments p) + ((_ ('quasiquote (arguments ..1))) + (match (member argument arguments eq?) + ((_ value . _) value) + (_ #f))) + (_ #f))))) + (define (package-input package name) "Return the package input NAME of PACKAGE--i.e., an input from the =E2=80=98inputs=E2=80=99 or =E2=80=98propagated-inputs=E2=80=99 f= ield. Native inputs are not diff --git a/guix/scripts/style.scm b/guix/scripts/style.scm index 3c100197a7..19185d924e 100644 --- a/guix/scripts/style.scm +++ b/guix/scripts/style.scm @@ -371,7 +371,7 @@ bailing out~%") (delete ,@to-delete) (prepend ,@things))) (location-column location)))) - (('quasiquote (exp ...)) + ((or ('quasiquote (exp ...)) ((or (exp ...) (? comment? exp)) ...)) (let/ec return (object->string* `(list ,@(simplify-expressions exp inputs return)) @@ -389,6 +389,33 @@ POLICY is a symbol that defines whether to simplify in= puts; it can one of 'silent (change only if the resulting derivation is the same), 'safe (chan= ge only if semantics are known to be unaffected), and 'always (fearlessly simplify inputs!)." + (define (package-argument package argument) + (match (member argument (package-arguments package) eq?) + ((_ value . _) value) + (_ #f))) + + ;; We know that the cargo build system does not use its special input la= bels, + ;; so it is always safe to simplify, but it will change the derivation. = Only + ;; proceed if POLICY is 'safe or 'always. + (when (member policy '(safe always)) + (for-each (lambda (argument) + (match (package-argument package argument) + (#f + #f) + (inputs + (match (package-argument-location package argument) + (#f + #f) + (location + (edit-expression + (location->source-properties location) + (lambda (str) + (simplify-inputs location + (package-name package) + str inputs + #:label-matches? (const #t))))))= ))) + (list #:cargo-inputs #:cargo-development-inputs))) + (for-each (lambda (field-name field) (match (field package) (() --=-=-=--