From ad44a1c2e571ea7d41fa91900830d36062b73a82 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Wed, 27 Jan 2021 17:15:36 +0400 Subject: [PATCH 01/13] dk: support build dans une image pour les projets composer --- dk | 130 ++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 89 insertions(+), 41 deletions(-) diff --git a/dk b/dk index 824c72a..ed8e49f 100755 --- a/dk +++ b/dk @@ -295,31 +295,62 @@ OPTIONS build -g, --ug, --no-update-apps ne pas mettre à jour les dépôts dépendants. ces dépôts sont définis dans le fichier update-apps.conf qui a le format suivant: - DEFAULT_DEVEL_SRCDIR= - DEFAULT_ORIGIN= - DEFAULT_BRANCH= - DEFAULT_COMPOSER_ACTION= - PROFILE_CLEAN= # fonction de nettoyage spécifique au profil - CLEAN= # ou... fonction de nettoyage par défaut - APPS=() # applications à mettre à jour par défaut - PROFILE_APPS=() # ou... spécifique au profil 'PROFILE' - app_URL= # url du dépôt - app_DEVEL_SRCDIR= # répertoire source du dépôt en mode devel - app_SRC= # répertoire/fichier source (si URL='') - app_DEST= # répertoire dans lequel faire le checkout - # ou destination si synchro avec app_SRC - app_NAME= # nom du répertoire dest si checkout; par - # défaut prendre la valeur 'app' - app_RSYNC_OPTS= # options de rsync si synchro (avec app_SRC - # ou app_DEVEL_SRCDIR) - app_PROFILE_ORIGIN= # origine spécifique au profil 'PROFILE' - app_ORIGIN= # ou... origine par défaut de la branche - app_PROFILE_BRANCH= # branche spécifique au profil 'PROFILE' - app_BRANCH= # ou... branche par défaut - app_TYPE= # type de projet (composer|none) - app_AFTER_UPDATE=() # liste de commandes à lancer après le checkout - app_COMPOSER_ACTION= # action projet composer (install|update|none) - app_COMPOSER_ARGS=() # arguments de composer install|update + ## valeurs par défaut + DEFAULT_DEVEL_SRCDIR= # répertoire de base des dépôts + DEFAULT_BRANCH= # branche par défaut pour les checkouts + DEFAULT_ORIGIN= # origine par défaut des branches + CLEAN= # fonction de nettoyage + APPS=() # applications à mettre à jour + ## valeurs par défaut pour les projets composer + COMPOSER_ACTION= # action projet composer (install|update|none) + COMPOSER_ARGS=() # arguments de composer install|update + COMPOSER_PHP= + COMPOSER_PHP_MAX= + COMPOSER_IMAGE= + COMPOSER_CMD= + COMPOSER_SETUP= + ## pour chaque application définie dans APPS + {app}_URL= # url du dépôt + {app}_DEVEL_SRCDIR= # répertoire source du dépôt en mode devel + {app}_SRC= # répertoire/fichier source (si URL='') + {app}_DEST= # répertoire dans lequel faire le checkout + # ou destination si synchro avec {app}_SRC + {app}_NAME= # nom du répertoire dest si checkout; par + # défaut prendre la valeur {app} + {app}_RSYNC_OPTS= # options de rsync si synchro avec {app}_SRC + # ou {app}_DEVEL_SRCDIR + {app}_BRANCH= # branche à sélectionner pour le checkout + {app}_ORIGIN= # origine de la branche à sélectionner + {app}_TYPE= # type de projet (composer|none) + {app}_AFTER_UPDATE=() # liste de commandes à lancer après le checkout + # valeurs pour les projets composer. ces valeurs remplacent le cas + # échéant celles définies dans le fichier .composer.conf du projet + {app}_COMPOSER_ACTION= + {app}_COMPOSER_ARGS=() + {app}_COMPOSER_PHP= + {app}_COMPOSER_PHP_MAX= + {app}_COMPOSER_IMAGE= + {app}_COMPOSER_CMD= + {app}_COMPOSER_SETUP= + Certaines valeurs peuvent être valuées selon le profil + {profile}_CLEAN= + {profile}_APPS=() + {profile}_COMPOSER_ACTION= + {profile}_COMPOSER_ARGS=() + {profile}_COMPOSER_PHP= + {profile}_COMPOSER_PHP_MAX= + {profile}_COMPOSER_IMAGE= + {profile}_COMPOSER_CMD= + {profile}_COMPOSER_SETUP= + {app}_{profile}_ORIGIN= + {app}_{profile}_BRANCH= + {app}_{profile}_COMPOSER_ACTION= + {app}_{profile}_COMPOSER_ARGS=() + {app}_{profile}_COMPOSER_PHP= + {app}_{profile}_COMPOSER_PHP_MAX= + {app}_{profile}_COMPOSER_IMAGE= + {app}_{profile}_COMPOSER_CMD= + {app}_{profile}_COMPOSER_SETUP= -u, --uu, --update-apps-only Ne faire que la mise à jour depuis les dépôts dépendants. -w, --ww, --update-apps-devel @@ -340,7 +371,7 @@ VARIABLES de update-apps.conf SRC répertoire/fichier source, si URL n'est pas défini. si ce chemin est relatif, il doit être exprimé par rapport au répertoire du projet. - IMPORTANT: dans ce cas, DEST n'est pas le répertoire de base du + IMPORTANT: si SRC est définit, DEST n'est pas le répertoire de base du checkout, mais le répertoire destination pour la synchro DEVEL_SRCDIR répertoire source pour le mode devel. attention, il s'agit du répertoire @@ -446,19 +477,23 @@ function docker_parse_build_args() { sed -r 's/([^=]+)=(.*)/\1=\2; replace_build_args+=(--build-arg \1="$\1")/' } function docker_parse_env_args() { - [ -f .build.env ] && eval "$(docker_parse_build_args .build.env)" + [ -f .build.env ] && eval "$(docker_parse_build_args .build.env)" # DEPRECATED [ -f build.env ] && eval "$(docker_parse_build_args build.env)" - [ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && eval "$(docker_parse_build_args ".build.$PROFILE.env")" + [ -f build.env.local ] && eval "$(docker_parse_build_args build.env.local)" + [ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && eval "$(docker_parse_build_args ".build.$PROFILE.env")" # DEPRECATED [ -n "$PROFILE" -a -f "build.$PROFILE.env" ] && eval "$(docker_parse_build_args "build.$PROFILE.env")" + [ -n "$PROFILE" -a -f "build.$PROFILE.env.local" ] && eval "$(docker_parse_build_args "build.$PROFILE.env.local")" } function docker_set_env_args() { - [ -f .build.env ] && source ./.build.env + [ -f .build.env ] && source ./.build.env # DEPRECATED [ -f build.env ] && source ./build.env - [ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && source "./.build.$PROFILE.env" + [ -f build.env.local ] && source ./build.env.local + [ -n "$PROFILE" -a -f ".build.$PROFILE.env" ] && source "./.build.$PROFILE.env" # DEPRECATED [ -n "$PROFILE" -a -f "build.$PROFILE.env" ] && source "./build.$PROFILE.env" + [ -n "$PROFILE" -a -f "build.$PROFILE.env.local" ] && source "./build.$PROFILE.env.local" } function docker_check_name() { - [ -n "$NAME" ] || die "Vous devez définir NAME dans .build.env" + [ -n "$NAME" ] || die "Vous devez définir NAME dans build.env" if [ "$1" == set_container_name ]; then project_name="$NAME" @@ -754,8 +789,7 @@ function build_update_apps() { fi etitle "Mise à jour des dépendances" - local app var URL SRC DEVEL_SRCDIR DEST NAME have_RSYNC_OPTS RSYNC_OPTS ORIGIN BRANCH TYPE after_update after_updates composer_action - local -a composer_args + local app var URL SRC DEVEL_SRCDIR DEST NAME have_RSYNC_OPTS RSYNC_OPTS ORIGIN BRANCH TYPE after_update after_updates for app in "${APPS[@]}"; do etitle "$app" @@ -935,13 +969,27 @@ function build_update_apps() { estep "Type de dépôt: $TYPE" if [ "$TYPE" == composer ]; then + local cvname cvvalue + local composer_php composer_php_max composer_image composer_cmd composer_setup composer_action + local -a composer_vars composer_args + + for cvname in composer_php composer_php_max composer_image composer_cmd composer_setup; do + cvvalue="${var}_${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}" + [ -n "$cvvalue" ] || { cvvalue="${var}_${cvname^^}"; cvvalue="${!cvvalue}"; } + [ -n "$cvvalue" ] || { cvvalue="${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"; } + [ -n "$cvvalue" ] || { cvvalue="${cvname^^}"; cvvalue="${!cvvalue}"; } + [ -n "$cvvalue" ] && composer_vars+=("${cvname^^}=$cvvalue") + done + composer_action="${var}_${PROFILE}_COMPOSER_ACTION"; composer_action="${!composer_action}" [ -n "$composer_action" ] || { composer_action="${var}_COMPOSER_ACTION"; composer_action="${!composer_action}"; } - [ -n "$composer_action" ] || composer_action="$DEFAULT_COMPOSER_ACTION" + [ -n "$composer_action" ] || { composer_action="${PROFILE}_COMPOSER_ACTION"; composer_action="${!composer_action}"; } + [ -n "$composer_action" ] || composer_action="$COMPOSER_ACTION" composer_args="${var}_${PROFILE}_COMPOSER_ARGS" is_defined "$composer_args" || composer_args="${var}_COMPOSER_ARGS" - is_defined "$composer_args" || composer_args="DEFAULT_COMPOSER_ARGS" + is_defined "$composer_args" || composer_args="${PROFILE}_COMPOSER_ARGS" + is_defined "$composer_args" || composer_args="COMPOSER_ARGS" composer_args="${composer_args}[@]"; composer_args=("${!composer_args}") if [ -z "$BUILD_UPDATE_DEVEL" ]; then @@ -955,7 +1003,7 @@ function build_update_apps() { setx cwd=pwd cd "$DEST" estep "Installation des dépendances composer" - auto_composer "$composer_action" "${composer_args[@]}" || { eend; return 1; } + auto_composer "${composer_vars[@]}" "$composer_action" "${composer_args[@]}" || { eend; return 1; } cd "$cwd" fi fi @@ -1826,7 +1874,7 @@ function auto_composer() { local COMPOSER_CMD= local COMPOSER_SETUP= [ -f .composer.conf ] && source ./.composer.conf - # les premiers arguments peuvent service à redéfinir les variables + # les premiers arguments peuvent servir à redéfinir les variables while [ $# -gt 0 ]; do case "$1" in COMPOSER_PHP=*) setv "$1"; shift;; @@ -1840,7 +1888,9 @@ function auto_composer() { done local use_image - if [ -n "$COMPOSER_PHP_MAX" -a "$COMPOSER_PHP_MAX" != none ]; then + if [ "$COMPOSER_PHP" == force -o "$COMPOSER_PHP" == any ]; then + use_image=1 + elif [ -n "$COMPOSER_PHP_MAX" -a "$COMPOSER_PHP_MAX" != none ]; then # Vérifier la version de PHP php -r ' $version = $argv[1]; @@ -1856,8 +1906,6 @@ exit((PHP_VERSION_ID > $version)? 0: 1); elif [ -z "$COMPOSER_PHP" ]; then # pas de version minimum, tester simplement la valeur de COMPOSER_IMAGE [ "$COMPOSER_IMAGE" != none ] && use_image=1 - elif [ "$COMPOSER_PHP" == force -o "$COMPOSER_PHP" == any ]; then - use_image=1 else # Vérifier la version de PHP php -r ' @@ -1966,7 +2014,7 @@ fi DEFAULT_PROFILE=devel # pour le moment ne pas lancer composer dans un container par défaut -DEFAULT_COMPOSER_IMAGE=none #docker.univ-reunion.fr/image/apache-php-myiccas-utils:d10 +DEFAULT_COMPOSER_IMAGE=none #docker.univ-reunion.fr/image/phpbuilder PROFILE= DM_ALIASES=() DM_PROFILES=() From f1a9c7a5e5e9662a5c39dc2234fa7fceb0391efe Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Fri, 29 Jan 2021 12:10:15 +0400 Subject: [PATCH 02/13] =?UTF-8?q?dk:=20d=C3=A9but=20support=20projets=20ma?= =?UTF-8?q?ven?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dk | 324 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 310 insertions(+), 14 deletions(-) diff --git a/dk b/dk index ed8e49f..299a6e6 100755 --- a/dk +++ b/dk @@ -206,8 +206,7 @@ COMMANDES 70300 pour PHP 7.3 Si la valeur n'est pas spécifiée ou vaut 'none', elle est ignorée. * COMPOSER_IMAGE -- Image utilisée pour lancer composer. La valeur par - défaut est: - $DEFAULT_COMPOSER_IMAGE + défaut est $DEFAULT_COMPOSER_IMAGE Spécifier 'none' pour lancer directement composer sans passer par une image docker. L'image spécifiée doit disposer de la commande 'su-exec' afin de @@ -235,6 +234,41 @@ COMMANDES peuvent être utilisés pour redéfinir les variables COMPOSER_*, e.g $scriptname composer COMPOSER_IMAGE=none install + maven|mvn [args...] + Frontend pour lancer maven à l'intérieur d'un container. S'il existe un + fichier .maven.conf dans le répertoire du projet, il est sourcé. Ce + fichier définit des variables qui indiquent comment la commande mvn est + lancée. Les variables suivantes peuvent être définies: + * MAVEN_JAVA -- Version de java à sélectionner à l'intérieur de + l'image. Spécifier 'any' ou 'force' pour prendre la valeur par + défaut. Spécifier 'none' pour ne pas utiliser l'image + * MAVEN_IMAGE -- Image utilisée pour lancer mvn. La valeur par défaut + est $DEFAULT_MAVEN_IMAGE + Spécifier 'none' pour lancer directement mvn sans passer par une image + docker. + L'image spécifiée doit disposer de la commande 'su-exec' afin de + pouvoir lancer la commande avec l'utilisateur courant. Le répertoire + \$HOME est monté à l'intérieur du container + * MAVEN_MACHINE -- Nom de la docker machine sur laquelle se connecter + pour lancer l'image docker. La valeur par défaut est -u, ce qui force + l'utilisation de l'instance docker locale. + * MAVEN_CMD -- Chemin vers l'exécutable mvn. Par défaut, utiliser la + commande trouvée dans le PATH + * MAVEN_SETUP -- Liste de commandes à lancer pour configurer le + container. Dans ce cas, un container ayant pour base \$MAVEN_IMAGE + et nommé d'après le nom du projet est préparé et les commandes + spécifiées y sont lancées. Ce container est réutilisé à chaque fois. + Ce paramétrage est utilisé pour par exemple installer certains + packages nécessaire au projet. + La commande 'rshell' est une extension qui lance un shell bash au lieu + de lancer la commande mvn, ce qui permet de faire des opérations + plus complexes si le besoin s'en fait sentir. NB: le shell est lancé + avec l'utilisateur root. La commande alternative 'shell' lance le shell + avec le compte utilisateur. + Pour faciliter l'utilisation dans un script, les premiers arguments + peuvent être utilisés pour redéfinir les variables MAVEN_*, e.g + $scriptname maven MAVEN_IMAGE=none clean package + OPTIONS générales (ces options sont communes à toutes les commandes) -d, --chdir PROJDIR @@ -309,6 +343,13 @@ OPTIONS build COMPOSER_IMAGE= COMPOSER_CMD= COMPOSER_SETUP= + ## valeurs par défaut pour les projets maven + MAVEN_ACTION= # action projet maven (package|none) + MAVEN_ARGS=() # arguments de mvn + MAVEN_JAVA= + MAVEN_IMAGE= + MAVEN_CMD= + MAVEN_SETUP= ## pour chaque application définie dans APPS {app}_URL= # url du dépôt {app}_DEVEL_SRCDIR= # répertoire source du dépôt en mode devel @@ -322,7 +363,10 @@ OPTIONS build {app}_BRANCH= # branche à sélectionner pour le checkout {app}_ORIGIN= # origine de la branche à sélectionner {app}_TYPE= # type de projet (composer|none) - {app}_AFTER_UPDATE=() # liste de commandes à lancer après le checkout + {app}_BEFORE_BUILD=() # liste de commandes à lancer après le + # checkout et avant le build du projet (pour + # les types de projets supportés) + {app}_AFTER_UPDATE=() # liste de commandes à lancer après le build # valeurs pour les projets composer. ces valeurs remplacent le cas # échéant celles définies dans le fichier .composer.conf du projet {app}_COMPOSER_ACTION= @@ -332,6 +376,12 @@ OPTIONS build {app}_COMPOSER_IMAGE= {app}_COMPOSER_CMD= {app}_COMPOSER_SETUP= + {app}_MAVEN_ACTION= + {app}_MAVEN_ARGS=() + {app}_MAVEN_JAVA= + {app}_MAVEN_IMAGE= + {app}_MAVEN_CMD= + {app}_MAVEN_SETUP= Certaines valeurs peuvent être valuées selon le profil {profile}_CLEAN= {profile}_APPS=() @@ -351,6 +401,12 @@ OPTIONS build {app}_{profile}_COMPOSER_IMAGE= {app}_{profile}_COMPOSER_CMD= {app}_{profile}_COMPOSER_SETUP= + {app}_{profile}_MAVEN_ACTION= + {app}_{profile}_MAVEN_ARGS=() + {app}_{profile}_MAVEN_JAVA= + {app}_{profile}_MAVEN_IMAGE= + {app}_{profile}_MAVEN_CMD= + {app}_{profile}_MAVEN_SETUP= -u, --uu, --update-apps-only Ne faire que la mise à jour depuis les dépôts dépendants. -w, --ww, --update-apps-devel @@ -384,8 +440,10 @@ VARIABLES de update-apps.conf Pour toutes les variables de type BRANCH, utiliser la syntaxe ^COMMIT pour ignorer ORIGIN et sélectionner un commit en particulier TYPE - vaut 'composer' par défaut si le fichier composer.json existe à la - racine du projet. sinon vaut 'none' par défaut + la valeur par défaut dépend des fichiers présents à la racine du projet + - si un fichier composer.json existe, vaut 'composer' par défaut + - si un fichier pom.xml existe, vaut 'maven' par défaut + - sinon vaut 'none' par défaut AFTER_UPDATE Cette variable est une liste de commandes à lancer après la maj du dépôt - si le chemin est absolu ou relatif, lancer la commande telle quelle @@ -789,7 +847,8 @@ function build_update_apps() { fi etitle "Mise à jour des dépendances" - local app var URL SRC DEVEL_SRCDIR DEST NAME have_RSYNC_OPTS RSYNC_OPTS ORIGIN BRANCH TYPE after_update after_updates + local app var URL SRC DEVEL_SRCDIR DEST NAME have_RSYNC_OPTS RSYNC_OPTS ORIGIN BRANCH TYPE + local before_build before_builds after_update after_updates for app in "${APPS[@]}"; do etitle "$app" @@ -848,6 +907,7 @@ function build_update_apps() { # possible de détecter le type quand on a le projet # en cas de maj ici, mettre à jour aussi le code ci-dessous if [ -f "$DEST/composer.json" ]; then TYPE=composer + elif [ -f "$DEST/pom.xml" ]; then TYPE=maven else TYPE=none fi fi @@ -899,6 +959,7 @@ function build_update_apps() { # possible de détecter le type quand on a le projet # en cas de maj ici, mettre à jour aussi le code ci-dessus et ci-dessous if [ -f "$DEST/composer.json" ]; then TYPE=composer + elif [ -f "$DEST/pom.xml" ]; then TYPE=maven else TYPE=none fi fi @@ -949,6 +1010,7 @@ function build_update_apps() { # possible de détecter le type quand on a le projet # en cas de maj ici, mettre à jour aussi le code ci-dessus if [ -f "$DEST/composer.json" ]; then TYPE=composer + elif [ -f "$DEST/pom.xml" ]; then TYPE=maven else TYPE=none fi fi @@ -958,14 +1020,30 @@ function build_update_apps() { die "ni URL ni SRC ne sont définis" fi - after_updates="${var}_AFTER_UPDATE" - if is_defined "$after_updates"; then - after_updates="$after_updates[@]"; after_updates=("${!after_updates}") - elif [ "$TYPE" == composer ]; then - after_updates=(sqlmig) + before_builds="${var}_BEFORE_BUILD" + if is_defined "$before_builds"; then + before_builds="$before_builds[@]"; before_builds=("${!before_builds}") else - after_updates=() + before_builds=() fi + for before_build in "${before_builds[@]}"; do + if [ "${before_build#/}" != "$before_build" ]; then + # commande absolue, la lancer telle quelle + etitle "$before_build" + eval "$before_build" || { eend; eend; return 1; } + eend + elif [ "${before_build#./}" != "$before_build" ]; then + # commande relative, la lancer telle quelle + etitle "$before_build" + eval "$before_build" || { eend; eend; return 1; } + eend + else + # c'est une fonction update_apps_func_* + etitle "$before_build" + eval "update_apps_func_$before_build" || { eend; eend; return 1; } + eend + fi + done estep "Type de dépôt: $TYPE" if [ "$TYPE" == composer ]; then @@ -1007,8 +1085,56 @@ function build_update_apps() { cd "$cwd" fi fi + elif [ "$TYPE" == maven ]; then + local cvname cvvalue + local maven_java maven_image maven_cmd maven_setup maven_action + local -a maven_vars maven_args + + for cvname in maven_java maven_image maven_cmd maven_setup; do + cvvalue="${var}_${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}" + [ -n "$cvvalue" ] || { cvvalue="${var}_${cvname^^}"; cvvalue="${!cvvalue}"; } + [ -n "$cvvalue" ] || { cvvalue="${PROFILE}_${cvname^^}"; cvvalue="${!cvvalue}"; } + [ -n "$cvvalue" ] || { cvvalue="${cvname^^}"; cvvalue="${!cvvalue}"; } + [ -n "$cvvalue" ] && maven_vars+=("${cvname^^}=$cvvalue") + done + + maven_action="${var}_${PROFILE}_MAVEN_ACTION"; maven_action="${!maven_action}" + [ -n "$maven_action" ] || { maven_action="${var}_MAVEN_ACTION"; maven_action="${!maven_action}"; } + [ -n "$maven_action" ] || { maven_action="${PROFILE}_MAVEN_ACTION"; maven_action="${!maven_action}"; } + [ -n "$maven_action" ] || maven_action="$MAVEN_ACTION" + + maven_args="${var}_${PROFILE}_MAVEN_ARGS" + is_defined "$maven_args" || maven_args="${var}_MAVEN_ARGS" + is_defined "$maven_args" || maven_args="${PROFILE}_MAVEN_ARGS" + is_defined "$maven_args" || maven_args="MAVEN_ARGS" + maven_args="${maven_args}[@]"; maven_args=("${!maven_args}") + + if [ -z "$BUILD_UPDATE_DEVEL" ]; then + case "${maven_action:-p}" in + c|clean) maven_action=clean;; + po|package_only) maven_action=package;; + p|package) maven_action="clean package";; + none|nop) maven_action=;; + *) ewarn "$maven_action: action invalide"; maven_action=;; + esac + if [ -n "$maven_action" ]; then + setx cwd=pwd + cd "$DEST" + estep "Compilation du projet maven" + auto_maven "${maven_vars[@]}" $maven_action "${maven_args[@]}" || { eend; return 1; } + cd "$cwd" + fi + fi fi + after_updates="${var}_AFTER_UPDATE" + if is_defined "$after_updates"; then + after_updates="$after_updates[@]"; after_updates=("${!after_updates}") + elif [ "$TYPE" == composer ]; then + after_updates=(sqlmig) + else + after_updates=() + fi for after_update in "${after_updates[@]}"; do if [ "${after_update#/}" != "$after_update" ]; then # commande absolue, la lancer telle quelle @@ -1940,6 +2066,166 @@ exit((PHP_VERSION_ID < $version)? 0: 1); fi } +function default_local_maven() { + # lancement direct + case "$1" in + rootshell|rshell|rootbash|rbash) + shift + # ewarn parce qu'on est pas root dans ce shell contrairement à ce qui est demandé + ewarn "Lancement d'un shell utilisateur alors qu'un shell root est demandé" + bash "$@" + ;; + usershell|shell|userbash|bash) + shift + estep "Lancement d'un shell utilisateur" + bash "$@" + ;; + *) + [ -n "$MAVEN_CMD" ] || MAVEN_CMD=mvn + "$MAVEN_CMD" "$@" + ;; + esac +} +function default_docker_maven() { + # lancement dans un container + local user group projdir actualcmd args + setx user=id -un; setx user=getent passwd "$user" + setx group=id -gn; setx group=getent group "$group" + setx projdir=pwd + case "$1" in + rootshell|rshell|rootbash|rbash) + shift + actualcmd='eval "bash $args"' + ;; + usershell|shell|userbash|bash) + shift + actualcmd='eval "su-exec \"$user\" bash $args"' + ;; + *) + actualcmd='eval "su-exec \"$user\" \"$maven\" $args"' + ;; + esac + setx args=qvals "$@" + + local -a basecmd cmd setupscript runscript + basecmd=( + -e user="$user" + -e group="$group" + -e projdir="$projdir" + -e setup="$MAVEN_SETUP" + -e maven="$MAVEN_CMD" + -e args="$args" + ${MAVEN_JAVA:+-e JAVA="$MAVEN_JAVA"} + -v "$HOME:$HOME" + ) + if [ "${projdir#$HOME/}" == "$projdir" ]; then + # si le répertoire de projet ne se trouve pas dans $HOME, le monter aussi + cmd+=(-v "$projdir:$projdir") + fi + setupscript='eval "$setup"' + runscript=' +echo "$user" >>/etc/passwd; user="${user%%:*}" +echo "$group" >>/etc/group; group="${group%%:*}" + +[ -n "$maven" ] || maven=mvn + +cd "$projdir" +'"$actualcmd" + + if [ -n "$MAVEN_SETUP" ]; then + # lancement dans un container docker à préparer + local NAME project_name container_name dkid + if [ -f docker-compose.yml ]; then + compose_set_project_name set_container_name + else + NAME="$(basename -- "$(pwd)")" + docker_check_name set_container_name + fi + container_name="dk_maven_${container_name}" + + # vérifier l'existence de l'image + setx dkid=docker image ls --format '{{.ID}}' "${container_name}_image" + + # créer le container le cas échéant + if [ -z "$dkid" ]; then + estep "Création du container $container_name avec l'image $MAVEN_IMAGE" + cmd=( + "$DOCKER" create -it --name "${container_name}_ct" + "${basecmd[@]}" + "$MAVEN_IMAGE" + bash -c "$setupscript" + ) + setx dkid="${cmd[@]}" || return 1 + "$DOCKER" container start -ai "$dkid" || return 1 + "$DOCKER" container commit "$dkid" "${container_name}_image" || return 1 + "$DOCKER" container rm "$dkid" || return 1 + fi + + # prendre comme image le container créé + MAVEN_IMAGE="${container_name}_image" + fi + + cmd=( + "$DOCKER" run -it --rm + "${basecmd[@]}" + "$MAVEN_IMAGE" + bash -c "$runscript" + ) + "${cmd[@]}" +} +function local_maven() { default_local_maven "$@"; } +function docker_maven() { default_docker_maven "$@"; } +function auto_maven() { + local MAVEN_JAVA= + local MAVEN_IMAGE="$DEFAULT_MAVEN_IMAGE" + local MAVEN_MACHINE=-u + local MAVEN_CMD= + local MAVEN_SETUP= + [ -f .maven.conf ] && source ./.maven.conf + # les premiers arguments peuvent servir à redéfinir les variables + while [ $# -gt 0 ]; do + case "$1" in + MAVEN_JAVA=*) setv "$1"; shift;; + MAVEN_IMAGE=*) setv "$1"; shift;; + MAVEN_MACHINE=*) setv "$1"; shift;; + MAVEN_CMD=*) setv "$1"; shift;; + MAVEN_SETUP=*) setv "$1"; shift;; + *) break;; + esac + done + + local use_image + if [ "$MAVEN_JAVA" == force -o "$MAVEN_JAVA" == any ]; then + MAVEN_JAVA= + use_image=1 + elif [ "$MAVEN_JAVA" == none ]; then + MAVEN_JAVA= + use_image= + else + use_image=1 + fi + if [ -n "$use_image" ]; then + [ "$MAVEN_IMAGE" != none ] || die "Vous devez spécifier l'image à utiliser pour maven" + + local PREVIOUS_DOCKER_MACHINE_NAME="$DOCKER_MACHINE_NAME" + if [ -n "$MAVEN_MACHINE" -a "$DOCKER_MACHINE_NAME" != "$MAVEN_MACHINE" ]; then + local -x DOCKER_TLS_VERIFY= DOCKER_HOST= DOCKER_CERT_PATH= DOCKER_MACHINE_NAME= + if [ "$MAVEN_MACHINE" != -u ]; then + local env + setx env=docker-machine env "$MAVEN_MACHINE" 2>/dev/null || { + eerror "$MAVEN_MACHINE: une erreur s'est produite lors de la sélection du noeud avec docker-machine" + return 1 + } + eval "$env" + fi + fi + + docker_maven "$@" + else + local_maven "$@" + fi +} + ################################################################################ function resolve_dm_alias() { @@ -2013,8 +2299,8 @@ else DOCKER=docker fi DEFAULT_PROFILE=devel -# pour le moment ne pas lancer composer dans un container par défaut -DEFAULT_COMPOSER_IMAGE=none #docker.univ-reunion.fr/image/phpbuilder +DEFAULT_COMPOSER_IMAGE=docker.univ-reunion.fr/image/phpbuilder +DEFAULT_MAVEN_IMAGE=docker.univ-reunion.fr/image/javabuilder PROFILE= DM_ALIASES=() DM_PROFILES=() @@ -2545,6 +2831,16 @@ NR == 1 { print; next } done auto_composer "${args[@]}" ;; + maven|mvn) + build_set_options "$update_apps_mode" "$update_apps_origin" "$update_apps_branch" + [ -f .build.scripts.sh ] && source ./.build.scripts.sh + [ -f build.scripts.sh ] && source ./build.scripts.sh + args=() + while [ $# -gt 0 -a "$1" != -- ]; do + args+=("$1"); shift + done + auto_maven "${args[@]}" + ;; _*|*_) # transmettre directement à docker cmd="${cmd#_}" From 543d2d2f797628ef917f00fbded3f2958fd5923c Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Tue, 2 Feb 2021 06:18:35 +0400 Subject: [PATCH 03/13] dk: mvn est aussi un frontend pour lancer java --- dk | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 16 deletions(-) diff --git a/dk b/dk index 299a6e6..a7697cf 100755 --- a/dk +++ b/dk @@ -182,9 +182,10 @@ COMMANDES Supprimer les containers et les images inutilisées composer|ci|cu|cr|cs [args...] - Frontend pour lancer composer à l'intérieur d'un container. Les - commandes 'ci', 'cu', 'cr', 'cs' sont des alias pour 'composer install', - 'composer update', 'composer rshell' et 'composer shell' respectivement + Frontend pour lancer composer à l'intérieur d'un container. + Les commandes 'ci', 'cu', 'cr', 'cs' sont des aliases pour 'composer + install', 'composer update', 'composer rshell' et 'composer shell' + respectivement S'il existe un fichier .composer.conf dans le répertoire du projet, il est sourcé. Ce fichier définit des variables qui indiquent comment la commande composer est lancée. Les variables suivantes peuvent être @@ -234,18 +235,20 @@ COMMANDES peuvent être utilisés pour redéfinir les variables COMPOSER_*, e.g $scriptname composer COMPOSER_IMAGE=none install - maven|mvn [args...] - Frontend pour lancer maven à l'intérieur d'un container. S'il existe un - fichier .maven.conf dans le répertoire du projet, il est sourcé. Ce - fichier définit des variables qui indiquent comment la commande mvn est - lancée. Les variables suivantes peuvent être définies: + maven|mvn|mvr|mvs|java [args...] + Frontend pour lancer maven ou Java à l'intérieur d'un container. + Les commandes 'mvr', 'mvs' et 'java' sont des aliases pour 'maven + rshell', 'maven shell' et 'maven java' respectivement + S'il existe un fichier .maven.conf dans le répertoire du projet, il est + sourcé. Ce fichier définit des variables qui indiquent comment la + commande mvn est lancée. Les variables suivantes peuvent être définies: * MAVEN_JAVA -- Version de java à sélectionner à l'intérieur de l'image. Spécifier 'any' ou 'force' pour prendre la valeur par défaut. Spécifier 'none' pour ne pas utiliser l'image * MAVEN_IMAGE -- Image utilisée pour lancer mvn. La valeur par défaut est $DEFAULT_MAVEN_IMAGE Spécifier 'none' pour lancer directement mvn sans passer par une image - docker. + docker, même si MAVEN_JAVA est renseigné. L'image spécifiée doit disposer de la commande 'su-exec' afin de pouvoir lancer la commande avec l'utilisateur courant. Le répertoire \$HOME est monté à l'intérieur du container @@ -265,6 +268,9 @@ COMMANDES plus complexes si le besoin s'en fait sentir. NB: le shell est lancé avec l'utilisateur root. La commande alternative 'shell' lance le shell avec le compte utilisateur. + La commande 'java' est une extension qui lance directement java au lieu + de lancer la commande mvn. Il est possible de spécifier la version de + java à sélectionner dans l'image e.g 'java7', 'java8', 'java11' Pour faciliter l'utilisation dans un script, les premiers arguments peuvent être utilisés pour redéfinir les variables MAVEN_*, e.g $scriptname maven MAVEN_IMAGE=none clean package @@ -2009,6 +2015,7 @@ function auto_composer() { COMPOSER_MACHINE=*) setv "$1"; shift;; COMPOSER_CMD=*) setv "$1"; shift;; COMPOSER_SETUP=*) setv "$1"; shift;; + COMPOSER_*=*) shift;; # ignorer variable inconnue *) break;; esac done @@ -2068,6 +2075,11 @@ exit((PHP_VERSION_ID < $version)? 0: 1); function default_local_maven() { # lancement direct + if [ -n "$MAVEN_JAVA" ]; then + urequire java + select_java_exact "$MAVEN_JAVA" || die + fi + case "$1" in rootshell|rshell|rootbash|rbash) shift @@ -2080,6 +2092,10 @@ function default_local_maven() { estep "Lancement d'un shell utilisateur" bash "$@" ;; + java) + shift + java "$@" + ;; *) [ -n "$MAVEN_CMD" ] || MAVEN_CMD=mvn "$MAVEN_CMD" "$@" @@ -2101,6 +2117,10 @@ function default_docker_maven() { shift actualcmd='eval "su-exec \"$user\" bash $args"' ;; + java) + shift + actualcmd='eval "su-exec \"$user\" java $args"' + ;; *) actualcmd='eval "su-exec \"$user\" \"$maven\" $args"' ;; @@ -2190,10 +2210,21 @@ function auto_maven() { MAVEN_MACHINE=*) setv "$1"; shift;; MAVEN_CMD=*) setv "$1"; shift;; MAVEN_SETUP=*) setv "$1"; shift;; + MAVEN_*=*) shift;; # ignorer variable inconnue *) break;; esac done + local version + case "$1" in + java*) + version="${1#java}" + [ -n "$version" ] && MAVEN_JAVA="$version" + shift + set -- java "$@" + ;; + esac + local use_image if [ "$MAVEN_JAVA" == force -o "$MAVEN_JAVA" == any ]; then MAVEN_JAVA= @@ -2201,7 +2232,7 @@ function auto_maven() { elif [ "$MAVEN_JAVA" == none ]; then MAVEN_JAVA= use_image= - else + elif [ "$MAVEN_IMAGE" != none ]; then use_image=1 fi if [ -n "$use_image" ]; then @@ -2821,21 +2852,41 @@ NR == 1 { print; next } [ -f .build.scripts.sh ] && source ./.build.scripts.sh [ -f build.scripts.sh ] && source ./build.scripts.sh args=() - if [ "$cmd" == ci ]; then args+=(install) - elif [ "$cmd" == cu ]; then args+=(update) - elif [ "$cmd" == cr ]; then args+=(rshell) - elif [ "$cmd" == cs ]; then args+=(shell) - fi + while [ $# -gt 0 -a "$1" != -- ]; do + if [[ "$1" == COMPOSER_*=* ]]; then + args+=("$1"); shift + else + break + fi + done + case "$cmd" in + ci) args+=(install);; + cu) args+=(update);; + cr) args+=(rshell);; + cs) args+=(shell);; + esac while [ $# -gt 0 -a "$1" != -- ]; do args+=("$1"); shift done auto_composer "${args[@]}" ;; - maven|mvn) + maven|mvn|mvr|mvs|java*) build_set_options "$update_apps_mode" "$update_apps_origin" "$update_apps_branch" [ -f .build.scripts.sh ] && source ./.build.scripts.sh [ -f build.scripts.sh ] && source ./build.scripts.sh args=() + while [ $# -gt 0 -a "$1" != -- ]; do + if [[ "$1" == MAVEN_*=* ]]; then + args+=("$1"); shift + else + break + fi + done + case "$cmd" in + mvr) args+=(rshell);; + mvs) args+=(shell);; + java*) args+=("$cmd");; + esac while [ $# -gt 0 -a "$1" != -- ]; do args+=("$1"); shift done From b3983edd2ac9f892a58c7dee1e2272bb0bd06251 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Wed, 3 Feb 2021 17:30:54 +0400 Subject: [PATCH 04/13] =?UTF-8?q?dk:=20support=20des=20mappings=20d'h?= =?UTF-8?q?=C3=B4tes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dk | 146 ++++++++++++++++++++++++++++++++++--------------- lib/default/dk | 15 ++++- 2 files changed, 116 insertions(+), 45 deletions(-) diff --git a/dk b/dk index a7697cf..6b6255c 100755 --- a/dk +++ b/dk @@ -341,7 +341,9 @@ OPTIONS build DEFAULT_ORIGIN= # origine par défaut des branches CLEAN= # fonction de nettoyage APPS=() # applications à mettre à jour + HOST_MAPPINGS=() # mappings d'hôtes pour les builds docker ## valeurs par défaut pour les projets composer + COMPOSER_DEVEL_SRCDIR= # répertoire de base des projets composer COMPOSER_ACTION= # action projet composer (install|update|none) COMPOSER_ARGS=() # arguments de composer install|update COMPOSER_PHP= @@ -350,6 +352,7 @@ OPTIONS build COMPOSER_CMD= COMPOSER_SETUP= ## valeurs par défaut pour les projets maven + MAVEN_DEVEL_SRCDIR= # répertoire de base des projets maven MAVEN_ACTION= # action projet maven (package|none) MAVEN_ARGS=() # arguments de mvn MAVEN_JAVA= @@ -391,6 +394,7 @@ OPTIONS build Certaines valeurs peuvent être valuées selon le profil {profile}_CLEAN= {profile}_APPS=() + {profile}_HOST_MAPPINGS=() {profile}_COMPOSER_ACTION= {profile}_COMPOSER_ARGS=() {profile}_COMPOSER_PHP= @@ -418,7 +422,8 @@ OPTIONS build -w, --ww, --update-apps-devel Faire la mise à jour en mode devel: le projet ainsi que ses fichiers des répertoires vendor/lib et vendor/ur sont synchronisés via rsync depuis - \$DEFAULT_DEVEL_SRCDIR qui vaut par défaut \$HOME/wop/php + \$DEFAULT_DEVEL_SRCDIR, \$COMPOSER_DEVEL_SRCDIR ou \$MAVEN_DEVEL_SRCDIR + en fonction du type de projet --uo, --update-apps-origin ORIGIN Spécifier l'origine par défaut pour update-apps --ub, --update-apps-branch BRANCH @@ -437,8 +442,8 @@ VARIABLES de update-apps.conf checkout, mais le répertoire destination pour la synchro DEVEL_SRCDIR répertoire source pour le mode devel. attention, il s'agit du répertoire - du projet, alors que DEFAULT_DEVEL_SRCDIR est le répertoire de base par - défaut des projets + du projet, alors que DEFAULT_DEVEL_SRCDIR, COMPOSER_DEVEL_SRCDIR et + MAVEN_DEVEL_SRCDIR sont les répertoires de base par défaut des projets ORIGIN vaut 'origin' par défaut BRANCH @@ -450,8 +455,13 @@ VARIABLES de update-apps.conf - si un fichier composer.json existe, vaut 'composer' par défaut - si un fichier pom.xml existe, vaut 'maven' par défaut - sinon vaut 'none' par défaut + BEFORE_BUILD + Cette variable est une liste de commandes à lancer après le clonage (ou + la mise à jour) du dépôt et avant le build, en fonction du type de + projet. La syntaxe à utiliser est la même que pour AFTER_UPDATE AFTER_UPDATE Cette variable est une liste de commandes à lancer après la maj du dépôt + et le build éventuel du projet - si le chemin est absolu ou relatif, lancer la commande telle quelle - s'il n'y a pas de chemin, alors ce doit être le nom d'une fonction existante auquel on enlève le préfixe update_apps_func_ @@ -470,14 +480,23 @@ VARIABLES de update-apps.conf TYPE= # type de projet (composer|none) COMPOSER_ACTION vaut 'install' par défaut. Indique ce qu'il faut faire pour un projet de - type 'composer' après avoir lancé les commandes de AFTER_UPDATE. Les - directives supportées sont 'install', 'update' et 'none' + type 'composer' après avoir lancé les commandes de BEFORE_BUILD et avant + les commandes de AFTER_UPDATE. Les directives supportées sont 'install', + 'update' et 'none' COMPOSER_ARGS - options à utiliser avec composer install|update. La valeur par défaut - dépend du profil: + options à utiliser avec 'composer \$COMPOSER_ACTION'. La valeur par + défaut dépend du profil: prod: --no-dev -o test: --no-dev -o autres: (pas d'options) + MAVEN_ACTION + vaut 'package' par défaut. Indique ce qu'il faut faire pour un projet de + type 'maven' après avoir lancé les commandes de BEFORE_BUILD et avant + les commandes de AFTER_UPDATE. Les directives supportées sont 'package' + (alias de 'clean package'), 'package_only' qui ne lance pas de clean + avant le build, et 'none' + MAVEN_ARGS + options à utiliser avec la commande 'mvn \$MAVEN_ACTION' FONCTIONS de update-apps.conf sqlmig [DESTDIR [SRCDIR [NOFIX]]] @@ -807,6 +826,7 @@ function update_apps_func_pff() { } function update_apps_func_mvn() { + # XXX obsolète: remplacé par le support natif des projets maven local cwd="$(pwd)" cd "$DEST" mvn "$@" || die @@ -818,17 +838,16 @@ function build_update_apps() { [ -f update-apps.conf ] || return 0 # charger le fichier de configuration - local DEFAULT_ORIGIN DEFAULT_BRANCH APPS + local DEFAULT_ORIGIN DEFAULT_BRANCH + local -a APPS DEFAULT_ORIGIN="$UPDATE_APPS_ORIGIN" [ -z "$DEFAULT_ORIGIN" ] && DEFAULT_ORIGIN=origin DEFAULT_BRANCH="$UPDATE_APPS_BRANCH" #XXX à terme, ne déployer en prod que la branche master [ -z "$DEFAULT_BRANCH" -a "$PROFILE" == prod ] && DEFAULT_BRANCH=develop #XXX master [ -z "$DEFAULT_BRANCH" ] && DEFAULT_BRANCH=develop - DEFAULT_DEVEL_SRCDIR="$HOME/wop/php" - DEFAULT_COMPOSER_ACTION=install - APPS=() CLEAN= + APPS=() [ -f update-apps.conf ] && source ./update-apps.conf local apps # liste des applications spécifique au profil @@ -869,11 +888,6 @@ function build_update_apps() { fi fi - DEVEL_SRCDIR="${var}_DEVEL_SRCDIR"; DEVEL_SRCDIR="${!DEVEL_SRCDIR}" - if [ -z "$DEVEL_SRCDIR" -a -n "$URL" ]; then - DEVEL_SRCDIR="$DEFAULT_DEVEL_SRCDIR/${URL##*/}" - fi - DEST="${var}_DEST"; DEST="${!DEST}" [ -n "$DEST" ] || DEST="$app/b" @@ -899,6 +913,16 @@ function build_update_apps() { # calculer le type maintenant, on en a besoin pour le mode devel TYPE="${var}_TYPE"; TYPE="${!TYPE}" + DEVEL_SRCDIR="${var}_DEVEL_SRCDIR"; DEVEL_SRCDIR="${!DEVEL_SRCDIR}" + if [ -z "$DEVEL_SRCDIR" -a -n "$URL" ]; then + case "$TYPE" in + composer) DEVEL_SRCDIR="${COMPOSER_DEVEL_SRCDIR:-$DEFAULT_DEVEL_SRCDIR}";; + maven) DEVEL_SRCDIR="${MAVEN_DEVEL_SRCDIR:-$DEFAULT_DEVEL_SRCDIR}";; + *) DEVEL_SRCDIR="$DEFAULT_DEVEL_SRCDIR";; + esac + DEVEL_SRCDIR="$DEVEL_SRCDIR/${URL##*/}" + fi + if [ -n "$BUILD_UPDATE_DEVEL" -a -n "$DEVEL_SRCDIR" ]; then mkdir -p "$DEST" || { eend; return 1; } DEST="$DEST/$NAME" @@ -1068,7 +1092,7 @@ function build_update_apps() { composer_action="${var}_${PROFILE}_COMPOSER_ACTION"; composer_action="${!composer_action}" [ -n "$composer_action" ] || { composer_action="${var}_COMPOSER_ACTION"; composer_action="${!composer_action}"; } [ -n "$composer_action" ] || { composer_action="${PROFILE}_COMPOSER_ACTION"; composer_action="${!composer_action}"; } - [ -n "$composer_action" ] || composer_action="$COMPOSER_ACTION" + [ -n "$composer_action" ] || composer_action="${COMPOSER_ACTION:-install}" composer_args="${var}_${PROFILE}_COMPOSER_ARGS" is_defined "$composer_args" || composer_args="${var}_COMPOSER_ARGS" @@ -1077,7 +1101,7 @@ function build_update_apps() { composer_args="${composer_args}[@]"; composer_args=("${!composer_args}") if [ -z "$BUILD_UPDATE_DEVEL" ]; then - case "${composer_action:-install}" in + case "$composer_action" in i|install) composer_action=install;; u|update) composer_action=update;; none|nop) composer_action=;; @@ -1107,7 +1131,7 @@ function build_update_apps() { maven_action="${var}_${PROFILE}_MAVEN_ACTION"; maven_action="${!maven_action}" [ -n "$maven_action" ] || { maven_action="${var}_MAVEN_ACTION"; maven_action="${!maven_action}"; } [ -n "$maven_action" ] || { maven_action="${PROFILE}_MAVEN_ACTION"; maven_action="${!maven_action}"; } - [ -n "$maven_action" ] || maven_action="$MAVEN_ACTION" + [ -n "$maven_action" ] || maven_action="${MAVEN_ACTION:-package}" maven_args="${var}_${PROFILE}_MAVEN_ARGS" is_defined "$maven_args" || maven_args="${var}_MAVEN_ARGS" @@ -1116,10 +1140,9 @@ function build_update_apps() { maven_args="${maven_args}[@]"; maven_args=("${!maven_args}") if [ -z "$BUILD_UPDATE_DEVEL" ]; then - case "${maven_action:-p}" in - c|clean) maven_action=clean;; - po|package_only) maven_action=package;; - p|package) maven_action="clean package";; + case "$maven_action" in + package_only|po) maven_action="package";; + "clean package"|package|cp|p) maven_action="clean package";; none|nop) maven_action=;; *) ewarn "$maven_action: action invalide"; maven_action=;; esac @@ -1926,7 +1949,7 @@ function default_docker_composer() { esac setx args=qvals "$@" - local -a basecmd cmd setupscript runscript + local -a basecmd setupscript runscript cmd basecmd=( -e user="$user" -e group="$group" @@ -1934,8 +1957,11 @@ function default_docker_composer() { -e setup="$COMPOSER_SETUP" -e composer="$COMPOSER_CMD" -e args="$args" - -v "$HOME:$HOME" ) + for host_mapping in "${HOST_MAPPINGS[@]}"; do + basecmd+=(--add-host "$host_mapping") + done + basecmd+=(-v "$HOME:$HOME") if [ "${projdir#$HOME/}" == "$projdir" ]; then # si le répertoire de projet ne se trouve pas dans $HOME, le monter aussi cmd+=(-v "$projdir:$projdir") @@ -1999,6 +2025,12 @@ fi function local_composer() { default_local_composer "$@"; } function docker_composer() { default_docker_composer "$@"; } function auto_composer() { + # mappings d'hôtes + if [ -z "$HOST_MAPPINGS" ]; then + HOST_MAPPINGS="${PROFILE}_HOST_MAPPINGS[@]"; HOST_MAPPINGS=("${!HOST_MAPPINGS}") + [ ${#HOST_MAPPINGS[*]} -gt 0 ] || HOST_MAPPINGS=("${DEFAULT_HOST_MAPPINGS[@]}") + fi + local COMPOSER_PHP= local COMPOSER_PHP_MAX= local COMPOSER_IMAGE="$DEFAULT_COMPOSER_IMAGE" @@ -2009,13 +2041,14 @@ function auto_composer() { # les premiers arguments peuvent servir à redéfinir les variables while [ $# -gt 0 ]; do case "$1" in - COMPOSER_PHP=*) setv "$1"; shift;; - COMPOSER_PHP_MAX=*) setv "$1"; shift;; - COMPOSER_IMAGE=*) setv "$1"; shift;; - COMPOSER_MACHINE=*) setv "$1"; shift;; - COMPOSER_CMD=*) setv "$1"; shift;; - COMPOSER_SETUP=*) setv "$1"; shift;; - COMPOSER_*=*) shift;; # ignorer variable inconnue + COMPOSER_*=*) + setv "$1" + shift + ;; + HOST_MAPPING=*) + HOST_MAPPINGS+=("${1#HOST_MAPPING=}") + shift + ;; *) break;; esac done @@ -2127,7 +2160,7 @@ function default_docker_maven() { esac setx args=qvals "$@" - local -a basecmd cmd setupscript runscript + local -a basecmd host_mapping setupscript runscript cmd basecmd=( -e user="$user" -e group="$group" @@ -2136,11 +2169,14 @@ function default_docker_maven() { -e maven="$MAVEN_CMD" -e args="$args" ${MAVEN_JAVA:+-e JAVA="$MAVEN_JAVA"} - -v "$HOME:$HOME" ) + for host_mapping in "${HOST_MAPPINGS[@]}"; do + basecmd+=(--add-host "$host_mapping") + done + basecmd+=(-v "$HOME:$HOME") if [ "${projdir#$HOME/}" == "$projdir" ]; then # si le répertoire de projet ne se trouve pas dans $HOME, le monter aussi - cmd+=(-v "$projdir:$projdir") + basecmd+=(-v "$projdir:$projdir") fi setupscript='eval "$setup"' runscript=' @@ -2196,6 +2232,12 @@ cd "$projdir" function local_maven() { default_local_maven "$@"; } function docker_maven() { default_docker_maven "$@"; } function auto_maven() { + # mappings d'hôtes + if [ -z "$HOST_MAPPINGS" ]; then + HOST_MAPPINGS="${PROFILE}_HOST_MAPPINGS[@]"; HOST_MAPPINGS=("${!HOST_MAPPINGS}") + [ ${#HOST_MAPPINGS[*]} -gt 0 ] || HOST_MAPPINGS=("${DEFAULT_HOST_MAPPINGS[@]}") + fi + local MAVEN_JAVA= local MAVEN_IMAGE="$DEFAULT_MAVEN_IMAGE" local MAVEN_MACHINE=-u @@ -2205,12 +2247,14 @@ function auto_maven() { # les premiers arguments peuvent servir à redéfinir les variables while [ $# -gt 0 ]; do case "$1" in - MAVEN_JAVA=*) setv "$1"; shift;; - MAVEN_IMAGE=*) setv "$1"; shift;; - MAVEN_MACHINE=*) setv "$1"; shift;; - MAVEN_CMD=*) setv "$1"; shift;; - MAVEN_SETUP=*) setv "$1"; shift;; - MAVEN_*=*) shift;; # ignorer variable inconnue + MAVEN_*=*) + setv "$1" + shift + ;; + HOST_MAPPING=*) + HOST_MAPPINGS+=("${1#HOST_MAPPING=}") + shift + ;; *) break;; esac done @@ -2330,15 +2374,27 @@ else DOCKER=docker fi DEFAULT_PROFILE=devel -DEFAULT_COMPOSER_IMAGE=docker.univ-reunion.fr/image/phpbuilder -DEFAULT_MAVEN_IMAGE=docker.univ-reunion.fr/image/javabuilder PROFILE= DM_ALIASES=() DM_PROFILES=() CLUSTERDIRS=() +DEFAULT_DEVEL_SRCDIR="$HOME/wop" +COMPOSER_DEVEL_SRCDIR="$HOME/wop/php" +MAVEN_DEVEL_SRCDIR="$HOME/wop/sn" +DEFAULT_COMPOSER_IMAGE=docker.univ-reunion.fr/image/phpbuilder +DEFAULT_MAVEN_IMAGE=docker.univ-reunion.fr/image/javabuilder +DEFAULT_HOST_MAPPINGS=() +prod_HOST_MAPPINGS=( + docker.univ-reunion.fr:10.82.70.154 + repos.univ-reunion.fr:10.82.70.246 + git.univ-reunion.fr:10.82.70.247 +) +test_HOST_MAPPINGS=("${prod_HOST_MAPPINGS}") set_defaults dk export PROFILE +HOST_MAPPINGS=() + chdir= CONFIG= DM_SET_MACHINE= @@ -2855,6 +2911,8 @@ NR == 1 { print; next } while [ $# -gt 0 -a "$1" != -- ]; do if [[ "$1" == COMPOSER_*=* ]]; then args+=("$1"); shift + elif [[ "$1" == HOST_MAPPING=* ]]; then + args+=("$1"); shift else break fi @@ -2878,6 +2936,8 @@ NR == 1 { print; next } while [ $# -gt 0 -a "$1" != -- ]; do if [[ "$1" == MAVEN_*=* ]]; then args+=("$1"); shift + elif [[ "$1" == HOST_MAPPING=* ]]; then + args+=("$1"); shift else break fi diff --git a/lib/default/dk b/lib/default/dk index 3bdacea..156c98d 100644 --- a/lib/default/dk +++ b/lib/default/dk @@ -14,5 +14,16 @@ # d'aliases #CLUSTERDIRS=(~/wop/containers/*.univ.run) -# Image à utiliser pour lancer composer -#COMPOSER_IMAGE=docker.univ-reunion.fr/image/apache-php-myiccas-utils:d10 +# Répertoire de base par défaut des projets en mode devel +#DEFAULT_DEVEL_SRCDIR="$HOME/wop" +#COMPOSER_DEVEL_SRCDIR="$HOME/wop/php" +#MAVEN_DEVEL_SRCDIR="$HOME/wop/sn" + +# Image à utiliser pour les builds +#DEFAULT_COMPOSER_IMAGE=docker.univ-reunion.fr/image/phpbuilder:d10 +#DEFAULT_MAVEN_IMAGE=docker.univ-reunion.fr/image/javabuilder:d10 + +# Mappings d'hôtes à activer pour les builds à base d'image +#DEFAULT_HOST_MAPPINGS=() +#prod_HOST_MAPPINGS=(docker.univ-reunion.fr:10.82.70.154 repos.univ-reunion.fr:10.82.70.246 git.univ-reunion.fr:10.82.70.247) +#test_HOST_MAPPINGS=("${prod_HOST_MAPPINGS}") From 1d4c4b4b04eeeb0167c10f13d7105d989bcb752b Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 8 Feb 2021 16:19:33 +0400 Subject: [PATCH 05/13] dk: support COMPOSER_PHP=none --- dk | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/dk b/dk index 6b6255c..470d825 100755 --- a/dk +++ b/dk @@ -198,6 +198,8 @@ COMMANDES Cette valeur doit être spécifiée avec le format de PHP_VERSION_ID i.e 70300 pour PHP 7.3 Spécifier 'any' ou 'force' pour forcer l'utilisation de l'image docker + Spécifier 'none' pour lancer directement composer sans passer par une + image docker. * COMPOSER_PHP_MAX -- Version de PHP à partir de laquelle COMPOSER_IMAGE est utilisée. En d'autres termes, c'est la version maximum de PHP, à partir de laquelle il faut passer par une image docker. L'idée est que @@ -2056,6 +2058,8 @@ function auto_composer() { local use_image if [ "$COMPOSER_PHP" == force -o "$COMPOSER_PHP" == any ]; then use_image=1 + elif [ "$COMPOSER_PHP" == none ]; then + use_image= elif [ -n "$COMPOSER_PHP_MAX" -a "$COMPOSER_PHP_MAX" != none ]; then # Vérifier la version de PHP php -r ' @@ -2065,10 +2069,15 @@ if (strpos($version, ".") !== false) { $version = $version[0] * 10000 + $version[1] * 100 + (isset($version[2])? $version[2]: 0); } exit((PHP_VERSION_ID > $version)? 0: 1); -' -- "$COMPOSER_PHP_MAX" && use_image=1 +' -- "$COMPOSER_PHP_MAX" + case $? in + 0) use_image=1;; + 1) use_image=;; + *) ewarn "Erreur lors du lancement de PHP: est-il installé? Vous pouvez utiliser COMPOSER_PHP=any";; + esac fi - if [ -n "$use_image" ]; then - : # ok, on a déjà décidé qu'il faut utiliser une image + if [ -n "$use_image" -o "$COMPOSER_PHP" == none ]; then + : # ok, on a déjà décidé elif [ -z "$COMPOSER_PHP" ]; then # pas de version minimum, tester simplement la valeur de COMPOSER_IMAGE [ "$COMPOSER_IMAGE" != none ] && use_image=1 @@ -2081,7 +2090,12 @@ if (strpos($version, ".") !== false) { $version = $version[0] * 10000 + $version[1] * 100 + (isset($version[2])? $version[2]: 0); } exit((PHP_VERSION_ID < $version)? 0: 1); -' -- "$COMPOSER_PHP" && use_image=1 +' -- "$COMPOSER_PHP" + case $? in + 0) use_image=1;; + 1) use_image=;; + *) ewarn "Erreur lors du lancement de PHP: est-il installé? Vous pouvez utiliser COMPOSER_PHP=any";; + esac fi if [ -n "$use_image" ]; then From b191552cb073a502099ee3d00ea724ae8f65f049 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 8 Feb 2021 16:46:36 +0400 Subject: [PATCH 06/13] =?UTF-8?q?dk:=20bug=20dans=20le=20mapping=20par=20d?= =?UTF-8?q?=C3=A9faut=20dans=20le=20profil=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dk b/dk index 470d825..a2c4163 100755 --- a/dk +++ b/dk @@ -2403,7 +2403,7 @@ prod_HOST_MAPPINGS=( repos.univ-reunion.fr:10.82.70.246 git.univ-reunion.fr:10.82.70.247 ) -test_HOST_MAPPINGS=("${prod_HOST_MAPPINGS}") +test_HOST_MAPPINGS=("${prod_HOST_MAPPINGS[@]}") set_defaults dk export PROFILE From 31e43dabd7e7e59f7e42d976fb685dcbdb254856 Mon Sep 17 00:00:00 2001 From: deploy Date: Tue, 9 Feb 2021 10:55:16 +0400 Subject: [PATCH 07/13] dk: support de 'system' comme alias de 'none' pour COMPOSER_PHP et MAVEN_JAVA --- dk | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dk b/dk index a2c4163..b56d086 100755 --- a/dk +++ b/dk @@ -198,8 +198,8 @@ COMMANDES Cette valeur doit être spécifiée avec le format de PHP_VERSION_ID i.e 70300 pour PHP 7.3 Spécifier 'any' ou 'force' pour forcer l'utilisation de l'image docker - Spécifier 'none' pour lancer directement composer sans passer par une - image docker. + Spécifier 'none' ou 'system' pour lancer directement composer sans + passer par une image docker. * COMPOSER_PHP_MAX -- Version de PHP à partir de laquelle COMPOSER_IMAGE est utilisée. En d'autres termes, c'est la version maximum de PHP, à partir de laquelle il faut passer par une image docker. L'idée est que @@ -246,7 +246,7 @@ COMMANDES commande mvn est lancée. Les variables suivantes peuvent être définies: * MAVEN_JAVA -- Version de java à sélectionner à l'intérieur de l'image. Spécifier 'any' ou 'force' pour prendre la valeur par - défaut. Spécifier 'none' pour ne pas utiliser l'image + défaut. Spécifier 'none' ou 'system' pour ne pas utiliser l'image * MAVEN_IMAGE -- Image utilisée pour lancer mvn. La valeur par défaut est $DEFAULT_MAVEN_IMAGE Spécifier 'none' pour lancer directement mvn sans passer par une image @@ -2058,7 +2058,8 @@ function auto_composer() { local use_image if [ "$COMPOSER_PHP" == force -o "$COMPOSER_PHP" == any ]; then use_image=1 - elif [ "$COMPOSER_PHP" == none ]; then + elif [ "$COMPOSER_PHP" == none -o "$COMPOSER_PHP" == system ]; then + COMPOSER_PHP=none use_image= elif [ -n "$COMPOSER_PHP_MAX" -a "$COMPOSER_PHP_MAX" != none ]; then # Vérifier la version de PHP @@ -2287,7 +2288,7 @@ function auto_maven() { if [ "$MAVEN_JAVA" == force -o "$MAVEN_JAVA" == any ]; then MAVEN_JAVA= use_image=1 - elif [ "$MAVEN_JAVA" == none ]; then + elif [ "$MAVEN_JAVA" == none -o "$MAVEN_JAVA" == system ]; then MAVEN_JAVA= use_image= elif [ "$MAVEN_IMAGE" != none ]; then From 026b8496fdd4f1f736a65c96247e21a40e2b3829 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Wed, 17 Feb 2021 22:15:28 +0400 Subject: [PATCH 08/13] dmctl: support de l'import de plusieurs machines avec -l --- dmctl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dmctl b/dmctl index 059fb39..e178fd2 100755 --- a/dmctl +++ b/dmctl @@ -14,9 +14,9 @@ OPTIONS -d, --dump Exporter la machine -l, --load - Import la machine + Importer la machine à partir de l'archive spécifiée -a, --load-all - Importer toutes les machines" + Importer toutes les machines depuis le répertoire spécifié" } function dump_machine() { @@ -129,8 +129,16 @@ if [ -z "$action" ]; then fi case "$action" in -dump) dump_machine "$1";; -load) load_machine "$1";; +dump) + dump_machine "$1" + ;; +load) + for archive in "$@"; do + etitle "$archive" + load_machine "$archive" + eend + done + ;; loadall) [ $# -gt 0 ] || set -- . archives=() From 47e058330fef874623a94e305549b61dfe31ad62 Mon Sep 17 00:00:00 2001 From: deploy Date: Wed, 24 Feb 2021 10:55:56 +0400 Subject: [PATCH 09/13] forcer l'utilisation de python2 --- chrono.py | 2 +- lib/b36sha1.py | 2 +- lib/nulib/python/deploydb/__main__.py | 2 +- lib/nulib/setup.py | 2 +- lib/pyulib/migrate/tasks1/TODO_helper.py | 2 +- lib/pyulib/migrate/tasks1/tiddlywiki.py | 2 +- lib/pyulib/migrate/tasks1/tiddlywiki2.py | 2 +- lib/pyulib/migrate/tasks2/Tasks.py | 2 +- lib/pyulib/migrate/tasks2/TiddlyWiki.py | 2 +- lib/pyulib/setup.py | 2 +- lib/pyulib/src/uapps/plbck.py | 2 +- lib/pyulib/src/uapps/plver.py | 2 +- lib/pyulib/src/uapps/pyucontacts.py | 2 +- lib/pyulib/src/uapps/pyurelease.py | 2 +- lib/pyulib/src/uapps/pyutasks.py | 2 +- lib/pyulib/src/uapps/pyuupdate_inc.py | 2 +- lib/pyulib/src/uapps/uencdetect.py | 2 +- lib/pyulib/src/uapps/umail.py | 2 +- lib/pyulib/src/uapps/uproject.py | 2 +- lib/pyulib/src/uapps/urandomize.py | 2 +- lib/pyulib/src/uapps/uxpath.py | 2 +- lib/pyulib/src/uapps/wofixsql.py | 2 +- lib/pyulib/src/ulib/base/htmlentities.py | 2 +- lib/pyulib/src/ulib/p/templ/pytempl.py | 2 +- lib/pyulib/src/ulib/templ/pytempl.py | 2 +- lib/pyulib/test/template.py | 2 +- lib/pyulib/test/test_base/test_args.py | 2 +- lib/pyulib/test/test_base/test_base.py | 2 +- lib/pyulib/test/test_base/test_config.py | 2 +- lib/pyulib/test/test_base/test_control.py | 2 +- lib/pyulib/test/test_base/test_dates.py | 2 +- lib/pyulib/test/test_base/test_editor.py | 2 +- lib/pyulib/test/test_base/test_encdetect.py | 2 +- lib/pyulib/test/test_base/test_encoding.py | 2 +- lib/pyulib/test/test_base/test_env.py | 2 +- lib/pyulib/test/test_base/test_files.py | 2 +- lib/pyulib/test/test_base/test_flock.py | 2 +- lib/pyulib/test/test_base/test_functions.py | 2 +- lib/pyulib/test/test_base/test_input.py | 2 +- lib/pyulib/test/test_base/test_iso8859.py | 2 +- lib/pyulib/test/test_base/test_lines.py | 2 +- lib/pyulib/test/test_base/test_output.py | 2 +- lib/pyulib/test/test_base/test_pager.py | 2 +- lib/pyulib/test/test_base/test_paths.py | 2 +- lib/pyulib/test/test_base/test_procs.py | 2 +- lib/pyulib/test/test_base/test_times.py | 2 +- lib/pyulib/test/test_base/test_tmpfiles.py | 2 +- lib/pyulib/test/test_base/test_uio.py | 2 +- lib/pyulib/test/test_base/test_words.py | 2 +- lib/ulib/support/cgilsxml.py | 2 +- lib/ulib/support/cgiparams.py | 2 +- lib/ulib/support/cgiupload.py | 2 +- lib/ulib/support/mkcrypt.py | 2 +- lib/ulib/support/uinc.py | 2 +- lib/ulib/support/xpathtool.py | 2 +- lib/ulib/templates/webpyapp/lib/python/flup/server/ajp.py | 2 +- lib/ulib/templates/webpyapp/lib/python/flup/server/ajp_fork.py | 2 +- lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi.py | 2 +- lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_fork.py | 2 +- .../templates/webpyapp/lib/python/flup/server/fcgi_single.py | 2 +- lib/ulib/templates/webpyapp/lib/python/flup/server/scgi.py | 2 +- lib/ulib/templates/webpyapp/lib/python/flup/server/scgi_fork.py | 2 +- lib/ulib/templates/webpyapp/server.py | 2 +- tailor.py | 2 +- 64 files changed, 64 insertions(+), 64 deletions(-) diff --git a/chrono.py b/chrono.py index 4cdd44f..7d640a4 100755 --- a/chrono.py +++ b/chrono.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""Afficher un chronomètre""" diff --git a/lib/b36sha1.py b/lib/b36sha1.py index f65807b..7abe3c8 100755 --- a/lib/b36sha1.py +++ b/lib/b36sha1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: afficher le hash SHA-1 d'un fichier exprimé en base 36 diff --git a/lib/nulib/python/deploydb/__main__.py b/lib/nulib/python/deploydb/__main__.py index 50bd39e..0f54021 100644 --- a/lib/nulib/python/deploydb/__main__.py +++ b/lib/nulib/python/deploydb/__main__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 """Interroger la base deploydb diff --git a/lib/nulib/setup.py b/lib/nulib/setup.py index 908b278..14af820 100755 --- a/lib/nulib/setup.py +++ b/lib/nulib/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 NAME = 'nulib' diff --git a/lib/pyulib/migrate/tasks1/TODO_helper.py b/lib/pyulib/migrate/tasks1/TODO_helper.py index b1ff3cf..80f0a12 100755 --- a/lib/pyulib/migrate/tasks1/TODO_helper.py +++ b/lib/pyulib/migrate/tasks1/TODO_helper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 """%(name)s: Fonction à usage de TODO pour gérer les tiddlywikis diff --git a/lib/pyulib/migrate/tasks1/tiddlywiki.py b/lib/pyulib/migrate/tasks1/tiddlywiki.py index 550fa7b..3ed2cde 100755 --- a/lib/pyulib/migrate/tasks1/tiddlywiki.py +++ b/lib/pyulib/migrate/tasks1/tiddlywiki.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 """%(name)s: Gérer un fichier html tiddlywiki diff --git a/lib/pyulib/migrate/tasks1/tiddlywiki2.py b/lib/pyulib/migrate/tasks1/tiddlywiki2.py index 3601e06..488a090 100644 --- a/lib/pyulib/migrate/tasks1/tiddlywiki2.py +++ b/lib/pyulib/migrate/tasks1/tiddlywiki2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 """%(name)s: Gestion d'un fichier tiddlywiki.html diff --git a/lib/pyulib/migrate/tasks2/Tasks.py b/lib/pyulib/migrate/tasks2/Tasks.py index 88add6d..3a70850 100755 --- a/lib/pyulib/migrate/tasks2/Tasks.py +++ b/lib/pyulib/migrate/tasks2/Tasks.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- u"""%(scriptname)s: gérer une liste de tâches diff --git a/lib/pyulib/migrate/tasks2/TiddlyWiki.py b/lib/pyulib/migrate/tasks2/TiddlyWiki.py index 11ff3a9..8140c34 100755 --- a/lib/pyulib/migrate/tasks2/TiddlyWiki.py +++ b/lib/pyulib/migrate/tasks2/TiddlyWiki.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- u"""%(scriptname)s: gérer un TiddlyWiki diff --git a/lib/pyulib/setup.py b/lib/pyulib/setup.py index 40bc5ef..e086aeb 100755 --- a/lib/pyulib/setup.py +++ b/lib/pyulib/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 NAME = 'pyulib' diff --git a/lib/pyulib/src/uapps/plbck.py b/lib/pyulib/src/uapps/plbck.py index eed4ce0..f348c16 100755 --- a/lib/pyulib/src/uapps/plbck.py +++ b/lib/pyulib/src/uapps/plbck.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Gérer des fichiers de sauvegarde diff --git a/lib/pyulib/src/uapps/plver.py b/lib/pyulib/src/uapps/plver.py index 242acc6..1269cad 100755 --- a/lib/pyulib/src/uapps/plver.py +++ b/lib/pyulib/src/uapps/plver.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Afficher la dernière version d'un ensemble de fichiers diff --git a/lib/pyulib/src/uapps/pyucontacts.py b/lib/pyulib/src/uapps/pyucontacts.py index 6d104c3..c6ae292 100755 --- a/lib/pyulib/src/uapps/pyucontacts.py +++ b/lib/pyulib/src/uapps/pyucontacts.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: afficher les contacts téléphoniques diff --git a/lib/pyulib/src/uapps/pyurelease.py b/lib/pyulib/src/uapps/pyurelease.py index 45e1805..7cfb13f 100755 --- a/lib/pyulib/src/uapps/pyurelease.py +++ b/lib/pyulib/src/uapps/pyurelease.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(name)s - Gérer les releases d'un projet diff --git a/lib/pyulib/src/uapps/pyutasks.py b/lib/pyulib/src/uapps/pyutasks.py index 212cd96..988313d 100755 --- a/lib/pyulib/src/uapps/pyutasks.py +++ b/lib/pyulib/src/uapps/pyutasks.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 import sys diff --git a/lib/pyulib/src/uapps/pyuupdate_inc.py b/lib/pyulib/src/uapps/pyuupdate_inc.py index 31b843a..0665a11 100755 --- a/lib/pyulib/src/uapps/pyuupdate_inc.py +++ b/lib/pyulib/src/uapps/pyuupdate_inc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 import os, sys, re, string diff --git a/lib/pyulib/src/uapps/uencdetect.py b/lib/pyulib/src/uapps/uencdetect.py index 3e06de4..c7c7e7b 100755 --- a/lib/pyulib/src/uapps/uencdetect.py +++ b/lib/pyulib/src/uapps/uencdetect.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(name)s - Détecter l'encoding d'un fichier ou d'une chaine diff --git a/lib/pyulib/src/uapps/umail.py b/lib/pyulib/src/uapps/umail.py index d0e75af..aee2bdd 100755 --- a/lib/pyulib/src/uapps/umail.py +++ b/lib/pyulib/src/uapps/umail.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Afficher un mail correctement encodé pour son envoi diff --git a/lib/pyulib/src/uapps/uproject.py b/lib/pyulib/src/uapps/uproject.py index 5e0ed0c..e64e74f 100755 --- a/lib/pyulib/src/uapps/uproject.py +++ b/lib/pyulib/src/uapps/uproject.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 import os, sys, re diff --git a/lib/pyulib/src/uapps/urandomize.py b/lib/pyulib/src/uapps/urandomize.py index 80c8166..5b4517f 100755 --- a/lib/pyulib/src/uapps/urandomize.py +++ b/lib/pyulib/src/uapps/urandomize.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 import os, sys, string diff --git a/lib/pyulib/src/uapps/uxpath.py b/lib/pyulib/src/uapps/uxpath.py index b2afa13..e1f59dc 100755 --- a/lib/pyulib/src/uapps/uxpath.py +++ b/lib/pyulib/src/uapps/uxpath.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Faire une requête xpath diff --git a/lib/pyulib/src/uapps/wofixsql.py b/lib/pyulib/src/uapps/wofixsql.py index 4687a1c..5a67c9b 100755 --- a/lib/pyulib/src/uapps/wofixsql.py +++ b/lib/pyulib/src/uapps/wofixsql.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Afficher une requête SQL d'un fichier de log WebObjects diff --git a/lib/pyulib/src/ulib/base/htmlentities.py b/lib/pyulib/src/ulib/base/htmlentities.py index 98cc6fb..32a0cd8 100755 --- a/lib/pyulib/src/ulib/base/htmlentities.py +++ b/lib/pyulib/src/ulib/base/htmlentities.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 import i_need_py23 diff --git a/lib/pyulib/src/ulib/p/templ/pytempl.py b/lib/pyulib/src/ulib/p/templ/pytempl.py index 0a3cd46..4cf4231 100644 --- a/lib/pyulib/src/ulib/p/templ/pytempl.py +++ b/lib/pyulib/src/ulib/p/templ/pytempl.py @@ -29,7 +29,7 @@ class PyTempl(FileTempl): MODE = u"python" - SHEBANG = u"""#!/usr/bin/env python""" + SHEBANG = u"""#!/usr/bin/env python2""" DOC = u'''\ u"""%%(scriptname)s: diff --git a/lib/pyulib/src/ulib/templ/pytempl.py b/lib/pyulib/src/ulib/templ/pytempl.py index 5762fa6..560e5e9 100644 --- a/lib/pyulib/src/ulib/templ/pytempl.py +++ b/lib/pyulib/src/ulib/templ/pytempl.py @@ -21,7 +21,7 @@ class PyTempl(FileTempl): MODE = u"python" - SHEBANG = u"""#!/usr/bin/env python""" + SHEBANG = u"""#!/usr/bin/env python2""" DOC = u'''\ u"""%%(scriptname)s: diff --git a/lib/pyulib/test/template.py b/lib/pyulib/test/template.py index 2148a30..060f9d9 100755 --- a/lib/pyulib/test/template.py +++ b/lib/pyulib/test/template.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_args.py b/lib/pyulib/test/test_base/test_args.py index 559bf77..2c73662 100755 --- a/lib/pyulib/test/test_base/test_args.py +++ b/lib/pyulib/test/test_base/test_args.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_base.py b/lib/pyulib/test/test_base/test_base.py index ecd593f..6978299 100755 --- a/lib/pyulib/test/test_base/test_base.py +++ b/lib/pyulib/test/test_base/test_base.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_config.py b/lib/pyulib/test/test_base/test_config.py index 19a2a20..da8f41a 100755 --- a/lib/pyulib/test/test_base/test_config.py +++ b/lib/pyulib/test/test_base/test_config.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_control.py b/lib/pyulib/test/test_base/test_control.py index 5d572e7..a54ff0e 100755 --- a/lib/pyulib/test/test_base/test_control.py +++ b/lib/pyulib/test/test_base/test_control.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_dates.py b/lib/pyulib/test/test_base/test_dates.py index 4173d08..ca2c009 100755 --- a/lib/pyulib/test/test_base/test_dates.py +++ b/lib/pyulib/test/test_base/test_dates.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_editor.py b/lib/pyulib/test/test_base/test_editor.py index df8b38d..5699320 100755 --- a/lib/pyulib/test/test_base/test_editor.py +++ b/lib/pyulib/test/test_base/test_editor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_encdetect.py b/lib/pyulib/test/test_base/test_encdetect.py index 2640c37..2292057 100755 --- a/lib/pyulib/test/test_base/test_encdetect.py +++ b/lib/pyulib/test/test_base/test_encdetect.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_encoding.py b/lib/pyulib/test/test_base/test_encoding.py index b814e68..ff2a3b9 100755 --- a/lib/pyulib/test/test_base/test_encoding.py +++ b/lib/pyulib/test/test_base/test_encoding.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_env.py b/lib/pyulib/test/test_base/test_env.py index e9832d2..9d19433 100755 --- a/lib/pyulib/test/test_base/test_env.py +++ b/lib/pyulib/test/test_base/test_env.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_files.py b/lib/pyulib/test/test_base/test_files.py index f43f16f..9b99f75 100755 --- a/lib/pyulib/test/test_base/test_files.py +++ b/lib/pyulib/test/test_base/test_files.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_flock.py b/lib/pyulib/test/test_base/test_flock.py index 9d188c3..1a6a24d 100755 --- a/lib/pyulib/test/test_base/test_flock.py +++ b/lib/pyulib/test/test_base/test_flock.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_functions.py b/lib/pyulib/test/test_base/test_functions.py index b973ef0..9adb439 100755 --- a/lib/pyulib/test/test_base/test_functions.py +++ b/lib/pyulib/test/test_base/test_functions.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_input.py b/lib/pyulib/test/test_base/test_input.py index f92151c..746e661 100755 --- a/lib/pyulib/test/test_base/test_input.py +++ b/lib/pyulib/test/test_base/test_input.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_iso8859.py b/lib/pyulib/test/test_base/test_iso8859.py index 6c344c0..b707323 100755 --- a/lib/pyulib/test/test_base/test_iso8859.py +++ b/lib/pyulib/test/test_base/test_iso8859.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_lines.py b/lib/pyulib/test/test_base/test_lines.py index 3acda75..6a907c9 100755 --- a/lib/pyulib/test/test_base/test_lines.py +++ b/lib/pyulib/test/test_base/test_lines.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_output.py b/lib/pyulib/test/test_base/test_output.py index 1c17ad7..bde7726 100755 --- a/lib/pyulib/test/test_base/test_output.py +++ b/lib/pyulib/test/test_base/test_output.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_pager.py b/lib/pyulib/test/test_base/test_pager.py index cd29a7e..4805bcd 100755 --- a/lib/pyulib/test/test_base/test_pager.py +++ b/lib/pyulib/test/test_base/test_pager.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_paths.py b/lib/pyulib/test/test_base/test_paths.py index 86f22ff..5b440f5 100755 --- a/lib/pyulib/test/test_base/test_paths.py +++ b/lib/pyulib/test/test_base/test_paths.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_procs.py b/lib/pyulib/test/test_base/test_procs.py index cf07174..230b96b 100755 --- a/lib/pyulib/test/test_base/test_procs.py +++ b/lib/pyulib/test/test_base/test_procs.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_times.py b/lib/pyulib/test/test_base/test_times.py index c9ea88e..712fca9 100755 --- a/lib/pyulib/test/test_base/test_times.py +++ b/lib/pyulib/test/test_base/test_times.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_tmpfiles.py b/lib/pyulib/test/test_base/test_tmpfiles.py index 1ad0378..10107ab 100755 --- a/lib/pyulib/test/test_base/test_tmpfiles.py +++ b/lib/pyulib/test/test_base/test_tmpfiles.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_uio.py b/lib/pyulib/test/test_base/test_uio.py index efe1940..91e416c 100755 --- a/lib/pyulib/test/test_base/test_uio.py +++ b/lib/pyulib/test/test_base/test_uio.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/pyulib/test/test_base/test_words.py b/lib/pyulib/test/test_base/test_words.py index c402c17..eb8a099 100755 --- a/lib/pyulib/test/test_base/test_words.py +++ b/lib/pyulib/test/test_base/test_words.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('suite', diff --git a/lib/ulib/support/cgilsxml.py b/lib/ulib/support/cgilsxml.py index f8bc105..fa1c95e 100755 --- a/lib/ulib/support/cgilsxml.py +++ b/lib/ulib/support/cgilsxml.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""Ce script est prévu pour être utilisé dans un script CGI. diff --git a/lib/ulib/support/cgiparams.py b/lib/ulib/support/cgiparams.py index 9290282..fbeb2a7 100755 --- a/lib/ulib/support/cgiparams.py +++ b/lib/ulib/support/cgiparams.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""Ce script est prévu pour être utilisé dans un script CGI. diff --git a/lib/ulib/support/cgiupload.py b/lib/ulib/support/cgiupload.py index 59b29e2..7871cd4 100755 --- a/lib/ulib/support/cgiupload.py +++ b/lib/ulib/support/cgiupload.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""Ce script est prévu pour être utilisé dans un script CGI. diff --git a/lib/ulib/support/mkcrypt.py b/lib/ulib/support/mkcrypt.py index 07b589b..2d90836 100755 --- a/lib/ulib/support/mkcrypt.py +++ b/lib/ulib/support/mkcrypt.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 import sys diff --git a/lib/ulib/support/uinc.py b/lib/ulib/support/uinc.py index bf8042d..214be41 100755 --- a/lib/ulib/support/uinc.py +++ b/lib/ulib/support/uinc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""%(scriptname)s: Plier/déplier des inclusions dans un fichier diff --git a/lib/ulib/support/xpathtool.py b/lib/ulib/support/xpathtool.py index ce2039e..f159817 100755 --- a/lib/ulib/support/xpathtool.py +++ b/lib/ulib/support/xpathtool.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""Ce script permet d'obtenir ou de modifier un élément identifié par une expression XPATH diff --git a/lib/ulib/templates/webpyapp/lib/python/flup/server/ajp.py b/lib/ulib/templates/webpyapp/lib/python/flup/server/ajp.py index 3dca295..4c98aec 100644 --- a/lib/ulib/templates/webpyapp/lib/python/flup/server/ajp.py +++ b/lib/ulib/templates/webpyapp/lib/python/flup/server/ajp.py @@ -35,7 +35,7 @@ For more information about the Web Server Gateway Interface, see Example usage: - #!/usr/bin/env python + #!/usr/bin/env python2 import sys from myapplication import app # Assume app is your WSGI application object from ajp import WSGIServer diff --git a/lib/ulib/templates/webpyapp/lib/python/flup/server/ajp_fork.py b/lib/ulib/templates/webpyapp/lib/python/flup/server/ajp_fork.py index 111b29c..cad0336 100644 --- a/lib/ulib/templates/webpyapp/lib/python/flup/server/ajp_fork.py +++ b/lib/ulib/templates/webpyapp/lib/python/flup/server/ajp_fork.py @@ -35,7 +35,7 @@ For more information about the Web Server Gateway Interface, see Example usage: - #!/usr/bin/env python + #!/usr/bin/env python2 import sys from myapplication import app # Assume app is your WSGI application object from ajp import WSGIServer diff --git a/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi.py b/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi.py index ab160e9..3b9de0e 100644 --- a/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi.py +++ b/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi.py @@ -34,7 +34,7 @@ For more information about the Web Server Gateway Interface, see Example usage: - #!/usr/bin/env python + #!/usr/bin/env python2 from myapplication import app # Assume app is your WSGI application object from fcgi import WSGIServer WSGIServer(app).run() diff --git a/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_fork.py b/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_fork.py index d79b777..9317b76 100644 --- a/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_fork.py +++ b/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_fork.py @@ -34,7 +34,7 @@ For more information about the Web Server Gateway Interface, see Example usage: - #!/usr/bin/env python + #!/usr/bin/env python2 from myapplication import app # Assume app is your WSGI application object from fcgi import WSGIServer WSGIServer(app).run() diff --git a/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_single.py b/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_single.py index e62b08f..e5bb953 100644 --- a/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_single.py +++ b/lib/ulib/templates/webpyapp/lib/python/flup/server/fcgi_single.py @@ -34,7 +34,7 @@ For more information about the Web Server Gateway Interface, see Example usage: - #!/usr/bin/env python + #!/usr/bin/env python2 from myapplication import app # Assume app is your WSGI application object from fcgi import WSGIServer WSGIServer(app).run() diff --git a/lib/ulib/templates/webpyapp/lib/python/flup/server/scgi.py b/lib/ulib/templates/webpyapp/lib/python/flup/server/scgi.py index aad3d7b..f61b824 100644 --- a/lib/ulib/templates/webpyapp/lib/python/flup/server/scgi.py +++ b/lib/ulib/templates/webpyapp/lib/python/flup/server/scgi.py @@ -35,7 +35,7 @@ For more information about the Web Server Gateway Interface, see Example usage: - #!/usr/bin/env python + #!/usr/bin/env python2 import sys from myapplication import app # Assume app is your WSGI application object from scgi import WSGIServer diff --git a/lib/ulib/templates/webpyapp/lib/python/flup/server/scgi_fork.py b/lib/ulib/templates/webpyapp/lib/python/flup/server/scgi_fork.py index 1c7506f..26660cf 100644 --- a/lib/ulib/templates/webpyapp/lib/python/flup/server/scgi_fork.py +++ b/lib/ulib/templates/webpyapp/lib/python/flup/server/scgi_fork.py @@ -35,7 +35,7 @@ For more information about the Web Server Gateway Interface, see Example usage: - #!/usr/bin/env python + #!/usr/bin/env python2 import sys from myapplication import app # Assume app is your WSGI application object from scgi import WSGIServer diff --git a/lib/ulib/templates/webpyapp/server.py b/lib/ulib/templates/webpyapp/server.py index efb2b4c..a732c98 100755 --- a/lib/ulib/templates/webpyapp/server.py +++ b/lib/ulib/templates/webpyapp/server.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python22 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 __all__ = ('Server',) diff --git a/tailor.py b/tailor.py index 6974874..acedc4a 100755 --- a/tailor.py +++ b/tailor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 mode: python -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 u"""Afficher les lignes d'un fichier en mettant en surbrillance certains patterns""" From 4bf4f6d1f3e6229ece15b7d7b41440148b4e6516 Mon Sep 17 00:00:00 2001 From: deploy Date: Wed, 24 Feb 2021 11:29:55 +0400 Subject: [PATCH 10/13] authftp: info pour host key verification failed --- authftp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/authftp b/authftp index abba8a6..cefa98b 100755 --- a/authftp +++ b/authftp @@ -40,6 +40,14 @@ façon dont le proxy ftp est configuré, il n'est pas possible de se connecter avec un mot de passe qui contient le caractère @" } +function hostkeyfailed_apropos() { + eecho "\ +------------------------------------------------------------------------------------ +Si le message 'Host key verification failed' apparait, lancer la commande suivante: + ssh -o StrictHostKeyChecking=no -o BatchMode=yes $1 +------------------------------------------------------------------------------------" +} + AUTHFTP_PROXY_DISABLED=1 # par défaut, ne pas utiliser le proxy set_defaults proxy set_defaults authftp @@ -78,6 +86,7 @@ if [ -n "$lftp" ]; then if [ -n "$noproxy" ]; then if [ -n "$sftp" ]; then url="sftp://$host/$path" + hostkeyfailed_apropos "$login@$host" else url="ftp://$host/$path" fi From 4607f0f3c2ad894006681a88e9a6e4be670de7c8 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 22 Mar 2021 10:06:30 +0400 Subject: [PATCH 11/13] =?UTF-8?q?possibilit=C3=A9=20de=20sp=C3=A9cifier=20?= =?UTF-8?q?compat=20bash=5Fcompletion=20si=20pas=20debian?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/bashrc.d/bash_completion.shared | 9 ++++++--- lib/bashrc.d/nutools.userconf | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/bashrc.d/bash_completion.shared b/lib/bashrc.d/bash_completion.shared index c245252..ac80471 100644 --- a/lib/bashrc.d/bash_completion.shared +++ b/lib/bashrc.d/bash_completion.shared @@ -4,7 +4,10 @@ if [ -n "$UTOOLS_BASH_COMPLETION" ]; then function __bash_completion_enabled() { return 1; } function __bash_completion_module_enabled() { return 1; } - if [ -f /etc/debian_version ]; then + _file= + if [ -n "$UTOOLS_BASH_COMPLETION_COMPAT" ]; then + _file="@@dest@@/lib/ulib/$UTOOLS_BASH_COMPLETION_COMPAT/bash_completion" + elif [ -f /etc/debian_version ]; then case "$( Date: Fri, 26 Mar 2021 22:02:56 +0400 Subject: [PATCH 12/13] pff: bug origext --- pff | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pff b/pff index da87e0c..1674cc9 100755 --- a/pff +++ b/pff @@ -838,11 +838,12 @@ function new_cmd() { local fnsrc0="$workdir/nsrc0" fosrc0="$workdir/osrc0" >"$fnsrc0" >"$fosrc0" - find "$srcdir" -type f | awkrun ORIGEXTS[@] prefix="$srcdir/" fnsrc="$fnsrc0" fosrc="$fosrc0" '{ + find "$srcdir" -type f | awkrun -f ORIGEXTS[@] prefix="$srcdir/" fnsrc="$fnsrc0" fosrc="$fosrc0" '{ found = 0 for (i = 1; i <= ORIGEXTS_count; i++) { sub("^" prefix, "") - if ($0 ~ ORIGEXTS[i] "(/|$)") { + re_origext = qregexp(ORIGEXTS[i]) "(/|$)" + if ($0 ~ re_origext) { print >fosrc found = 1 break @@ -966,11 +967,12 @@ function new_cmd() { csort "$fosrc0" >"$fosrc" >"$flsrc" >"$flosrc" - awkrun <"$fosrc0" ORIGEXTS[@] flsrc="$flsrc" flosrc="$flosrc" '{ + <"$fosrc0" awkrun -f ORIGEXTS[@] flsrc="$flsrc" flosrc="$flosrc" '{ for (i = 1; i <= ORIGEXTS_count; i++) { - if ($0 ~ ORIGEXTS[i] "(/|$)") { + re_origext = qregexp(ORIGEXTS[i]) "(/|$)" + if ($0 ~ re_origext) { orig = $0 - local = gensub(ORIGEXTS[i] "(/|$)", "\\1", 1, $0) + local = gensub(re_origext, "\\1", 1, $0) print local ":" orig >flosrc print local >flsrc break From a4ed8d9a45268e6275f86300a7d4d24c321c61fe Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Mon, 29 Mar 2021 09:41:20 +0400 Subject: [PATCH 13/13] Init changelog & version 9.12.0 --- CHANGES.md | 15 +++++++++++++++ VERSION.txt | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8ac8822..1d78179 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,18 @@ +## Version 9.12.0 du 29/03/2021-09:41 + +* `3d54e37` pff: bug origext +* `4607f0f` possibilité de spécifier compat bash_completion si pas debian +* `4bf4f6d` authftp: info pour host key verification failed +* `47e0583` forcer l'utilisation de python2 +* `026b849` dmctl: support de l'import de plusieurs machines avec -l +* `31e43da` dk: support de 'system' comme alias de 'none' pour COMPOSER_PHP et MAVEN_JAVA +* `b191552` dk: bug dans le mapping par défaut dans le profil test +* `1d4c4b4` dk: support COMPOSER_PHP=none +* `b3983ed` dk: support des mappings d'hôtes +* `543d2d2` dk: mvn est aussi un frontend pour lancer java +* `f1a9c7a` dk: début support projets maven +* `ad44a1c` dk: support build dans une image pour les projets composer + ## Version 9.11.0 du 11/12/2020-15:43 * `01e940b` repoctl: permettre create -u diff --git a/VERSION.txt b/VERSION.txt index ea5a459..2f0dbe6 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -9.11.0 +9.12.0