From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uHSRGYD3YmKdXgEAbAwnHQ (envelope-from ) for ; Fri, 22 Apr 2022 20:44:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id OMZ5GYD3YmJ8xwAAauVa8A (envelope-from ) for ; Fri, 22 Apr 2022 20:44:16 +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 023C439BF8 for ; Fri, 22 Apr 2022 20:44:16 +0200 (CEST) Received: from localhost ([::1]:37716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhyGM-0008Vu-Tg for larch@yhetil.org; Fri, 22 Apr 2022 14:44:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42320) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhyGK-0008VV-D3 for gwl-devel@gnu.org; Fri, 22 Apr 2022 14:44:12 -0400 Received: from smtp.polymtl.ca ([132.207.4.11]:59141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhyGI-0007B1-Gx for gwl-devel@gnu.org; Fri, 22 Apr 2022 14:44:12 -0400 Received: from laura.hitronhub.home (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 23MIi0pg018334 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 22 Apr 2022 14:44:08 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 23MIi0pg018334 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1650653049; bh=0XdmGbfYmpCvMqRohsV00LVCE+uLhn2s7A/7pJ1Xp/o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Fqr5bzZrpExIlKCUXT+vvuvcHpPwQ/vMjtlcgFW5UsYpx3uUGN8mi+csf+ieQr7Dj N2jsI6e0MwCmlhAe87811vnFyoLXRSDXJAu/OUO+AFKCQMdzoeKJ3AvQqF/Jr6c7f3 eoIx00dkSCs8UnJRyV58dR241MapRE/uyuteQuy8= From: Olivier Dion To: Olivier Dion , Olivier Dion via Subject: [PATCH v2 1/2] packages: Support for full Guix specification Date: Fri, 22 Apr 2022 14:43:58 -0400 Message-Id: <20220422184359.7929-2-olivier.dion@polymtl.ca> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220422184359.7929-1-olivier.dion@polymtl.ca> References: <20220421195158.22407-1-olivier.dion@polymtl.ca> <20220422184359.7929-1-olivier.dion@polymtl.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at Fri, 22 Apr 2022 18:44:00 +0000 Received-SPF: pass client-ip=132.207.4.11; envelope-from=olivier.dion@polymtl.ca; helo=smtp.polymtl.ca X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gwl-devel-bounces+larch=yhetil.org@gnu.org Sender: "gwl-devel" 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=1650653056; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=0XdmGbfYmpCvMqRohsV00LVCE+uLhn2s7A/7pJ1Xp/o=; b=X4nSA3H5o36RdkWabZYN2SuoYmCHDuosdbepr96c1VX7V7LY6ZTbYZRICEryIhLqZwMYuH Z14UpLrgd2tCmwsONh6r8vzclWifsqtz+Fd8RPrh6CZ9/MjvJMhUhb/IDuMq7gXTyB7bRN Q8IsmP8k5u5PDNabchfqQw08K2u4773wvamkYDQGqHYxVgxarLiIiDoKILV3zOo1oGthqb TBPC9vB4mc/pyaaimVkrN/WOvvBOOcUl6nL4qBEjcvvxAnfgglEMXAVoWPrw2eAWnbKTJ0 0RCVPudbPvd1jylxuDmwRoKm2M/Lt9R64Y24Jp5YFgPWt3NiApLPX0TnUyA+qA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650653056; a=rsa-sha256; cv=none; b=dAxDf09Nq6Ckyaa2tGWtRorZWwzXgjfOKes8O0wB9Px1DHbvhIMAn6PlgvaJPFz4ejakim +UjPUs2DEAVlEjJwpyOx7Gq0zOBaUo8LQhwD3WhI7HvGerBuQOoRQu2LxaEn6sh7bZQc8e 9wtFkqTiye7wQiF+Tkx4P7AthpkHTlyfnx9k6huU1sur6vnYhRn48yvipeWEzUarjIVDIJ cRowK/NvajckJ6oa1HTI8rQH6QwGK217SdNMiPSPx95n1IsJB2vzcD0ROt9NMe6RX+2LV8 mg4IdmIMJjZ3nH8PcPfu0+lekNm68Z05BisxWWhwlzfK/qZwKJSLmxI+CJ4Vcw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=Fqr5bzZr; dmarc=pass (policy=quarantine) header.from=polymtl.ca; 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: -5.82 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=Fqr5bzZr; dmarc=pass (policy=quarantine) header.from=polymtl.ca; 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: 023C439BF8 X-Spam-Score: -5.82 X-Migadu-Scanner: scn0.migadu.com X-TUID: dTaJgIrBUiSL Guix package specifications match: PACKAGE [@VERSION] [:OUTPUT] thus the following are all valid package specifications: - "guile" - "guile@3.0.8" - "guile:debug" - "guile@3.0.8:debug" This is not currently supported by gwl. To do so, simply return in `lookup-package` a list with `car` as the inferior's package and `cadr` as its output. The `simple-package` procedure can be used to remove the package's output from the returned value of `lookup-package` which is often necessary for manipulating the package itself and not its output. --- gwl/packages.scm | 31 +++++++++++++++++++++++-------- gwl/processes.scm | 2 +- gwl/workflows/graph.scm | 2 +- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/gwl/packages.scm b/gwl/packages.scm index 6fe82d4..1658e03 100644 --- a/gwl/packages.scm +++ b/gwl/packages.scm @@ -43,6 +43,7 @@ lookup-package valid-package? package-name + simple-package bash-minimal build-time-guix @@ -71,17 +72,31 @@ (set! connection (open-connection)) connection))))) -(define (lookup-package specification) +(define (%lookup-package name+version output) + (list (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) (simple-package (%lookup-package name+version output))))) (define (valid-package? val) - (or (package? val) - (inferior-package? val))) + (or + (and (list? val) + (valid-package? (car val)) + (string? (cadr val))) + (package? val) + (inferior-package? val))) + +(define (simple-package pkg) + (if (list? pkg) (car pkg) pkg)) ;; Just like package-full-name from (guix packages) but for inferior ;; packages. diff --git a/gwl/processes.scm b/gwl/processes.scm index ce40d12..cdb0988 100644 --- a/gwl/processes.scm +++ b/gwl/processes.scm @@ -657,7 +657,7 @@ PROCESS." (set-search-paths (map sexp->search-path-specification ',search-paths) (cons ,profile - ',packages)))) + ',(map simple-package packages))))) #$(if out `(setenv "out" ,out) "") (setenv "_GWL_PROFILE" #$profile) (use-modules (ice-9 match)) diff --git a/gwl/workflows/graph.scm b/gwl/workflows/graph.scm index ea3fec9..bdfdb11 100644 --- a/gwl/workflows/graph.scm +++ b/gwl/workflows/graph.scm @@ -43,7 +43,7 @@ label=<~a
\ (take-color) (string-upcase pretty-name) (process-synopsis process) - (match (process-packages process) + (match (map simple-package (process-packages process)) (() "") (inputs (format #f "
Uses: ~{~a~^, ~}." (map package-name inputs))))))) -- 2.35.1