| 1 | # Copyright 1999-2008 Gentoo Foundation |
1 | # Copyright 1999-2008 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/versionator.eclass,v 1.15 2008/06/12 12:48:34 opfer Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/versionator.eclass,v 1.16 2010/07/18 21:24:33 vapier Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: versionator.eclass |
5 | # @ECLASS: versionator.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # base-system@gentoo.org |
7 | # base-system@gentoo.org |
| 8 | # @BLURB: functions which simplify manipulation of ${PV} and similar version strings |
8 | # @BLURB: functions which simplify manipulation of ${PV} and similar version strings |
| … | |
… | |
| 468 | done |
468 | done |
| 469 | echo ${items[@]} |
469 | echo ${items[@]} |
| 470 | __versionator_shopt_toggle off |
470 | __versionator_shopt_toggle off |
| 471 | } |
471 | } |
| 472 | |
472 | |
|
|
473 | # @FUNCTION: version_format_string |
|
|
474 | # @USAGE: <format> [version] |
|
|
475 | # @DESCRIPTION: |
|
|
476 | # Reformat complicated version strings. The first argument is the string |
|
|
477 | # to reformat with while the rest of the args are passed on to the |
|
|
478 | # get_version_components function. You should make sure to single quote |
|
|
479 | # the first argument since it'll have variables that get delayed expansion.s |
|
|
480 | # @EXAMPLE: |
|
|
481 | # P="cow-hat-1.2.3_p4" |
|
|
482 | # MY_P=$(version_format_string '${PN}_source_$1_$2-$3_$4') |
|
|
483 | # Now MY_P will be: cow-hat_source_1_2-3_p4 |
|
|
484 | version_format_string() { |
|
|
485 | local fstr=$1 |
|
|
486 | shift |
|
|
487 | set -- $(get_version_components "$@") |
|
|
488 | eval echo "${fstr}" |
|
|
489 | } |
|
|
490 | |
| 473 | __versionator__test_version_compare() { |
491 | __versionator__test_version_compare() { |
| 474 | __versionator_shopt_toggle on |
492 | __versionator_shopt_toggle on |
| 475 | local lt=1 eq=2 gt=3 p q |
493 | local lt=1 eq=2 gt=3 p q |
| 476 | |
494 | |
| 477 | __versionator__test_version_compare_t() { |
495 | __versionator__test_version_compare_t() { |