From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id MFztMIjcG2UUAAAAauVa8A:P1 (envelope-from ) for ; Tue, 03 Oct 2023 11:19:04 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MFztMIjcG2UUAAAAauVa8A (envelope-from ) for ; Tue, 03 Oct 2023 11:19:04 +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 9102D3E958 for ; Tue, 3 Oct 2023 11:19:04 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ultrarare.space header.s=dkim header.b=wmOQxiTT; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1696324744; 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:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=fLs3ot+6xGwMZp4fkkjFriYktdL5LxxUtFV25loACmQ=; b=hxJbbHWu+3SgXzdqnjukNn4uyFj6+yTVeOPIYLOTq0etav9Mpd9wcVer1RmejZ6HRVEl0F m86/e+7VSsGoBnS3Vzy8rup6uLQi4LkZPoIFqaTBgFMdK1pxwFI1h9tcWFg42FPK61O+66 P8KOpscT/p+bf2a/rL45j6PSWAMF5bO/H7AXUCkguz8NF4DKUTEUaLNHczUfNz1Sp6MPjU Lk55hjJQo9hOchdLmpgv0lIp26oRakkKAPF/499CiNQz1hYxy/18xAt+yhS/LLGm4GHD8V GbrG90pJ3QXGu39TvE80c8SGowEFHZHHdFiIHQAZe5/9+xmUdSuJcbg8BF55ow== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1696324744; a=rsa-sha256; cv=none; b=Kqk6PaioRTIZ5ch7DkxKR38HvPCCzl3gbuiagRo5GlC/L83utH9lXOX473hceLOel9Qub2 H4ali7RFIY9fZQSiH7OX10cVyn+TtybRunMlkRMD7FLL8Jdr+8NGvHPBvvv65plkkJLypV Bdj7Bbo7+SYAmVQacS/tCKFzAvFQX5MRIo1SsoIuliFotBN3Jvzgp4vvZMCePGFlSHn8Cc 0cTJV+yRyk0e48p3x6mg7tfn+e5PnH7NL9wAq60BkWsA/Wm0Ju4QtwFr99Sn/P/qzmAkOc 3PNSMm2KuU1GuDwKMMvTW0im2ubAETmwuFh7ezyaZ4fi8usSW6xWxsThKq7cFw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=ultrarare.space header.s=dkim header.b=wmOQxiTT; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnbYM-00084A-Pk; Tue, 03 Oct 2023 05:18:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qnbYH-00083Z-69 for guix-patches@gnu.org; Tue, 03 Oct 2023 05:18:49 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qnbYG-0002ia-Pf; Tue, 03 Oct 2023 05:18:48 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qnbYU-0003S4-I1; Tue, 03 Oct 2023 05:19:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65062] [PATCH v2 core-updates 1/2] ui: package-specification->name+version+output: Move to (guix packages). Resent-From: Hilton Chain Original-Sender: "Debbugs-submit" Resent-CC: hako@ultrarare.space, ludo@gnu.org, dev@jpoiret.xyz, guix@cbaines.net, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 03 Oct 2023 09:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65062 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo patch To: 65062@debbugs.gnu.org Cc: Hilton Chain , Hilton Chain , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Josselin Poiret , Christopher Baines , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Hilton Chain , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Josselin Poiret , Christopher Baines , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 65062-submit@debbugs.gnu.org id=B65062.169632471413198 (code B ref 65062); Tue, 03 Oct 2023 09:19:02 +0000 Received: (at 65062) by debbugs.gnu.org; 3 Oct 2023 09:18:34 +0000 Received: from localhost ([127.0.0.1]:38792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnbY1-0003Qm-HI for submit@debbugs.gnu.org; Tue, 03 Oct 2023 05:18:33 -0400 Received: from mail.boiledscript.com ([144.168.59.46]:52084) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qnbY0-0003Qa-0M for 65062@debbugs.gnu.org; Tue, 03 Oct 2023 05:18:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ultrarare.space; s=dkim; t=1696324581; 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=fLs3ot+6xGwMZp4fkkjFriYktdL5LxxUtFV25loACmQ=; b=wmOQxiTTzEkUPL8DEjbgljUWWH8hlg9akD7aXAaG7ywnpsWsoZOuMC7G5U/hDZDfzai2x3 o78O1f1bbI/QmrRxo01PkVl1PrR7HPDRQ49VRqAyqtZJpDIgqLjxZ1wZgY2rwJtYxFKiVD AhwobJirHzxX9eP4PJA8FeAawkvPZVVYe4C5FaA3bcs1ZV0ife8vm66AbKh4HLNDN2jjzF UuLHY235oCYOJPEO9jXX8aXStyog7rfGVZ3KBRSUscGoWgcLEpgfFjHVQ9TBBNwwp91nW3 9kvaz/4/bfXMfJuBd0P8inJ6wBx6HZ/SelBIR9pSwmdqxu6mz9dBViJtH/cxAg== Date: Tue, 3 Oct 2023 17:17:01 +0800 Message-ID: <2b6bc0121a38d6aecf11536cc7e0c630d8eeaaa9.1696323536.git.hako@ultrarare.space> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spamd-Bar: --- X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Hilton Chain X-ACL-Warn: , Hilton Chain via Guix-patches From: Hilton Chain via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -5.25 X-Migadu-Spam-Score: -5.25 X-Migadu-Scanner: mx1.migadu.com X-Migadu-Queue-Id: 9102D3E958 X-TUID: 9UE3w6hSW5p8 * guix/ui.scm (package-specification->name+version+output): Move it to... * guix/packages.scm (package-specification->name+version+output): ...here. * tests/ui.scm (package-specification->name+version+output): Move it to... * tests/packages.scm (package-specification->name+version+output): ...here. --- guix/packages.scm | 23 +++++++++++++++++++++++ guix/ui.scm | 21 --------------------- tests/packages.scm | 17 +++++++++++++++++ tests/ui.scm | 17 ----------------- 4 files changed, 40 insertions(+), 38 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index f70fad695e..b004882cc6 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -52,6 +52,7 @@ (define-module (guix packages) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9 gnu) + #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) @@ -117,6 +118,8 @@ (define-module (guix packages) deprecated-package package-field-location + package-specification->name+version+output + this-package-input this-package-native-input @@ -783,6 +786,26 @@ (define (package-field-location package field) #f))) (_ #f))) +(define* (package-specification->name+version+output spec + #:optional (output "out")) + "Parse package specification SPEC and return three value: the specified +package name, version number (or #f), and output name (or OUTPUT). SPEC may +optionally contain a version number and an output name, as in these examples: + + guile + guile@2.0.9 + guile:debug + guile@2.0.9:debug +" + (let*-values (((name sub-drv) + (match (string-rindex spec #\:) + (#f (values spec output)) + (colon (values (substring spec 0 colon) + (substring spec (+ 1 colon)))))) + ((name version) + (package-name->name+version name))) + (values name version sub-drv))) + (define-syntax-rule (this-package-input name) "Return the input NAME of the package being defined--i.e., an input from the ‘inputs’ or ‘propagated-inputs’ field. Native inputs are not diff --git a/guix/ui.scm b/guix/ui.scm index 6f2d4fe245..0cc121f048 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -118,7 +118,6 @@ (define-module (guix ui) package-synopsis-string string->recutils package->recutils - package-specification->name+version+output pager-wrapped-port with-paginated-output-port @@ -2098,26 +2097,6 @@ (define (delete-generation* store profile generation) (generation-file-name profile generation)) (delete-generation store profile generation)) -(define* (package-specification->name+version+output spec - #:optional (output "out")) - "Parse package specification SPEC and return three value: the specified -package name, version number (or #f), and output name (or OUTPUT). SPEC may -optionally contain a version number and an output name, as in these examples: - - guile - guile@2.0.9 - guile:debug - guile@2.0.9:debug -" - (let*-values (((name sub-drv) - (match (string-rindex spec #\:) - (#f (values spec output)) - (colon (values (substring spec 0 colon) - (substring spec (+ 1 colon)))))) - ((name version) - (package-name->name+version name))) - (values name version sub-drv))) - ;;; ;;; Command-line option processing. diff --git a/tests/packages.scm b/tests/packages.scm index 2b4f9f8e90..be9188ceb1 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1926,6 +1926,23 @@ (define compressors '(("gzip" . "gz") "-p" (derivation->output-path prof2) "--search-paths")))))) +(test-equal "package-specification->name+version+output" + '(("guile" #f "out") + ("guile" "2.0.9" "out") + ("guile" #f "debug") + ("guile" "2.0.9" "debug") + ("guile-cairo" "1.4.1" "out")) + (map (lambda (spec) + (call-with-values + (lambda () + (package-specification->name+version+output spec)) + list)) + '("guile" + "guile@2.0.9" + "guile:debug" + "guile@2.0.9:debug" + "guile-cairo@1.4.1"))) + (test-equal "specification->package when not found" 'quit (catch 'quit diff --git a/tests/ui.scm b/tests/ui.scm index 438acae525..7bd948bd14 100644 --- a/tests/ui.scm +++ b/tests/ui.scm @@ -100,23 +100,6 @@ (define guile-2.0.9 (package-description-string (dummy-package "foo" (description "b•ll•t"))))) -(test-equal "package-specification->name+version+output" - '(("guile" #f "out") - ("guile" "2.0.9" "out") - ("guile" #f "debug") - ("guile" "2.0.9" "debug") - ("guile-cairo" "1.4.1" "out")) - (map (lambda (spec) - (call-with-values - (lambda () - (package-specification->name+version+output spec)) - list)) - '("guile" - "guile@2.0.9" - "guile:debug" - "guile@2.0.9:debug" - "guile-cairo@1.4.1"))) - (test-equal "integer" '(1) (string->generations "1")) -- 2.41.0