Changeset 3805 in MondoRescue


Ignore:
Timestamp:
Feb 16, 2024, 1:17:57 AM (4 months ago)
Author:
Bruno Cornec
Message:

trac env is based on svn repo name to streamline treatment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/ansible/roles/trac/templates/trac-svn-hook

    r3804 r3805  
    179179export TRAC_ENV
    180180if [ -n "$PYTHONPATH" ]; then
    181     export PYTHONPATH
     181    export PYTHONPATH
    182182fi
    183183if [ -n "$TRAC_PATH" ]; then
    184     export PATH="$TRAC_PATH:$PATH"
     184    export PATH="$TRAC_PATH:$PATH"
    185185fi
    186186if [ -n "$TRAC_LD_LIBRARY_PATH" ]; then
    187     export LD_LIBRARY_PATH="$TRAC_LD_LIBRARY_PATH:$LD_LIBRARY_PATH"
     187    export LD_LIBRARY_PATH="$TRAC_LD_LIBRARY_PATH:$LD_LIBRARY_PATH"
    188188fi
    189189
     
    198198
    199199if [ -z "$REPOS" -o -z "$REV" ]; then
    200     >&2 echo "Usage: $0 REPOS REV"
    201     exit 2
     200    >&2 echo "Usage: $0 REPOS REV"
     201    exit 2
    202202fi
    203203
    204204if ! python -V 2>/dev/null; then
    205     >&2 echo "python is not in the PATH ($PATH), check TRAC_PATH."
    206     exit 2
     205    >&2 echo "python is not in the PATH ($PATH), check TRAC_PATH."
     206    exit 2
    207207fi
    208208
    209209if ! trac-admin -v 2>/dev/null; then
    210     >&2 echo "trac-admin is not in the PATH ($PATH), check TRAC_PATH."
    211     exit 2
     210    >&2 echo "trac-admin is not in the PATH ($PATH), check TRAC_PATH."
     211    exit 2
    212212fi
    213213
    214214if [ -z "$TRAC_ENV" ]; then
    215     >&2 echo "TRAC_ENV is not set."
    216     exit 2
     215    >&2 echo "TRAC_ENV is not set."
     216    exit 2
    217217fi
    218218
     
    222222
    223223if [ -z "$USER" -a -z "$PROPNAME" ]; then
    224     EVENT="added"
    225     echo "Changeset $REV was added in $REPOS"
     224    EVENT="added"
     225    echo "Changeset $REV was added in $REPOS"
    226226else
    227     EVENT="modified"
    228     echo "Changeset $REV was modified by $USER in $REPOS"
     227    EVENT="modified"
     228    echo "Changeset $REV was modified by $USER in $REPOS"
    229229fi
    230230
    231231# -- Call "trac-admin ... changeset ... $REPOS $REV" for each Trac environment
    232232
    233 ifs=$IFS
    234 IFS=:
    235 if [ -n "$BASH_VERSION" ]; then # we can use Bash syntax
    236     if [[ ${BASH_VERSINFO[5]} = *cygwin ]]; then
    237         IFS=";"
    238     fi
    239 fi
    240 for env in $TRAC_ENV; do
    241     if [ -r "$env/VERSION" ]; then
    242         log=$env/log/svn-hooks-`basename $REPOS`.log
    243         REPO=`grep -E '^name[ \t]*=' $env/conf/trac.ini | cut -d= -f2`
    244         nohup sh <<EOF >> $log 2>&1 &
    245             echo "Changeset $REV $EVENT"
    246             trac-admin $env changeset $EVENT $REPO $REV && \
    247                 echo "OK" || echo "FAILED: see the Trac log"
     233BASEREPO=`basename $REPOS
     234env="/prj/trac/$BASEREPO.env"
     235if [ -r "$env/VERSION" ]; then
     236    log=$env/log/svn-hooks-$BASEREPO.log
     237    REPO=`grep -E '^name[ \t]*=' $env/conf/trac.ini | cut -d= -f2`
     238    nohup sh <<EOF >> $log 2>&1 &
     239    echo "Changeset $REV $EVENT"
     240    trac-admin $env changeset $EVENT $REPO $REV && \
     241        echo "OK" || echo "FAILED: see the Trac log"
    248242EOF
    249     else
    250         echo "$env doesn't seem to be a Trac environment, skipping..."
    251     fi
    252 done
    253 IFS=$ifs
     243else
     244    echo "$env doesn't seem to be a Trac environment, skipping..."
     245fi
Note: See TracChangeset for help on using the changeset viewer.