Compare commits

..

1 Commits

Author SHA1 Message Date
Jephté Clain a80f572573 maj TODO 2024-02-12 11:48:51 +04:00
8 changed files with 61 additions and 167 deletions

View File

@ -1,16 +1,3 @@
## Version 11.2.0 du 21/06/2024-20:34
* `21042e4` bug
* `e4176df` reginc: possibilité de renommer des fichiers
* `1787aa2` bug
* `d1f77aa` dkbuild: support dist none et tag LATEST
* `c2cfd77` bug
* `e7745c2` dk: support --plain-output
* `ce8f541` dkbuild: -g pour --profile
* `30594aa` maj distributions
* `2df175e` dkbuild: cosmetic
* `fbb05f8` support des versions AMUE
## Version 11.1.0 du 01/02/2024-20:59
* `8570d12` pff: les répertoires liés peuvent contenir des fichiers

10
TODO.md
View File

@ -1,10 +0,0 @@
# TODO
dkbuild
* setversion peut prendre la version depuis la branche git d'un dépôt
* un argument permettrait de spécifier comment la version est calculée à
partir du dépôt
* si cela a du sens, une commande setlatest qui permet de désigner quelle
distribution/version est la dernière
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary

5
TODO.pff.md Normal file
View File

@ -0,0 +1,5 @@
# TODO
* [ ] utiliser les fonctions de ulib/pff
-*- coding: utf-8 mode: markdown -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8:noeol:binary

View File

@ -1 +1 @@
11.2.0
11.1.0

7
dk
View File

