GNU bug report logs - #55139
package-location is wrong for transformed packages

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; dated Wed, 27 Apr 2022 01:49:02 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 55139 <at> debbugs.gnu.org:


Received: (at 55139) by debbugs.gnu.org; 22 May 2022 05:16:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 22 01:16:42 2022
Received: from localhost ([127.0.0.1]:43461 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nsdxJ-0002os-P9
	for submit <at> 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 <maxim.cournoyer@HIDDEN>) id 1nsdxH-0002hq-1g
 for 55139 <at> 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 <at> 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 <maxim.cournoyer@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: bug#55139: package-location is wrong for transformed packages
References: <8735hz2t4u.fsf@HIDDEN> <87pmkvr6t2.fsf@HIDDEN>
Date: Sun, 22 May 2022 01:16:32 -0400
In-Reply-To: <87pmkvr6t2.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Mon, 02 May 2022 22:57:45 +0200")
Message-ID: <87v8ty5eq7.fsf@HIDDEN>
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-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55139
Cc: 55139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi,

Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@HIDDEN> skribis:
>
>>> ,import (gnu packages) (guix packages)
>>> (car (find-packages-by-name "python2-pyalsaaudio"))
>> $1 =3D #<package python2-pyalsaaudio@HIDDEN gnu/packages/audio.scm:4327 7=
f2b76fab160>
>>> (package-definition-location-code package $1)
>> $2 =3D #f
>>> (package-definition-location $2)
>> $3 =3D #<<location> 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




Information forwarded to bug-guix@HIDDEN:
bug#55139; Package guix. Full text available.

Message received at 55139 <at> debbugs.gnu.org:


Received: (at 55139) by debbugs.gnu.org; 2 May 2022 20:57:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 02 16:57:55 2022
Received: from localhost ([127.0.0.1]:38111 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1nld7C-0003ip-Nl
	for submit <at> debbugs.gnu.org; Mon, 02 May 2022 16:57:54 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39830)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1nld7B-0003ia-FX
 for 55139 <at> debbugs.gnu.org; Mon, 02 May 2022 16:57:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:37848)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1nld76-0005QN-49; Mon, 02 May 2022 16:57:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To:
 From; bh=8u5Yeiy0kbK57DtNg/VbIyDnZeVoui2s2mHjc8TN9WA=; b=l8BghTcdY//D00QWCoVe
 B576IGpLD/qUnSzYelOJmUyXJnejIr6NpCDG98vSDUBS1D16Cm86nV+3Ql02Eb7oBwGeTxM00YtqC
 HbYNLhr0GCXL/mruoGp49SIbLovgtV+ZV2j2yT2ykYp6Sjc0KNVwC6fXAoApZDxhd74OC63xOxnjg
 9UO4KfJacYUUOH1jiFK5ClfiYXx4ehJgJxcFIRSweFBaJUVXTrrlM8Ws9UqZU2V4NV8Nb/auFK0vi
 H7d0NmWLFt+b3G8B475q44cshP2EFRMHjeh8SrJYR3nQOUVnA/wd52AD76DS27HLxUcfysbDEMOcu
 bkg20j4CSSx1Wg==;
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:57254
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1nld75-0007uI-Mr; Mon, 02 May 2022 16:57:47 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
Subject: Re: bug#55139: package-location is wrong for transformed packages
References: <8735hz2t4u.fsf@HIDDEN>
Date: Mon, 02 May 2022 22:57:45 +0200
In-Reply-To: <8735hz2t4u.fsf@HIDDEN> (Maxim Cournoyer's message of "Tue, 26
 Apr 2022 21:48:49 -0400")
Message-ID: <87pmkvr6t2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55139
Cc: 55139 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Maxim Cournoyer <maxim.cournoyer@HIDDEN> skribis:

>> ,import (gnu packages) (guix packages)
>> (car (find-packages-by-name "python2-pyalsaaudio"))
> $1 =3D #<package python2-pyalsaaudio@HIDDEN gnu/packages/audio.scm:4327 7f=
2b76fab160>
>> (package-definition-location-code package $1)
> $2 =3D #f
>> (package-definition-location $2)
> $3 =3D #<<location> 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 more =
useful to see
the location of the original package (the Python=C2=A03 variant) than always
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.

HTH,
Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#55139; Package guix. Full text available.

Message received at 55139 <at> debbugs.gnu.org:


Received: (at 55139) by debbugs.gnu.org; 27 Apr 2022 12:23:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 27 08:23:28 2022
Received: from localhost ([127.0.0.1]:41477 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1njghb-0005iT-Sx
	for submit <at> 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 <liliana.prikler@HIDDEN>) id 1njghZ-0005iH-27
 for 55139 <at> 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@HIDDEN>
Subject: Re: package-location is wrong for transformed packages
From: Liliana Marie Prikler <liliana.prikler@HIDDEN>
To: Maxim Cournoyer <maxim.cournoyer@HIDDEN>, 55139 <at> debbugs.gnu.org
Date: Wed, 27 Apr 2022 14:23:20 +0200
In-Reply-To: <8735hz2t4u.fsf@HIDDEN>
References: <8735hz2t4u.fsf@HIDDEN>
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-Spam-Scanner: SpamAssassin 3.003001 
X-Spam-Score-relay: -1.9
X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55139
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

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 = #<package python2-pyalsaaudio@HIDDEN gnu/packages/audio.scm:4327
> 7f2b76fab160>
> > (package-definition-location-code package $1)
> $2 = #f
> > (package-definition-location $2)
> $3 = #<<location> 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 :)




Information forwarded to bug-guix@HIDDEN:
bug#55139; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Apr 2022 01:48:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 26 21:48:57 2022
Received: from localhost ([127.0.0.1]:40816 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1njWnZ-0007vX-G8
	for submit <at> debbugs.gnu.org; Tue, 26 Apr 2022 21:48:57 -0400
Received: from lists.gnu.org ([209.51.188.17]:57492)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maxim.cournoyer@HIDDEN>) id 1njWnY-0007vP-1V
 for submit <at> debbugs.gnu.org; Tue, 26 Apr 2022 21:48:56 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:52052)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1njWnX-0006AS-MY
 for bug-guix@HIDDEN; Tue, 26 Apr 2022 21:48:55 -0400
Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:35666)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <maxim.cournoyer@HIDDEN>)
 id 1njWnV-0008OP-2l
 for bug-guix@HIDDEN; Tue, 26 Apr 2022 21:48:55 -0400
