From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AGeADno+5WEdVQEAgWs5BA (envelope-from ) for ; Mon, 17 Jan 2022 11:01:30 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GLswC3o+5WHK+AAAauVa8A (envelope-from ) for ; Mon, 17 Jan 2022 11:01:30 +0100 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 8A01F44479 for ; Mon, 17 Jan 2022 11:01:29 +0100 (CET) Received: from localhost ([::1]:40972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n9OpM-0004jI-L2 for larch@yhetil.org; Mon, 17 Jan 2022 05:01:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52090) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n9Op5-0004j9-Tz for guix-devel@gnu.org; Mon, 17 Jan 2022 05:01:11 -0500 Received: from m42-5.mailgun.net ([69.72.42.5]:63765) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n9Op3-0001cI-QR for guix-devel@gnu.org; Mon, 17 Jan 2022 05:01:11 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.wilsonb.com; q=dns/txt; s=krs; t=1642413668; h=Content-Type: MIME-Version: Message-Id: Subject: From: To: Date: Sender; bh=Ytz27o757UIzXDKhpBvW3SNwJadoZgeiJsT/Pz3sYxQ=; b=XSfLaNtixXef5Ooq1UhJ0E9FIgZ7ScWMra38i08G9MF2p/m2jLBmAIe3CMBOrE8sWaGmwo2x DYuh9pJ1d2THK+fYKwkycMH8VVBZM22WoTrxjshh+qlWkiROycX6Vo6zuJQKk6De4KRdiPEr Rg5cvL1U9afUCv5XbUSSmrCrp41lWQgt6rIex32dZrEH8YPjm/RFQeWuYNjwf5xp/RmMqJ83 DdGh6jTOqUHNDHmeBRsZdH4zV2zFJRPp/Poko6gfp/s9p0VHz4DXhoJ62d+mnADNgdJgS39q oDOLXapZsjQL6WTMUi6QoIvwLwGJcTaq6bGrjWYrz3rF6W59m6nxDQ== X-Mailgun-Sending-Ip: 69.72.42.5 X-Mailgun-Sid: WyIyNWJlMSIsICJndWl4LWRldmVsQGdudS5vcmciLCAiMDg1NDdhIl0= Received: from wilsonb.com (wilsonb.com [104.199.203.42]) by smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 61e53e62e0071250cfcf76bc (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Mon, 17 Jan 2022 10:01:06 GMT Received: from localhost (q045100.dynamic.ppp.asahi-net.or.jp [203.181.45.100]) by wilsonb.com (Postfix) with ESMTPSA id AA471A04C0 for ; Mon, 17 Jan 2022 10:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wilsonb.com; s=201703; t=1642413662; bh=Ytz27o757UIzXDKhpBvW3SNwJadoZgeiJsT/Pz3sYxQ=; h=Date:To:From:Subject:From; b=UFaheiseSuzdK26YH7E9DN6PrJQlv1sa9TNQNDAg0LeGd74jhuQ21+TuamU9UXAqY qwQcST+hOzuEdxha9VSVQEf7l7cE1tSSb5hmMMRFdO+7IC86K41mf50E+Dw659acTC rUGONqym6A4jATDH+4jS986SEsfPnMOnDS+mp+xamaqPE0ofLyT+Brvo+VXbu3yXcA DKtYE7GqExHlJHov/YjDbw7+8ktEoQrRnhKjzN6C7xHWNLCVa+oTeRHpmzfW8NQXtY zQLxEkZ7ECOvzb6jwoadTNmPAQgQGtbsMY840bDfezErbnHaB/WSh0kdf/g0xa8Pzm o0rHKNQU7C1u6U/SkBWkZrX746EL1AfZexxMYkkSUm64m6lFb4IFWMM41ulbDyflsX ijhXNRZYCrVb4yFVMk+FrWJA4MeewCybXhegmHallYwo0LNxLrB3IuhkPNSodKGh4u yTtMYtiGa6BJBy84KZk3y+CyUuG8xf91g01xIF2U6bVbg1uDp+Cb/m0Wkvl3mMpvP/ GzFCf5GgLhPDeNBGnhBBuGvM/RQRoLG0zrtCjcPoiOqKn4enqEqh4iOLF9hgYnM3aa cc9S582QhTjJUwilHxhZzwz/wt3pL7WEnkpN2/Hkm/0gC8XMp08I1dk7FrSQ1YCIEO tD3E/0PbbPBtJHUjxAlYAAR4= Date: Mon, 17 Jan 2022 19:01:35 +0900 To: guix-devel@gnu.org From: elaexuotee@wilsonb.com Subject: packages: [PoC] Expand range of objects 'add-input-label' can label Message-Id: <3J7C60ZL2GML6.2523PXP88LOT9@wilsonb.com> User-Agent: mblaze/1.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_5342a6515eea97113c422bb0_=_" Received-SPF: pass client-ip=69.72.42.5; envelope-from=bounce+ec9951.08547a-guix-devel=gnu.org@mg.wilsonb.com; helo=m42-5.mailgun.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642413690; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=Ytz27o757UIzXDKhpBvW3SNwJadoZgeiJsT/Pz3sYxQ=; b=pq357cDqn/U0JwbVf/ssqyOoP9HJcpHogDwLlZjnlWCOrn/hkEpw5h03fn6dXPy8ZQXPKU JTnpCO8PYtRouLFZxCnIdyra+qnLxQhOwUI/18aqElcvHuKu7vyIVprsdz3nSu6w7P/pl4 QWpC8zpbrIfUKmMmaWxZt/j2+VTPPfwSyga70YJTFt7+p2uXqgN61FIUI3qKtYLYKKT9Ho 1qs34u4iC3fBqDOdDufmPuQ6SV4I3n5FSkiyyv/+MuUVl4U0olOzEYAQ0/xIkt5tixrHNg 8/5LB9rNrKwcheQUJOCOo8TdebPoSCO77LvKbJaPKgMq1+fURsygbma0ukeUvA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642413690; a=rsa-sha256; cv=none; b=AD0Ke+DulpTxJJ2kG/n+L+rmybRMOnZpWCYLrBki0hWXXKf9epoyPu3gj0dX535gjuuWGh 8FhIvkW3gNcTtdelt6J1L3QIcRbYgaUzNA+Le3ov3o4cHODBVTdSd9C5N98hS9BHGh5+3z 6/m/VWYFp/hUrbI3Xii5iIgBZrB4pCNoOznA3mfyUWwQeHxqoaPDsaBCxGjvCEV6YanUb6 jX+fmxBYNFNUFSVXg2amYnayqVqO8gDjPZT+e+Q18gRwB3E2qSrbTJsKX0N8nHAkGjRrCO CbFgbuWUnV6Wg0UGbztiaKSEJQxWGwSBqWhkWghTQvkqXKOxbF+H8QCxQ7C2jQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mg.wilsonb.com header.s=krs header.b=XSfLaNti; dkim=pass header.d=wilsonb.com header.s=201703 header.b=UFaheise; dmarc=pass (policy=quarantine) header.from=wilsonb.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -6.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mg.wilsonb.com header.s=krs header.b=XSfLaNti; dkim=pass header.d=wilsonb.com header.s=201703 header.b=UFaheise; dmarc=pass (policy=quarantine) header.from=wilsonb.com; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8A01F44479 X-Spam-Score: -6.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: uvlxb4dNKE0j This is a multipart message in MIME format. ------_=_5342a6515eea97113c422bb0_=_ Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Guix! This is me grubbing around with internals I know nothing about. Here is a q= uick and dirty proof-of-concept patch that extends 'add-input-label' to use the 'name' property of plain-file, program-file, etc. In addition, it also labels auxiliary files, using the same path string one= provides to search-auxiliary-file. This part is the dirtiest, especially si= nce we cannot make use of %auxiliary-files-path from (gnu packages) since that would introduce a circular dependency. The motivation for this arose while recently munging a package to use new-s= tyle inputs. The package's inputs include an auxiliary file and custom program-f= ile gexp; however, with new-style inputs there is no obvious way to get get acc= ess to these input paths within the build phases: - Both get the default "_" label; and - search-input-file only finds files inside store path *directories*. There potentially a workaround using file-union, but it's clearly friction.= Naive package-writing me wanted one of two things: 1) Ability to mix old, explicit labels with the new labelless inputs, or 2) Labels that come from the gexp name. The first option is much more general, but somehow I stumbled across the add-input-label procedure, so went with 2. What are your thoughts? Clear unknows to me: - Is add-input-label in a fast path? This patch significantly increases the= cases supplied to 'match', which feels like it has the potential to hit performance in a bad way. - Using the 'name' property is kind of obvious, but add-input-label looks deliberatly small. Was using 'name' intentionally avoided for some reason= ? - Are there other implicit concerns/constraints within guix/packages.scm th= at I am oblivious to? - etc? Anyway, by no means do I expect this to get merged, mostly just hoping to l= earn something. Cheers, B. Wilson ------_=_5342a6515eea97113c422bb0_=_ Content-Disposition: attachment; filename*0*=UTF-8''0001-packages-Expand-range-of-objects-add-input-label; filename*1*=-can.patch Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable =46rom 3b8e7fa8fbd58e7e164e3730c708419f612b8549 Mon Sep 17 00:00:00 2001 =46rom: "B. Wilson" =44ate: Sun, 16 Jan 2022 23:54:51 +0900 =53ubject: [PATCH 1/2] packages: Expand range of objects 'add-input-label' = =63an =20label =54o: guix-patches@gnu.org =0A* guix/packages.scm (%auxiliary-files-subpath-dir): New variable. =28add-input-label): Support labels from the name property of =6Fbjects that have one. Also, name auxiliary files from their =73ubpath. =2D-- =20guix/packages.scm | 24 +++++++++++++++++++++++- =201 file changed, 23 insertions(+), 1 deletion(-) =0Adiff --git a/guix/packages.scm b/guix/packages.scm =69ndex 9d5b23eb8a..4feea8ad5f 100644 =2D-- a/guix/packages.scm =2B++ b/guix/packages.scm =40@ -7,6 +7,7 @@ =20;;; Copyright =C2=A9 2019 Marius Bakke =20;;; Copyright =C2=A9 2020, 2021 Maxim Cournoyer =20;;; Copyright =C2=A9 2021 Chris Marusich =2B;;; Copyright =C2=A9 2022 B. Wilson =20;;; =20;;; This file is part of GNU Guix. =20;;; =40@ -569,6 +570,10 @@ (define-record-type* =20 (default (current-definition-location)) =20 (innate))) =20= =2B;; Note: This morally imports from gnu/packages.scm, but since they impo= =72t us, =2B;; we define here instead. =2B(define %auxiliary-files-subdir-path "/gnu/packages/aux-files") =2B =20(define (add-input-label input) =20 "Add an input label to INPUT." =20 (match input =40@ -576,7 +581,24 @@ (define (add-input-label input) =20 (list (package-name package) package)) =20 (((? package? package) output) ;XXX: ugly? =20 (list (package-name package) package output)) =2D ((? gexp-input?) ;XXX: misplaced because 'native?' field is ig= =6Eored? =2B ((? local-file? local-file) =2B (list (local-file-name local-file) local-file)) =2B ((? plain-file? plain-file) =2B (list (plain-file-name plain-file) plain-file)) =2B ((? computed-file? computed-file) =2B (list (computed-file-name computed-file) computed-file)) =2B ((? program-file? program-file) =2B (list (program-file-name program-file) program-file)) =2B ((? scheme-file? scheme-file) =2B (list (scheme-file-name scheme-file) scheme-file)) =2B ((? string? path) =2B (let* ((regex (string-append %auxiliary-files-subdir-path "/(.*)"))= =0A+ (match (string-match regex input))) =2B `(,(if match =2B (match:substring match 1) =2B "_") =2B ,input))) =2B ((? gexp-input?) ;XXX: misplaced because 'native?' field is ign= =6Fred? =20 (let ((obj (gexp-input-thing input)) =20 (output (gexp-input-output input))) =20 `(,(if (package? obj) =2D-=20 =32.34.0 =0A= ------_=_5342a6515eea97113c422bb0_=_--