From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id KHVVNQCmoGZQggEAe85BDQ:P1 (envelope-from ) for ; Wed, 24 Jul 2024 06:58:09 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id KHVVNQCmoGZQggEAe85BDQ (envelope-from ) for ; Wed, 24 Jul 2024 08:58:09 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=IHZ7uqMm; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1721804288; 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: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=sjf05D5KWkbgZ9DqWwv9xcNoHBNey+k2hm8FGTWyyCI=; b=VnyYK61EJXqcbponFUsrt2oYkoDOByjTGXqVL1jFWF6ufrAoZwL/1Joq33V6z9oqPHnTes eZmBz+XIizHUlubqsWcHPR44JqGElsiDjXaTTIPfxoBn1w55FLAG8uxCkuPN+hU4XpTh8z ykEQR80GqqnIo44ybRSXAouQK24WrUikuvPUwvYPr/b73JJRR1rwtVyfPmrO+84zJqW8Oo 554pKFfvoElhg1OYq6Se1wQojlIEIkLqPfegSH4OMK8KXmx1e509v0L5WhbN8HaI8gIEuD i4evnJwYd0TyGlLZ3aXUjFtz7BBjOCnAk7LgabQYrOT4v4f3y7wXHBevO4PnDQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1721804288; a=rsa-sha256; cv=none; b=I6zVMw5iGWSXeihvmenzqXdoE+dF5U1xY79tZ0CwKahUDa7hOIkNBkfH/LdAF9Z+X7e+MO wBl1oioUD7RtCFgcpX9bhL0BDtMe+qBEpbewCoQ1OAhC4GJZdNpY8PswLdnMTs7hVTsIOe UAwlT7K+SPMLYCDizWig5AS6BVnZOY/UCFfLWDGKJ8lyFK+J4n1/Iw9fnfaJUCGmViBwkS 2DBSXCg41b+J6LokekH0N7hhmeuEjcS76AG8gYFMXYaROgr1u7BLjlR+ytxLsAj8qHSz8Q Tg9Ak39ZsRrqUSb6nunEGvpP26KzHwGuyhYTP12z7SXp/Tg3hvOiSb1yPH74pg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=IHZ7uqMm; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" 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 5C2B864248 for ; Wed, 24 Jul 2024 08:58:08 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sWVn5-0003Q4-Gz; Wed, 24 Jul 2024 02:47:59 -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 1sWVn3-0003Pg-Si for bug-guix@gnu.org; Wed, 24 Jul 2024 02:47:57 -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 1sWVn2-0007wL-Pj; Wed, 24 Jul 2024 02:47:56 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sWVn7-0008WL-Ql; Wed, 24 Jul 2024 02:48:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#72266: this-package-input for multiple outputs package Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, bug-guix@gnu.org Resent-Date: Wed, 24 Jul 2024 06:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72266 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 72266@debbugs.gnu.org Cc: ludo@gnu.org X-Debbugs-Original-To: bug-guix@gnu.org X-Debbugs-Original-Xcc: ludo@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.172180366632727 (code B ref -1); Wed, 24 Jul 2024 06:48:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jul 2024 06:47:46 +0000 Received: from localhost ([127.0.0.1]:33027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sWVmr-0008Vn-AR for submit@debbugs.gnu.org; Wed, 24 Jul 2024 02:47:45 -0400 Received: from lists.gnu.org ([209.51.188.17]:32796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sWVmp-0008Ve-4d for submit@debbugs.gnu.org; Wed, 24 Jul 2024 02:47:43 -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 1sWVmj-0003OG-9d for bug-guix@gnu.org; Wed, 24 Jul 2024 02:47:37 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sWVmh-0007h1-C2 for bug-guix@gnu.org; Wed, 24 Jul 2024 02:47:37 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-427d8f2611fso5757275e9.0 for ; Tue, 23 Jul 2024 23:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721803654; x=1722408454; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=sjf05D5KWkbgZ9DqWwv9xcNoHBNey+k2hm8FGTWyyCI=; b=IHZ7uqMm4edSQpIuf++paeRDyxmmV5NQtPs4ioPvQdJuGg+9ShxSiIgnkQ2GEVlNZl 48w1qH0xRKeGK1NJJ1aWZI7Labyz53dPLfc3a89CbzmTo+gaGe4BxV/4tLP/xCLYQnvg 2qTO0zkav5Llac/4Vzw09M+HgIsks6pkwuyiW+x8c3SD4cVLsulRjTgYqDoOO2OQVGnt kJTYfreTlRNaksykk4qSHQ9tgJSdsRnNfXG4QJx3LrU7YaJQXRlt0NSCtdmUMdj8hEPA mYVtpfKngx0LoIF9y0MnZsBXYFw1SqFkHue9+1M1xlt1wZn+0WY9hHl3LH2Mpai7/TmY YmQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721803654; x=1722408454; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sjf05D5KWkbgZ9DqWwv9xcNoHBNey+k2hm8FGTWyyCI=; b=O6dW6X0sWPi/0+TiSElZhRJY2yayhPaftc5O/u9dTB41/mform7Nkws6isOkzIU3df r/7Zv5YAU4qnC5/5VRTXG0nmBFiEY4404hJB6l4JvtVvu+4pLhp6hMkauB+VQaE1w+h2 17eaF/co+McpT6fQfPT6odNv5j4Z7qUAzkCM8UOqC0FoMy/PbGeQNvn1Z+yHTVk2Rmw2 hcj14w6kFFaLHVZGdc9qdM5pXFG/VEyRBo11mKQeMIjT4zub8Avz3UaaAucQF238Ynej AN+RTOeSBzcptu5cZan9wCjaQ7BA0PtU+79hIDdJgZgzTtwxl7+Kw84UxykIBXAmKI9K aZFA== X-Gm-Message-State: AOJu0YyKirub0ihpVa5RbykvMgkwVCQVhBvhy4pwY5LRmzPOBqnYmVMk PDhpMzecNiY3FPmv7LEEPTZfTjU1cfoT1CO4OprC8B0XWdBOyzx3i9Je6A== X-Google-Smtp-Source: AGHT+IFqCxqTlAOxK0D1UwaX0C9H+hI5gnVBwhGP16cD+O6szcn+cjDqs/V+2b/8mnnLGN3PG1oNkA== X-Received: by 2002:a05:6000:1844:b0:366:e4b4:c055 with SMTP id ffacd0b85a97d-369b69c4c24mr5817698f8f.7.1721803653511; Tue, 23 Jul 2024 23:47:33 -0700 (PDT) Received: from lili (2a02-8429-6820-f501-2d56-26dd-ea60-f757.rev.sfr.net. [2a02:8429:6820:f501:2d56:26dd:ea60:f757]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427f938da6fsm14369095e9.25.2024.07.23.23.47.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jul 2024 23:47:33 -0700 (PDT) From: Simon Tournier Date: Wed, 24 Jul 2024 02:41:39 +0200 Message-ID: <87plr3ei4c.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x334.google.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_06_12=1.543, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -0.22 X-Spam-Score: -0.22 X-Migadu-Queue-Id: 5C2B864248 X-Migadu-Scanner: mx11.migadu.com X-TUID: psQaw/ZMx4iL Hi, For the good or the bad, we have package with multiple outputs. For instance, see =E2=80=99git=E2=80=99 with =E2=80=99git:send-email=E2=80=99 a= nd others. However, it=E2=80=99s not always easy to work with them using the =E2=80=9C= new style=E2=80=9D. For a concrete example: . A minimal example. --8<---------------cut here---------------start------------->8--- $ cat /tmp/pkgs/pkgs.scm (define-module (pkgs) #:use-module (guix packages) #:use-module (gnu packages base) #:use-module (gnu packages version-control)) (define-public salut (package (inherit hello) (name "bye") (inputs (list git `(,git "send-email"))))) --8<---------------cut here---------------end--------------->8--- Then, it=E2=80=99s possible to add phases, e.g., --8<---------------cut here---------------start------------->8--- (wrap-program (string-append #$output "/bin/hello") `("STUFF" ":" prefix (,(string-append #$(this-package-input "git") "/bin"))) --8<---------------cut here---------------end--------------->8--- All fine! However, from my understanding, it does not seem possible to access using this =E2=80=9Cnew style=E2=80=9D way to other outputs than =E2=80=9Co= ut=E2=80=9D. Because, the inputs reads, --8<---------------cut here---------------start------------->8--- $ guix repl -q -L /tmp/pkgs GNU Guile 3.0.9 Copyright (C) 1995-2023 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guix-user)> ,use(guix packages) scheme@(guix-user)> ,use(pkgs) scheme@(guix-user)> ,pp (package-inputs salut) $1 =3D (("git" #) ("git" # "send-email")) --8<---------------cut here---------------end--------------->8--- Other said, both outputs have the same label =E2=80=93 here =E2=80=9Cgit=E2= =80=9D. Then, the procedure =E2=80=99this-package-input=E2=80=99 =E2=80=93 under th= e hood via lookup-package-input and then lookup-input from (guix packages) =E2=80=93 c= alls: (assoc-ref (package-inputs some-package) some-string) Therefore, since =E2=80=9Csome-string=E2=80=9D is the same here, bang! A first proposal for fixing the issue. It=E2=80=99s easy to tweak how =E2=80=99sanitize-inputs=E2=80=99 works. Fo= r instance using this patch: --8<---------------cut here---------------start------------->8--- 1 file changed, 1 insertion(+), 1 deletion(-) guix/packages.scm | 2 +- modified guix/packages.scm @@ -667,7 +667,7 @@ (define (add-input-label input) ((? package? package) (list (package-name package) package)) (((? package? package) output) ;XXX: ugly? - (list (package-name package) package output)) + (list (string-append (package-name package) ":" output) package outpu= t)) ((? gexp-input?) ;XXX: misplaced because 'native?' field is igno= red? (let ((obj (gexp-input-thing input)) (output (gexp-input-output input))) --8<---------------cut here---------------end--------------->8--- Now we get different labels, --8<---------------cut here---------------start------------->8--- scheme@(guix-user)> ,pp (package-inputs salut) $1 =3D (("git" #) ("git:send-email" # "send-email")) --8<---------------cut here---------------end--------------->8--- So far, so good! Please note that some packages then need some adjustment; e.g., see below. Next, let add to the package definition this snippet for more wrapping, --8<---------------cut here---------------start------------->8--- (,(string-append #$(this-package-input "git:send-email"= ) "/bin"))) --8<---------------cut here---------------end--------------->8--- Because of the procedure =E2=80=99lookup-input=E2=80=99 from (guix packages= ), the package is correctly identified but the output is still discarded. Hence this modification: --8<---------------cut here---------------start------------->8--- 1 file changed, 1 insertion(+) guix/packages.scm | 1 + modified guix/packages.scm @@ -1213,6 +1213,7 @@ (define (lookup-input inputs name) ;; check package names. (match (assoc-ref inputs name) ((obj) obj) + ((obj (? string? out)) (cons obj out)) ((obj _) obj) (#f #f))) --8<---------------cut here---------------end--------------->8--- But then it is still incorrect. For instance, we check using =E2=80=99package-arguments=E2=80=99 and the interesting part reads: --8<---------------cut here---------------start------------->8--- (unquote (string-append # . "send-email"):out> "/bin")) --8<---------------cut here---------------end--------------->8--- Ok, this is incorrect and it will error when trying to build. Well, the G-exp compiler needs to be updated in agreement with =E2=80=99lookup-input= =E2=80=99 as above. What I would expect is something like: #:send-email> All in all, I am a bit lost inside the module (guix gexp). :-) To be conti= nued=E2=80=A6 Cheers, simon Some adjustments here or there: --8<---------------cut here---------------start------------->8--- 1 file changed, 1 insertion(+), 1 deletion(-) gnu/packages/backup.scm | 2 +- modified gnu/packages/backup.scm @@ -318,7 +318,7 @@ (define-public libarchive (libxml2 (assoc-ref inputs "libxml2")) (xz (assoc-ref inputs "xz")) (zlib (assoc-ref inputs "zlib")) - (zstd (assoc-ref inputs "zstd")) + (zstd (assoc-ref inputs "zstd:lib")) (bzip2 (assoc-ref inputs "bzip2"))) ;; Embed absolute references to these inputs to avoid prop= agation. (substitute* (list (string-append lib "/pkgconfig/libarchi= ve.pc") --8<---------------cut here---------------end--------------->8--- And thus improving the situation for packages with multiple outputs and =E2=80=9Cnew style=E2=80=9D probably means a world rebuild.