/[gentoo-x86]/eclass/versionator.eclass
Gentoo

Diff of /eclass/versionator.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.16 Revision 1.17
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.16 2010/07/18 21:24:33 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/versionator.eclass,v 1.17 2010/07/19 20:17:35 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
23# 23#
24# There's also: 24# There's also:
25# version_is_at_least want have 25# version_is_at_least want have
26# which may be buggy, so use with caution. 26# which may be buggy, so use with caution.
27 27
28# Quick function to toggle the shopts required for some functions on and off 28inherit eutils
29# Used because we can't set extglob in global scope anymore (QA Violation)
30__versionator_shopt_toggle() {
31 VERSIONATOR_RECURSION=${VERSIONATOR_RECURSION:-0}
32 case "$1" in
33 "on")
34 if [[ $VERSIONATOR_RECURSION -lt 1 ]] ; then
35 VERSIONATOR_OLD_EXTGLOB=$(shopt -p extglob)
36 shopt -s extglob
37 fi
38 VERSIONATOR_RECURSION=$(( $VERSIONATOR_RECURSION + 1 ))
39 ;;
40 "off")
41 VERSIONATOR_RECURSION=$(( $VERSIONATOR_RECURSION - 1 ))
42 if [[ $VERSIONATOR_RECURSION -lt 1 ]] ; then
43 eval $VERSIONATOR_OLD_EXTGLOB
44 fi
45 ;;
46 esac
47 return 0
48}
49 29
50# @FUNCTION: get_all_version_components 30# @FUNCTION: get_all_version_components
51# @USAGE: [version] 31# @USAGE: [version]
52# @DESCRIPTION: 32# @DESCRIPTION:
53# Split up a version string into its component parts. If no parameter is 33# Split up a version string into its component parts. If no parameter is
56# 7c -> 7 c 36# 7c -> 7 c
57# 3.0_p2 -> 3 . 0 _ p2 37# 3.0_p2 -> 3 . 0 _ p2
58# 20040905 -> 20040905 38# 20040905 -> 20040905
59# 3.0c-r1 -> 3 . 0 c - r1 39# 3.0c-r1 -> 3 . 0 c - r1
60get_all_version_components() { 40get_all_version_components() {
61 __versionator_shopt_toggle on 41 eshopts_push -s extglob
62 local ver_str=${1:-${PV}} result result_idx=0 42 local ver_str=${1:-${PV}} result result_idx=0
63 result=( ) 43 result=( )
64 44
65 # sneaky cache trick cache to avoid having to parse the same thing several 45 # sneaky cache trick cache to avoid having to parse the same thing several
66 # times. 46 # times.
67 if [[ "${VERSIONATOR_CACHE_VER_STR}" == "${ver_str}" ]] ; then 47 if [[ "${VERSIONATOR_CACHE_VER_STR}" == "${ver_str}" ]] ; then
68 echo ${VERSIONATOR_CACHE_RESULT} 48 echo ${VERSIONATOR_CACHE_RESULT}
69 __versionator_shopt_toggle off 49 eshopts_pop
70 return 50 return
71 fi 51 fi
72 export VERSIONATOR_CACHE_VER_STR="${ver_str}" 52 export VERSIONATOR_CACHE_VER_STR="${ver_str}"
73 53
74 while [[ -n "$ver_str" ]] ; do 54 while [[ -n "$ver_str" ]] ; do
104 esac 84 esac
105 done 85 done
106 86
107 export VERSIONATOR_CACHE_RESULT="${result[@]}" 87 export VERSIONATOR_CACHE_RESULT="${result[@]}"
108 echo ${result[@]} 88 echo ${result[@]}
109 __versionator_shopt_toggle off 89 eshopts_pop
110} 90}
111 91
112# @FUNCTION: get_version_components 92# @FUNCTION: get_version_components
113# @USAGE: [version] 93# @USAGE: [version]
114# @DESCRIPTION: 94# @DESCRIPTION:
118# 7c -> 7 c 98# 7c -> 7 c
119# 3.0_p2 -> 3 0 p2 99# 3.0_p2 -> 3 0 p2
120# 20040905 -> 20040905 100# 20040905 -> 20040905
121# 3.0c-r1 -> 3 0 c r1 101# 3.0c-r1 -> 3 0 c r1
122get_version_components() { 102get_version_components() {
123 __versionator_shopt_toggle on 103 eshopts_push -s extglob
124 local c="$(get_all_version_components "${1:-${PV}}")" 104 local c="$(get_all_version_components "${1:-${PV}}")"
125 c=( ${c[@]//[-._]/ } ) 105 c=( ${c[@]//[-._]/ } )
126 echo ${c[@]} 106 echo ${c[@]}
127 __versionator_shopt_toggle off 107 eshopts_pop
128} 108}
129 109
130# @FUNCTION: get_major_version 110# @FUNCTION: get_major_version
131# @USAGE: [version] 111# @USAGE: [version]
132# @DESCRIPTION: 112# @DESCRIPTION:
135# 7c -> 7 115# 7c -> 7
136# 3.0_p2 -> 3 116# 3.0_p2 -> 3
137# 20040905 -> 20040905 117# 20040905 -> 20040905
138# 3.0c-r1 -> 3 118# 3.0c-r1 -> 3
139get_major_version() { 119get_major_version() {
140 __versionator_shopt_toggle on 120 eshopts_push -s extglob
141 local c 121 local c
142 c=( $(get_all_version_components "${1:-${PV}}" ) ) 122 c=( $(get_all_version_components "${1:-${PV}}" ) )
143 echo ${c[0]} 123 echo ${c[0]}
144 __versionator_shopt_toggle off 124 eshopts_pop
145} 125}
146 126
147# @FUNCTION: get_version_component_range 127# @FUNCTION: get_version_component_range
148# @USAGE: [version] 128# @USAGE: [version]
149# @DESCRIPTION: 129# @DESCRIPTION:
151# version parameter is supplied, defaults to $PV. 131# version parameter is supplied, defaults to $PV.
152# 1 1.2.3 -> 1 132# 1 1.2.3 -> 1
153# 1-2 1.2.3 -> 1.2 133# 1-2 1.2.3 -> 1.2
154# 2- 1.2.3 -> 2.3 134# 2- 1.2.3 -> 2.3
155get_version_component_range() { 135get_version_component_range() {
156 __versionator_shopt_toggle on 136 eshopts_push -s extglob
157 local c v="${2:-${PV}}" range="${1}" range_start range_end i=-1 j=0 137 local c v="${2:-${PV}}" range="${1}" range_start range_end i=-1 j=0
158 c=( $(get_all_version_components ${v} ) ) 138 c=( $(get_all_version_components ${v} ) )
159 range_start="${range%-*}" ; range_start="${range_start:-1}" 139 range_start="${range%-*}" ; range_start="${range_start:-1}"
160 range_end="${range#*-}" ; range_end="${range_end:-${#c[@]}}" 140 range_end="${range#*-}" ; range_end="${range_end:-${#c[@]}}"
161 141
162 while (( j < ${range_start} )) ; do 142 while (( j < ${range_start} )) ; do
163 i=$(($i + 1)) 143 i=$(($i + 1))
164 [[ $i -gt ${#c[@]} ]] && __versionator_shopt_toggle off && return 144 [[ $i -gt ${#c[@]} ]] && eshopts_pop && return
165 [[ -n "${c[${i}]//[-._]}" ]] && j=$(($j + 1)) 145 [[ -n "${c[${i}]//[-._]}" ]] && j=$(($j + 1))
166 done 146 done
167 147
168 while (( j <= ${range_end} )) ; do 148 while (( j <= ${range_end} )) ; do
169 echo -n ${c[$i]} 149 echo -n ${c[$i]}
170 [[ $i -gt ${#c[@]} ]] && __versionator_shopt_toggle off && return 150 [[ $i -gt ${#c[@]} ]] && eshopts_pop && return
171 [[ -n "${c[${i}]//[-._]}" ]] && j=$(($j + 1)) 151 [[ -n "${c[${i}]//[-._]}" ]] && j=$(($j + 1))
172 i=$(($i + 1)) 152 i=$(($i + 1))
173 done 153 done
174 __versionator_shopt_toggle off 154 eshopts_pop
175} 155}
176 156
177# @FUNCTION: get_after_major_version 157# @FUNCTION: get_after_major_version
178# @USAGE: [version] 158# @USAGE: [version]
179# @DESCRIPTION: 159# @DESCRIPTION:
183# 7c -> c 163# 7c -> c
184# 3.0_p2 -> 0_p2 164# 3.0_p2 -> 0_p2
185# 20040905 -> (empty string) 165# 20040905 -> (empty string)
186# 3.0c-r1 -> 0c-r1 166# 3.0c-r1 -> 0c-r1
187get_after_major_version() { 167get_after_major_version() {
188 __versionator_shopt_toggle on 168 eshopts_push -s extglob
189 echo $(get_version_component_range 2- "${1:-${PV}}" ) 169 echo $(get_version_component_range 2- "${1:-${PV}}" )
190 __versionator_shopt_toggle off 170 eshopts_pop
191} 171}
192 172
193# @FUNCTION: replace_version_separator 173# @FUNCTION: replace_version_separator
194# @USAGE: <search> <replacement> [subject] 174# @USAGE: <search> <replacement> [subject]
195# @DESCRIPTION: 175# @DESCRIPTION:
199# 2 '_' 1.2.3 -> 1.2_3 179# 2 '_' 1.2.3 -> 1.2_3
200# 1 '_' 1b-2.3 -> 1b_2.3 180# 1 '_' 1b-2.3 -> 1b_2.3
201# Rather than being a number, $1 can be a separator character such as '-', '.' 181# Rather than being a number, $1 can be a separator character such as '-', '.'
202# or '_'. In this case, the first separator of this kind is selected. 182# or '_'. In this case, the first separator of this kind is selected.
203replace_version_separator() { 183replace_version_separator() {
204 __versionator_shopt_toggle on 184 eshopts_push -s extglob
205 local w i c found=0 v="${3:-${PV}}" 185 local w i c found=0 v="${3:-${PV}}"
206 w=${1:-1} 186 w=${1:-1}
207 c=( $(get_all_version_components ${v} ) ) 187 c=( $(get_all_version_components ${v} ) )
208 if [[ "${w//[[:digit:]]/}" == "${w}" ]] ; then 188 if [[ "${w//[[:digit:]]/}" == "${w}" ]] ; then
209 # it's a character, not an index 189 # it's a character, not an index
224 fi 204 fi
225 done 205 done
226 fi 206 fi
227 c=${c[@]} 207 c=${c[@]}
228 echo ${c// } 208 echo ${c// }
229 __versionator_shopt_toggle off 209 eshopts_pop
230} 210}
231 211
232# @FUNCTION: replace_all_version_separators 212# @FUNCTION: replace_all_version_separators
233# @USAGE: <replacement> [subject] 213# @USAGE: <replacement> [subject]
234# @DESCRIPTION: 214# @DESCRIPTION:
235# Replace all version separators in $2 (defaults to $PV) with $1. 215# Replace all version separators in $2 (defaults to $PV) with $1.
236# '_' 1b.2.3 -> 1b_2_3 216# '_' 1b.2.3 -> 1b_2_3
237replace_all_version_separators() { 217replace_all_version_separators() {
238 __versionator_shopt_toggle on 218 eshopts_push -s extglob
239 local c 219 local c
240 c=( $(get_all_version_components "${2:-${PV}}" ) ) 220 c=( $(get_all_version_components "${2:-${PV}}" ) )
241 c="${c[@]//[-._]/$1}" 221 c="${c[@]//[-._]/$1}"
242 echo ${c// } 222 echo ${c// }
243 __versionator_shopt_toggle off 223 eshopts_pop
244} 224}
245 225
246# @FUNCTION: delete_version_separator 226# @FUNCTION: delete_version_separator
247# @USAGE: <search> [subject] 227# @USAGE: <search> [subject]
248# @DESCRIPTION: 228# @DESCRIPTION:
252# 2 1.2.3 -> 1.23 232# 2 1.2.3 -> 1.23
253# 1 1b-2.3 -> 1b2.3 233# 1 1b-2.3 -> 1b2.3
254# Rather than being a number, $1 can be a separator character such as '-', '.' 234# Rather than being a number, $1 can be a separator character such as '-', '.'
255# or '_'. In this case, the first separator of this kind is deleted. 235# or '_'. In this case, the first separator of this kind is deleted.
256delete_version_separator() { 236delete_version_separator() {
257 __versionator_shopt_toggle on 237 eshopts_push -s extglob
258 replace_version_separator "${1}" "" "${2}" 238 replace_version_separator "${1}" "" "${2}"
259 __versionator_shopt_toggle off 239 eshopts_pop
260} 240}
261 241
262# @FUNCTION: delete_all_version_separators 242# @FUNCTION: delete_all_version_separators
263# @USAGE: [subject] 243# @USAGE: [subject]
264# @DESCRIPTION: 244# @DESCRIPTION:
265# Delete all version separators in $1 (defaults to $PV). 245# Delete all version separators in $1 (defaults to $PV).
266# 1b.2.3 -> 1b23 246# 1b.2.3 -> 1b23
267delete_all_version_separators() { 247delete_all_version_separators() {
268 __versionator_shopt_toggle on 248 eshopts_push -s extglob
269 replace_all_version_separators "" "${1}" 249 replace_all_version_separators "" "${1}"
270 __versionator_shopt_toggle off 250 eshopts_pop
271} 251}
272 252
273# @FUNCTION: get_version_component_count 253# @FUNCTION: get_version_component_count
274# @USAGE: [version] 254# @USAGE: [version]
275# @DESCRIPTION: 255# @DESCRIPTION:
276# How many version components are there in $1 (defaults to $PV)? 256# How many version components are there in $1 (defaults to $PV)?
277# 1.0.1 -> 3 257# 1.0.1 -> 3
278# 3.0c-r1 -> 4 258# 3.0c-r1 -> 4
279get_version_component_count() { 259get_version_component_count() {
280 __versionator_shopt_toggle on 260 eshopts_push -s extglob
281 local a 261 local a
282 a=( $(get_version_components "${1:-${PV}}" ) ) 262 a=( $(get_version_components "${1:-${PV}}" ) )
283 echo ${#a[@]} 263 echo ${#a[@]}
284 __versionator_shopt_toggle off 264 eshopts_pop
285} 265}
286 266
287# @FUNCTION: get_last_version_component_index 267# @FUNCTION: get_last_version_component_index
288# @USAGE: [version] 268# @USAGE: [version]
289# @DESCRIPTION: 269# @DESCRIPTION:
290# What is the index of the last version component in $1 (defaults to $PV)? 270# What is the index of the last version component in $1 (defaults to $PV)?
291# Equivalent to get_version_component_count - 1. 271# Equivalent to get_version_component_count - 1.
292# 1.0.1 -> 3 272# 1.0.1 -> 3
293# 3.0c-r1 -> 4 273# 3.0c-r1 -> 4
294get_last_version_component_index() { 274get_last_version_component_index() {
295 __versionator_shopt_toggle on 275 eshopts_push -s extglob
296 echo $(( $(get_version_component_count "${1:-${PV}}" ) - 1 )) 276 echo $(( $(get_version_component_count "${1:-${PV}}" ) - 1 ))
297 __versionator_shopt_toggle off 277 eshopts_pop
298} 278}
299 279
300# @FUNCTION: version_is_at_least 280# @FUNCTION: version_is_at_least
301# @USAGE: <want> [have] 281# @USAGE: <want> [have]
302# @DESCRIPTION: 282# @DESCRIPTION:
303# Is $2 (defaults to $PVR) at least version $1? Intended for use in eclasses 283# Is $2 (defaults to $PVR) at least version $1? Intended for use in eclasses
304# only. May not be reliable, be sure to do very careful testing before actually 284# only. May not be reliable, be sure to do very careful testing before actually
305# using this. 285# using this.
306version_is_at_least() { 286version_is_at_least() {
307 __versionator_shopt_toggle on 287 eshopts_push -s extglob
308 local want_s="$1" have_s="${2:-${PVR}}" r 288 local want_s="$1" have_s="${2:-${PVR}}" r
309 version_compare "${want_s}" "${have_s}" 289 version_compare "${want_s}" "${have_s}"
310 r=$? 290 r=$?
311 case $r in 291 case $r in
312 1|2) 292 1|2)
313 __versionator_shopt_toggle off 293 eshopts_pop
314 return 0 294 return 0
315 ;; 295 ;;
316 3) 296 3)
317 __versionator_shopt_toggle off 297 eshopts_pop
318 return 1 298 return 1
319 ;; 299 ;;
320 *) 300 *)
321 __versionator_shopt_toggle off 301 eshopts_pop
322 die "versionator compare bug [atleast, ${want_s}, ${have_s}, ${r}]" 302 die "versionator compare bug [atleast, ${want_s}, ${have_s}, ${r}]"
323 ;; 303 ;;
324 esac 304 esac
325 __versionator_shopt_toggle off 305 eshopts_pop
326} 306}
327 307
328# @FUNCTION: version_compare 308# @FUNCTION: version_compare
329# @USAGE: <A> <B> 309# @USAGE: <A> <B>
330# @DESCRIPTION: 310# @DESCRIPTION:
331# Takes two parameters (A, B) which are versions. If A is an earlier version 311# Takes two parameters (A, B) which are versions. If A is an earlier version
332# than B, returns 1. If A is identical to B, return 2. If A is later than B, 312# than B, returns 1. If A is identical to B, return 2. If A is later than B,
333# return 3. You probably want version_is_at_least rather than this function. 313# return 3. You probably want version_is_at_least rather than this function.
334# May not be very reliable. Test carefully before using this. 314# May not be very reliable. Test carefully before using this.
335version_compare() { 315version_compare() {
336 __versionator_shopt_toggle on 316 eshopts_push -s extglob
337 local ver_a=${1} ver_b=${2} parts_a parts_b cur_idx_a=0 cur_idx_b=0 317 local ver_a=${1} ver_b=${2} parts_a parts_b cur_idx_a=0 cur_idx_b=0
338 parts_a=( $(get_all_version_components "${ver_a}" ) ) 318 parts_a=( $(get_all_version_components "${ver_a}" ) )
339 parts_b=( $(get_all_version_components "${ver_b}" ) ) 319 parts_b=( $(get_all_version_components "${ver_b}" ) )
340 320
341 ### compare number parts. 321 ### compare number parts.
377 # if a component is blank, make it zero. 357 # if a component is blank, make it zero.
378 [[ -z ${cur_tok_a} ]] && cur_tok_a=0 358 [[ -z ${cur_tok_a} ]] && cur_tok_a=0
379 [[ -z ${cur_tok_b} ]] && cur_tok_b=0 359 [[ -z ${cur_tok_b} ]] && cur_tok_b=0
380 360
381 # compare 361 # compare
382 [[ ${cur_tok_a} -lt ${cur_tok_b} ]] && __versionator_shopt_toggle off && return 1 362 [[ ${cur_tok_a} -lt ${cur_tok_b} ]] && eshopts_pop && return 1
383 [[ ${cur_tok_a} -gt ${cur_tok_b} ]] && __versionator_shopt_toggle off && return 3 363 [[ ${cur_tok_a} -gt ${cur_tok_b} ]] && eshopts_pop && return 3
384 done 364 done
385 365
386 ### number parts equal. compare letter parts. 366 ### number parts equal. compare letter parts.
387 local letter_a= 367 local letter_a=
388 letter_a=${parts_a[${cur_idx_a}]} 368 letter_a=${parts_a[${cur_idx_a}]}
399 else 379 else
400 letter_b="@" 380 letter_b="@"
401 fi 381 fi
402 382
403 # compare 383 # compare
404 [[ ${letter_a} < ${letter_b} ]] && __versionator_shopt_toggle off && return 1 384 [[ ${letter_a} < ${letter_b} ]] && eshopts_pop && return 1
405 [[ ${letter_a} > ${letter_b} ]] && __versionator_shopt_toggle off && return 3 385 [[ ${letter_a} > ${letter_b} ]] && eshopts_pop && return 3
406 386
407 ### letter parts equal. compare suffixes in order. 387 ### letter parts equal. compare suffixes in order.
408 local suffix rule part r_lt r_gt 388 local suffix rule part r_lt r_gt
409 for rule in "alpha=1" "beta=1" "pre=1" "rc=1" "p=3" "r=3" ; do 389 for rule in "alpha=1" "beta=1" "pre=1" "rc=1" "p=3" "r=3" ; do
410 suffix=${rule%%=*} 390 suffix=${rule%%=*}
425 suffix_b=${part#${suffix}}0 405 suffix_b=${part#${suffix}}0
426 done 406 done
427 407
428 [[ -z ${suffix_a} ]] && [[ -z ${suffix_b} ]] && continue 408 [[ -z ${suffix_a} ]] && [[ -z ${suffix_b} ]] && continue
429 409
430 [[ -z ${suffix_a} ]] && __versionator_shopt_toggle off && return ${r_gt} 410 [[ -z ${suffix_a} ]] && eshopts_pop && return ${r_gt}
431 [[ -z ${suffix_b} ]] && __versionator_shopt_toggle off && return ${r_lt} 411 [[ -z ${suffix_b} ]] && eshopts_pop && return ${r_lt}
432 412
433 # avoid octal problems 413 # avoid octal problems
434 suffix_a=${suffix_a##+(0)} ; suffix_a=${suffix_a:-0} 414 suffix_a=${suffix_a##+(0)} ; suffix_a=${suffix_a:-0}
435 suffix_b=${suffix_b##+(0)} ; suffix_b=${suffix_b:-0} 415 suffix_b=${suffix_b##+(0)} ; suffix_b=${suffix_b:-0}
436 416
437 [[ ${suffix_a} -lt ${suffix_b} ]] && __versionator_shopt_toggle off && return 1 417 [[ ${suffix_a} -lt ${suffix_b} ]] && eshopts_pop && return 1
438 [[ ${suffix_a} -gt ${suffix_b} ]] && __versionator_shopt_toggle off && return 3 418 [[ ${suffix_a} -gt ${suffix_b} ]] && eshopts_pop && return 3
439 done 419 done
440 420
441 ### no differences. 421 ### no differences.
442 __versionator_shopt_toggle off 422 eshopts_pop
443 return 2 423 return 2
444} 424}
445 425
446# @FUNCTION: version_sort 426# @FUNCTION: version_sort
447# @USAGE: <version> [more versions...] 427# @USAGE: <version> [more versions...]
448# @DESCRIPTION: 428# @DESCRIPTION:
449# Returns its parameters sorted, highest version last. We're using a quadratic 429# Returns its parameters sorted, highest version last. We're using a quadratic
450# algorithm for simplicity, so don't call it with more than a few dozen items. 430# algorithm for simplicity, so don't call it with more than a few dozen items.
451# Uses version_compare, so be careful. 431# Uses version_compare, so be careful.
452version_sort() { 432version_sort() {
453 __versionator_shopt_toggle on 433 eshopts_push -s extglob
454 local items= left=0 434 local items= left=0
455 items=( $@ ) 435 items=( $@ )
456 while [[ ${left} -lt ${#items[@]} ]] ; do 436 while [[ ${left} -lt ${#items[@]} ]] ; do
457 local lowest_idx=${left} 437 local lowest_idx=${left}
458 local idx=$(( ${lowest_idx} + 1 )) 438 local idx=$(( ${lowest_idx} + 1 ))
465 items[${lowest_idx}]=${items[${left}]} 445 items[${lowest_idx}]=${items[${left}]}
466 items[${left}]=${tmp} 446 items[${left}]=${tmp}
467 left=$(( ${left} + 1 )) 447 left=$(( ${left} + 1 ))
468 done 448 done
469 echo ${items[@]} 449 echo ${items[@]}
470 __versionator_shopt_toggle off 450 eshopts_pop
471} 451}
472 452
473# @FUNCTION: version_format_string 453# @FUNCTION: version_format_string
474# @USAGE: <format> [version] 454# @USAGE: <format> [version]
475# @DESCRIPTION: 455# @DESCRIPTION:
487 set -- $(get_version_components "$@") 467 set -- $(get_version_components "$@")
488 eval echo "${fstr}" 468 eval echo "${fstr}"
489} 469}
490 470
491__versionator__test_version_compare() { 471__versionator__test_version_compare() {
492 __versionator_shopt_toggle on 472 eshopts_push -s extglob
493 local lt=1 eq=2 gt=3 p q 473 local lt=1 eq=2 gt=3 p q
494 474
495 __versionator__test_version_compare_t() { 475 __versionator__test_version_compare_t() {
496 version_compare "${1}" "${3}" 476 version_compare "${1}" "${3}"
497 local r=$? 477 local r=$?
591 __versionator__test_version_compare_t "7.2${p}1" $lt "7.2${p}2" 571 __versionator__test_version_compare_t "7.2${p}1" $lt "7.2${p}2"
592 __versionator__test_version_compare_t "7.2${p}2" $gt "7.2${p}1" 572 __versionator__test_version_compare_t "7.2${p}2" $gt "7.2${p}1"
593 __versionator__test_version_compare_t "7.2${p}3" $gt "7.2${p}2" 573 __versionator__test_version_compare_t "7.2${p}3" $gt "7.2${p}2"
594 __versionator__test_version_compare_t "7.2${p}2" $lt "7.2${p}3" 574 __versionator__test_version_compare_t "7.2${p}2" $lt "7.2${p}3"
595 done 575 done
596 __versionator_shopt_toggle off 576 eshopts_pop
597} 577}

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20