framework pour comparaison

This commit is contained in:
Jephte CLAIN 2014-01-18 12:14:14 +04:00
parent 5388951acb
commit ec89c5ea57
2 changed files with 24 additions and 6 deletions

View File

@ -108,6 +108,10 @@ function semver_setprelease() {
fi
}
function semver_compare_prelease() {
echo err
}
function semver_setmetadata() {
# XXX analyser $1 et spliter avant de copier dans le tableau $6
if [ "$1" ]; then
@ -117,6 +121,10 @@ function semver_setmetadata() {
fi
}
function semver_compare_metadata() {
echo err
}
function semver_copy() {
set_var "$1" "${!6}"
set_var "$2" "${!7}"
@ -146,7 +154,9 @@ function psemver_incmajor() { semver_incmajor "${1}major" "${1}minor" "${1}patch
function psemver_incminor() { semver_incminor "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata"; }
function psemver_incpatchlevel() { semver_incpatchlevel "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata"; }
function psemver_setprelease() { semver_setprelease "$1" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata"; }
function psemver_compare_prelease() { semver_compare_prelease "${1}prelease" "${2}prelease"; }
function psemver_setmetadata() { semver_setmetadata "$1" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata"; }
function psemver_compare_metadata() { semver_compare_metadata "${1}metadata" "${2}metadata"; }
function psemver_copy() { semver_copy "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata"; }
function psemver_build() { semver_build "${1}major" "${1}minor" "${1}patchlevel" "${1}prelease" "${1}metadata"; }
function psemver_setvar() { semver_setvar "$1" "${2}major" "${2}minor" "${2}patchlevel" "${2}prelease" "${2}metadata"; }

View File

@ -185,7 +185,9 @@ elif [ "$action" == compare ]; then
[ "$minor" -gt "$ominor" ] && exit 1
[ "$patchlevel" -lt "$opatchlevel" ] && exit 0
[ "$patchlevel" -gt "$opatchlevel" ] && exit 1
# XXX tester prelease
case "$(psemver_compare_prelease "" o)" in
lt) exit 0;;
esac
exit 1
;;
le)
@ -196,8 +198,10 @@ elif [ "$action" == compare ]; then
[ "$minor" -gt "$ominor" ] && exit 1
[ "$patchlevel" -lt "$opatchlevel" ] && exit 0
[ "$patchlevel" -gt "$opatchlevel" ] && exit 1
# XXX tester prelease
exit 0
case "$(psemver_compare_prelease "" o)" in
lt|eq) exit 0;;
esac
exit 1
;;
gt)
[ -z "$valid" -a -z "$ovalid" ] && exit 1
@ -207,7 +211,9 @@ elif [ "$action" == compare ]; then
[ "$minor" -gt "$ominor" ] && exit 0
[ "$patchlevel" -lt "$opatchlevel" ] && exit 1
[ "$patchlevel" -gt "$opatchlevel" ] && exit 0
# XXX tester prelease
case "$(psemver_compare_prelease "" o)" in
gt) exit 0;;
esac
exit 1
;;
ge)
@ -218,8 +224,10 @@ elif [ "$action" == compare ]; then
[ "$minor" -gt "$ominor" ] && exit 0
[ "$patchlevel" -lt "$opatchlevel" ] && exit 1
[ "$patchlevel" -gt "$opatchlevel" ] && exit 0
# XXX tester prelease
exit 0
case "$(psemver_compare_prelease "" o)" in
gt|eq) exit 0;;
esac
exit 1
;;
esac