From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8F5061581D3 for ; Sun, 2 Jun 2024 13:58:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6F467E2B62; Sun, 2 Jun 2024 13:57:29 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 06A0EE2B5E for ; Sun, 2 Jun 2024 13:57:29 +0000 (UTC) From: Florian Schmaus To: gentoo-dev@lists.gentoo.org Cc: pacho@gentoo.org, Florian Schmaus Subject: [gentoo-dev] [PATCH 4/4] readme.gentoo-r1.eclass: add readme.gentoo_file() Date: Sun, 2 Jun 2024 15:57:09 +0200 Message-ID: <20240602135716.66992-5-flow@gentoo.org> X-Mailer: git-send-email 2.44.1 In-Reply-To: <20240602135716.66992-1-flow@gentoo.org> References: <20240109083914.242561-1-flow@gentoo.org> <20240602135716.66992-1-flow@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: c938e63a-3ded-4f48-b66b-b686acd1be40 X-Archives-Hash: 3ae6fc9fc5a7384caca6ce99fa5d4e3b The new readme.gentoo_file() function provided more flexibility from where the readme file is obtained, compared to the existing methods. Signed-off-by: Florian Schmaus --- eclass/readme.gentoo-r1.eclass | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/eclass/readme.gentoo-r1.eclass b/eclass/readme.gentoo-r1.eclass index db7fa0c47077..619f3eaa8fbf 100644 --- a/eclass/readme.gentoo-r1.eclass +++ b/eclass/readme.gentoo-r1.eclass @@ -110,6 +110,27 @@ readme.gentoo_stdin() { readme.gentoo_create_doc } +# @FUNCTION: readme.gentoo_file +# @USAGE: +# @DESCRIPTION: +# Installs the provided file as readme doc. +readme.gentoo_file() { + debug-print-function ${FUNCNAME} "${@}" + + local input_doc_file="${1}" + if [[ -z "${input_doc_file}" ]]; then + die "No file specified" + fi + + if [[ -f "${_GREADME_TMP_FILE}" ]]; then + die "Gentoo README already exists" + fi + + cp "${input_doc_file}" "${_GREADME_TMP_FILE}" || die "Failed to copy ${input_doc_file}" + + readme.gentoo_create_doc +} + # @FUNCTION: readme.gentoo_create_doc # @DESCRIPTION: # Create doc file with ${DOC_CONTENTS} variable (preferred) and, if not set, -- 2.44.1