From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aC/nKfs1aWIWKQEAbAwnHQ (envelope-from ) for ; Wed, 27 Apr 2022 14:24:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 2G+tKPs1aWKdkwAA9RJhRA (envelope-from ) for ; Wed, 27 Apr 2022 14:24:27 +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 4DC60C53B for ; Wed, 27 Apr 2022 14:24:27 +0200 (CEST) Received: from localhost ([::1]:50922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njgiY-0007cR-9s for larch@yhetil.org; Wed, 27 Apr 2022 08:24:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njgiA-00079Z-7e for bug-guix@gnu.org; Wed, 27 Apr 2022 08:24:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:47580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njgi9-0002wB-Tk for bug-guix@gnu.org; Wed, 27 Apr 2022 08:24:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1njgi9-0005jM-QE for bug-guix@gnu.org; Wed, 27 Apr 2022 08:24:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#55139: package-location is wrong for transformed packages Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 27 Apr 2022 12:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55139 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Maxim Cournoyer , 55139@debbugs.gnu.org Received: via spool by 55139-submit@debbugs.gnu.org id=B55139.165106220821981 (code B ref 55139); Wed, 27 Apr 2022 12:24:01 +0000 Received: (at 55139) by debbugs.gnu.org; 27 Apr 2022 12:23:28 +0000 Received: from localhost ([127.0.0.1]:41477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njghb-0005iT-Sx for submit@debbugs.gnu.org; Wed, 27 Apr 2022 08:23:28 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:11391) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njghZ-0005iH-27 for 55139@debbugs.gnu.org; Wed, 27 Apr 2022 08:23:26 -0400 Received: from lprikler-laptop.ist.intra (gw.ist.tugraz.at [129.27.202.101]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4KpHw95b35z3xbl; Wed, 27 Apr 2022 14:23:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1651062201; bh=05p2U4nhnQkPfJUBEJwA6tgzxn8sg0cuFLDLy864wGo=; h=Subject:From:To:Date:In-Reply-To:References; b=XYinASKMhhwdM0BD/gADcqKqdbrTmAo1BAw74ITqA5fc4g6yhO4OuBZYVf+5lVnX8 9ykN605d1Ktn6IkXyW5Id0o2usfmFJv22n6G4O1ry/iS3VYOnKmLp1DMXaL+KxlzFS gyRpccYOL4NT78cIgqaHYyLTVMEND3Lhazh+KXKA= Message-ID: <24e49cc6e3c212973efc4c46b1218ebd1a9acf0a.camel@ist.tugraz.at> From: Liliana Marie Prikler Date: Wed, 27 Apr 2022 14:23:20 +0200 In-Reply-To: <8735hz2t4u.fsf@gmail.com> References: <8735hz2t4u.fsf@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: waObeELIUl4ypBWmcn/8wQ X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651062267; 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: content-transfer-encoding:content-transfer-encoding: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=05p2U4nhnQkPfJUBEJwA6tgzxn8sg0cuFLDLy864wGo=; b=aEAlCSq/5AuYokYDHO6O1BTLWS33bdLvCvGta6VO7+/ITEyyA2liMTvEl9D8kUeV4HO02Y nrC5DIUdPIndccK3E+Bd9y9gH4KtR+DwSXt9ucW/6CHNLJtzVbgBH/47+BSVvT10DU6zuC L+XMLZvM3vuAPvtEkTf4p0LdmOrP0i4awfP05/r10TCoLe2NAsHlCJDW9LwplDP4bSE4y3 /w0OseE3KYwGoqJY1iRT61Df1kZUiceahW4fPyUVx73CNEltlwqOyTK6Z0pltGYUx/ZCw1 J9Q61RolmKgiuvkmBX30FkC/3fRRl+AIlOBNSJ/k6oLLVrE1d9b/5ak+a91+9g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651062267; a=rsa-sha256; cv=none; b=NU2jN/tSTGgd6jeSkYwZ5VAWUiVTHRwnUDBT7v9QeDmJ/n+W6s9bB8H50L8KAx7zdoqS67 r/vp52qyjFztdok9hYJ9JaXxjfzTy6oThjoDee530a9V1dxNG3YemS4DvI+gOVgclxTeQz ZzPWMK1AXH3FJO+QtUL88Dp7qRe8iKarkY5DNCwpZZ3/1Xk8TxhIX1iqPtPnKteYiRd1GN edqt3nf0o9a1r0lWLacyR/GxPD+qnhIFZcNO50c1HSAvru2lvc6IOIWJ7qoDU619xe99K+ 4yPtXn15NNH6R3h5Pov5CEU29Ya4uUuKXRFYx8w4vBC+2jRYDgiktBEnA5jxxw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=XYinASKM; dmarc=fail reason="SPF not aligned (relaxed)" header.from=tugraz.at (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" X-Migadu-Spam-Score: 5.80 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=XYinASKM; dmarc=fail reason="SPF not aligned (relaxed)" header.from=tugraz.at (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" X-Migadu-Queue-Id: 4DC60C53B X-Spam-Score: 5.80 X-Migadu-Scanner: scn1.migadu.com X-TUID: e5GBxCr38+De Am Dienstag, dem 26.04.2022 um 21:48 -0400 schrieb Maxim Cournoyer: > Hi Guix! > > --8<---------------cut here---------------start------------->8--- > > ,import (gnu packages) (guix packages) > > (car (find-packages-by-name "python2-pyalsaaudio")) > $1 = # 7f2b76fab160> > > (package-definition-location-code package $1) > $2 = #f > > (package-definition-location $2) > $3 = #< file: "gnu/packages/audio.scm" line: 4327 column: > 2> > --8<---------------cut here---------------end--------------->8--- > > This is wrong though, and gives the location of the parent package > (the one it inherited from).  This seems to be made on purpose (?) > given the code in (gnu build-system python): I'm pretty sure that this is done so that `guix edit' points you to the package you want to edit rather than its wrapper. While thus incorrect, it is most often what you want. Also, the wrapper should be in its vicinity (usually the next package). > --8<---------------cut here---------------start------------->8--- > (package/inherit p >         (location (package-location p)) > >         ^ Here, we explicitly set the location to that of its parent. >         >         (name (let ((name (package-name p))) >                 (string-append new-prefix >                                (if (string-prefix? old-prefix name) >                                    (substring name >                                               (string-length old- > prefix)) >                                    name)))) >         (arguments >          (let ((python (if (promise? python) >                            (force python) >                            python))) >            (ensure-keyword-arguments (package-arguments p) >                                      `(#:python ,python))))) > --8<---------------cut here---------------end--------------->8--- > > Another related issue for package-with-python2 packages: > > --8<---------------cut here---------------start------------->8--- > > (package-definition-location-code $1) > $4 = #f > --8<---------------cut here---------------end--------------->8--- > > I was expecting to use this to get rid of all leaf Python 2 packages, > but it seems that may not work (as easily as I'd hoped). Note, that you can use guix graphs to detect leaves and then grep for the variable name. This still requires you to use Emacs for deleting some three lines rather than doing so programmatically. However, given that you have the location, you could try to filter out the variable name, then detect whether it's in a package-with-python2 call within the same file. Finally, you can try to just locally comment out that setter and it might return the "true" path. Note that I haven't tested this. Since you're probably using this for a more or less one-time script anyway, I wouldn't be too bothered about it being a dirty hack. Cheers :)