Intégration de la branche release-9.12.0

This commit is contained in:
Jephté Clain 2021-03-29 09:41:20 +04:00
commit b03df72236
73 changed files with 706 additions and 187 deletions

View File

@ -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

View File

@ -1 +1 @@
9.11.0
9.12.0

View File

@ -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

View File

@ -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"""

686
dk
View File

@ -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
@ -197,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' 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
@ -206,8 +209,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 +237,46 @@ COMMANDES
peuvent être utilisés pour redéfinir les variables COMPOSER_*, e.g
$scriptname composer COMPOSER_IMAGE=none install
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' 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
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
* 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.
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
OPTIONS générales
(ces options sont communes à toutes les commandes)
-d, --chdir PROJDIR
@ -295,37 +337,95 @@ 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
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=
COMPOSER_PHP_MAX=
COMPOSER_IMAGE=
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=
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
{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}_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=
{app}_COMPOSER_ARGS=()
{app}_COMPOSER_PHP=
{app}_COMPOSER_PHP_MAX=
{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=()
{profile}_HOST_MAPPINGS=()
{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=
{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
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
@ -340,12 +440,12 @@ 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
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
@ -353,10 +453,17 @@ 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
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_
@ -375,14 +482,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
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]]]
@ -446,19 +562,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"
@ -708,6 +828,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
@ -719,17 +840,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
@ -754,8 +874,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 composer_action
local -a composer_args
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"
@ -770,11 +890,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"
@ -800,6 +915,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"
@ -814,6 +939,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
@ -865,6 +991,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
@ -915,6 +1042,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
@ -924,6 +1052,112 @@ function build_update_apps() {
die "ni URL ni SRC ne sont définis"
fi
before_builds="${var}_BEFORE_BUILD"
if is_defined "$before_builds"; then
before_builds="$before_builds[@]"; before_builds=("${!before_builds}")
else
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
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="${PROFILE}_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"
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
case "$composer_action" in
i|install) composer_action=install;;
u|update) composer_action=update;;
none|nop) composer_action=;;
*) ewarn "$composer_action: action invalide"; composer_action=;;
esac
if [ -n "$composer_action" ]; then
setx cwd=pwd
cd "$DEST"
estep "Installation des dépendances composer"
auto_composer "${composer_vars[@]}" "$composer_action" "${composer_args[@]}" || { eend; return 1; }
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:-package}"
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" 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
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}")
@ -932,35 +1166,6 @@ function build_update_apps() {
else
after_updates=()
fi
estep "Type de dépôt: $TYPE"
if [ "$TYPE" == composer ]; then
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"
composer_args="${var}_${PROFILE}_COMPOSER_ARGS"
is_defined "$composer_args" || composer_args="${var}_COMPOSER_ARGS"
is_defined "$composer_args" || composer_args="DEFAULT_COMPOSER_ARGS"
composer_args="${composer_args}[@]"; composer_args=("${!composer_args}")
if [ -z "$BUILD_UPDATE_DEVEL" ]; then
case "${composer_action:-install}" in
i|install) composer_action=install;;
u|update) composer_action=update;;
none|nop) composer_action=;;
*) ewarn "$composer_action: action invalide"; composer_action=;;
esac
if [ -n "$composer_action" ]; then
setx cwd=pwd
cd "$DEST"
estep "Installation des dépendances composer"
auto_composer "$composer_action" "${composer_args[@]}" || { eend; return 1; }
cd "$cwd"
fi
fi
fi
for after_update in "${after_updates[@]}"; do
if [ "${after_update#/}" != "$after_update" ]; then
# commande absolue, la lancer telle quelle
@ -1746,7 +1951,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"
@ -1754,8 +1959,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")
@ -1819,6 +2027,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"
@ -1826,21 +2040,28 @@ 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;;
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_*=*)
setv "$1"
shift
;;
HOST_MAPPING=*)
HOST_MAPPINGS+=("${1#HOST_MAPPING=}")
shift
;;
*) break;;
esac
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 [ "$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
php -r '
$version = $argv[1];
@ -1849,15 +2070,18 @@ 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
elif [ "$COMPOSER_PHP" == force -o "$COMPOSER_PHP" == any ]; then
use_image=1
else
# Vérifier la version de PHP
php -r '
@ -1867,7 +2091,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
@ -1892,6 +2121,201 @@ exit((PHP_VERSION_ID < $version)? 0: 1);
fi
}
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
# 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 "$@"
;;
java)
shift
java "$@"
;;
*)
[ -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"'
;;
java)
shift
actualcmd='eval "su-exec \"$user\" java $args"'
;;
*)
actualcmd='eval "su-exec \"$user\" \"$maven\" $args"'
;;
esac
setx args=qvals "$@"
local -a basecmd host_mapping setupscript runscript cmd
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"}
)
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
basecmd+=(-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() {
# 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
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_*=*)
setv "$1"
shift
;;
HOST_MAPPING=*)
HOST_MAPPINGS+=("${1#HOST_MAPPING=}")
shift
;;
*) 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=
use_image=1
elif [ "$MAVEN_JAVA" == none -o "$MAVEN_JAVA" == system ]; then
MAVEN_JAVA=
use_image=
elif [ "$MAVEN_IMAGE" != none ]; then
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() {
@ -1965,15 +2389,27 @@ 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/apache-php-myiccas-utils:d10
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=
@ -2487,16 +2923,50 @@ 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
elif [[ "$1" == HOST_MAPPING=* ]]; 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|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
elif [[ "$1" == HOST_MAPPING=* ]]; 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
auto_maven "${args[@]}"
;;
_*|*_)
# transmettre directement à docker
cmd="${cmd#_}"

16
dmctl
View File

@ -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=()

View File

@ -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

View File

@ -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 "$(</etc/debian_version)" in
6*|squeeze*)
# le code suivant n'est compatible qu'avec debian squeeze (plus
@ -17,9 +20,9 @@ if [ -n "$UTOOLS_BASH_COMPLETION" ]; then
_file="@@dest@@/lib/ulib/bash41/bash_completion"
;;
esac
[ -f "$_file" ] && source "$_file"
unset _file
fi
[ -f "$_file" ] && source "$_file"
unset _file
if __bash_completion_enabled; then
for i in "@@dest@@/lib/completion.d/"*; do
[ -f "$i" ] || continue

View File

@ -9,6 +9,7 @@
# Activer l'auto complétion de bash pour les outils de nutools
#export UTOOLS_BASH_COMPLETION=1
#export UTOOLS_BASH_COMPLETION_COMPAT=bash41
# utools utilise su plutôt que sudo pour la fonction run_as_root et le script
# _root. Par défaut, ce n'est le cas que si sudo n'est pas installé. Si sudo est

View File

@ -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}")

View File

@ -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

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
u"""%(scriptname)s: gérer un TiddlyWiki

View File

@ -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'

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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:

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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',

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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',)

12
pff
View File

@ -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

View File

@ -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"""