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 4C1E015807A for ; Tue, 8 Oct 2024 15:30:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 93A8DE29E0; Tue, 8 Oct 2024 15:30:00 +0000 (UTC) Received: from smtp.gentoo.org (mail.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 pigeon.gentoo.org (Postfix) with ESMTPS id 7B9B7E29E0 for ; Tue, 8 Oct 2024 15:30:00 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B08523431BB for ; Tue, 8 Oct 2024 15:29:59 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4C49B16EF for ; Tue, 8 Oct 2024 15:29:58 +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: <1728400960.99bfe5fc6f7cea4dbf7764628cbde4187959d66b.ulm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/eapi7-ver.eclass X-VCS-Directories: eclass/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 99bfe5fc6f7cea4dbf7764628cbde4187959d66b X-VCS-Branch: master Date: Tue, 8 Oct 2024 15:29:58 +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: aa71db06-b65e-4ef2-a993-eff5f53e375a X-Archives-Hash: 703a8ae11f3f5bf553203ddc520f8cd8 commit: 99bfe5fc6f7cea4dbf7764628cbde4187959d66b Author: Ulrich Müller gentoo org> AuthorDate: Tue Aug 20 18:02:49 2024 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Tue Oct 8 15:22:40 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=99bfe5fc eapi7-ver.eclass: Remove dead eclass Signed-off-by: Ulrich Müller gentoo.org> eclass/eapi7-ver.eclass | 309 ------------------------------------------------ 1 file changed, 309 deletions(-) diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass deleted file mode 100644 index 85c0856f73b3..000000000000 --- a/eclass/eapi7-ver.eclass +++ /dev/null @@ -1,309 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# @DEAD -# @ECLASS: eapi7-ver.eclass -# @MAINTAINER: -# PMS team -# @AUTHOR: -# Ulrich Müller -# Michał Górny -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 -# @BLURB: Testing implementation of EAPI 7 version manipulators -# @DESCRIPTION: -# A stand-alone implementation of the version manipulation functions -# aimed for EAPI 7. Intended to be used for wider testing of -# the proposed functions and to allow ebuilds to switch to the new -# model early, with minimal change needed for actual EAPI 7. -# -# https://bugs.gentoo.org/482170 -# -# @SUBSECTION Version strings -# -# The functions support arbitrary version strings consisting of version -# components interspersed with (possibly empty) version separators. -# -# A version component can either consist purely of digits ([0-9]+) -# or purely of uppercase and lowercase letters ([A-Za-z]+). A version -# separator is either a string of any other characters ([^A-Za-z0-9]+), -# or it occurs at the transition between a sequence of letters -# and a sequence of digits, or vice versa. In the latter case, -# the version separator is an empty string. -# -# The version is processed left-to-right, and each successive component -# is assigned numbers starting with 1. The components are either split -# on version separators or on boundaries between digits and letters -# (in which case the separator between the components is empty). -# Version separators are assigned numbers starting with 1 for -# the separator between 1st and 2nd components. As a special case, -# if the version string starts with a separator, it is assigned index 0. -# -# Examples: -# -# @CODE -# 1.2b-alpha4 -> 1 . 2 '' b - alpha '' 4 -# c s c s c s c s c -# 1 1 2 2 3 3 4 4 5 -# -# .11. -> . 11 . -# s c s -# 0 1 1 -# @CODE -# -# @SUBSECTION Ranges -# -# A range can be specified as 'm' for m-th version component, 'm-' -# for all components starting with m-th or 'm-n' for components starting -# at m-th and ending at n-th (inclusive). If the range spans outside -# the version string, it is truncated silently. - -case ${EAPI:-0} in - 0|1|2|3|4|5|6) ;; - 7|8) die "${ECLASS}: EAPI=${EAPI} includes all functions from this eclass" ;; - *) die "${ECLASS}: EAPI=${EAPI} unknown" ;; -esac - -# @FUNCTION: _ver_parse_range -# @USAGE: -# @INTERNAL -# @DESCRIPTION: -# Parse the range string , setting 'start' and 'end' variables -# to the appropriate bounds. specifies the appropriate upper -# bound for the range; the user-specified value is truncated to this. -_ver_parse_range() { - local range=${1} - local max=${2} - - [[ ${range} == [0-9]* ]] \ - || die "${FUNCNAME}: range must start with a number" - start=${range%-*} - [[ ${range} == *-* ]] && end=${range#*-} || end=${start} - if [[ ${end} ]]; then - [[ ${start} -le ${end} ]] \ - || die "${FUNCNAME}: end of range must be >= start" - [[ ${end} -le ${max} ]] || end=${max} - else - end=${max} - fi -} - -# @FUNCTION: _ver_split -# @USAGE: -# @INTERNAL -# @DESCRIPTION: -# Split the version string into separator-component array. -# Sets 'comp' to an array of the form: ( s_0 c_1 s_1 c_2 s_2 c_3... ) -# where s_i are separators and c_i are components. -_ver_split() { - local v=${1} LC_ALL=C - - comp=() - - # get separators and components - local s c - while [[ ${v} ]]; do - # cut the separator - s=${v%%[a-zA-Z0-9]*} - v=${v:${#s}} - # cut the next component; it can be either digits or letters - [[ ${v} == [0-9]* ]] && c=${v%%[^0-9]*} || c=${v%%[^a-zA-Z]*} - v=${v:${#c}} - - comp+=( "${s}" "${c}" ) - done -} - -# @FUNCTION: ver_cut -# @USAGE: [] -# @DESCRIPTION: -# Print the substring of the version string containing components -# defined by the and the version separators between them. -# Processes if specified, ${PV} otherwise. -# -# For the syntax of versions and ranges, please see the eclass -# description. -ver_cut() { - local range=${1} - local v=${2:-${PV}} - local start end - local -a comp - - _ver_split "${v}" - local max=$((${#comp[@]}/2)) - _ver_parse_range "${range}" "${max}" - - if [[ ${start} -gt 0 ]]; then - start=$(( start*2 - 1 )) - fi - # Work around a bug in bash-3.2, where "${comp[*]:start:end*2-start}" - # inserts stray 0x7f characters for empty array elements - printf "%s" "${comp[@]:start:end*2-start}" $'\n' -} - -# @FUNCTION: ver_rs -# @USAGE: [ ...] [] -# @DESCRIPTION: -# Print the version string after substituting the specified version -# separators at with (string). Multiple ' ' -# pairs can be specified. Processes if specified, -# ${PV} otherwise. -# -# For the syntax of versions and ranges, please see the eclass -# description. -ver_rs() { - local v - (( ${#} & 1 )) && v=${@: -1} || v=${PV} - local start end i - local -a comp - - _ver_split "${v}" - local max=$((${#comp[@]}/2 - 1)) - - while [[ ${#} -ge 2 ]]; do - _ver_parse_range "${1}" "${max}" - for (( i = start*2; i <= end*2; i+=2 )); do - [[ ${i} -eq 0 && -z ${comp[i]} ]] && continue - comp[i]=${2} - done - shift 2 - done - - local IFS= - echo "${comp[*]}" -} - -# @FUNCTION: _ver_compare_int -# @USAGE: -# @RETURN: 0 if -eq , 1 if -lt , 3 if -gt -# @INTERNAL -# @DESCRIPTION: -# Compare two non-negative integers and , of arbitrary length. -# If is equal to, less than, or greater than , return 0, 1, or 3 -# as exit status, respectively. -_ver_compare_int() { - local a=$1 b=$2 d=$(( ${#1}-${#2} )) - - # Zero-pad to equal length if necessary. - if [[ ${d} -gt 0 ]]; then - printf -v b "%0${d}d%s" 0 "${b}" - elif [[ ${d} -lt 0 ]]; then - printf -v a "%0$(( -d ))d%s" 0 "${a}" - fi - - [[ ${a} > ${b} ]] && return 3 - [[ ${a} == "${b}" ]] -} - -# @FUNCTION: _ver_compare -# @USAGE: -# @RETURN: 1 if < , 2 if = , 3 if > -# @INTERNAL -# @DESCRIPTION: -# Compare two versions and . If is less than, equal to, -# or greater than , return 1, 2, or 3 as exit status, respectively. -_ver_compare() { - local va=${1} vb=${2} a an al as ar b bn bl bs br re LC_ALL=C - - re="^([0-9]+(\.[0-9]+)*)([a-z]?)((_(alpha|beta|pre|rc|p)[0-9]*)*)(-r[0-9]+)?$" - - [[ ${va} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${va}" - an=${BASH_REMATCH[1]} - al=${BASH_REMATCH[3]} - as=${BASH_REMATCH[4]} - ar=${BASH_REMATCH[7]} - - [[ ${vb} =~ ${re} ]] || die "${FUNCNAME}: invalid version: ${vb}" - bn=${BASH_REMATCH[1]} - bl=${BASH_REMATCH[3]} - bs=${BASH_REMATCH[4]} - br=${BASH_REMATCH[7]} - - # Compare numeric components (PMS algorithm 3.2) - # First component - _ver_compare_int "${an%%.*}" "${bn%%.*}" || return - - while [[ ${an} == *.* && ${bn} == *.* ]]; do - # Other components (PMS algorithm 3.3) - an=${an#*.} - bn=${bn#*.} - a=${an%%.*} - b=${bn%%.*} - if [[ ${a} == 0* || ${b} == 0* ]]; then - # Remove any trailing zeros - [[ ${a} =~ 0+$ ]] && a=${a%"${BASH_REMATCH[0]}"} - [[ ${b} =~ 0+$ ]] && b=${b%"${BASH_REMATCH[0]}"} - [[ ${a} > ${b} ]] && return 3 - [[ ${a} < ${b} ]] && return 1 - else - _ver_compare_int "${a}" "${b}" || return - fi - done - [[ ${an} == *.* ]] && return 3 - [[ ${bn} == *.* ]] && return 1 - - # Compare letter components (PMS algorithm 3.4) - [[ ${al} > ${bl} ]] && return 3 - [[ ${al} < ${bl} ]] && return 1 - - # Compare suffixes (PMS algorithm 3.5) - as=${as#_}${as:+_} - bs=${bs#_}${bs:+_} - while [[ -n ${as} && -n ${bs} ]]; do - # Compare each suffix (PMS algorithm 3.6) - a=${as%%_*} - b=${bs%%_*} - if [[ ${a%%[0-9]*} == "${b%%[0-9]*}" ]]; then - _ver_compare_int "${a##*[a-z]}" "${b##*[a-z]}" || return - else - # Check for p first - [[ ${a%%[0-9]*} == p ]] && return 3 - [[ ${b%%[0-9]*} == p ]] && return 1 - # Hack: Use that alpha < beta < pre < rc alphabetically - [[ ${a} > ${b} ]] && return 3 || return 1 - fi - as=${as#*_} - bs=${bs#*_} - done - if [[ -n ${as} ]]; then - [[ ${as} == p[_0-9]* ]] && return 3 || return 1 - elif [[ -n ${bs} ]]; then - [[ ${bs} == p[_0-9]* ]] && return 1 || return 3 - fi - - # Compare revision components (PMS algorithm 3.7) - _ver_compare_int "${ar#-r}" "${br#-r}" || return - - return 2 -} - -# @FUNCTION: ver_test -# @USAGE: [] -# @DESCRIPTION: -# Check if the relation is true. If is not specified, -# default to ${PVR}. can be -gt, -ge, -eq, -ne, -le, -lt. -# Both versions must conform to the PMS version syntax (with optional -# revision parts), and the comparison is performed according to -# the algorithm specified in the PMS. -ver_test() { - local va op vb - - if [[ $# -eq 3 ]]; then - va=${1} - shift - else - va=${PVR} - fi - - [[ $# -eq 2 ]] || die "${FUNCNAME}: bad number of arguments" - - op=${1} - vb=${2} - - case ${op} in - -eq|-ne|-lt|-le|-gt|-ge) ;; - *) die "${FUNCNAME}: invalid operator: ${op}" ;; - esac - - _ver_compare "${va}" "${vb}" - test $? "${op}" 2 -}