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 cAtBNMKhYWItKAEAbAwnHQ
	(envelope-from <gwl-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 21 Apr 2022 20:26:10 +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 CFI/NMKhYWJjWwAA9RJhRA
	(envelope-from <gwl-devel-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Thu, 21 Apr 2022 20:26:10 +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 5D8F729836
	for <larch@yhetil.org>; Thu, 21 Apr 2022 20:26:10 +0200 (CEST)
Received: from localhost ([::1]:52622 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 1nhbVJ-0008KG-Ht
	for larch@yhetil.org; Thu, 21 Apr 2022 14:26:09 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59440)
 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 1nhbVF-0008DM-Kf
 for gwl-devel@gnu.org; Thu, 21 Apr 2022 14:26:05 -0400
Received: from smtp.polymtl.ca ([132.207.4.11]:53369)
 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 1nhbVC-0003dP-Nb
 for gwl-devel@gnu.org; Thu, 21 Apr 2022 14:26:04 -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 23LIPurW021685
 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
 for <gwl-devel@gnu.org>; Thu, 21 Apr 2022 14:26:01 -0400
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 23LIPurW021685
To: gwl-devel@gnu.org
Subject: Re: Packages specification does not work
In-Reply-To: <87wnfiuzal.fsf@laura>
References: <87wnfiuzal.fsf@laura>
Date: Thu, 21 Apr 2022 14:25:56 -0400
Message-ID: <87tuamuwcr.fsf@laura>
MIME-Version: 1.0
Content-Type: text/plain
X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at
 Thu, 21 Apr 2022 18:25:56 +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=1650565570;
	h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post; bh=wMKNo76kVacJX84i0UZ1ZwToWsJAdx4tQbLfHccqd70=;
	b=XBMWWff1cqg7PWVh2i3BArBwT8V4NKBYVKb1XaLz5uum5mb3eYaHpWBB9sISUgAQ5MLXIe
	tY1LUvJEXrefnr/XlcUETEbj1GSETSweM7+9lV3zzF8MIkeMfVmWPwmhLvrSqMhBuv/aOi
	tVb6bwmj+NFrx92XhXs3pAjNaK4q35cTD4omEFluW3GCtjd+X+ggMoO7eWYbfVkmMnQrDx
	7ZkjBrECB80N4suNnb1gWXVU3wN07+O7y7r7LAH/aXKhMw+KSfGk/oLTaiZl7nP56Yniog
	CD3hSumNgDp+Z/49iCVNJ4plNnMxJL9yVSKjat2j4E2lAWgw9pjgzUz3+J+o5A==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650565570; a=rsa-sha256; cv=none;
	b=lssNjh+vMM50I9Kwpch0xWAWBlTnU1zDuniShLV+4eGmaINYHAmGogtSDBrnRRXsCQy87v
	pr1a8kplUwbb1tT30J1E534U4G1Tc/xbOZmBYQVycVUdZ7jZ5MCHnPX1WGR5V4pfU5AVQi
	cDRqKqEByakwRIscXjfojjlI8fFBqMv9JN6t1WW1UZ3m/5ybhaS6b1Bely9MaMm/2Rbg2K
	7t4giE1hlO/KR7SV3lcRo/WUfJ5NkaUw02ydneVhkskVyOVzyHP3ug867z0e0lwYkR1iJL
	toZhkuLhlTPFoAH/pbnCwBbuakCfjzTxIZV20bpYfeJbj36Yp6sWZKQOSK+OFg==
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: -4.43
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: 5D8F729836
X-Spam-Score: -4.43
X-Migadu-Scanner: scn0.migadu.com
X-TUID: tcXjc3Q8Cotj

On Thu, 21 Apr 2022, Olivier Dion <olivier.dion@polymtl.ca> wrote:
> Hi,
>
> The documentation says that we can provide the list of packages as Guix
> specification:

I might have a fix.  Still working on testing it though:

--8<---------------cut here---------------start------------->8---
diff --git a/gwl/packages.scm b/gwl/packages.scm
index 6fe82d4..60e90a7 100644
--- a/gwl/packages.scm
+++ b/gwl/packages.scm
@@ -71,13 +71,21 @@
             (set! connection (open-connection))
             connection)))))

-(define (lookup-package specification)
+(define (%lookup-package name+version output)
+  (values
+   (match (apply lookup-inferior-packages
+                 (cons (current-guix) (string-split name+version #\@)))
+     ((first . rest) first)
+     (_ (raise (condition
+                (&gwl-package-error
+                 (package-spec (string-append name+version output)))))))
+   output))
+
+(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) (%lookup-package name+version output))))

 (define (valid-package? val)
   (or (package? val)
--8<---------------cut here---------------end--------------->8---

-- 
Olivier Dion
oldiob.dev