From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uGFyN2XHiWLEcQEAbAwnHQ (envelope-from ) for ; Sun, 22 May 2022 07:17:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IIFjN2XHiWI7BgAA9RJhRA (envelope-from ) for ; Sun, 22 May 2022 07:17:25 +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 02C4426037 for ; Sun, 22 May 2022 07:17:24 +0200 (CEST) Received: from localhost ([::1]:60702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nsdxz-0006ik-ET for larch@yhetil.org; Sun, 22 May 2022 01:17:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nsdxi-0006iX-3q for bug-guix@gnu.org; Sun, 22 May 2022 01:17:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49564) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nsdxd-0002FA-Vl for bug-guix@gnu.org; Sun, 22 May 2022 01:17:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nsdxd-00035Q-Ql for bug-guix@gnu.org; Sun, 22 May 2022 01:17:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#55139: package-location is wrong for transformed packages Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 22 May 2022 05:17: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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 55139@debbugs.gnu.org Received: via spool by 55139-submit@debbugs.gnu.org id=B55139.165319660210867 (code B ref 55139); Sun, 22 May 2022 05:17:01 +0000 Received: (at 55139) by debbugs.gnu.org; 22 May 2022 05:16:42 +0000 Received: from localhost ([127.0.0.1]:43461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsdxJ-0002os-P9 for submit@debbugs.gnu.org; Sun, 22 May 2022 01:16:42 -0400 Received: from mail-qt1-f179.google.com ([209.85.160.179]:44546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nsdxH-0002hq-1g for 55139@debbugs.gnu.org; Sun, 22 May 2022 01:16:40 -0400 Received: by mail-qt1-f179.google.com with SMTP id b9so4419820qtx.11 for <55139@debbugs.gnu.org>; Sat, 21 May 2022 22:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=XBxAVvx7fb5YOksvBxdBO9sBKkDTXNul67OffdzqFMc=; b=jKSF8u+K1Y20uWdwgblyo7bbQZXhxfBAP5v8ERC6w7RoAfG9b/ogSsOT+DbbTwLb+a WgQu+OOEaaeOV6c8+gpD+2ppiGS4MZxVE5dKp8jr+TqYjyIbERyseRFmEULmG6v1ZL40 Kuk7qVgYsv10lTOV+Jn0HoT9ErvYo2Hdkf1XOdv6zFRx2tsvh021/oXgyCsD9geXvWvp NST1aPDMzxOZEtokiGs8tU2QUhRPFTbo3kfDeTv6l/91MkqzoZogxh9KVm1ObkHfMqTH SHEeX2Lk/40mmfYWumHa8xm09sPAGNgX7uNJ3KMozhEL5azuNbhJHKp5zl61Ohs18ZsV WmAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=XBxAVvx7fb5YOksvBxdBO9sBKkDTXNul67OffdzqFMc=; b=J82cfy64Zc+WMO1NY3Bke1c319a5Q7jengNnm+oOK4bgbBxnhmgNVWNlrjvr3fcNxG xP5+vKVcqWxgMmfUfwef1fT1ItjEMQ6rmE338GZ+/dR/5dqsV3ccJ0yqS49b4ZFxgiCb vtuw/7qskXtoMt3Twz8NvirXD/hKRhunD66TqEz2YYojLeBZ409WDaEjdb5QIviuBkeP Z3J59ttLux29giV4HhgXzDm639M+fMakIfehGDQW2WMjrqg52JJowlOFky/x0+nM7pL4 6Gb0v2S43aXAO2NqQRbzvpRg5UvEkwmqesyJ5wQ0wYmqFmnr4R9lbVhqXAEHNqjRhEog OKrA== X-Gm-Message-State: AOAM530bQfzZeIplLWQSXdPTPP4mUAi4RcHRVXZEsej+K4jew4VzDUzo S/+2BC2YnIYbIv6gEoWoal2QE7p7RcQX23QS X-Google-Smtp-Source: ABdhPJxVO0Lb2mY6FYd3LKNw7wLYXCaIjwx95UfTuciwiz/fwCN3lFzqhDaW0u0IEM+z0QI9dgfgRQ== X-Received: by 2002:ac8:5d92:0:b0:2f9:1f14:b6bc with SMTP id d18-20020ac85d92000000b002f91f14b6bcmr6572093qtx.383.1653196593344; Sat, 21 May 2022 22:16:33 -0700 (PDT) Received: from hurd (dsl-152-80.b2b2c.ca. [66.158.152.80]) by smtp.gmail.com with ESMTPSA id m11-20020a05620a24cb00b0069fc13ce23bsm1726430qkn.108.2022.05.21.22.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 22:16:32 -0700 (PDT) From: Maxim Cournoyer References: <8735hz2t4u.fsf@gmail.com> <87pmkvr6t2.fsf@gnu.org> Date: Sun, 22 May 2022 01:16:32 -0400 In-Reply-To: <87pmkvr6t2.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Mon, 02 May 2022 22:57:45 +0200") Message-ID: <87v8ty5eq7.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=1653196645; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=XBxAVvx7fb5YOksvBxdBO9sBKkDTXNul67OffdzqFMc=; b=uanZaoKvstUn6FjExFCU8/RC1TTiixYH7lFVVhcVk0R6U/ohqS5moTcziqPrKTyK0abUBD u6vliE9C6Xtymaawq6Dk1iAnATdTBxGTlgAEjUCXTUjcczt7ZjfEC1CLwy2MakjeHSVeDL ECygeU8zxHBFTTBaeaiP05BporbEMQK2vP8uCD8aulVtrk3zn7OsgetyPtkoy0RkL+PSpc UKbqeyOaCmcCEe0lhYCszIt7zZ9b6FnMJ7cwCetIRxz4gF+y2paq+Au3hLHXBTkG59bwqA A7i3x7RnvScs/duKcduzEqCJTIHr1pFp1BJTDix5aPQUyu1Y5JcdZ3Z98uL7wg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653196645; a=rsa-sha256; cv=none; b=QdcD9fLVPI3KgOrUd8j4K+5ZASSWxPT21NMyXQDwJ1LTIA97gb53gxHfTpOX0QQozxmx4Q tHwP9WGj86XFq08Hd7lbg487MoSrFg1zQQItsgexTwVKDY7ziqUW+XWNw1PGoUxoklzOUo U0qiK6yFTybAPmiiUjO+ra9P0DCFZNeAplnFIUaTJYDdINwXqnmwwe261nQefGOLOyH6Ov pNUa17QdHEz0j4ihDw5eObY0MuYJJAltDkqyExvEHgysMj/j45uV2XJsmg6WB3GWyJW3Er TaV0H++9SIbVZN7/Hpj8aUEWKDEtoY6qZrZNnjdDoLBSNYSRyTt43Fothscr3A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=jKSF8u+K; 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" X-Migadu-Spam-Score: 5.95 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=jKSF8u+K; 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" X-Migadu-Queue-Id: 02C4426037 X-Spam-Score: 5.95 X-Migadu-Scanner: scn0.migadu.com X-TUID: 5KqytrEGRzY7 Hi, Ludovic Court=C3=A8s writes: > Hi, > > Maxim Cournoyer skribis: > >>> ,import (gnu packages) (guix packages) >>> (car (find-packages-by-name "python2-pyalsaaudio")) >> $1 =3D # >>> (package-definition-location-code package $1) >> $2 =3D #f >>> (package-definition-location $2) >> $3 =3D #< file: "gnu/packages/audio.scm" line: 4327 column: 2> >> >> >> 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): >> >> (package/inherit p >> (location (package-location p)) >> >> ^ Here, we explicitly set the location to that of its parent. > > Indeed, that=E2=80=99s on purpose; the rationale is that it=E2=80=99s mor= e useful to see > the location of the original package (the Python=C2=A03 variant) than alw= ays > this one line in gnu/build-system/python.scm. > >> Another related issue for package-with-python2 packages: >> >>> (package-definition-location-code $1) >> $4 =3D #f > > Yes, I see it=E2=80=99s annoying, but that=E2=80=99s expected. > >> 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). > > You were willing to have a script that would automatically delete the > relevant lines, right? > > It=E2=80=99s kinda silly but I think the script will have to estimate the > definition location by looking for =E2=80=9C(define-public python2-=E2=80= =A6=E2=80=9D. Yeah, I ended up with this [0]: --8<---------------cut here---------------start------------->8--- (define (locate-package-via-git name) "Return the location object corresponding to package NAME, searched via g= it." (let* ((input-pipe (open-pipe* OPEN_READ "git" "grep" "-n" "--column" (format #f "^(define-public ~a$" name))) (output (get-string-all input-pipe)) ;file:line:column:match (exit-val (status:exit-val (close-pipe input-pipe)))) (case exit-val ((0) (let ((components (string-split output #\:))) (location (first components) ;file (string->number (second components)) ;1-indexed line ;; FIXME: Comment discrepancy in (guix diagnostics), which ;; says the column is 0-indexed. (and=3D> (string->number (third components)) 1-)))) ;0-indexed co= lumn ((1) #f) ;no match (else (error "git grep failed with status" exit-val))))) --8<---------------cut here---------------end--------------->8--- and it does feel silly to have to shell out to git, but it did the job. Thanks, Maxim [0] https://notabug.org/apteryx/guix-api-examples/src/master/purge-python2= -packages.scm#L42