summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-07-18 21:24:33 +0000
committerMike Frysinger <vapier@gentoo.org>2010-07-18 21:24:33 +0000
commit4a09ad0367a253ccead0d3ddce0591b6e3c5861f (patch)
treec4b85bc421f132b25373da3da1bc8c292791f69b /eclass/versionator.eclass
parentUpdated oldest version for CVE-2010-1411. (diff)
downloadhistorical-4a09ad0367a253ccead0d3ddce0591b6e3c5861f.tar.gz
historical-4a09ad0367a253ccead0d3ddce0591b6e3c5861f.tar.bz2
historical-4a09ad0367a253ccead0d3ddce0591b6e3c5861f.zip
new version_format_string func by Michał Górny #327679
Diffstat (limited to 'eclass/versionator.eclass')
-rw-r--r--eclass/versionator.eclass20
1 files changed, 19 insertions, 1 deletions
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: <format> [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