dkbuild: les versions de profil sont ordonnées comme les versions de distribution

This commit is contained in:
Jephté Clain 2023-11-18 08:02:04 +04:00
parent e5315532a1
commit a855b04c21
5 changed files with 53 additions and 2 deletions

27
dkbuild
View File

@ -1273,14 +1273,37 @@ function define_functions_env() {
return 1
}
function profile() {
local profile version
local profile version default
for profile in "$@"; do
[ "$profile" == DEFAULT ] && profile="${SETPROFILES[0]}"
if [ "$profile" == DEFAULT ]; then
default=1
continue
fi
parse_profile "$profile" profile version
[ "$profile" == "$PROFILE" ] || continue
[ -z "$version" -o "$version" == "$PVERSION" ] || continue
return 0
done
if [ -n "$default" ]; then
# trouver la dernière occurence du premier profil mentionné. en
# effet, les versions doivent être ordonnées de la plus ancienne à
# la plus récente.
local first_profile last_version
for profile in "${SETPROFILES[@]}"; do
parse_profile "$profile" profile version
if [ -z "$first_profile" ]; then
first_profile="$profile"
last_version="$version"
elif [ "$profile" == "$first_profile" ]; then
last_version="$version"
fi
done
if [ "$first_profile" == "$PROFILE" ]; then
if [ -z "$last_version" -o "$last_version" == "$PVERSION" ]; then
return 0
fi
fi
fi
return 1
}
declare -g -A ENVIRON

View File

@ -0,0 +1,8 @@
# tests
Lancer un test de cette façon
~~~sh
../../../dkbuild -j test-xxx
~~~
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
setdists v1-d11 v2-d11 v1-d10
if dist LATEST; then
info "$DIST est la distribution la plus récente"
fi
info "version=$VERSION"
# pas de build automatique
AUTOBUILD=

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
setprofiles v1-prod v2-prod test
if profile DEFAULT; then
info "$PROFILE est le profil par défaut"
fi
info "version=$VERSION"
# pas de build automatique
AUTOBUILD=