From 4a09ad0367a253ccead0d3ddce0591b6e3c5861f Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 18 Jul 2010 21:24:33 +0000 Subject: [PATCH] =?utf8?q?new=20version=5Fformat=5Fstring=20func=20by=20Mi?= =?utf8?q?cha=C5=82=20G=C3=B3rny=20#327679?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- eclass/versionator.eclass | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/eclass/versionator.eclass b/eclass/versionator.eclass index 09d52dab3d0b..bc0388ab87b0 100644 --- a/eclass/versionator.eclass +++ b/eclass/versionator.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/versionator.eclass,v 1.15 2008/06/12 12:48:34 opfer Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/versionator.eclass,v 1.16 2010/07/18 21:24:33 vapier Exp $ # @ECLASS: versionator.eclass # @MAINTAINER: @@ -470,6 +470,24 @@ version_sort() { __versionator_shopt_toggle off } +# @FUNCTION: version_format_string +# @USAGE: [version] +# @DESCRIPTION: +# Reformat complicated version strings. The first argument is the string +# to reformat with while the rest of the args are passed on to the +# get_version_components function. You should make sure to single quote +# the first argument since it'll have variables that get delayed expansion.s +# @EXAMPLE: +# P="cow-hat-1.2.3_p4" +# MY_P=$(version_format_string '${PN}_source_$1_$2-$3_$4') +# Now MY_P will be: cow-hat_source_1_2-3_p4 +version_format_string() { + local fstr=$1 + shift + set -- $(get_version_components "$@") + eval echo "${fstr}" +} + __versionator__test_version_compare() { __versionator_shopt_toggle on local lt=1 eq=2 gt=3 p q -- 2.26.2