From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 SMXeLE0+HmN9KgEAbAwnHQ (envelope-from ) for ; Sun, 11 Sep 2022 22:00:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id 2DoMLE0+HmNepgAAG6o9tA (envelope-from ) for ; Sun, 11 Sep 2022 22:00:13 +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 5B4E239DCE for ; Sun, 11 Sep 2022 22:00:13 +0200 (CEST) Received: from localhost ([::1]:56390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXT7k-0001FP-F2 for larch@yhetil.org; Sun, 11 Sep 2022 16:00:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53462) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXT7a-0001Eq-R1 for guix-patches@gnu.org; Sun, 11 Sep 2022 16:00:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54913) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXT7a-0007ur-DC for guix-patches@gnu.org; Sun, 11 Sep 2022 16:00:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oXT7a-0006PA-4N for guix-patches@gnu.org; Sun, 11 Sep 2022 16:00:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57031] [PATCH v2 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: Sun, 11 Sep 2022 20:00:02 +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.166292639124559 (code B ref 57031); Sun, 11 Sep 2022 20:00:02 +0000 Received: (at 57031) by debbugs.gnu.org; 11 Sep 2022 19:59:51 +0000 Received: from localhost ([127.0.0.1]:43610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXT7P-0006Nx-3g for submit@debbugs.gnu.org; Sun, 11 Sep 2022 15:59:51 -0400 Received: from knopi.disroot.org ([178.21.23.139]:59702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXT7N-0006Nl-23 for 57031@debbugs.gnu.org; Sun, 11 Sep 2022 15:59:49 -0400 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 33C224A06A; Sun, 11 Sep 2022 21:59:48 +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 ESMTP id ClGgwd7ye4Vc; Sun, 11 Sep 2022 21:59:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1662926386; bh=59Y8FNHYI47zfC+7QOGV/W/vMtqsFtjf/5X+93Cf7yo=; h=From:To:Cc:Subject:Date; b=h+C2SlGEcMApc/ciK39iTaSHPJ1ALuSXQ2oHJ2PhAugrIy8BrePKXXyi9vS8H6+Oj WPl5xTpA6YZAsgb2KSVRwCZ9tmAETJSz3e6kf+rlOEDPAnrxD97mcI78UwT/8tA/k/ NngByrDG9ZhREVpkT1isriGySsJyl/SYOyZ2gnAG6/x79H/pgNADqt5NMH2TmtNiWR PUlW5D+Ex1JjfC6/y0EDy/nQP1bNSfL+t8uX8AM1YWmZ1FWjC+bJNKl8dHhddbMjBG XrVK2r7UxeZOFkc2W5hS5E49TLWVNBX6CEiUlLExYfNtdrbXxMwtpM/zCW630jw7Sp E5f/tf7kVuvGw== Date: Sun, 11 Sep 2022 20:59:40 +0100 Message-Id: <20220911195941.8442-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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: "\(" X-ACL-Warn: , "\( via Guix-patches" From: "\( via Guix-patches" via 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=1662926413; 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=gGBiZF/5fQlzVnaIeiC3xTQzfSKIUaYlIYabhzhVvcI=; b=TVeIQYXVzuCFtKOtPV6qnO7DOdjIuCix3tFYtJC4cgEnvzV96UKoKAcJWc+WRSsZUzFC7/ GdJBGaTMoORamvCcBUEwN3TwJoZPz9IqqTda+mJcZTOMaC2BNMmYBVt2fQCPLfvPWfPrEt tLQ6RTbP2VMZarmsTa9Lds1N/DmrO0KOpRwQuTzybCmjDmRg/+VZw1FfpUaDD+ly69NQA5 8itl0ItITshkdRx5Hi7FNa10iKUPAufGKlRIfaSTMTlzy6U8+KmD6S7MXpRbvl0csiwYEE QgB+7DKqd4k5hL3eKTDBbvKtY5vpMOB2v9C79lAVxeRGbQM4xIE/++5+X6kbGw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1662926413; a=rsa-sha256; cv=none; b=n7WRc771JBrea1tzUveN7n0N/pfeB8JoFPhW0dRlZaKII+Eza5VeeQ+IjNzPGs7FzPYxIm 6Ii3q660GO708mm/azywQXXPQRUBJnQU3IyjHF222T3aOXUsvqumceuebkixuch/y2PunO 2eoMqNWqm2f5D8IB5HB3Ifb3Dbsl1dr5yJxBtlXmFBJ5h47kmO7o+/wp71cqcPgTCxBi2N RbDXG8QE9Du585/MA+eaZ8cPgBcbYZ9IhLVKKeNJMjYhd6yn3bEh9W8vRktLxrt17xNm+z Is2629VDvu0wrlzXVDX0jRIYgXDeN7G3gUW+QKW3diaeA9rC2xriDf1mBfaiZw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=h+C2SlGE; 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: -2.80 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=disroot.org header.s=mail header.b=h+C2SlGE; 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: 5B4E239DCE X-Spam-Score: -2.80 X-Migadu-Scanner: scn1.migadu.com X-TUID: RuA6tU68pUZf * 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 c115a00320..3ac7d80eb0 100644 --- a/guix/scripts/shell.scm +++ b/guix/scripts/shell.scm @@ -489,29 +489,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. -- 2.37.3