source: orange/install-scripts/mac/bundle-daily-build-hg.sh @ 11427:72163d6c657d

Revision 11427:72163d6c657d, 2.3 KB checked in by Ales Erjavec <ales.erjavec@…>, 13 months ago (diff)

Fix for daily build scripts.

  • Property exe set to *
RevLine 
[10270]1#!/bin/bash -e
2#
3# ./bundle-daily-build-hg.sh
4#
[11427]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
[10788]9#
[10270]10
[11427]11WORK_DIR=${1:-"/private/tmp"}
12PUBLISH_DIR=${2:-"$WORK_DIR/download"}
13
14FORCE=$3
15LOCAL=$4
16
17ORANGE_REPO=$WORK_DIR/repos/orange
[10270]18
[10289]19trap "echo \"Script failed\"" ERR
[10270]20
[10289]21# If possible get the orange tip revision number and check if the bundle already exists
[11427]22if [ -e $ORANGE_REPO ]; then
[10289]23    # Try to pull and update (pull returns 1 if no changesets)
[11427]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`
[10289]26else
27    DAILY_REVISION="tip"
28fi
[10270]29
[11427]30BUNDLE="$WORK_DIR/orange-bundle-hg-$DAILY_REVISION.dmg"
31PUBLISH_BUNDLE=$PUBLISH_DIR/orange-bundle-hg-0.0.$DAILY_REVISION.dmg
32
33
[10289]34# Create the bundle if it does not yet exist
[11427]35if [[ ! -e $PUBLISH_BUNDLE || $DAILY_REVISION -eq "tip" || $FORCE ]]; then
[10289]36    echo "Building orange revision $DAILY_REVISION"
[11427]37    ./bundle-build-hg.sh $WORK_DIR tip $BUNDLE
[10289]38   
39    # Get the revision again in case it was "tip"
[11427]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
[10270]43
[11427]44    if [ ! $LOCAL ]; then
45        /Users/ailabc/mount-dirs.sh
46    fi
[10270]47
[10289]48    echo "Removing old versions of bundles."
49    # (Keeps last 5 versions.)
[11427]50    perl -e "unlink ((reverse sort <$PUBLISH_DIR/orange-bundle-hg-0*.dmg>)[5..10000])"
[10270]51
[10789]52    MD5=`md5 -q $BUNDLE`
53   
[10270]54    echo "Moving bundle to the download directory."
[11427]55    mv $BUNDLE $PUBLISH_BUNDLE.new
[10788]56
[10270]57    echo "Setting permissions."
[11427]58    chmod +r $PUBLISH_BUNDLE.new
[10788]59
[11427]60    # Check integrity
61    MD5_D=`md5 -q $PUBLISH_BUNDLE.new`
[10789]62    if [[ $MD5 != $MD5_D ]]; then
[10788]63        echo "Error moving the bundle in place"
[11427]64        rm $PUBLISH_BUNDLE.new
[10788]65        exit 1
[11427]66    else
67        mv $PUBLISH_BUNDLE.new $PUBLISH_BUNDLE
[10788]68    fi
[10270]69   
[10289]70    echo "Registering new bundles."
[11427]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
[10270]74
[10289]75else
76    echo "The bundle with revision $DAILY_REVISION already exists."
[10270]77fi
Note: See TracBrowser for help on using the repository browser.