From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 YMlZO7ziWmPbPAAAbAwnHQ (envelope-from ) for ; Thu, 27 Oct 2022 21:57:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CPG8OrziWmPuRwAAG6o9tA (envelope-from ) for ; Thu, 27 Oct 2022 21:57:48 +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 A8325B626 for ; Thu, 27 Oct 2022 21:57:48 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oo8xG-0000tP-9x; Thu, 27 Oct 2022 15:54:18 -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 1oo8x2-0000gz-Oc for guix-patches@gnu.org; Thu, 27 Oct 2022 15:54:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oo8mM-0005f9-4O for guix-patches@gnu.org; Thu, 27 Oct 2022 15:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oo8mL-00073q-Vl for guix-patches@gnu.org; Thu, 27 Oct 2022 15:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57031] [PATCH v3 1/2] ui: Make one-time hint API public. References: <20220807111421.14771-1-paren@disroot.org> In-Reply-To: <20220807111421.14771-1-paren@disroot.org> Resent-From: "(" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 Oct 2022 19:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57031 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57031@debbugs.gnu.org Cc: "\(" Received: via spool by 57031-submit@debbugs.gnu.org id=B57031.166689977627121 (code B ref 57031); Thu, 27 Oct 2022 19:43:01 +0000 Received: (at 57031) by debbugs.gnu.org; 27 Oct 2022 19:42:56 +0000 Received: from localhost ([127.0.0.1]:59415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oo8mF-00073M-Qc for submit@debbugs.gnu.org; Thu, 27 Oct 2022 15:42:56 -0400 Received: from knopi.disroot.org ([178.21.23.139]:57158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oo8mE-000737-CO for 57031@debbugs.gnu.org; Thu, 27 Oct 2022 15:42:55 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id CB1744E81B; Thu, 27 Oct 2022 21:42:52 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with UTF8SMTP id C6BIFCH-tePl; Thu, 27 Oct 2022 21:42:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1666899770; bh=aD82VbXMexYv2POWO4x3TPxE3rTnQJpkD/WFHqo4aWg=; h=From:To:Cc:Subject:Date; b=R0icBIqSQ7bs4r82geWg6sj/E5XY71hD1l0rkHQtoRlbGz+0tyGiXDU0lV3HWro+U RXlMfT/MT/kyKU6MqZi2ORu/pFOSSUbHNMzmClEcK62biBMTqvbkgCLlPv2xUM0Z9L TO8yJmVQMGax0Nc4FGQkh90q4XiBOKNGMepQhCuUg8YLyKkzW3drFSZLxgFbO9RYIW uuKKOzK3n5gEjHCqJeqH4ZdAUL3GYX9jHLx8cG3K9P8hEkChORh9ai7ab9gXqVj1LI Aq7cQLybf0iVAYQguyM2sAbDiGOzc0RC+DJ4/xOJAl30gfGPyMf13tRIuFiDyoDdhL EAf0QpaEXwVQg== Date: Thu, 27 Oct 2022 20:42:42 +0100 Message-Id: <20221027194243.15612-1-paren@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: , Sender: "Guix-patches" Reply-to: "\(" X-ACL-Warn: , "\( via Guix-patches" From: "\( via Guix-patches" via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1666900668; 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=8JIvOK03iBatvJu7K/qnbTT3btshh61MPgz5O/RgMGM=; b=IP6H3Yqm4MPiufs+hYx48lHsiraSYU037WQT4lhklAg//Ss2XD7/mRo71eloKqspsFLWir tIRpKkuycXToLvY1BET42jvZI0XeqFcLUBuax1tno1Y3VWysWQq3l/fNASfMAQFBswNV7r ozrW5ug1ja36SuzyHw2wTlk9sImEssJS43DdvLQ3wzei+iZXHyj/y3UeOPMkMcavTIOe1O gFGQQcD1mcE+aJC7wIvdTKK8f0pW+/BysBf/KOZOM1KCz9WhcrovQVEpmZzoqBAl51GW+y B5sBFuhtbrnY1HCZaazidV3yJ1gQ8aBHh1NdWrFrQIRev8+Q2s/Oy4dj9qCfYQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1666900668; a=rsa-sha256; cv=none; b=bIcJFEHw5tr2GkzqWuxxe8a/J62QKijqK0B2KUJSXiGNzW8WMIGZqqkaKWu9Kmmve5uiIk lXjsPIcpq9liB120b1+awz++9dFuQsskuoNuSw1B3wCENYx5SEWI3gnSmTcjzXN63KEx9J NQOg0E2v1ne99vuKdyUNZf7Ckw1yiPNYXZiD8Q/ZyXcOv5FQtdBUFUzqrt5StKRg3fSCHE rkbHXGVuVPUki6Eh9fysXzhz93ERe62ov1nId/yu1Jjtr2A8CCvSYX0We0EC8/3r9TH30/ f9GhqPNN6Ciw6/TibReW4+crti71pgZpO8L+e0+jdYWNviw2JaR9gqhrDZeKqA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=R0icBIqS; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Spam-Score: -1.71 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=R0icBIqS; dmarc=pass (policy=none) header.from=gnu.org; 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" X-Migadu-Queue-Id: A8325B626 X-Spam-Score: -1.71 X-Migadu-Scanner: scn0.migadu.com X-TUID: L9LO4rlQg69C * guix/scripts/shell.scm (hint-directory, hint-file, record-hint, hint-given?): Move these... * guix/ui.scm (hint-directory, hint-file, record-hint, hint-given?): ...here. --- guix/scripts/shell.scm | 23 ----------------------- guix/ui.scm | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/guix/scripts/shell.scm b/guix/scripts/shell.scm index a2836629ad..c66ff4e5c4 100644 --- a/guix/scripts/shell.scm +++ b/guix/scripts/shell.scm @@ -505,29 +505,6 @@ (define (validated-spec spec) (exp (pretty-print exp port))))) - -;;; -;;; One-time hints. -;;; - -(define (hint-directory) - "Return the directory name where previously given hints are recorded." - (string-append (cache-directory #:ensure? #f) "/hints")) - -(define (hint-file hint) - "Return the name of the file that marks HINT as already printed." - (string-append (hint-directory) "/" (symbol->string hint))) - -(define (record-hint hint) - "Mark HINT as already given." - (let ((file (hint-file hint))) - (mkdir-p (dirname file)) - (close-fdes (open-fdes file (logior O_CREAT O_WRONLY))))) - -(define (hint-given? hint) - "Return true if HINT was already given." - (file-exists? (hint-file hint))) - (define-command (guix-shell . args) (category development) diff --git a/guix/ui.scm b/guix/ui.scm index dad2b853ac..3512c761d2 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -19,6 +19,7 @@ ;;; Copyright © 2018 Steve Sprang ;;; Copyright © 2022 Taiju HIGASHI ;;; Copyright © 2022 Liliana Marie Prikler +;;; Copyright © 2022 ( ;;; ;;; This file is part of GNU Guix. ;;; @@ -137,6 +138,11 @@ (define-module (guix ui) switch-to-generation* delete-generation* + hint-directory + hint-file + record-hint + hint-given? + %default-message-language current-message-language @@ -2057,6 +2063,29 @@ (define* (package-specification->name+version+output spec (package-name->name+version name))) (values name version sub-drv))) + +;;; +;;; One-time hints. +;;; + +(define (hint-directory) + "Return the directory name where previously given hints are recorded." + (string-append (cache-directory #:ensure? #f) "/hints")) + +(define (hint-file hint) + "Return the name of the file that marks HINT as already printed." + (string-append (hint-directory) "/" (symbol->string hint))) + +(define (record-hint hint) + "Mark HINT as already given." + (let ((file (hint-file hint))) + (mkdir-p (dirname file)) + (close-fdes (open-fdes file (logior O_CREAT O_WRONLY))))) + +(define (hint-given? hint) + "Return true if HINT was already given." + (file-exists? (hint-file hint))) + ;;; ;;; Command-line option processing. base-commit: f928abac369f699f425ddee925d0d0c2dc0a635d -- 2.38.0