Received: by mail-qk1-x72e.google.com with SMTP id z126so384340qkb.2
 for <bug-guix@HIDDEN>; Tue, 26 Apr 2022 18:48:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:subject:date:message-id:mime-version;
 bh=1phqMD13WJP4oED0kIy1SX+QR/+iqmM9ut3ARVXJhuc=;
 b=N2GCblsoWGZgWponjNT3kkHJNVe9Cpi5Ioe49Q0irMHa1TvujPrK4za4A36g1kILPo
 ES3qbBT79rPq8+CFGnaboXuzRTmKjyyH84bh8EGnTnlAhnIhSGlsmNJMYjtSEoBPopCo
 F4DVd4scDZC4NebDCkpxejzNpL7h5upOLM43QddJvIdqyDmt0f5P4R4atNvjSQjIw7Dc
 TITbTvyrK5s8BKbfNWQOt/F0FWWlwaEa8BD6gpys6sMjXM5cPJZuuHhNIpHxVV/knLXr
 08aQ0GTtYukSNT/2y/7kX/c1uqS+Xhk0ucAcGFlGHjNOfxCg3cfAb7hY4MZLoBx8UyvD
 Cvnw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=1phqMD13WJP4oED0kIy1SX+QR/+iqmM9ut3ARVXJhuc=;
 b=cOQ67lJTt1Onu7UpQKMhjb/hiR8NsJ7ot+AANFW6efAx4tJrUzM7tVbETyzrxhvtFU
 McPjsL0YxNpFDCdr1mFseWbQDaoarjPt6Q2ha/A4jbCRuYZKv45jqh1L7+lGs9eRJbth
 ykkqDPJR0fqfwBtr6yMFa79pOaAo/+3Hb/H0d4k3aM1qHRjFXb2IpQpm+06slMRMgA/f
 U7uKKoMH/bN8Hx3n0/JhfNxKk88XOBqZ4CUVWTznhKwPHqLhM62GSxd+mCeGizKmCwWm
 wWfaWfoGSMXVSmZaToXFqng0Y+XrBP/pW428NkIsB7j/h2rUv8xIXw607SFuIgJGnsti
 1/QA==
X-Gm-Message-State: AOAM532BjKXAQUBcWAPytprBRT1SLRYPpbsctj/igg/TT+uLW5tpyL2s
 nUMSHk0MAkckHuvhZOqdK2aVxcW5vFJJog==
X-Google-Smtp-Source: ABdhPJwLkDy9opE2fv5y4JzqD/7obCCm6ryTyesTOL3zjEje/IPh3jAINF/Y2SVVyBtA8Tk1N7VTGQ==
X-Received: by 2002:a05:620a:2152:b0:69f:6130:fa29 with SMTP id
 m18-20020a05620a215200b0069f6130fa29mr6717745qkm.126.1651024131121; 
 Tue, 26 Apr 2022 18:48:51 -0700 (PDT)
Received: from hurd (dsl-150-50.b2b2c.ca. [66.158.150.50])
 by smtp.gmail.com with ESMTPSA id
 v67-20020a376146000000b0069ec181a0c6sm7452674qkb.10.2022.04.26.18.48.50
 for <bug-guix@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 26 Apr 2022 18:48:50 -0700 (PDT)
From: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
To: bug-guix <bug-guix@HIDDEN>
Subject: package-location is wrong for transformed packages
Date: Tue, 26 Apr 2022 21:48:49 -0400
Message-ID: <8735hz2t4u.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::72e;
 envelope-from=maxim.cournoyer@HIDDEN; helo=mail-qk1-x72e.google.com
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, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Hi Guix!

--8<---------------cut here---------------start------------->8---
> ,import (gnu packages) (guix packages)
> (car (find-packages-by-name "python2-pyalsaaudio"))
$1 = #<package python2-pyalsaaudio@HIDDEN gnu/packages/audio.scm:4327 7f2b76fab160>
> (package-definition-location-code package $1)
$2 = #f
> (package-definition-location $2)
$3 = #<<location> 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):

--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).

Thanks,

Maxim




Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#55139; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 22 May 2022 05:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.