@ -336,8 +336,6 @@ OPTIONS build
deploy, by, bpy et update impliquent --stack
-j, --no-cache
Ne pas utiliser le cache lors du build
--plain-output
Afficher la sortie complète des containers lors du build
-U, --pull
Essayer de récupérer une version plus récente de l'image source
-g, --ug, --no-update-apps
@ -1247,7 +1245,6 @@ function default_compose_build() {
"${replace_env_args[@]}" "${env_args[@]}" \
build \
${NO_CACHE:+--no-cache} \
${PROGRESS:+--progress "$PROGRESS"} \
${PULL:+--pull} \
"${replace_build_args[@]}" "${build_args[@]}" \
"$@"
@ -1259,7 +1256,6 @@ function default_docker_build() {
done
${FAKE:+qvals} "$DOCKER" build \
${NO_CACHE:+--no-cache} \
${PROGRESS:+--progress "$PROGRESS"} \
${PULL:+--pull} \
"${replace_env_args[@]}" "${env_args[@]}" \
"${replace_build_args[@]}" "${build_args[@]}" \
@ -1309,7 +1305,6 @@ function auto_build() {
done
${FAKE:+qvals} "$DOCKER" build \
${NO_CACHE:+--no-cache} \
${PROGRESS:+--progress "$PROGRESS"} \
${PULL:+--pull} \
"${replace_build_args[@]}" "$@"
fi
@ -2504,7 +2499,6 @@ FAKE=
VARS=()
FORCE=
NO_CACHE=
PROGRESS=
PULL=
HOST=
WITH_REGISTRY_AUTH=1
@ -2528,7 +2522,6 @@ args=(
-e:,--build-arg:,--env: VARS
-f,--force FORCE=1
-j,--no-cache NO_CACHE=1
--plain-output PROGRESS=plain
-U,--pull PULL=1
-h:,--host: HOST=
-g,--ug,--no-update-apps update_apps_mode=b

36
dkbuild
View File

@ -100,7 +100,7 @@ $scriptname build [OPTIONS] [BUILDVARS...]
le build pour toutes les distributions définies. Si la distribution
sélectionnée n'est pas valide pour ce build, elle est ignorée
-g, --profile PROFILE
--profile PROFILE
-P, --prod
-T, --test
-E, --dtest
@ -224,13 +224,9 @@ construites. Une version est définie en ajoutant un préfixe à la distribution
La commande 'setdists' permet de lister explicitement les distributions valides
(et les versions associées le cas échéant). Si la distribution sélectionnée par
l'utilisateur n'est pas dans la liste fournie, le script s'arrête sans erreur.
La première distribution listée est spéciale: c'est la distribution la plus
récente, celle qui reçoit le tag :latest
La distribution 'none' est spéciale aussi: elle n'est pas mentionnée dans les
tags automatiquement attribués aux images.
La commande 'dist' permet de tester si la distribution spécifiée en argument a
été sélectionnée par l'utilisateur. L'argument 'LATEST' permet de tester la
dernière distribution.
@ -682,8 +678,7 @@ Les paramètres optionnels sont
* set-tag=TAGS... ou set-tags=TAGS...
spécifier des tags à rajouter au nom de l'image, séparés par un espace. cette
liste remplace celle calculée automatiquement. ce paramètre est ignoré pour
les noms d'images comportant un tag.
Utiliser le tag spécial LATEST pour rajouter :latest si c'est approprié
les noms d'images comportant un tag
* add-tag=TAGS... ou add-tags=TAGS...
spécifier des tags à rajouter à la liste calculée automatiquement, séparés par
un espace. ce paramètre est ignoré pour les noms d'images comportant un tag
@ -946,8 +941,8 @@ SHARED_ARGS2=(
-d:,--dist: DIST=
-0,--d10 DIST=d10
-1,--d11 DIST=d11
-2,--d12 DIST=d12
-3,--d13 DIST=d13
-2,--d12 DIST=d11
-3,--d13 DIST=d11
--r7,--rhel7 DIST=rhel7
--r8,--rhel8 DIST=rhel8
--r9,--rhel9 DIST=rhel9
@ -955,7 +950,7 @@ SHARED_ARGS2=(
--ol8,--oracle8 DIST=ol8
--ol9,--oracle9 DIST=ol9
-g:,--profile: PROFILE=
-p:,--profile: PROFILE=
-P,--prod PROFILE=prod
-T,--test PROFILE=test
-E,--dtest PROFILE=dtest
@ -1083,13 +1078,12 @@ function reset_functions() {
function include() {
edebug "include $(qvals "$@")"
local file="$1" cwd="$(pwd)"
local file="$1"
[ -d "$file" ] && file="$file/dkbuild"
[ -f "$file" ] || die "$file: fichier introuvable"
setx file=abspath "$file"
cd "$(dirname "$file")"
source "$file"
cd "$cwd"
}
function machine() {
local machine version
@ -2048,14 +2042,6 @@ function define_functions_cmd() {
imagetags+=("$imagetag")
else
for tag in "${set_tags[@]}" "${add_tags[@]}"; do
if [ "$tag" == LATEST ]; then
if [ -n "$HAVE_VERSION" -a "$VERSION" == "$LAST_VERSION" ]; then
tag=latest
else
# ignorer le tag LATEST s'il n'est pas applicable
continue
fi
fi
imagetags+=("$imagetag:$tag")
done
fi
@ -2068,16 +2054,10 @@ function define_functions_cmd() {
imagetags+=("$imagetag")
else
for tag in "${add_tags[@]}"; do
if [ "$tag" == LATEST ]; then
# toujours ignorer le tag LATEST dans add_tags
continue
fi
imagetags+=("$imagetag:$tag")
done
[ -n "$VERSION" ] && imagetags+=("$imagetag:$VERSION-$DIST")
if [ -n "$DIST" -a "$DIST" != none -a -z "$HAVE_VERSION" ]; then
imagetags+=("$imagetag:$DIST")
fi
[ -n "$DIST" -a -z "$HAVE_VERSION" ] && imagetags+=("$imagetag:$DIST")
fi
done
fi
@ -2086,7 +2066,7 @@ function define_functions_cmd() {
if [ -z "$HAVE_VERSION" ]; then
dist LATEST && imagetags+=("$imagetag:latest")
elif [ "$VERSION" == "$LAST_VERSION" ]; then
[ "$DIST" != none ] && imagetags+=("$imagetag:$DIST")
imagetags+=("$imagetag:$DIST")
dist LATEST && imagetags+=("$imagetag:latest")
fi
elif [ -n "$PROFILE" ]; then

View File

@ -154,7 +154,7 @@ function ctmatch_one(ctval, ref, parts, part, i, j, start, end, ste
#print "final: is " ref " ~ " ctval " ? " (ok? "yes": "no") #DEBUG
return ok
}
function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow, Mok, Hok, alldom, domok, monok, alldow, dowok, doxok) {
function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow, Mok, Hok, domok, monok, dowok) {
if (refM == "**ANY**") return 1
gsub(/\*/, "0-59", M)
@ -163,28 +163,16 @@ function ctmatch_all(M, H, dom, mon, dow, refM, refH, refdom, refmon, refdow,
gsub(/\*/, "0-23", H)
Hok = ctmatch_one(H, refH)
alldom = dom == "*"
gsub(/\*/, "1-31", dom)
domok = ctmatch_one(dom, refdom)
gsub(/\*/, "1-12", mon)
monok = ctmatch_one(mon, refmon)
alldow = dow == "*"
gsub(/\*/, "1-7", dow)
dowok = ctmatch_one(dow, refdow)
if (alldom && alldow) {
doxok = 1
} else if (alldom) {
doxok = dowok
} else if (alldow) {
doxok = domok
} else {
doxok = domok || dowok
}
return Mok && Hok && monok && doxok
return Mok && Hok && monok && (domok || dowok)
}
function print_cmd(cmd) {
print "__ctexec " quote_value(cmd)

139
reginc
View File

@ -12,111 +12,62 @@ remplacer les nombres de FROMmin à FROMmax par leur valeur correspondante,
sachant que FROMmin doit être remplacé par TO. On peut mentionner autant de
couples (FROM, TO) que nécessaire: ils seront traités dans l'ordre
$scriptname -r FROMmin-FROMmax TO FILEs...
renommer les fichiers en remplaçant les nombres de FROMmin à FROMmax par leur
valeur correspondante, sachant que FROMmin doit être remplacé par TO
OPTIONS
-n, --fake
Afficher le fichier tel qu'il serait modifié au lieu de le modifier en
place
-r, --rename
Renommer les fichiers au lieu de modifier le texte à l'intérieur du
fichier. Attention, l'ordre des arguments est différent avec cette
option"
place"
}
function process_file() {
local file from to fromb frome seds r
file="$1"; shift
[ -n "$file" ] || die "vous devez spécifier le fichier à modifier"
seds=
while [ $# -ge 2 ]; do
from="$1"
if [[ "$from" == *-* ]]; then
let fromb="${from%-*}"
let frome="${from#*-}"
else
let fromb="$from"
let frome="$from"
fi
let to="$2"; shift 2
if [ "$to" -eq "$fromb" ]; then
einfo "$fromb --> $to aucune modification n'est nécessaire"
elif [ "$to" -lt "$fromb" ]; then
einfo "$fromb-$frome --> $to-$((to+frome-fromb))"
let from=fromb
while [ "$from" -le "$frome" ]; do
seds="$seds${seds:+; }s/$from/$to/g"
let from=from+1
let to=to+1
done
elif [ "$to" -gt "$fromb" ]; then
einfo "$frome-$fromb --> $((to+frome-fromb))-$to"
let from=frome
let to=to+frome-fromb
while [ "$from" -ge "$fromb" ]; do
seds="$seds${seds:+; }s/$from/$to/g"
let from=from-1
let to=to-1
done
fi
done
edebug "Script sed: $seds"
[ -n "$Fake" ] && args=() || args=(-i)
args+=("$seds" "$file")
sed "${args[@]}"; r=$?
[ -z "$Fake" -a $r -eq 0 ]
}
Fake=
rename=
fake=
args=(
--help '$exit_with display_help'
-n,--Fake Fake=1
-r,--rename rename=1
-n,--fake fake=1
)
parse_args "$@"; set -- "${args[@]}"
if [ -n "$rename" ]; then
from="$1"; to="$2"; shift 2
file="$1"; shift
[ -n "$file" ] || die "vous devez spécifier le fichier à modifier"
froms=("$@")
ac_set_tmpfile tmptos
echo "tos=(" >>"$tmptos"
for file in "${froms[@]}"; do
qval "$file" >>"$tmptos"
done
echo ")" >>"$tmptos"
seds=
while [ $# -ge 2 ]; do
from="$1"
if [[ "$from" == *-* ]]; then
let fromb="${from%-*}"
let frome="${from#*-}"
else
let fromb="$from"
let frome="$from"
fi
let to="$2"; shift 2
Fake= process_file "$tmptos" "$from" "$to"
eval "$(<"$tmptos")"
if [ "$to" -eq "$fromb" ]; then
einfo "$fromb --> $to aucune modification n'est nécessaire"
i=0
count=${#froms[*]}
while [ $i -lt $count ]; do
from="${froms[$i]}"
to="${tos[$i]}"
if [ "$to" == "$from" ]; then
ewarn "$from: renommage non nécessaire"
else
estep "$from --> $to"
[ -z "$Fake" ] && mv "$from" "$to"
fi
let i=i+1
done
elif [ "$to" -lt "$fromb" ]; then
einfo "$fromb-$frome --> $to-$((to+frome-fromb))"
else
process_file "$@"
fi
let from=fromb
while [ "$from" -le "$frome" ]; do
seds="$seds${seds:+; }s/$from/$to/g"
let from=from+1
let to=to+1
done
elif [ "$to" -gt "$fromb" ]; then
einfo "$frome-$fromb --> $((to+frome-fromb))-$to"
let from=frome
let to=to+frome-fromb
while [ "$from" -ge "$fromb" ]; do
seds="$seds${seds:+; }s/$from/$to/g"
let from=from-1
let to=to-1
done
fi
done
edebug "Script sed: $seds"
[ -n "$fake" ] && args=() || args=(-i)
args+=("$seds" "$file")
sed "${args[@]}"