Changeset 11032


Ignore:
Timestamp:
Jan 21, 2016 1:37:45 AM (3 years ago)
Author:
jdsiiro
Message:

Overhaul of the rebuild script to work with git-based packages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dist/zipbuilder/rebuild

    r11030 r11032  
    2525fi
    2626
     27USAGE="Usage: $0 --trunk|--release|--pypi [--zip-only]"
     28
     29if test -z "$1"; then
     30    echo "Missing mode argument."
     31    echo "$USAGE"
     32    exit 1
     33fi
     34if test "$2" == "--zip-only"; then
     35    ZIP_ONLY=1
     36elif test -n "$2"; then
     37    echo "UNKNOWN OPTION: $2"
     38    echo "$USAGE"
     39    exit 1
     40fi
     41if test -n "$3"; then
     42    echo "UNKNOWN OPTION: $3"
     43    echo "$USAGE"
     44    exit 1
     45fi
     46
    2747if test "$1" == "--trunk"; then
    2848    MODE="'--trunk'"
     
    3050    MODE=
    3151elif test "$1" == "--pypi"; then
    32     rm -f ../${PACKAGE}.zip
    33     touch ${PACKAGE}.zip
    34 
    35     if test ! -d hudson; then
    36         svn co https://software.sandia.gov/svn/fast/hudson/python hudson || exit 1
    37     fi
    38     if test ! -d vpy; then
    39         git clone https://github.com/PyUtilib/pyutilib.virtualenv.git vpy || exit 1
    40     fi
    41 
    42     SCRIPT="
    43 import sys
    44 import os
    45 
    46 sys.argv = ['dummy', '--preinstall', ""]
    47 sys.path.append(os.getcwd())
    48 os.environ['WORKSPACE'] = os.getcwd()
    49 import hudson.driver
    50 hudson.driver.perform_build(
    51     'pyutilib', cat=None, config='${INI}.ini', dest='preinstall' )"
    52     python -c "$SCRIPT" | tee ${PACKAGE}.log || exit 1
    53     python `dirname $0`/rebuild.py
    54     exit 0
    55 elif test -z "$1"; then
    56     echo "Missing mode argument."
    57     echo "Usage: $0 --trunk|--release|--pypi [--zip-only]"
     52    MODE=
     53    PYPY=1
     54else
     55    echo "Unknown argument $1"
     56    echo "$USAGE"
    5857    exit 1
    5958fi
    6059
    61 if test "$2" == "--zip-only"; then
    62     ZIP_ONLY=1
     60if test -n "$PYPI"; then
     61    rm -f ../${PACKAGE}.zip
     62    touch ${PACKAGE}.zip
    6363fi
    6464
    65 SSG=https://software.sandia.gov/svn/public
    6665if test ! -d hudson; then
    6766    svn co https://software.sandia.gov/svn/fast/hudson/python hudson || exit 1
     
    8584"
    8685python -c "$SCRIPT" | tee ${PACKAGE}.log || exit 1
     86
     87if test -n "$PYPI"; then
     88    if test -z "$ZIP_ONLY"; then
     89        python `dirname $0`/rebuild.py ${PACKAGE}
     90    fi
     91    exit 0
     92fi
     93
    8794
    8895cd preinstall || exit 1
     
    108115
    109116    for PKG in `\ls src | sort`; do
    110         SVN=`grep -A1 "package ${PKG}\$" $LOG | tail -1 | cut -d: -f2- \
    111             | xargs basename`
     117        VCS=`grep -A1 "package ${PKG}\$" $LOG | tail -1 | sed 's/ //g' | cut -c1`
     118        if test "$VCS" == 'S'; then
     119            SVN=`grep -A1 "package ${PKG}\$" $LOG | tail -1 | cut -d: -f2- \
     120                | xargs basename`
     121        elif test "$VCS" == 'G'; then
     122            SVN=`grep "Git switching ${PKG}" $LOG | cut -d: -f2-`
     123        else
     124            SVN='(unknown)'
     125        fi
    112126        printf '%12s  %s\n' $SVN $PKG >> $VER
    113127    done
     
    123137    mv tmp $VER_FILE
    124138
    125     echo "This installer includes the following Subversion revisions:" >> $VER
     139    echo "This installer includes the following package revisions:" >> $VER
    126140
    127141    for PKG in `\ls src | sort`; do
    128         SVN=`grep -A1 "package ${PKG}\$" $LOG | tail -1 | cut -d: -f2- \
    129             | xargs svn info | grep 'Last Changed Rev' | cut -d: -f2`
    130         printf '%12d  %s\n' $SVN $PKG >> $VER
     142        VCS=`grep -A1 "package ${PKG}\$" $LOG | tail -1 | sed 's/ //g' | cut -c1`
     143        if test "$VCS" == 'S'; then
     144            SVN=`grep -A1 "package ${PKG}\$" $LOG | tail -1 | cut -d: -f2- \
     145                | xargs svn info | grep 'Last Changed Rev' | cut -d: -f2`
     146        elif test "$VCS" == 'G'; then
     147            pushd src/${PKG}
     148            SVN=`git log -1 --format="%h"`
     149            popd
     150        else
     151            SVN='(unknown)'
     152        fi
     153        printf '%12s  %s\n' $SVN $PKG >> $VER
    131154    done
    132155fi
     156
     157# Remove any .git / .svn directories
     158find . -name .git | xargs rm -rf
     159find . -name .svn | xargs rm -rf
     160
    133161
    134162if test -z "$MODE"; then
Note: See TracChangeset for help on using the changeset viewer.