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 qJzsGUK6YWJ/RAAAbAwnHQ (envelope-from ) for ; Thu, 21 Apr 2022 22:10:42 +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 gBa+GUK6YWI5aAEAauVa8A (envelope-from ) for ; Thu, 21 Apr 2022 22:10:42 +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 C5C33398A7 for ; Thu, 21 Apr 2022 22:10:41 +0200 (CEST) Received: from localhost ([::1]:49424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhd8T-0004Hi-09 for larch@yhetil.org; Thu, 21 Apr 2022 16:10:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhcqf-0000LB-W5 for gwl-devel@gnu.org; Thu, 21 Apr 2022 15:52:18 -0400 Received: from smtp.polymtl.ca ([132.207.4.11]:39166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhcqc-00005T-Rj for gwl-devel@gnu.org; Thu, 21 Apr 2022 15:52:16 -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 23LJpxCu021044 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 21 Apr 2022 15:52:13 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 23LJpxCu021044 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1650570733; bh=wY00Dfo+8FVsw6mIHuNQy88fph0ox3uLbBkrt0YD7hA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTL25vFIqvcT+VJdVPearxhtXVJcjiDTdrpuSEHOhDDMz2du3crPSqP9bcmNNFCUs Q4ZwQuBj/iROb7DEdiqRplpBs0KE1BtJ1kGUi6DN12WJFxQuFGmTLVK4MdkRfXCZC0 0hJu72XVk1BARdYfaTUQrw8BL5b4tfmMktf5RTHo= From: Olivier Dion To: Olivier Dion via Cc: Olivier Dion Subject: [PATCH v1 1/2] packages: Support for full Guix specification Date: Thu, 21 Apr 2022 15:51:57 -0400 Message-Id: <20220421195158.22407-1-olivier.dion@polymtl.ca> X-Mailer: git-send-email 2.35.1 In-Reply-To: <87wnfiuzal.fsf@laura> References: <87wnfiuzal.fsf@laura> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Poly-FromMTA: (modemcable094.169-200-24.mc.videotron.ca [24.200.169.94]) at Thu, 21 Apr 2022 19:51:59 +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=1650571842; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=wY00Dfo+8FVsw6mIHuNQy88fph0ox3uLbBkrt0YD7hA=; b=NGmDFr41NKSy8SEc7S+fZYyAhveDv1jy4lD5b01UsFgqDCWeHiTtH2HYxpn7CPD2/Ppbs/ pSbi8tk6AIMCzODFADD/Rha0rlHrnSoZ5QEx4AErW3orJkMDculrMGRQHgYZTtx8miZTSO qSv64gXm+X+yXIoOfPW9FAJgl+3G8xAZMfpCci5QF6epyVGL2JV4VWiuLdUXXCwCG6fV1x jNrYEziAgtLDhYAsEuCRSU2hff1nzwyZwfTJJ6pwWlx6GdWsQb12rSdecapvBvRqjqoF7Q tzelCprBoYB6vgYoxF+NfUVnqR07tStWaD6fUS0SmEAySCHzZKc6dcoHMoTGfg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650571842; a=rsa-sha256; cv=none; b=iExunlK7c0FLuoNYHnDOI3/h8svNnF1onzHAUzf+lEoGp3QWbDA8+SmR0u/GNCceIvIM+R cnBJ+I7/jCCE5QUSQE6qiRvd5Vg/FXwi/mB0dvDrcuYI4katUq5gMGnzy5FJYkEZTDsGgY 22vI18ySNBglgwHL0ToOztZhk54AzIQ1rezIesMsCpUjECWxjJ+S6Vl91YSCBVQZWFN/Q+ 29DXJa9tvBQhjARZjGGL1URnmcR0k/0rPw7pNZ2Qxo/MFNgxY8ArPNMDWYPb2wxs1QsnnM dlVqucaE5r92tkpVr+MNU6LpQuXAH+buKlWzlL3Xa21rdifrc4Du/Px7bwjvog== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=XTL25vFI; 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: -3.73 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=polymtl.ca header.s=default header.b=XTL25vFI; 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: C5C33398A7 X-Spam-Score: -3.73 X-Migadu-Scanner: scn1.migadu.com X-TUID: 7PeqzAbGDgc3 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 | 35 +++++++++++++++++++++++++---------- gwl/processes.scm | 2 +- gwl/workflows/graph.scm | 2 +- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/gwl/packages.scm b/gwl/packages.scm index 6fe82d4..295c31c 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) (%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. @@ -102,11 +117,11 @@ the version. By default, DELIMITER is \"@\"." (define bash-minimal (mlambda () - (lookup-package "bash-minimal"))) + (simple-package (lookup-package "bash-minimal")))) (define build-time-guix (mlambda () - (lookup-package "guix"))) + (simple-package (lookup-package "guix")))) (define default-guile (mlambda () diff --git a/gwl/processes.scm b/gwl/processes.scm index 3a05e03..02a38c6 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