Ignore:
Timestamp:
03/27/13 18:23:19 (13 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fix for daily build scripts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • install-scripts/mac/bundle-daily-build-hg.sh

    r10789 r11427  
    33# ./bundle-daily-build-hg.sh 
    44# 
    5 # $1 Force 
     5# $1 workdir (directory where sources can be checked out and build) 
     6# $2 publishdir (directory where the resulting versioned bundle can be moved) 
     7# $3 force (force the build even if a bundle with the same revision exists at publishdir) 
     8# $4 local 
    69# 
    710 
    8 FORCE=$1 
     11WORK_DIR=${1:-"/private/tmp"} 
     12PUBLISH_DIR=${2:-"$WORK_DIR/download"} 
     13 
     14FORCE=$3 
     15LOCAL=$4 
     16 
     17ORANGE_REPO=$WORK_DIR/repos/orange 
    918 
    1019trap "echo \"Script failed\"" ERR 
    1120 
    1221# If possible get the orange tip revision number and check if the bundle already exists 
    13 if [ -e /private/tmp/repos/orange ]; then 
     22if [ -e $ORANGE_REPO ]; then 
    1423    # Try to pull and update (pull returns 1 if no changesets) 
    15     hg pull --update -R /private/tmp/repos/orange || true 
    16     DAILY_REVISION=`hg log -r tip -R /private/tmp/repos/orange | grep 'changeset:' | cut -d ' ' -f 4 | cut -d ':' -f 1` 
     24    hg pull --update -R $ORANGE_REPO || true 
     25    DAILY_REVISION=`hg log -r tip -R $ORANGE_REPO | grep 'changeset:' | cut -d ' ' -f 4 | cut -d ':' -f 1` 
    1726else 
    1827    DAILY_REVISION="tip" 
    1928fi 
    2029 
    21 BUNDLE="/private/tmp/orange-bundle-hg-$DAILY_REVISION.dmg" 
    22          
     30BUNDLE="$WORK_DIR/orange-bundle-hg-$DAILY_REVISION.dmg" 
     31PUBLISH_BUNDLE=$PUBLISH_DIR/orange-bundle-hg-0.0.$DAILY_REVISION.dmg 
     32 
     33 
    2334# Create the bundle if it does not yet exist 
    24 if [[ ! -e /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg || $DAILY_REVISION -eq "tip" || $FORCE ]]; then 
     35if [[ ! -e $PUBLISH_BUNDLE || $DAILY_REVISION -eq "tip" || $FORCE ]]; then 
    2536    echo "Building orange revision $DAILY_REVISION" 
    26     ./bundle-build-hg.sh /private/tmp tip $BUNDLE 
     37    ./bundle-build-hg.sh $WORK_DIR tip $BUNDLE 
    2738     
    2839    # Get the revision again in case it was "tip" 
    29     DAILY_REVISION=`hg log -r tip -R /private/tmp/repos/orange | grep 'changeset:' | cut -d ' ' -f 4 | cut -d ':' -f 1` 
     40    DAILY_REVISION=`hg log -r tip -R $ORANGE_REPO | grep 'changeset:' | cut -d ' ' -f 4 | cut -d ':' -f 1` 
     41    # And update the publish bundle filename 
     42    PUBLISH_BUNDLE=$PUBLISH_DIR/orange-bundle-hg-0.0.$DAILY_REVISION.dmg 
    3043 
    31     # TODO: Should be called only on a daily build server and not if building locally 
    32     /Users/ailabc/mount-dirs.sh 
     44    if [ ! $LOCAL ]; then 
     45        /Users/ailabc/mount-dirs.sh 
     46    fi 
    3347 
    3448    echo "Removing old versions of bundles." 
    3549    # (Keeps last 5 versions.) 
    36     perl -e 'unlink ((reverse sort </Volumes/download/orange-bundle-hg-0*.dmg>)[5..10000])' 
     50    perl -e "unlink ((reverse sort <$PUBLISH_DIR/orange-bundle-hg-0*.dmg>)[5..10000])" 
    3751 
    3852    MD5=`md5 -q $BUNDLE` 
    3953     
    4054    echo "Moving bundle to the download directory." 
    41     mv $BUNDLE /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg 
     55    mv $BUNDLE $PUBLISH_BUNDLE.new 
    4256 
    4357    echo "Setting permissions." 
    44     chmod +r /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg 
     58    chmod +r $PUBLISH_BUNDLE.new 
    4559 
    46     # Check integrity  
    47     MD5_D=`md5 -q /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg` 
     60    # Check integrity 
     61    MD5_D=`md5 -q $PUBLISH_BUNDLE.new` 
    4862    if [[ $MD5 != $MD5_D ]]; then 
    4963        echo "Error moving the bundle in place" 
    50         rm /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg 
     64        rm $PUBLISH_BUNDLE.new 
    5165        exit 1 
     66    else 
     67        mv $PUBLISH_BUNDLE.new $PUBLISH_BUNDLE 
    5268    fi 
    5369     
    5470    echo "Registering new bundles." 
    55     egrep -v '^(MAC_DAILY)=' /Volumes/download/filenames_mac.set > /Volumes/download/filenames_mac.set.new 
    56     echo "MAC_DAILY=orange-bundle-hg-0.0.$DAILY_REVISION.dmg" >> /Volumes/download/filenames_mac.set.new 
    57     mv /Volumes/download/filenames_mac.set.new /Volumes/download/filenames_mac.set 
     71    egrep -v '^(MAC_DAILY)=' $PUBLISH_DIR/filenames_mac.set > $PUBLISH_DIR/filenames_mac.set.new 
     72    echo "MAC_DAILY=orange-bundle-hg-0.0.$DAILY_REVISION.dmg" >> $PUBLISH_DIR/filenames_mac.set.new 
     73    mv $PUBLISH_DIR/filenames_mac.set.new $PUBLISH_DIR/filenames_mac.set 
    5874 
    5975else 
Note: See TracChangeset for help on using the changeset viewer.