GNU bug report logs - #51655
[PATCH] build-system: haskell: Add ‘package-with-explicit-haskell’ procedure.

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-patches; Reported by: Xinglu Chen <public@HIDDEN>; Keywords: patch; dated Sun, 7 Nov 2021 10:56:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

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


Received: (at 51655) by debbugs.gnu.org; 19 Dec 2021 09:31:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 19 04:31:12 2021
Received: from localhost ([127.0.0.1]:44806 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mysXA-00021z-Ar
	for submit <at> debbugs.gnu.org; Sun, 19 Dec 2021 04:31:12 -0500
Received: from mail-wr1-f49.google.com ([209.85.221.49]:38579)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1mysX6-0001tc-7D
 for 51655 <at> debbugs.gnu.org; Sun, 19 Dec 2021 04:31:08 -0500
Received: by mail-wr1-f49.google.com with SMTP id e5so13560959wrc.5
 for <51655 <at> debbugs.gnu.org>; Sun, 19 Dec 2021 01:31:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version:content-transfer-encoding;
 bh=8WAdufyBcjpP+9Dt1+jZNfHCYon5x0CbtHgf3mUh3c0=;
 b=SVmzto/1HVwXo3ZruKiXwJiqaij1TX1nWb7NUnHTesEjVIoAhIzgokZrOUG954zgla
 gYQW1VdEuAvEi3mAeC3lNo7g1X9WR2WvBZALRJovxeQO6emj3j+M3iOHkcYGfFPW7+Y3
 eOIT2E/dmyDS9ZDoaHXrXDUcQwQ9FHDDQeiBEppM56BaynZnz8dNi4Z5Pw5G6T3H6FA9
 088akeLWMGJ5rfY21gTH505iI4WL/2WLYcaIAIKrmR3wRgSoufha2yvq5YWl+av0ZfJk
 j6HtIoCEu+35gCtwJ5oaoVBWs7HjUV9DTRKFuMx8v9goIfXNqG4itB+zD5YUL9T+wawp
 Bysg==
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:in-reply-to:references:date
 :message-id:mime-version:content-transfer-encoding;
 bh=8WAdufyBcjpP+9Dt1+jZNfHCYon5x0CbtHgf3mUh3c0=;
 b=CfNOCtPOghfKkgEmyESfGvCS2bI02wT2CWq00onASBE5tPMEmuLEDdOBDW+lvlCYuu
 vOVpP2Wc18aQcsguSa6dHmmg3TzKE6UzzOgJnc3FU2l2GGM5Xjaza/RezoeMnYhjon93
 hl4ztnTFnSOg+/gMZVWwvS9gTqTT1W4ZQAV7fkDV2lQGsA3rtWsmu3iXPtUGY9a4Sw1C
 vRDAldu33x4c80HhiZxf8UMbyirGySzOgQyLryBTgTvakGYawocLOIV0Bmdk+lckMSCC
 Uf+TfLxgj0wob6re4H80P4yJ9VArcTax4TGTHKESKi8ivHS7GOQIPqqD/CbzGtTJDp10
 YVcA==
X-Gm-Message-State: AOAM530dxyy/B60hAyw0WRzEpXRGpKW7OaSbp0yLTrfUbr4oVjMo7dK5
 7tEesXY+mCHH7kVzWNNxglNKrdIzD+w=
X-Google-Smtp-Source: ABdhPJzh7wT8wacUPSMb0HDmQ9kBW7wN+gOvwMuWKFyci5WUenv9yKQ8o3UDpzTfZYh3T7GT+8uOSw==
X-Received: by 2002:a5d:6d88:: with SMTP id l8mr9217976wrs.270.1639906262648; 
 Sun, 19 Dec 2021 01:31:02 -0800 (PST)
Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e])
 by smtp.gmail.com with ESMTPSA id j85sm20609276wmj.3.2021.12.19.01.31.01
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 19 Dec 2021 01:31:02 -0800 (PST)
From: zimoun <zimon.toutoune@HIDDEN>
To: Xinglu Chen <public@HIDDEN>, 51655 <at> debbugs.gnu.org
Subject: Re: [bug#51655] [PATCH] build-system: haskell: Add
 =?utf-8?Q?=E2=80=98package-with-explicit-haskell=E2=80=99?= procedure.
In-Reply-To: <878rwhouat.fsf@HIDDEN>
References: <878rwhouat.fsf@HIDDEN>
Date: Sun, 19 Dec 2021 10:23:05 +0100
Message-ID: <86wnk1osna.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Hi, On Sun, 19 Dec 2021 at 09:47,
 Xinglu Chen wrote: >>> +@lisp
 >>> +(use-modules (guix build-system haskell)) >>> + >>> +(define
 (default-haskell-8.8)
 >>> + ;; Lazily resolve the binding to avoid a circular dependency. >>> +
 (let ((haskell (resolve-int [...] 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (zimon.toutoune[at]gmail.com)
 2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
 [URI: yoctocell.xyz (xyz)]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.221.49 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.221.49 listed in wl.mailspike.net]
X-Debbugs-Envelope-To: 51655
Cc: Lars-Dominik Braun <lars@HIDDEN>
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,

On Sun, 19 Dec 2021 at 09:47, Xinglu Chen <public@HIDDEN> wrote:

>>> +@lisp
>>> +(use-modules (guix build-system haskell))
>>> +
>>> +(define (default-haskell-8.8)
>>> +  ;; Lazily resolve the binding to avoid a circular dependency.
>>> +  (let ((haskell (resolve-interface '(gnu packages haskell))))
>>> +    (module-ref haskell 'ghc-8.8)))
>>> +
>>> +(define package-with-haskell-8.8
>>> +  (package-with-explicit-haskell (delay (default-haskell-8.8))
>>> +                                 "ghc-" "ghc-8.8-"
>>> +                                 #:variant-property 'ghc-8.8-variant))
>>> +@end lisp
>>
>> As Lars said, an instance is missing, IMHO.
>
> Not sure what you are referring to here, what exactly do you mean with
> =E2=80=9Cinstance=E2=80=9D?

For example, something as:

    (package-with-haskell-8.8 hledger)

Cheers,
simon




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

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


Received: (at 51655) by debbugs.gnu.org; 19 Dec 2021 08:47:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 19 03:47:35 2021
Received: from localhost ([127.0.0.1]:44775 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1myrqw-0008Ji-KH
	for submit <at> debbugs.gnu.org; Sun, 19 Dec 2021 03:47:35 -0500
Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:46354
 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <public@HIDDEN>) id 1myrqu-0008JO-EH
 for 51655 <at> debbugs.gnu.org; Sun, 19 Dec 2021 03:47:33 -0500
From: Xinglu Chen <public@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz;
 s=mail; t=1639903644;
 bh=lUsSNZCC6TQkYfW8Bh9Lr0xKpAf/40BultOCDXkWCLQ=;
 h=From:To:Cc:Subject:In-Reply-To:Date;
 b=RcHJ5xXfffoSiI4GbqTeIfHNMI4RK+mmuku/76I5VfOwyYJh7/J8d71f8Fv5YQwDc
 Xjel+AUOYC+D5DYb85DBJaLggggURCggw1YSi55sz6nugSIfAQxukacj9686+Bgpa/
 glhJYeQHsHN7jF7bo/JRGxC91eFflN8P5i7vSWj0=
To: zimoun <zimon.toutoune@HIDDEN>, 51655 <at> debbugs.gnu.org
Subject: Re: [bug#51655] [PATCH] build-system: haskell: Add
 =?utf-8?Q?=E2=80=98package-with-explicit-haskell=E2=80=99?= procedure.
In-Reply-To: <86bl2lbgvd.fsf@HIDDEN>
Date: Sun, 19 Dec 2021 09:47:22 +0100
Message-ID: <878rwhouat.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
X-Spam-Score: 2.9 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Hi, On Mo, Nov 15 2021, zimoun wrote: > Hi, > > On Sun, 07
    Nov 2021 at 11:55, Xinglu Chen <public@HIDDEN> wrote: >> * guix/packages.scm
    (package-with-explicit-compiler): New procedure; >> factorized from ‘package-with-explicit-py
    [...] 
 
 Content analysis details:   (2.9 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
  0.4 RDNS_DYNAMIC           Delivered to internal network by host with
                             dynamic-looking rDNS
  0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps
X-Debbugs-Envelope-To: 51655
Cc: Lars-Dominik Braun <lars@HIDDEN>
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.9 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Hi, On Mo, Nov 15 2021, zimoun wrote: > Hi, > > On Sun, 07
    Nov 2021 at 11:55, Xinglu Chen <public@HIDDEN> wrote: >> * guix/packages.scm
    (package-with-explicit-compiler): New procedure; >> factorized from ‘package-with-explicit-py
    [...] 
 
 Content analysis details:   (2.9 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
  0.4 RDNS_DYNAMIC           Delivered to internal network by host with
                             dynamic-looking rDNS
  1.0 BULK_RE_SUSP_NTLD      Precedence bulk and RE: from a suspicious TLD
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager
  0.0 PDS_RDNS_DYNAMIC_FP    RDNS_DYNAMIC with FP steps

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi,

On Mo, Nov 15 2021, zimoun wrote:

> Hi,
>
> On Sun, 07 Nov 2021 at 11:55, Xinglu Chen <public@HIDDEN> wrote:
>> * guix/packages.scm (package-with-explicit-compiler): New procedure;
>> factorized from =E2=80=98package-with-explicit-python=E2=80=99.
>> * guix/build-system/python.scm (package-with-explicit-python): Use
>> =E2=80=98package-with-explicit-compiler=E2=80=99.
>> * guix/build-system/haskell.scm (package-with-explicit-haskell): New pro=
cedure.
>> * doc/guix.texi (Defining Package Variants): Document it.
>> ---
>>  doc/guix.texi                 | 37 ++++++++++++++++++
>>  guix/build-system/haskell.scm |  8 ++++
>>  guix/build-system/python.scm  | 71 +++++++----------------------------
>>  guix/packages.scm             | 55 +++++++++++++++++++++++++++
>>  4 files changed, 113 insertions(+), 58 deletions(-)
>
> Neat refactoring! :-)  It is something discussing several times and I do
> not know if =E2=80=99package-with-explicit-ocaml=E2=80=99 could not be ad=
ded too.  The
> issue is that it depends on more than only one element for =E2=80=9Ccompi=
ling=E2=80=9D:
> ocaml, findlib and dune.

Ah, yes, I forgot about OCaml.  :-)

> On the other hand, guix/build-system/gnu.scm contains
> =E2=80=99package-with-explicit-inputs*=E2=80=99 which is more or less the=
 same idea.
> And =E2=80=99transform-package-toolchain=E2=80=99 is another instance.

I didn=E2=80=99t about =E2=80=98package-with-explicit-inputs*=E2=80=99, but=
 I will look into it.=20

> This =E2=80=99package-with-explicit-{ocaml,python}=E2=80=99 pre-dates the
> transformations and deep rewriting.
>
> Therefore, maybe refactor could revisit the complete story.
>
> Well, I had headaches last time I gave a look at transformations.  And I
> do not know if it is possible to have a generic transformation for
> rewriting implicit inputs of all build systems.  That=E2=80=99s something=
 that
> could be nice to nice: =E2=80=99package-with-explicit-python=E2=80=99 bas=
ed on a
> =E2=80=9Cgeneric=E2=80=9D =E2=80=99package-with-explicit-compiler=E2=80=
=99 (compiler or toolchain
> though) and provides =E2=80=99package-with-explicit-*=E2=80=99 for all bu=
ild systems
> (ocaml, ghc, emacs, guile, etc.).

Yeah, that would be nice to have.  I currently have some other things I
would like to focus on, but I should look more into package
transformations, and hopefully come up with a good solution to this.
:-)

>> +@lisp
>> +(use-modules (guix build-system haskell))
>> +
>> +(define (default-haskell-8.8)
>> +  ;; Lazily resolve the binding to avoid a circular dependency.
>> +  (let ((haskell (resolve-interface '(gnu packages haskell))))
>> +    (module-ref haskell 'ghc-8.8)))
>> +
>> +(define package-with-haskell-8.8
>> +  (package-with-explicit-haskell (delay (default-haskell-8.8))
>> +                                 "ghc-" "ghc-8.8-"
>> +                                 #:variant-property 'ghc-8.8-variant))
>> +@end lisp
>
> As Lars said, an instance is missing, IMHO.

Not sure what you are referring to here, what exactly do you mean with
=E2=80=9Cinstance=E2=80=9D?

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmG+8ZoVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5e9EP/3PxboQBE64JEhoWvB7FmqjxFhyv
WMQbr9zfOPSUCmD4jwgjxjgIyOwZe7/yTwKv66rQFGGd2Q3Qo+DmTm/1CTWNllZ6
K2Vt52D+oEjlEplfAqjFsftuiGx3JQm5XfluwakaV1qlOi/nbWS1lpP68iOT2d/W
lVoo+F4loXjKkPK/ZpEzWFZk5JW5v15b1X2+/dFhh2cEWwxEweuNVZqDWVSOBaqW
jqwkaFgEKeoyj/F21Qmj7oq40gqn56lJtB1kKkV2FbHivTu2l4MoknIYzsyvdV69
P6MQQKCRCHzaLn6JuZLuI65dDqquEt2U7GAYm5OyaHlYO7/PVYUt6/lB/l4KSCV3
dcx1+yTuKKlR06ApRQnVjfiwpqnPX2yTD0DOazN1KNBu907CAAXeLuQxCYLG4TPo
6zWXV8lTZAIVX6uwmVPsnBSJEr/Fk5kw18P8uNgg+fvRB5aV4+Ru/kD+CgwE5F2U
eej9opR5APX8T8S+KUfditG458AskKGlhh3x+IW3RTro8dglR6dWZEdwWfK6+hMY
1buf/B/WvwyU8lGwNUwGa5gtlrRc1m1gkQ9zgFJhKrHJJsMBIMXIGWiEpkQTsbEf
awr07B0+hFmGzGyn6438YipU/XvVRDqQ/caDxCxiu1lUllBELC7+04rzmk3jFLdV
CJnGXc7ahVAPAMNY
=rg0J
-----END PGP SIGNATURE-----
--=-=-=--




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

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


Received: (at 51655) by debbugs.gnu.org; 15 Nov 2021 15:13:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 15 10:13:44 2021
Received: from localhost ([127.0.0.1]:55800 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mmdg0-0005ZR-CI
	for submit <at> debbugs.gnu.org; Mon, 15 Nov 2021 10:13:44 -0500
Received: from mail-wm1-f47.google.com ([209.85.128.47]:40581)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zimon.toutoune@HIDDEN>) id 1mmdfy-0005Z4-VA
 for 51655 <at> debbugs.gnu.org; Mon, 15 Nov 2021 10:13:43 -0500
Received: by mail-wm1-f47.google.com with SMTP id
 az33-20020a05600c602100b00333472fef04so15366559wmb.5
 for <51655 <at> debbugs.gnu.org>; Mon, 15 Nov 2021 07:13:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version:content-transfer-encoding;
 bh=OWmliPwa6XpT73FDilnTpIIdM8PmnBV7CWMQ70J9tE4=;
 b=VPtip+ZLqaUgBJ5RgiSAdFSTQTGSV3/6I3xVoLfvTk4KOphJUovyT+fVP1s29ayHPm
 t20AAzi9R+roK9P1IwpJ6kV/PWuMECoIWj9vXjN5YdWTvsh2Sjo60F0zAgOYxia0G7Ub
 P3UuE3eknd9r6kxFR4vmnKu6LIkF0Y9qQR/739ocLU9mNdzsxDzfMuJO/M2jZEnsJeSL
 A7AmISBH2XJPSqSR6wwvP8cQRuFgrZtPdD5GAnzxunOzbpJqjjHMdGhKIzWXr+0jZBea
 F3aZhZktYcYeuKEmEXA0x/MFDMPc0Jgw65t8oaujwEi7vrDmnqVrDVSKwlQ340cWguPn
 Cv+w==
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:in-reply-to:references:date
 :message-id:mime-version:content-transfer-encoding;
 bh=OWmliPwa6XpT73FDilnTpIIdM8PmnBV7CWMQ70J9tE4=;
 b=v0aoKwa3SR9QDNMeCGu7s+n03ecMCOLZDRFRd61LP9iANopVWXMDjEGVJY9iLnBDyV
 Jjn4+GJYwh0cM0qwyrXxSEx1eBdLpEozLVcOpIrnk7vn8PvMXWbIG2oqzq+zN2mEV4cs
 oPsUSlsVM+24S7lk28Ted3rkJXkrXh/RDyNR/aCjTOt0quH8k5w2wvuEpg1Ah3kwxDFN
 7dL4HhPVLLsSvdIHh4e4dPJLBQ8/yBer2R3KbvVScWSgNYrU5WaCBg1bHuoGRCW4FHGr
 rg4Gb3kspqV3wKgayuXUFzmpQWBCDXGQy4EpOXrcBLYRhC4zEhdFBJ9HfSIpb86/IXZi
 9/uw==
X-Gm-Message-State: AOAM530GtAOc10KaM/AFHT8HMIX8Jc20vOSViXrMh9vl6gJwIeqm1s2W
 BtqPVJsw9Xirkyq6F+VNehM=
X-Google-Smtp-Source: ABdhPJx4EQz5ubhKa3UIs2VhLUkmU70PSM5jF/meJ0zr/MkhvappD/QY1wyrqWs2lfNyWuTONVzSAw==
X-Received: by 2002:a05:600c:4ec7:: with SMTP id
 g7mr43463863wmq.138.1636989217119; 
 Mon, 15 Nov 2021 07:13:37 -0800 (PST)
Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e])
 by smtp.gmail.com with ESMTPSA id 10sm18061586wrb.75.2021.11.15.07.13.36
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 15 Nov 2021 07:13:36 -0800 (PST)
From: zimoun <zimon.toutoune@HIDDEN>
To: Xinglu Chen <public@HIDDEN>, 51655 <at> debbugs.gnu.org
Subject: Re: [bug#51655] [PATCH] build-system: haskell: Add
 =?utf-8?Q?=E2=80=98package-with-explicit-haskell=E2=80=99?= procedure.
In-Reply-To: <7f7b889aebed4c17e3a021883bfed1d67c564109.1636216701.git.public@HIDDEN>
References: <7f7b889aebed4c17e3a021883bfed1d67c564109.1636216701.git.public@HIDDEN>
Date: Mon, 15 Nov 2021 16:03:50 +0100
Message-ID: <86bl2lbgvd.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Hi, On Sun, 07 Nov 2021 at 11:55, Xinglu Chen wrote: > * guix/packages.scm
    (package-with-explicit-compiler): New procedure; > factorized from ‘package-with-explicit-python’.
    > * guix/build-system/py [...] 
 
 Content analysis details:   (2.0 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
  0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
                             provider (zimon.toutoune[at]gmail.com)
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.85.128.47 listed in wl.mailspike.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
                              no trust
                             [209.85.128.47 listed in list.dnswl.org]
X-Debbugs-Envelope-To: 51655
Cc: Lars-Dominik Braun <lars@HIDDEN>
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,

On Sun, 07 Nov 2021 at 11:55, Xinglu Chen <public@HIDDEN> wrote:
> * guix/packages.scm (package-with-explicit-compiler): New procedure;
> factorized from =E2=80=98package-with-explicit-python=E2=80=99.
> * guix/build-system/python.scm (package-with-explicit-python): Use
> =E2=80=98package-with-explicit-compiler=E2=80=99.
> * guix/build-system/haskell.scm (package-with-explicit-haskell): New proc=
edure.
> * doc/guix.texi (Defining Package Variants): Document it.
> ---
>  doc/guix.texi                 | 37 ++++++++++++++++++
>  guix/build-system/haskell.scm |  8 ++++
>  guix/build-system/python.scm  | 71 +++++++----------------------------
>  guix/packages.scm             | 55 +++++++++++++++++++++++++++
>  4 files changed, 113 insertions(+), 58 deletions(-)

Neat refactoring! :-)  It is something discussing several times and I do
not know if =E2=80=99package-with-explicit-ocaml=E2=80=99 could not be adde=
d too.  The
issue is that it depends on more than only one element for =E2=80=9Ccompili=
ng=E2=80=9D:
ocaml, findlib and dune.

On the other hand, guix/build-system/gnu.scm contains
=E2=80=99package-with-explicit-inputs*=E2=80=99 which is more or less the s=
ame idea.
And =E2=80=99transform-package-toolchain=E2=80=99 is another instance.  This
=E2=80=99package-with-explicit-{ocaml,python}=E2=80=99 pre-dates the transf=
ormations and
deep rewriting.

Therefore, maybe refactor could revisit the complete story.

Well, I had headaches last time I gave a look at transformations.  And I
do not know if it is possible to have a generic transformation for
rewriting implicit inputs of all build systems.  That=E2=80=99s something t=
hat
could be nice to nice: =E2=80=99package-with-explicit-python=E2=80=99 based=
 on a
=E2=80=9Cgeneric=E2=80=9D =E2=80=99package-with-explicit-compiler=E2=80=99 =
(compiler or toolchain
though) and provides =E2=80=99package-with-explicit-*=E2=80=99 for all buil=
d systems
(ocaml, ghc, emacs, guile, etc.).


> +@lisp
> +(use-modules (guix build-system haskell))
> +
> +(define (default-haskell-8.8)
> +  ;; Lazily resolve the binding to avoid a circular dependency.
> +  (let ((haskell (resolve-interface '(gnu packages haskell))))
> +    (module-ref haskell 'ghc-8.8)))
> +
> +(define package-with-haskell-8.8
> +  (package-with-explicit-haskell (delay (default-haskell-8.8))
> +                                 "ghc-" "ghc-8.8-"
> +                                 #:variant-property 'ghc-8.8-variant))
> +@end lisp

As Lars said, an instance is missing, IMHO.


Cheers,
simon




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

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


Received: (at 51655) by debbugs.gnu.org; 12 Nov 2021 10:34:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 12 05:34:30 2021
Received: from localhost ([127.0.0.1]:43537 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mlTt7-0001Ug-N8
	for submit <at> debbugs.gnu.org; Fri, 12 Nov 2021 05:34:30 -0500
Received: from mout-p-202.mailbox.org ([80.241.56.172]:19954)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lars@HIDDEN>) id 1mlTt2-0001UM-8a
 for 51655 <at> debbugs.gnu.org; Fri, 12 Nov 2021 05:34:28 -0500
Received: from smtp102.mailbox.org (smtp102.mailbox.org
 [IPv6:2001:67c:2050:105:465:1:3:0])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest
 SHA256) (No client certificate requested)
 by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4HrFLx3dXzzQkjN;
 Fri, 12 Nov 2021 11:34:17 +0100 (CET)
X-Virus-Scanned: amavisd-new at heinlein-support.de
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6xq.net; s=MBO0001;
 t=1636713255;
 h=from:from: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:
 in-reply-to:in-reply-to:references:references;
 bh=3FdcOwzOxF1+NzGzo5c9LcOB/0btj3vKAZHDcmwD7Mk=;
 b=d45bbg0DkJxoT6TWb3/M9/RRuG/qYpy9tXJn0g5gkJamEK54X695+KrbDe0STEc8AyE2/0
 2B2DbXebwa2qVtjV8t9IpVqU/HxRPXOJ1HAXMAA1ocNF9zld4fBtQFjYBqt/3WgdQaSmzh
 66XToIWBbxotmv+I/Z/HAXlJ75d0oznFk8g9RF6fVpa76v4tzhWzqz23+4ThhZEWNBSYM+
 MuSoxl7cCM/wEyMUIlEgMLFiNfCOsO8BR1kJC3Jdq7cWGjzaW+rB5nx5o0zcky2VPrNFMV
 H/9k57wYi8vdTxGaXVvk3xFj86bMXNJGpnI5hA+/e4VpGuNoRDvTeUmYqyVB2w==
Date: Fri, 12 Nov 2021 11:34:11 +0100
From: Lars-Dominik Braun <lars@HIDDEN>
To: Xinglu Chen <public@HIDDEN>
Subject: Re: [bug#51655] [PATCH] =?utf-8?Q?build-sy?=
 =?utf-8?Q?stem=3A_haskell=3A_Add_=E2=80=98package-with-explicit-haskell?=
 =?utf-8?B?4oCZ?= procedure.
Message-ID: <YY5DI3ZbADDZg468@HIDDEN>
References: <7f7b889aebed4c17e3a021883bfed1d67c564109.1636216701.git.public@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <7f7b889aebed4c17e3a021883bfed1d67c564109.1636216701.git.public@HIDDEN>
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 51655
Cc: 51655 <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.7 (-)

Hi,

I’ve tested the patch with the snippet below and it builds most
packages fine, until it hits a type error and aborts. This is probably
expected, since not all packages are compatible with multiple GHC
versions.

The code looks fine, since it’s just moving the Python-specific code to
(guix packages).  I don’t feel qualified enough to say whether the new
API in (guix packages) is welcome or not though. Anyone? Maybe it’d
be worth having a common parameter for all build systems?

---
(use-modules (guix build-system haskell)
             (gnu packages finance))

(define (default-haskell-8.8)
  ;; Lazily resolve the binding to avoid a circular dependency.
  (let ((haskell (resolve-interface '(gnu packages haskell))))
    (module-ref haskell 'ghc-8.8)))

(define package-with-haskell-8.8
  (package-with-explicit-haskell (delay (default-haskell-8.8))
                                 "ghc-" "ghc-8.8-"
                                 #:variant-property 'ghc-8.8-variant))

(package-with-haskell-8.8 hledger)
---

Cheers,
Lars





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

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


Received: (at submit) by debbugs.gnu.org; 7 Nov 2021 10:55:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 07 05:55:42 2021
Received: from localhost ([127.0.0.1]:51864 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mjfpt-0003In-Dn
	for submit <at> debbugs.gnu.org; Sun, 07 Nov 2021 05:55:41 -0500
Received: from lists.gnu.org ([209.51.188.17]:45730)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <public@HIDDEN>) id 1mjfpp-0003Ie-PR
 for submit <at> debbugs.gnu.org; Sun, 07 Nov 2021 05:55:40 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:51102)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <public@HIDDEN>)
 id 1mjfpp-0004Q8-IS
 for guix-patches@HIDDEN; Sun, 07 Nov 2021 05:55:37 -0500
Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:34970
 helo=mail.yoctocell.xyz)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <public@HIDDEN>)
 id 1mjfpm-00062X-OO
 for guix-patches@HIDDEN; Sun, 07 Nov 2021 05:55:37 -0500
From: Xinglu Chen <public@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz;
 s=mail; t=1636282526;
 bh=1AbHFgRMuasz+k+7TOSLmKejvj3I1cIXwV211QsB9AU=;
 h=From:To:Subject:Date;
 b=iaVKIOYn8sKqEHueXmyuDIRkdS/ORoVjRgvYtpSgT5yTs9BP8qroPb323k6elvNDd
 yf5SshEXFZJkKe2kdoMiNCeMia4+smkYXDa/1DV6JAf11HlDB8aGia2QmPqvrav5yD
 4smeRO3kjyMnHV2dgif0QXBbbCHWTdod4VSsmbs4=
To: guix-patches@HIDDEN
Subject: [PATCH] =?UTF-8?q?build-system:=20haskell:=20Add=20=E2=80=98packa?=
 =?UTF-8?q?ge-with-explicit-haskell=E2=80=99=20procedure.?=
X-Debbugs-CC: Lars-Dominik Braun <lars@HIDDEN>
Message-Id: <7f7b889aebed4c17e3a021883bfed1d67c564109.1636216701.git.public@HIDDEN>
Date: Sun, 07 Nov 2021 11:55:25 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@HIDDEN;
 helo=mail.yoctocell.xyz
X-Spam_score_int: 11
X-Spam_score: 1.1
X-Spam_bar: +
X-Spam_report: (1.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, FROM_SUSPICIOUS_NTLD=0.001,
 FROM_SUSPICIOUS_NTLD_FP=1.997, PDS_OTHER_BAD_TLD=0.001,
 PDS_RDNS_DYNAMIC_FP=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, TO_NO_BRKTS_DYNIP=0.252 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * guix/packages.scm (package-with-explicit-compiler): New
   procedure; factorized from ‘package-with-explicit-python’. * guix/build-system/python.scm
    (package-with-explicit-python): Use ‘package-w [...] 
 
 Content analysis details:   (1.7 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
                             medium trust
                             [209.51.188.17 listed in list.dnswl.org]
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.51.188.17 listed in wl.mailspike.net]
  0.5 FROM_SUSPICIOUS_NTLD_FP From abused NTLD
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
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: 0.2 (/)

* guix/packages.scm (package-with-explicit-compiler): New procedure;
factorized from =E2=80=98package-with-explicit-python=E2=80=99.
* guix/build-system/python.scm (package-with-explicit-python): Use
=E2=80=98package-with-explicit-compiler=E2=80=99.
* guix/build-system/haskell.scm (package-with-explicit-haskell): New proced=
ure.
* doc/guix.texi (Defining Package Variants): Document it.
---
 doc/guix.texi                 | 37 ++++++++++++++++++
 guix/build-system/haskell.scm |  8 ++++
 guix/build-system/python.scm  | 71 +++++++----------------------------
 guix/packages.scm             | 55 +++++++++++++++++++++++++++
 4 files changed, 113 insertions(+), 58 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index ea1973f02c..95fa5ab103 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7717,6 +7717,43 @@
 applied to implicit inputs as well.
 @end deffn
=20
+@deffn {Scheme Procedure} package-with-explicit-compiler @var{compiler} @
+@var{keyword} @var{build-system} @var{old-prefix} @var{new-prefix} @
+[#:variant-property #f]
+Return a procedure of one argument, @var{p}.  The procedure creates a
+package with the same fields as @var{p}, which is assumed to use
+@var{build-system}, such that it is compiled with @var{compiler}
+instead.  @var{keyword} is a symbol whose name is the name of the
+keyword for explicitly specifying a compiler, e.g., @code{python} for
+@code{python-build-system}.  The inputs are changed recursively
+accordingly.  If the name of @var{p} starts with @var{old-prefix}, this
+is replaced by @var{new-prefix}; otherwise, @var{new-prefix} is
+prepended to the name.
+
+When @var{variant-property} is present, it is used as a key to search
+for pre-defined variants of this transformation recorded in the
+@code{properties} field of packages.  The property value must be the
+promise of a package.  This is a convenient way for package writers to
+force the transformation to use pre-defined variants.
+
+You can for example define a procedure which given a Haskell package,
+builds it and all of its recursive dependencies with GHC 8.8.
+
+@lisp
+(use-modules (guix build-system haskell))
+
+(define (default-haskell-8.8)
+  ;; Lazily resolve the binding to avoid a circular dependency.
+  (let ((haskell (resolve-interface '(gnu packages haskell))))
+    (module-ref haskell 'ghc-8.8)))
+
+(define package-with-haskell-8.8
+  (package-with-explicit-haskell (delay (default-haskell-8.8))
+                                 "ghc-" "ghc-8.8-"
+                                 #:variant-property 'ghc-8.8-variant))
+@end lisp=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20
+@end deffn
+
=20
 @node Build Systems
 @section Build Systems
diff --git a/guix/build-system/haskell.scm b/guix/build-system/haskell.scm
index 18a584f782..8656e5f318 100644
--- a/guix/build-system/haskell.scm
+++ b/guix/build-system/haskell.scm
@@ -2,6 +2,7 @@
 ;;; Copyright =C2=A9 2015 Federico Beffa <beffa@HIDDEN>
 ;;; Copyright =C2=A9 2020 Timothy Sample <samplet@HIDDEN>
 ;;; Copyright =C2=A9 2020 Simon Tournier <zimon.toutoune@HIDDEN>
+;;; Copyright =C2=A9 2021 Xinglu Chen <public@HIDDEN>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +32,7 @@ (define-module (guix build-system haskell)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (%haskell-build-system-modules
+            package-with-explicit-haskell
             haskell-build
             haskell-build-system))
=20
@@ -190,4 +192,10 @@ (define haskell-build-system
     (description "The standard Haskell build system")
     (lower lower)))
=20
+(define* (package-with-explicit-haskell haskell old-prefix new-prefix
+                                        #:key variant-property)
+  (package-with-explicit-compiler haskell 'haskell haskell-build-system
+                                  old-prefix new-prefix
+                                  #:variant-property variant-property))
+
 ;;; haskell.scm ends here
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index 80895162f8..3d8b437d11 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -70,64 +70,6 @@ (define (default-python2)
   (let ((python (resolve-interface '(gnu packages python))))
     (module-ref python 'python-2)))
=20
-(define* (package-with-explicit-python python old-prefix new-prefix
-                                       #:key variant-property)
-  "Return a procedure of one argument, P.  The procedure creates a package=
 with
-the same fields as P, which is assumed to use PYTHON-BUILD-SYSTEM, such th=
at
-it is compiled with PYTHON instead.  The inputs are changed recursively
-accordingly.  If the name of P starts with OLD-PREFIX, this is replaced by
-NEW-PREFIX; otherwise, NEW-PREFIX is prepended to the name.
-
-When VARIANT-PROPERTY is present, it is used as a key to search for
-pre-defined variants of this transformation recorded in the 'properties' f=
ield
-of packages.  The property value must be the promise of a package.  This i=
s a
-convenient way for package writers to force the transformation to use
-pre-defined variants."
-  (define package-variant
-    (if variant-property
-        (lambda (package)
-          (assq-ref (package-properties package)
-                    variant-property))
-        (const #f)))
-
-  (define (transform p)
-    (cond
-     ;; If VARIANT-PROPERTY is present, use that.
-     ((package-variant p)
-      =3D> force)
-
-     ;; Otherwise build the new package object graph.
-     ((eq? (package-build-system p) python-build-system)
-      (package/inherit p
-        (location (package-location p))
-        (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))))))
-     (else p)))
-
-  (define (cut? p)
-    (or (not (eq? (package-build-system p) python-build-system))
-        (package-variant p)))
-
-  (package-mapping transform cut?))
-
-(define package-with-python2
-  ;; Note: delay call to 'default-python2' until after the 'arguments' fie=
ld
-  ;; of packages is accessed to avoid a circular dependency when evaluating
-  ;; the top-level of (gnu packages python).
-  (package-with-explicit-python (delay (default-python2))
-                                "python-" "python2-"
-                                #:variant-property 'python2-variant))
-
 (define (strip-python2-variant p)
   "Remove the 'python2-variant' property from P."
   (package/inherit p
@@ -220,4 +162,17 @@ (define python-build-system
     (description "The standard Python build system")
     (lower lower)))
=20
+(define* (package-with-explicit-python python old-prefix new-prefix
+                                       #:key variant-property)
+  (package-with-explicit-compiler python 'python python-build-system
+                                  old-prefix new-prefix
+                                  #:variant-property variant-property))
+(define package-with-python2
+  ;; Note: delay call to 'default-python2' until after the 'arguments' fie=
ld
+  ;; of packages is accessed to avoid a circular dependency when evaluating
+  ;; the top-level of (gnu packages python).
+  (package-with-explicit-python (delay (default-python2))
+                                  "python-" "python2-"
+                                  #:variant-property 'python2-variant))
+
 ;;; python.scm ends here
diff --git a/guix/packages.scm b/guix/packages.scm
index 4b6098bb8d..81c5701886 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -130,6 +130,7 @@ (define-module (guix packages)
             package-with-extra-patches
             package-with-c-toolchain
             package/inherit
+            package-with-explicit-compiler
=20
             transitive-input-references
=20
@@ -951,6 +952,60 @@ (define (package-with-c-toolchain package toolchain)
     (package/inherit package
       (build-system (build-system-with-c-toolchain bs toolchain)))))
=20
+(define* (package-with-explicit-compiler compiler keyword build-system
+                                         old-prefix new-prefix
+                                         #:key variant-property)
+  "Return a procedure of one argument, P.  The procedure creates a package=
 with
+the same fields as P, which is assumed to use BUILD-SYSTEM, such that it is
+compiled with COMPILER instead.  KEYWORD is a symbol whose name is the nam=
e of
+the keyword for explicitly specifying a compiler, e.g., 'python' for
+'python-build-system'.  The inputs are changed recursively accordingly.  If
+the name of P starts with OLD-PREFIX, this is replaced by NEW-PREFIX;
+otherwise, NEW-PREFIX is prepended to the name.
+
+When VARIANT-PROPERTY is present, it is used as a key to search for
+pre-defined variants of this transformation recorded in the 'properties' f=
ield
+of packages.  The property value must be the promise of a package.  This i=
s a
+convenient way for package writers to force the transformation to use
+pre-defined variants."
+  (define package-variant
+    (if variant-property
+        (lambda (package)
+          (assq-ref (package-properties package)
+                    variant-property))
+        (const #f)))
+
+  (define (transform p)
+    (cond
+     ;; If VARIANT-PROPERTY is present, use that.
+     ((package-variant p)
+      =3D> force)
+
+     ;; Otherwise build the new package object graph.
+     ((eq? (package-build-system p) build-system)
+      (package/inherit p
+        (location (package-location p))
+        (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 ((compiler (if (promise? compiler)
+                             (force compiler)
+                             compiler)))
+           (ensure-keyword-arguments (package-arguments p)
+                                     `(,(symbol->keyword keyword)
+                                       ,compiler))))))
+     (else p)))
+
+  (define (cut? p)
+    (or (not (eq? (package-build-system p) build-system))
+        (package-variant p)))
+
+  (package-mapping transform cut?))
+
 (define (transitive-inputs inputs)
   "Return the closure of INPUTS when considering the 'propagated-inputs'
 edges.  Omit duplicate inputs, except for those already present in INPUTS

base-commit: 1ffc0a6be3c1613b2d99ceea098174d1f11f6f3f
--=20
2.33.0







Acknowledgement sent to Xinglu Chen <public@HIDDEN>:
New bug report received and forwarded. Copy sent to lars@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to lars@HIDDEN, guix-patches@HIDDEN:
bug#51655; Package guix-patches. 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, 19 Dec 2021 09:30:02 UTC

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