From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gwl-devel-bounces+larch=yhetil.org@gnu.org>
Received: from mp11.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms5.migadu.com with LMTPS
	id ALDiDUxJaGKRXgEAbAwnHQ
	(envelope-from <gwl-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 26 Apr 2022 21:34:36 +0200
Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp11.migadu.com with LMTPS
	id QA4XDkxJaGJpJwAA9RJhRA
	(envelope-from <gwl-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 26 Apr 2022 21:34:36 +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 99AE210E81
	for <larch@yhetil.org>; Tue, 26 Apr 2022 21:34:35 +0200 (CEST)
Received: from localhost ([::1]:33014 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <gwl-devel-bounces+larch=yhetil.org@gnu.org>)
	id 1njQxG-0005Bp-Eg
	for larch@yhetil.org; Tue, 26 Apr 2022 15:34:34 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:53126)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <olivier.dion@polymtl.ca>)
 id 1njQPA-0002o7-6V
 for gwl-devel@gnu.org; Tue, 26 Apr 2022 14:59:20 -0400
Received: from smtp.polymtl.ca ([132.207.4.11]:44945)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <olivier.dion@polymtl.ca>)
 id 1njQP6-0002qu-Hs
 for gwl-devel@gnu.org; Tue, 26 Apr 2022 14:59:18 -0400
Received: from localhost (modemcable094.169-200-24.mc.videotron.ca
 [24.200.169.94])
 by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 23QIx7Kr017622
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); 
 Tue, 26 Apr 2022 14:59:13 -0400
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 23QIx7Kr017622
To: Ricardo Wurmus <rekado@elephly.net>
Cc: gwl-devel@gnu.org
Subject: Re: [PATCH v2 1/2] packages: Support for full Guix specification
In-Reply-To: <87ilqv66yd.fsf@elephly.net>
References: <20220421195158.22407-1-olivier.dion@polymtl.ca>
 <20220422184359.7929-1-olivier.dion@polymtl.ca>
 <20220422184359.7929-2-olivier.dion@polymtl.ca>
 <87ilqv66yd.fsf@elephly.net>
Date: Tue, 26 Apr 2022 14:59:07 -0400
Message-ID: <875ymvhds4.fsf@laura>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at
 Tue, 26 Apr 2022 18:59:07 +0000
Received-SPF: pass client-ip=132.207.4.11;
 envelope-from=olivier.dion@polymtl.ca; helo=smtp.polymtl.ca
X-Spam_score_int: -41
X-Spam_score: -4.2
X-Spam_bar: ----
X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3,
 RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: gwl-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: <gwl-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/gwl-devel>,
 <mailto:gwl-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/gwl-devel>
List-Post: <mailto:gwl-devel@gnu.org>
List-Help: <mailto:gwl-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/gwl-devel>,
 <mailto:gwl-devel-request@gnu.org?subject=subscribe>
