source: orange/install-scripts/mac/bundle-daily-build.sh @ 8908:b2ea00654318

Revision 8908:b2ea00654318, 18.4 KB checked in by ales_erjavec <ales.erjavec@…>, 3 years ago (diff)

Exclude orangeqt from the daily bundle build.

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Should be run as: ./bundle-daily-build.sh [stable revision] [daily revision]
4#
5# If [stable revision] and/or [daily revision] is/are not specified it uses its latest revision
6#
7
8# Lists of add-ons to include
9STABLE_ADDONS=""
10DAILY_ADDONS="Bioinformatics Text"
11
12# Sets error handler
13trap "echo \"Script failed\"" ERR
14
15[ -e /Volumes/download/ ] || { echo "/Volumes/download/ not mounted."; exit 1; }
16
17if [ ! -x /usr/bin/xcodebuild ]; then
18    echo "It seems Xcode is not installed on a system."
19    exit 2
20fi
21
22# Defaults are current latest revisions in stable branch and trunk
23STABLE_REVISION_1=${1:-`svn info --non-interactive http://orange.biolab.si/svn/orange/branches/ver1.0/ | grep 'Last Changed Rev:' | cut -d ' ' -f 4`}
24# svn info does not return proper exit status on an error so we check it this way
25[ "$STABLE_REVISION_1" ] || exit 3
26STABLE_REVISION_2=${1:-`svn info --non-interactive http://orange.biolab.si/svn/orange/externals/branches/ver1.0/ | grep 'Last Changed Rev:' | cut -d ' ' -f 4`}
27# svn info does not return proper exit status on an error so we check it this way
28[ "$STABLE_REVISION_2" ] || exit 3
29if [[ $STABLE_REVISION_1 -gt $STABLE_REVISION_2 ]]; then
30    STABLE_REVISION=$STABLE_REVISION_1
31else
32    STABLE_REVISION=$STABLE_REVISION_2
33fi
34DAILY_REVISION_1=${2:-`svn info --non-interactive http://orange.biolab.si/svn/orange/trunk/ | grep 'Last Changed Rev:' | cut -d ' ' -f 4`}
35# svn info does not return proper exit status on an error so we check it this way
36[ "$DAILY_REVISION_1" ] || exit 4
37DAILY_REVISION_2=${2:-`svn info --non-interactive http://orange.biolab.si/svn/orange/externals/trunk/ | grep 'Last Changed Rev:' | cut -d ' ' -f 4`}
38# svn info does not return proper exit status on an error so we check it this way
39[ "$DAILY_REVISION_2" ] || exit 4
40if [[ $DAILY_REVISION_1 -gt $DAILY_REVISION_2 ]]; then
41    DAILY_REVISION=$DAILY_REVISION_1
42else
43    DAILY_REVISION=$DAILY_REVISION_2
44fi
45
46echo "Preparing temporary directory."
47rm -rf /private/tmp/bundle/
48   
49# Gives our Python executable to compile scripts later on
50export PATH=/private/tmp/bundle/Orange.app/Contents/MacOS/:$PATH
51
52# Enables compiling of Universal binaries
53export CFLAGS="-arch ppc -arch i386"
54export CXXFLAGS="-arch ppc -arch i386"
55export LDFLAGS="-arch ppc -arch i386"
56
57if [ ! -e /Volumes/download/orange-bundle-1.0b.$STABLE_REVISION.dmg ]; then
58    echo "Downloading bundle template."
59    svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/externals/branches/ver1.0/install-scripts/mac/bundle/ /private/tmp/bundle/
60   
61    echo "Downloading Orange stable source code revision $STABLE_REVISION."
62    svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/orange/ /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/
63    svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/source/ /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/source/
64    svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/add-ons/orngCRS/src/ /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/source/crs/
65   
66    [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/doc/COPYING ] || svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/COPYING /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/doc/COPYING
67    [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/doc/LICENSES ] || svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/LICENSES /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/doc/LICENSES
68   
69    ln -s ../Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/ /private/tmp/bundle/Orange.app/Contents/Resources/orange
70    ln -s ../Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/doc/ /private/tmp/bundle/Orange.app/Contents/Resources/doc
71   
72    echo "Compiling."
73    cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/source/
74    make
75    cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/source/crs/
76    make
77    mv _orngCRS.so ../../
78    cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/
79   
80    echo "Correcting install names for modules."
81    for module in *.so ; do
82        [ -L $module ] && continue
83       
84        install_name_tool -id @executable_path/../Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/$module $module
85       
86        perl -MFile::Spec::Functions=abs2rel -e '
87        for (`/usr/bin/otool -L -X $ARGV[0]`) {
88            next unless m|^\s+(/private/tmp/bundle/Orange.app/.*) \(.*\)$|;
89            system("/usr/bin/install_name_tool", "-change", $1, "\@loader_path/" . abs2rel($1), $ARGV[0]);
90        }
91        ' $module
92    done
93   
94    echo "Cleaning up."
95    rm -rf source/ c45.dll liborange_include.a updateOrange.py
96   
97    # Installation registration
98    echo "orange" > /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange.pth
99   
100    for addon in $STABLE_ADDONS ; do
101        echo "Downloading Orange add-on $addon stable source code revision $STABLE_REVISION."
102        svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/add-ons/$addon/ /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/
103       
104        [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/doc/COPYING ] || svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/COPYING /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/doc/COPYING
105        [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/doc/LICENSES ] || svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/LICENSES /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/doc/LICENSES
106       
107        if [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/source/ ]; then
108            echo "Compiling add-on."
109            cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/source/
110            make
111            cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/
112           
113            echo "Correcting install names for modules."
114            for module in *.so ; do
115                [ -L $module ] && continue
116           
117                install_name_tool -id @executable_path/../Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange/add-ons/$addon/$module $module
118               
119                perl -MFile::Spec::Functions=abs2rel -e '
120                for (`/usr/bin/otool -L -X $ARGV[0]`) {
121                    next unless m|^\s+(/private/tmp/bundle/Orange.app/.*) \(.*\)$|;
122                    system("/usr/bin/install_name_tool", "-change", $1, "\@loader_path/" . abs2rel($1), $ARGV[0]);
123                }
124                ' $module
125            done
126        fi
127       
128        echo "Cleaning up."
129        rm -rf source/ setup.py
130       
131        # Installation registration
132        echo "orange/add-ons/$addon" > /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/orange-`echo $addon | tr "[:upper:]" "[:lower:]"`.pth
133    done
134   
135    echo "Removing unnecessary files."
136    find /private/tmp/bundle/ \( -name '*~' -or -name '*.bak' -or -name '*.pyc' -or -name '*.pyo' -or -name '*.pyd' \) -exec rm -rf {} ';'
137   
138    # Makes a link to Applications folder
139    ln -s /Applications/ /private/tmp/bundle/Applications
140   
141    echo "Fixing bundle permissions."
142    chown -Rh root:wheel /private/tmp/bundle/
143   
144    echo "Creating temporary image with the bundle."
145    rm -f /private/tmp/bundle.dmg
146    hdiutil detach /Volumes/Orange -force || true
147    hdiutil create -format UDRW -volname Orange -fs HFS+ -fsargs "-c c=64,a=16,e=16" -srcfolder /private/tmp/bundle/ /private/tmp/bundle.dmg
148    MOUNT_OUTPUT=`hdiutil attach -readwrite -noverify -noautoopen /private/tmp/bundle.dmg | egrep '^/dev/'`
149    DEV_NAME=`echo -n "$MOUNT_OUTPUT" | head -n 1 | awk '{print $1}'`
150    MOUNT_POINT=`echo -n "$MOUNT_OUTPUT" | tail -n 1 | awk '{print $3}'`
151   
152    # Makes the disk image window open automatically when mounted
153    bless -openfolder "$MOUNT_POINT"
154    # Hides background directory even more
155    /Developer/Tools/SetFile -a V "$MOUNT_POINT/.background/"
156    # Sets the custom icon volume flag so that volume has nice Orange icon after mount (.VolumeIcon.icns)
157    /Developer/Tools/SetFile -a C "$MOUNT_POINT"
158   
159    rm -rf "$MOUNT_POINT/.Trashes/"
160    rm -rf "$MOUNT_POINT/.fseventsd/"
161   
162    hdiutil detach "$DEV_NAME" -force
163   
164    echo "Converting temporary image to a compressed image."
165    rm -f /private/tmp/orange-bundle-1.0b.$STABLE_REVISION.dmg
166    hdiutil convert /private/tmp/bundle.dmg -format UDZO -imagekey zlib-level=9 -o /private/tmp/orange-bundle-1.0b.$STABLE_REVISION.dmg
167   
168    echo "Cleaning up."
169    rm -f /private/tmp/bundle.dmg
170    rm -rf /private/tmp/bundle/
171fi
172
173# TODO: Should be called only on a daily build server and not if building locally
174/Users/ailabc/mount-dirs.sh
175
176if [ ! -e /Volumes/download/orange-bundle-svn-0.0.$DAILY_REVISION.dmg ]; then
177    echo "Downloading bundle template."
178    svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/externals/trunk/install-scripts/mac/bundle/ /private/tmp/bundle/
179   
180    echo "Downloading Orange daily source code revision $DAILY_REVISION."
181    svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/orange/ /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/
182    svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/source/ /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/source/
183    svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/add-ons/orngCRS/src/ /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/source/crs/
184   
185    [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/doc/COPYING ] || svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/COPYING /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/doc/COPYING
186    [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/doc/LICENSES ] || svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/LICENSES /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/doc/LICENSES
187   
188    ln -s ../Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/ /private/tmp/bundle/Orange.app/Contents/Resources/orange
189    ln -s ../Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/doc/ /private/tmp/bundle/Orange.app/Contents/Resources/doc
190   
191    echo "Compiling."
192    cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/source/
193    make EXCLUDE_ORANGEQT=1
194    cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/source/crs/
195    make
196    mv _orngCRS.so ../../
197    cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/
198   
199    echo "Correcting install names for modules."
200    for module in *.so ; do
201        [ -L $module ] && continue
202       
203        install_name_tool -id @executable_path/../Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/$module $module
204       
205        perl -MFile::Spec::Functions=abs2rel -e '
206        for (`/usr/bin/otool -L -X $ARGV[0]`) {
207            next unless m|^\s+(/private/tmp/bundle/Orange.app/.*) \(.*\)$|;
208            system("/usr/bin/install_name_tool", "-change", $1, "\@loader_path/" . abs2rel($1), $ARGV[0]);
209        }
210        ' $module
211    done
212   
213    echo "Cleaning up."
214    rm -rf source/ c45.dll liborange_include.a updateOrange.py
215   
216    # Installation registration
217    echo "orange" > /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange.pth
218   
219    for addon in $DAILY_ADDONS ; do
220        echo "Downloading Orange add-on $addon daily source code revision $DAILY_REVISION."
221        svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/add-ons/$addon/ /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/
222       
223        [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/doc/COPYING ] || svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/COPYING /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/doc/COPYING
224        [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/doc/LICENSES ] || svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/LICENSES /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/doc/LICENSES
225       
226        if [ -e /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/source/ ]; then
227            echo "Compiling add-on."
228            cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/source/
229            make
230            cd /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/
231           
232            echo "Correcting install names for modules."
233            for module in *.so ; do
234                [ -L $module ] && continue
235           
236                install_name_tool -id @executable_path/../Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange/add-ons/$addon/$module $module
237               
238                perl -MFile::Spec::Functions=abs2rel -e '
239                for (`/usr/bin/otool -L -X $ARGV[0]`) {
240                    next unless m|^\s+(/private/tmp/bundle/Orange.app/.*) \(.*\)$|;
241                    system("/usr/bin/install_name_tool", "-change", $1, "\@loader_path/" . abs2rel($1), $ARGV[0]);
242                }
243                ' $module
244            done
245        fi
246       
247        echo "Cleaning up."
248        rm -rf source/ setup.py
249       
250        # Installation registration
251        echo "orange/add-ons/$addon" > /private/tmp/bundle/Orange.app/Contents/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/orange-`echo $addon | tr "[:upper:]" "[:lower:]"`.pth
252    done
253   
254    echo "Removing unnecessary files."
255    find /private/tmp/bundle/ \( -name '*~' -or -name '*.bak' -or -name '*.pyc' -or -name '*.pyo' -or -name '*.pyd' \) -exec rm -rf {} ';'
256   
257    # Makes a link to Applications folder
258    ln -s /Applications/ /private/tmp/bundle/Applications
259
260    echo "Fixing bundle permissions."
261    chown -Rh root:wheel /private/tmp/bundle/
262   
263    echo "Creating temporary image with the bundle."
264    rm -f /private/tmp/bundle.dmg
265    hdiutil detach /Volumes/Orange -force || true
266    hdiutil create -format UDRW -volname Orange -fs HFS+ -fsargs "-c c=64,a=16,e=16" -srcfolder /private/tmp/bundle/ /private/tmp/bundle.dmg
267    MOUNT_OUTPUT=`hdiutil attach -readwrite -noverify -noautoopen /private/tmp/bundle.dmg | egrep '^/dev/'`
268    DEV_NAME=`echo -n "$MOUNT_OUTPUT" | head -n 1 | awk '{print $1}'`
269    MOUNT_POINT=`echo -n "$MOUNT_OUTPUT" | tail -n 1 | awk '{print $3}'`
270   
271    # Makes the disk image window open automatically when mounted
272    bless -openfolder "$MOUNT_POINT"
273    # Hides background directory even more
274    /Developer/Tools/SetFile -a V "$MOUNT_POINT/.background/"
275    # Sets the custom icon volume flag so that volume has nice Orange icon after mount (.VolumeIcon.icns)
276    /Developer/Tools/SetFile -a C "$MOUNT_POINT"
277   
278    rm -rf "$MOUNT_POINT/.Trashes/"
279    rm -rf "$MOUNT_POINT/.fseventsd/"
280   
281    hdiutil detach "$DEV_NAME" -force
282   
283    echo "Converting temporary image to a compressed image."
284    rm -f /private/tmp/orange-bundle-svn-0.0.$DAILY_REVISION.dmg
285    hdiutil convert /private/tmp/bundle.dmg -format UDZO -imagekey zlib-level=9 -o /private/tmp/orange-bundle-svn-0.0.$DAILY_REVISION.dmg
286   
287    echo "Cleaning up."
288    rm -f /private/tmp/bundle.dmg
289    rm -rf /private/tmp/bundle/
290fi
291
292# TODO: Should be called only on a daily build server and not if building locally
293/Users/ailabc/mount-dirs.sh
294
295echo "Removing old versions of bundles."
296# (Keeps last 5 versions.)
297perl -e 'unlink ((reverse sort </Volumes/download/orange-bundle-svn-0*.dmg>)[5..10000])'
298perl -e 'unlink ((reverse sort </Volumes/download/orange-bundle-1*.dmg>)[5..10000])'
299
300if [ -e /private/tmp/orange-bundle-svn-0.0.$DAILY_REVISION.dmg ] || [ -e /private/tmp/orange-bundle-svn-0.0.$DAILY_REVISION.dmg ]; then
301    echo "Moving bundles to the download directory."
302    [ -e /private/tmp/orange-bundle-1.0b.$STABLE_REVISION.dmg ] && mv /private/tmp/orange-bundle-1.0b.$STABLE_REVISION.dmg /Volumes/download/
303    [ -e /private/tmp/orange-bundle-svn-0.0.$DAILY_REVISION.dmg ] && mv /private/tmp/orange-bundle-svn-0.0.$DAILY_REVISION.dmg /Volumes/download/
304   
305    echo "Setting permissions."
306    chmod +r /Volumes/download/orange-bundle-1.0b.$STABLE_REVISION.dmg
307    chmod +r /Volumes/download/orange-bundle-svn-0.0.$DAILY_REVISION.dmg
308   
309    echo "Registering new bundles."
310    egrep -v '^(MAC_STABLE|MAC_DAILY)=' /Volumes/download/filenames_mac.set > /Volumes/download/filenames_mac.set.new
311    echo "MAC_STABLE=orange-bundle-1.0b.$STABLE_REVISION.dmg" >> /Volumes/download/filenames_mac.set.new
312    echo "MAC_DAILY=orange-bundle-svn-0.0.$DAILY_REVISION.dmg" >> /Volumes/download/filenames_mac.set.new
313    mv /Volumes/download/filenames_mac.set.new /Volumes/download/filenames_mac.set
314fi
Note: See TracBrowser for help on using the repository browser.