From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 finch.gentoo.org (Postfix) with ESMTPS id 078C41582EF for ; Thu, 13 Feb 2025 17:18:10 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (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) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id DB37E3431A2 for ; Thu, 13 Feb 2025 17:18:09 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id C364511042D; Thu, 13 Feb 2025 17:18:08 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 bobolink.gentoo.org (Postfix) with ESMTPS id B5C6E11042D for ; Thu, 13 Feb 2025 17:18:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5BD16343060 for ; Thu, 13 Feb 2025 17:18:08 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8CB3C2694 for ; Thu, 13 Feb 2025 17:18:06 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1739467078.65cb33ec019e2ce8980f546a137ba27c55042c55.ulm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/eapi9-ver.eclass X-VCS-Directories: eclass/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 65cb33ec019e2ce8980f546a137ba27c55042c55 X-VCS-Branch: master Date: Thu, 13 Feb 2025 17:18:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 03341fa2-2621-414c-8175-8b409b007942 X-Archives-Hash: a015f54981244f82566ec07af6445cb8 commit: 65cb33ec019e2ce8980f546a137ba27c55042c55 Author: Ulrich Müller gentoo org> AuthorDate: Mon Feb 10 19:05:59 2025 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Thu Feb 13 17:17:58 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65cb33ec eapi9-ver.eclass: New eclass This implements the ver_replacing command, as proposed for EAPI 9: | Takes an operator and a version string as arguments, which follow | the same specification as in ver_test. Iterates over the elements | of REPLACING_VERSIONS, using ver_test to compare each element with | the version string. Returns shell true (0) if the specified relation | is fulfilled for any element. Note that if REPLACING_VERSIONS is | empty, shell false (1) is returned. The command is only meaningful | in phases where \t{REPLACING_VERSIONS} is defined. Bug: https://bugs.gentoo.org/947530 Signed-off-by: Ulrich Müller gentoo.org> eclass/eapi9-ver.eclass | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/eclass/eapi9-ver.eclass b/eclass/eapi9-ver.eclass new file mode 100644 index 000000000000..9908fec37de8 --- /dev/null +++ b/eclass/eapi9-ver.eclass @@ -0,0 +1,50 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: eapi9-ver.eclass +# @MAINTAINER: +# Ulrich Müller +# @AUTHOR: +# Ulrich Müller +# @SUPPORTED_EAPIS: 7 8 +# @BLURB: Testing implementation of EAPI 9 ver_replacing +# @DESCRIPTION: +# A stand-alone implementation of the ver_replacing function aimed +# for EAPI 9. Intended to be used for wider testing of the proposed +# function and to allow ebuilds to switch to the new model early, with +# minimal change needed for the actual EAPI 9. +# +# @CODE +# if ver_replacing -lt 1.2; then +# elog "The frobnicate command was dropped in version 1.2" +# fi +# @CODE + +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +# @FUNCTION: ver_replacing +# @USAGE: +# @RETURN: 0 if any element of REPLACING_VERSIONS qualifies, 1 otherwise +# @DESCRIPTION: +# Compare each element of REPLACING_VERSIONS with version +# using ver_test(). Return 0 (true) if any element fulfills +# "ver_test ", 1 (false) otherwise. +# +# Note: If REPLACING_VERSIONS is empty, 1 (false) is returned. +ver_replacing() { + case ${EBUILD_PHASE} in + pretend|setup|preinst|postinst) ;; + *) die "ver_replacing is meaningless in the ${EBUILD_PHASE} phase" ;; + esac + + [[ $# -eq 2 ]] || die "Usage: ver_replacing " + + local v + for v in ${REPLACING_VERSIONS}; do + ver_test "${v}" "$@" && return 0 + done + return 1 +}