source: orange/install-scripts/mac/bundle-daily-build-hg.sh @ 10789:3178bd8fce77

Revision 10789:3178bd8fce77, 2.1 KB checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Packaging scripts fixes.

  • Property exe set to *
RevLine 
[10270]1#!/bin/bash -e
2#
3# ./bundle-daily-build-hg.sh
4#
[10788]5# $1 Force
6#
[10270]7
[10788]8FORCE=$1
[10270]9
[10289]10trap "echo \"Script failed\"" ERR
[10270]11
[10289]12# If possible get the orange tip revision number and check if the bundle already exists
13if [ -e /private/tmp/repos/orange ]; then
14    # 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`
17else
18    DAILY_REVISION="tip"
19fi
[10270]20
[10289]21BUNDLE="/private/tmp/orange-bundle-hg-$DAILY_REVISION.dmg"
22       
23# Create the bundle if it does not yet exist
[10788]24if [[ ! -e /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg || $DAILY_REVISION -eq "tip" || $FORCE ]]; then
[10289]25    echo "Building orange revision $DAILY_REVISION"
26    ./bundle-build-hg.sh /private/tmp tip $BUNDLE
27   
28    # 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`
[10270]30
[10289]31    # TODO: Should be called only on a daily build server and not if building locally
32    /Users/ailabc/mount-dirs.sh
[10270]33
[10289]34    echo "Removing old versions of bundles."
35    # (Keeps last 5 versions.)
36    perl -e 'unlink ((reverse sort </Volumes/download/orange-bundle-hg-0*.dmg>)[5..10000])'
[10270]37
[10789]38    MD5=`md5 -q $BUNDLE`
39   
[10270]40    echo "Moving bundle to the download directory."
41    mv $BUNDLE /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg
[10788]42
[10270]43    echo "Setting permissions."
44    chmod +r /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg
[10788]45
46    # Check integrity
[10789]47    MD5_D=`md5 -q /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg`
48    if [[ $MD5 != $MD5_D ]]; then
[10788]49        echo "Error moving the bundle in place"
50        rm /Volumes/download/orange-bundle-hg-0.0.$DAILY_REVISION.dmg
51        exit 1
52    fi
[10270]53   
[10289]54    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
[10270]58
[10289]59else
60    echo "The bundle with revision $DAILY_REVISION already exists."
[10270]61fi
Note: See TracBrowser for help on using the repository browser.