Errors-To: gwl-devel-bounces+larch=yhetil.org@gnu.org
Sender: "gwl-devel" <gwl-devel-bounces+larch=yhetil.org@gnu.org>
Reply-to:  Olivier Dion <olivier.dion@polymtl.ca>
From:  Olivier Dion via <gwl-devel@gnu.org>
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=1651001675;
	h=from:from:sender:sender:reply-to: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:list-id:list-help:
	 list-unsubscribe:list-subscribe:list-post;
	bh=icWNipLemNB54OgyrJeSmUSWH7+2tZDE8OXqR/sB3yE=;
	b=ZwIjjP+SUdrbDKMnoBA1nr7G6YiDLceU8c6jSTaWvlD42L3CIpFr3ZeKVMUgB46dYBSWYG
	eFJ1Q8Zzv0rasa7egMQzs6KIvXnhBhjWOkVjcUBoeEBQuYBXSjvtq2BPNLedOQl4fE8jbc
	30xIK/BOv07OLMguPB/sLClc8kFmOd9UpMy5eDMUSGfY9KyGMTYvVWUjU32SszJjhyfGM3
	mvS5gEu8oXLg+x4PRfYKNUBVvJ4zC4aPXLGKz+o6cun8Bjb6nXsQW3qT4Gbz6dAz4Tcxd8
	DczDA5ClHqWXZXkrR3F7VfqQFW/gGdmLYX27RvUSdcdAHBDVwfa9vqcWK0kFrw==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651001675; a=rsa-sha256; cv=none;
	b=lJ3OmLr7+v5nW5AmsBC9GV0A7SINEW5NHaBv17Wfm1rCnY9CbLFejCuJCc2pGdkpg2hZcR
	1cbzH/F29IeNE2QDk0o/VSH+v1mZXptJ3zL7jpB1hH4OdMwgAy560VuJoIon1iyksrnwLl
	YOPmUCTh/2peffd30cTnW8yhq89eAuhv7ydvNWAQGJkCBJ7VReaF/tvBm/DgST5aks6zUB
	+I31jpdU4Z3C1j1Jil73A+Nkb8VYdHXZn1sObcPZKxvyfX3eOs35cL9sxBVgUSF/w5Th37
	oqUvTLbiIzbYEHn60v7+6XDo9zD+I+7D+AxEXXhIBXtDhN8I1Wu/rg1YpwtevA==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=none;
	dmarc=pass (policy=none) header.from=gnu.org;
	spf=pass (aspmx1.migadu.com: domain of "gwl-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="gwl-devel-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Spam-Score: -3.51
Authentication-Results: aspmx1.migadu.com;
	dkim=none;
	dmarc=pass (policy=none) header.from=gnu.org;
	spf=pass (aspmx1.migadu.com: domain of "gwl-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="gwl-devel-bounces+larch=yhetil.org@gnu.org"
X-Migadu-Queue-Id: 99AE210E81
X-Spam-Score: -3.51
X-Migadu-Scanner: scn0.migadu.com
X-TUID: BczvDd1YBOfP

On Tue, 26 Apr 2022, Ricardo Wurmus <rekado@elephly.net> wrote:
> Hi Olivier,
>
> thank for the patch!
>
>> -(define (lookup-package specification)
>> +(define (%lookup-package name+version output)
>> +  (list (match (apply lookup-inferior-packages
>> +                      (cons (current-guix) (string-split name+version #=
\@)))
>
> I don=E2=80=99t think we need the cons here.  As long as the last argumen=
t to
> APPLY is a list everything=E2=80=99s fine.

Oh I didn't knew that! Awesome!

>> +          ((first . rest) first)
>> +          (_ (raise (condition
>> +                     (&gwl-package-error
>> +                      (package-spec (string-append name+version output)=
))))))
>> +        output))
>
> I=E2=80=99d prefer to have this return multiple values instead of a compo=
und
> value.

With (values ...)?  That's what (gnu packages) does I think.

>  And if it had to be a compound value for some reason I=E2=80=99d prefer
> to use a dedicated data type (a record value) instead of a list.

A record would be a better fit than a list yes.

>> +
>> +(define* (lookup-package specification #:optional (output "out"))
>>    (log-event 'guix (G_ "Looking up package `~a'~%") specification)
>> -  (match (lookup-inferior-packages (current-guix) specification)
>> -    ((first . rest) first)
>> -    (_ (raise (condition
>> -               (&gwl-package-error
>> -                (package-spec specification)))))))
>> +  (match (string-split specification #\:)
>> +    ((name+version sub-drv) (%lookup-package name+version sub-drv))
>> +    ((name+version) (simple-package (%lookup-package name+version outpu=
t)))))
>
> I=E2=80=99m not sure about forcing SIMPLE-PACKAGE to be used because the =
return
> value might be an output.  The stuff in (guix inferior) also doesn=E2=80=
=99t
> know about outputs, so I feel that we shouldn=E2=80=99t attempt to include
> syntax for selecting outputs.  IIRC we=E2=80=99ll end up with all outputs=
 in the
> environment, so there=E2=80=99s no actual effect of picking a specific ou=
tput.
> I=E2=80=99d prefer to revisit this once (guix inferior) supports selecting
> outputs.  What do you think?

I do think it would be better to wait for (guix inferior) to support
selecting outputs.  However, I do need selection of outputs for my use
case right now!  Specificaly, I need to have debug symbols of many
packages.  The quick hack above does the work for me but I understand
that it would be preferable if (guix inferior) has support for outputs
instead.

For example, try the following:

--8<---------------cut here---------------start------------->8---
process test
  packages "coreutils" "make"
  # {
    ls $_GWL_PROFILE > "result.txt"
  }

workflow wf
  processes test
--8<---------------cut here---------------end--------------->8---

and you will see that there's no `lib/debug` directory.  So not all
outputs are in the profile.

What would you suggest I do in the meantime?  I have to publish for
december and I don't think we will see this feature very soon.  I can
keep this patch on my side for my use case, but it would be awesome if
we have a none ad-hoc solution by the time of publication :-).

Regards,
old

--=20
Olivier Dion
oldiob.dev