source: orange/install-scripts/mac/fink-daily-build.sh @ 9210:5cbd1cd32412

Revision 9210:5cbd1cd32412, 21.5 KB checked in by mitar, 2 years ago (diff)

Removed octave from list of Fink packages.

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Should be run as: sudo ./fink-daily-build.sh [stable revision] [daily revision]
4#
5# If [stable revision] and/or [daily revision] is specified it makes source archives and updates
6# our info files with those revisions (if any is not specified it uses its latest revision)
7# before building Fink packages
8#
9
10# Those packages should not be installed as we are just building them (and dependencies)
11# The order is important as for validation to work we should first build packages which do not depend on other
12# packages we want to validate (as they would be build without validation as dependencies)
13STABLE_PACKAGES="orange-py25 orange"
14DAILY_PACKAGES="orange-svn-py26 orange-gui-svn-py26 orange-bioinformatics-svn-py26 orange-bioinformatics-gui-svn-py26 orange-text-svn-py26 orange-text-gui-svn-py26 orange-svn-py27 orange-gui-svn-py27 orange-bioinformatics-svn-py27 orange-bioinformatics-gui-svn-py27 orange-text-svn-py27 orange-text-gui-svn-py27"
15
16LAST_MAC_VERSION_FOR_STABLE_PACKAGES=5
17
18# Packages which, when installing, want special confirmation from the user
19# We keep those packages installed all the time
20SPECIAL_PACKAGES="passwd xinitrc"
21
22# Additional source directories which get packed
23STABLE_SOURCE_DIRS="install-scripts/mac/bundle-lite/"
24DAILY_SOURCE_DIRS="install-scripts/mac/bundle-lite/ add-ons/Bioinformatics/ add-ons/Text/"
25
26# A list of packages (dependencies) from which user can choose upon installing our packages
27# We would like to build all those so that it does not need to compile anything whichever packages he or she chooses
28# The problem is that they are often mutually conflicting so we cannot have them simply installed (so that update-all
29# would update them) but have to build them explicitly
30OTHER_PACKAGES="ghostscript ghostscript-esp ghostscript6 ghostscript-nox ghostscript6-nox gnuplot gnuplot-nox gnuplot-nogtk tetex-base tetex-nox-base texlive-nox-base texlive-base tetex-texmf texlive-texmf"
31
32# Miscellaneous extra packages which are maybe not really needed for Orange but are useful for CS research
33EXTRA_PACKAGES="fuse gcc42 gcc43 gcc44 gnuplot gnuplot-nox gnuplot-nogtk db48 db48-aes git imagemagick-nox rrdtool maxima nmap wireshark openssl pstree python26 python27 python3 rdiff-backup svn swi-prolog lynx links w3m elinks matplotlib-py26 matplotlib-py27 mercurial-py26 mercurial-py27"
34
35FINK_ARGS="--yes --build-as-nobody"
36FINK_SELFUPDATE_ARGS="--yes"
37APT_ARGS="--assume-yes"
38
39# Path to Fink root
40FINK_ROOT=/sw
41
42ARCH=`perl -MFink::FinkVersion -e 'print Fink::FinkVersion::get_arch'`
43
44if [ "$1" ] || [ "$2" ]; then
45    PACKAGE_SOURCE=1
46fi
47
48# Sets error handler
49trap "echo \"Script failed\"" ERR
50
51((`id -u` == 0)) || { echo "Must run as root user (use sudo)."; exit 1; }
52
53test -r $FINK_ROOT/bin/init.sh || { echo "Fink cannot be found." exit 2; }
54
55[ -e /Volumes/fink/ ] || { echo "/Volumes/fink/ not mounted."; exit 3; }
56
57if [ $PACKAGE_SOURCE ]; then
58    [ -e /Volumes/download/ ] || { echo "/Volumes/download/ not mounted."; exit 4; }
59fi
60
61# Configures environment for Fink
62. $FINK_ROOT/bin/init.sh
63
64if ! grep '^Trees:' $FINK_ROOT/etc/fink.conf | grep -q 'unstable/main' && grep '^SelfUpdateMethod:' $FINK_ROOT/etc/fink.conf | grep -q 'point'; then
65    echo "Fink does not seem to use unstable Fink packages tree with rsync or CVS updating."
66    exit 5
67fi
68
69if [ ! -x /usr/bin/xcodebuild ]; then
70    echo "It seems Xcode is not installed on a system."
71    exit 6
72fi
73
74MAC_VERSION=`sw_vers -productVersion | cut -d '.' -f 2`
75if [[ "$MAC_VERSION" -ne 5 && "$MAC_VERSION" -ne 6 ]]; then
76    echo "It seems system is not Mac OS X version 10.5 or 10.6."
77    exit 7
78fi
79if [[ "$MAC_VERSION" -gt "$LAST_MAC_VERSION_FOR_STABLE_PACKAGES" ]]; then
80    STABLE_PACKAGES=""
81fi
82
83if [ ! "`/usr/X11/bin/X -version 2>&1 | grep '^X.Org X Server' | grep -E -o '[0-9]+\.[0-9]+\.[0-9]+' | cut -d '.' -f 2`" -gt "3" ]; then
84    echo "It seems X11 version 2.3.0 or later is not installed on a system."
85    exit 8
86fi
87
88if [ $PACKAGE_SOURCE ]; then
89    # Defaults are current latest revisions in stable branch and trunk
90    STABLE_REVISION=${1:-`svn info --non-interactive http://orange.biolab.si/svn/orange/branches/ver1.0/ | grep 'Last Changed Rev:' | cut -d ' ' -f 4`}
91    # svn info does not return proper exit status on an error so we check it this way
92    [ "$STABLE_REVISION" ] || exit 9
93    DAILY_REVISION=${2:-`svn info --non-interactive http://orange.biolab.si/svn/orange/trunk/ | grep 'Last Changed Rev:' | cut -d ' ' -f 4`}
94    # svn info does not return proper exit status on an error so we check it this way
95    [ "$DAILY_REVISION" ] || exit 10
96fi
97
98echo "Preparing local biolab Fink info files repository."
99mkdir -p $FINK_ROOT/fink/dists/biolab/main/finkinfo/
100rm -f $FINK_ROOT/fink/dists/biolab/main/finkinfo/*
101if [ $PACKAGE_SOURCE ]; then   
102    # Gets Fink package info files from SVN
103    svn export --force --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/install-scripts/mac/fink/ $FINK_ROOT/fink/dists/biolab/main/finkinfo/
104   
105    # Injects revision versions into templates
106    perl -pi -e "s/__STABLE_REVISION__/$STABLE_REVISION/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
107    perl -pi -e "s/__DAILY_REVISION__/$DAILY_REVISION/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
108else
109    # Gets current (daily) info files from SVN
110    echo "Updating local biolab Fink info files repository."
111    curl "http://orange.biolab.si/fink/dists/10.$MAC_VERSION/main/finkinfo/all.tgz" --output $FINK_ROOT/fink/dists/biolab/main/finkinfo/all.tgz
112    tar -xzf $FINK_ROOT/fink/dists/biolab/main/finkinfo/all.tgz -C $FINK_ROOT/fink/dists/biolab/main/finkinfo/
113    rm -f $FINK_ROOT/fink/dists/biolab/main/finkinfo/all.tgz
114fi
115
116if ! grep '^Trees:' $FINK_ROOT/etc/fink.conf | grep -q 'biolab/main'; then
117    echo "Adding local biolab Fink info files repository to Fink configuration."
118    perl -p -i -l -e '$_ = "$_ biolab/main" if /^Trees/' $FINK_ROOT/etc/fink.conf
119fi
120
121# Adds our binary repository to local Fink (APT) configuration
122if ! grep -q "deb http://orange.biolab.si/fink 10.$MAC_VERSION main" $FINK_ROOT/etc/apt/sources.list; then
123    echo "Adding biolab Fink binary packages repository to Fink configuration."
124    echo "deb http://orange.biolab.si/fink 10.$MAC_VERSION main" >> $FINK_ROOT/etc/apt/sources.list
125fi
126
127if [ ! -e $FINK_ROOT/etc/apt/apt.conf.d/daily-build ]; then
128    echo "Configuring apt-get to assume yes to all questions."
129    echo 'APT::Get::Assume-Yes "true";' > $FINK_ROOT/etc/apt/apt.conf.d/daily-build
130fi
131
132if [ $PACKAGE_SOURCE ]; then
133    mkdir -p "/Volumes/fink/dists/10.$MAC_VERSION/main/source/"
134    chmod +rx "/Volumes/fink/dists/10.$MAC_VERSION/main/source/"
135   
136    if [ ! -e /Volumes/fink/dists/10.$MAC_VERSION/main/source/orange-1.0b.$STABLE_REVISION.tgz ]; then
137        echo "Making source archive orange-1.0b.$STABLE_REVISION."
138       
139        rm -rf /tmp/orange-1.0b.$STABLE_REVISION/ /tmp/orange-1.0b.$STABLE_REVISION.tgz
140       
141        svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/orange/ /tmp/orange-1.0b.$STABLE_REVISION/
142        svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/source/ /tmp/orange-1.0b.$STABLE_REVISION/source/
143        svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/add-ons/orngCRS/src/ /tmp/orange-1.0b.$STABLE_REVISION/source/crs/
144        svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/COPYING /tmp/orange-1.0b.$STABLE_REVISION/COPYING
145        svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/LICENSES /tmp/orange-1.0b.$STABLE_REVISION/LICENSES
146       
147        [ -e /tmp/orange-1.0b.$STABLE_REVISION/doc/COPYING ] && mv /tmp/orange-1.0b.$STABLE_REVISION/doc/COPYING /tmp/orange-1.0b.$STABLE_REVISION/
148        [ -e /tmp/orange-1.0b.$STABLE_REVISION/doc/LICENSES ] && mv /tmp/orange-1.0b.$STABLE_REVISION/doc/LICENSES /tmp/orange-1.0b.$STABLE_REVISION/
149       
150        tar -czf /tmp/orange-1.0b.$STABLE_REVISION.tgz -C /tmp/ orange-1.0b.$STABLE_REVISION
151       
152        MD5SUM=`md5 -q /tmp/orange-1.0b.$STABLE_REVISION.tgz`
153       
154        mv /tmp/orange-1.0b.$STABLE_REVISION.tgz /Volumes/fink/dists/10.$MAC_VERSION/main/source/
155        chmod -R +r "/Volumes/fink/dists/10.$MAC_VERSION/main/source/"
156       
157        rm -rf /tmp/orange-1.0b.$STABLE_REVISION/
158       
159        echo "Registering new source archive."
160        egrep -v '^SOURCE_STABLE=' /Volumes/download/filenames_mac.set > /Volumes/download/filenames_mac.set.new
161        echo "SOURCE_STABLE=orange-1.0b.$STABLE_REVISION.tgz" >> /Volumes/download/filenames_mac.set.new
162        mv /Volumes/download/filenames_mac.set.new /Volumes/download/filenames_mac.set
163        chmod +r /Volumes/download/filenames_mac.set
164    else
165        MD5SUM=`md5 -q /Volumes/fink/dists/10.$MAC_VERSION/main/source/orange-1.0b.$STABLE_REVISION.tgz`
166    fi
167   
168    perl -pi -e "s/__STABLE_MD5SUM_ORANGE__/$MD5SUM/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
169   
170    if [ ! -e /Volumes/fink/dists/10.$MAC_VERSION/main/source/orange-svn-0.0.$DAILY_REVISION.tgz ]; then
171        echo "Making source archive orange-svn-0.0.$DAILY_REVISION."
172       
173        rm -rf /tmp/orange-svn-0.0.$DAILY_REVISION/ /tmp/orange-svn-0.0.$DAILY_REVISION.tgz
174       
175        svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/orange/ /tmp/orange-svn-0.0.$DAILY_REVISION/
176        svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/source/ /tmp/orange-svn-0.0.$DAILY_REVISION/source/
177        svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/add-ons/orngCRS/src/ /tmp/orange-svn-0.0.$DAILY_REVISION/source/crs/
178        svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/COPYING /tmp/orange-svn-0.0.$DAILY_REVISION/COPYING
179        svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/LICENSES /tmp/orange-svn-0.0.$DAILY_REVISION/LICENSES
180       
181        [ -e /tmp/orange-svn-0.0.$DAILY_REVISION/doc/COPYING ] && mv /tmp/orange-svn-0.0.$DAILY_REVISION/doc/COPYING /tmp/orange-svn-0.0.$DAILY_REVISION/
182        [ -e /tmp/orange-svn-0.0.$DAILY_REVISION/doc/LICENSES ] && mv /tmp/orange-svn-0.0.$DAILY_REVISION/doc/LICENSES /tmp/orange-svn-0.0.$DAILY_REVISION/
183       
184        tar -czf /tmp/orange-svn-0.0.$DAILY_REVISION.tgz -C /tmp/ orange-svn-0.0.$DAILY_REVISION
185       
186        MD5SUM=`md5 -q /tmp/orange-svn-0.0.$DAILY_REVISION.tgz`
187       
188        mv /tmp/orange-svn-0.0.$DAILY_REVISION.tgz /Volumes/fink/dists/10.$MAC_VERSION/main/source/
189        chmod -R +r /Volumes/fink/dists/10.$MAC_VERSION/main/source/
190       
191        rm -rf /tmp/orange-svn-0.0.$DAILY_REVISION/
192       
193        echo "Registering new source archive."
194        egrep -v '^SOURCE_DAILY=' /Volumes/download/filenames_mac.set > /Volumes/download/filenames_mac.set.new
195        echo "SOURCE_DAILY=orange-svn-0.0.$DAILY_REVISION.tgz" >> /Volumes/download/filenames_mac.set.new
196        mv /Volumes/download/filenames_mac.set.new /Volumes/download/filenames_mac.set
197        chmod +r /Volumes/download/filenames_mac.set
198    else
199        MD5SUM=`md5 -q /Volumes/fink/dists/10.$MAC_VERSION/main/source/orange-svn-0.0.$DAILY_REVISION.tgz`
200    fi
201   
202    perl -pi -e "s/__DAILY_MD5SUM_ORANGE__/$MD5SUM/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
203   
204    for dir in $STABLE_SOURCE_DIRS ; do
205        # Gets only the last part of the directory name, converts to lower case and removes dashes
206        SOURCE_NAME=`basename $dir | tr "[:upper:]" "[:lower:]" | tr -d "-"`
207        SOURCE_VAR=`basename $dir | tr "[:lower:]" "[:upper:]" | tr -d "-"`
208        STABLE_SOURCE_NAME=orange-$SOURCE_NAME-1.0b.$STABLE_REVISION
209       
210        if [ ! -e /Volumes/fink/dists/10.$MAC_VERSION/main/source/$STABLE_SOURCE_NAME.tgz ]; then
211            echo "Making source archive $STABLE_SOURCE_NAME."
212           
213            rm -rf /tmp/$STABLE_SOURCE_NAME/ /tmp/$STABLE_SOURCE_NAME.tgz
214           
215            svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/$dir /tmp/$STABLE_SOURCE_NAME/
216            svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/COPYING /tmp/$STABLE_SOURCE_NAME/COPYING
217            svn export --non-interactive --revision $STABLE_REVISION http://orange.biolab.si/svn/orange/branches/ver1.0/LICENSES /tmp/$STABLE_SOURCE_NAME/LICENSES
218           
219            [ -e /tmp/$STABLE_SOURCE_NAME/doc/COPYING ] && mv /tmp/$STABLE_SOURCE_NAME/doc/COPYING /tmp/$STABLE_SOURCE_NAME/
220            [ -e /tmp/$STABLE_SOURCE_NAME/doc/LICENSES ] && mv /tmp/$STABLE_SOURCE_NAME/doc/LICENSES /tmp/$STABLE_SOURCE_NAME/
221           
222            tar -czf /tmp/$STABLE_SOURCE_NAME.tgz -C /tmp/ $STABLE_SOURCE_NAME
223           
224            MD5SUM=`md5 -q /tmp/$STABLE_SOURCE_NAME.tgz`
225           
226            mv /tmp/$STABLE_SOURCE_NAME.tgz /Volumes/fink/dists/10.$MAC_VERSION/main/source/
227       
228            rm -rf /tmp/$STABLE_SOURCE_NAME/
229           
230            echo "Registering new source archive."
231            egrep -v "^SOURCE_${SOURCE_VAR}_STABLE=" /Volumes/download/filenames_mac.set > /Volumes/download/filenames_mac.set.new
232            echo "SOURCE_${SOURCE_VAR}_STABLE=$STABLE_SOURCE_NAME.tgz" >> /Volumes/download/filenames_mac.set.new
233            mv /Volumes/download/filenames_mac.set.new /Volumes/download/filenames_mac.set
234        else
235            MD5SUM=`md5 -q /Volumes/fink/dists/10.$MAC_VERSION/main/source/$STABLE_SOURCE_NAME.tgz`
236        fi
237       
238        perl -pi -e "s/__STABLE_MD5SUM_\U$SOURCE_NAME\E__/$MD5SUM/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
239    done
240   
241    for dir in $DAILY_SOURCE_DIRS ; do
242        # Gets only the last part of the directory name, converts to lower case and removes dashes
243        SOURCE_NAME=`basename $dir | tr "[:upper:]" "[:lower:]" | tr -d "-"`
244        SOURCE_VAR=`basename $dir | tr "[:lower:]" "[:upper:]" | tr -d "-"`
245        DAILY_SOURCE_NAME=orange-$SOURCE_NAME-svn-0.0.$DAILY_REVISION
246       
247        if [ ! -e /Volumes/fink/dists/10.$MAC_VERSION/main/source/$DAILY_SOURCE_NAME.tgz ]; then
248            echo "Making source archive $DAILY_SOURCE_NAME."
249           
250            rm -rf /tmp/$DAILY_SOURCE_NAME/ /tmp/$DAILY_SOURCE_NAME.tgz
251           
252            svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/$dir /tmp/$DAILY_SOURCE_NAME/
253            svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/COPYING /tmp/$DAILY_SOURCE_NAME/COPYING
254            svn export --non-interactive --revision $DAILY_REVISION http://orange.biolab.si/svn/orange/trunk/LICENSES /tmp/$DAILY_SOURCE_NAME/LICENSES
255           
256            [ -e /tmp/$DAILY_SOURCE_NAME/doc/COPYING ] && mv /tmp/$DAILY_SOURCE_NAME/doc/COPYING /tmp/$DAILY_SOURCE_NAME/
257            [ -e /tmp/$DAILY_SOURCE_NAME/doc/LICENSES ] && mv /tmp/$DAILY_SOURCE_NAME/doc/LICENSES /tmp/$DAILY_SOURCE_NAME/
258           
259            tar -czf /tmp/$DAILY_SOURCE_NAME.tgz -C /tmp/ $DAILY_SOURCE_NAME
260           
261            MD5SUM=`md5 -q /tmp/$DAILY_SOURCE_NAME.tgz`
262           
263            mv /tmp/$DAILY_SOURCE_NAME.tgz /Volumes/fink/dists/10.$MAC_VERSION/main/source/
264       
265            rm -rf /tmp/$DAILY_SOURCE_NAME/
266           
267            echo "Registering new source archive."
268            egrep -v "^SOURCE_${SOURCE_VAR}_DAILY=" /Volumes/download/filenames_mac.set > /Volumes/download/filenames_mac.set.new
269            echo "SOURCE_${SOURCE_VAR}_DAILY=$DAILY_SOURCE_NAME.tgz" >> /Volumes/download/filenames_mac.set.new
270            mv /Volumes/download/filenames_mac.set.new /Volumes/download/filenames_mac.set
271        else
272            MD5SUM=`md5 -q /Volumes/fink/dists/10.$MAC_VERSION/main/source/$DAILY_SOURCE_NAME.tgz`
273        fi
274       
275        perl -pi -e "s/__DAILY_MD5SUM_\U$SOURCE_NAME\E__/$MD5SUM/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
276    done
277fi
278
279# Configures any pending packages from possible interrupted past sessions
280dpkg --configure -a
281
282# Gets all official Fink package info files
283echo "Updating installed Fink packages."
284fink $FINK_SELFUPDATE_ARGS selfupdate --method=rsync
285fink $FINK_ARGS scanpackages
286
287# Updates everything (probably by compiling new packages)
288fink $FINK_ARGS update-all
289
290# Installs special packages (if they are not already installed)
291yes | fink $FINK_ARGS install $SPECIAL_PACKAGES
292
293# Removes possiblly installed packages which we want built
294fink $FINK_ARGS purge --recursive $STABLE_PACKAGES $DAILY_PACKAGES $OTHER_PACKAGES $EXTRA_PACKAGES
295# Sometimes Fink and APT are not in sync so we remove packages also directly
296for package in $STABLE_PACKAGES $DAILY_PACKAGES $OTHER_PACKAGES $EXTRA_PACKAGES ; do
297    echo $package "purge" | dpkg --set-selections
298done
299apt-get $APT_ARGS dselect-upgrade
300
301# Stores current packages status
302dpkg --get-selections '*' > /tmp/dpkg-selections.list
303
304for package in $OTHER_PACKAGES ; do
305    # Restores intitial packages status
306    dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
307    dpkg --set-selections < /tmp/dpkg-selections.list
308    apt-get $APT_ARGS dselect-upgrade
309   
310    # Builds a package if it has not been rebuilt already (for example, as a dependency)
311    # We install it and not just build it because installation does not build package if it already exists as a binary package
312    echo "Specially building package $package."
313    fink $FINK_ARGS install $package
314done
315
316for package in $EXTRA_PACKAGES ; do
317    if fink $FINK_ARGS describe $package > /dev/null ; then
318        # Restores intitial packages status
319        dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
320        dpkg --set-selections < /tmp/dpkg-selections.list
321        apt-get $APT_ARGS dselect-upgrade
322       
323        # Builds a package if it has not been rebuilt already (for example, as a dependency)
324        # We install it and not just build it because installation does not build package if it already exists as a binary package
325        echo "Specially building extra package $package."
326        fink $FINK_ARGS install $package
327    else
328        echo "Not building extra package $package."
329    fi
330done
331
332# We build our packages in "maintainer" mode - Fink makes tests and validates packages
333for package in $STABLE_PACKAGES $DAILY_PACKAGES ; do
334    DEPS=`perl -MFink -MFink::PkgVersion -l -e "Fink::Package->require_packages(); map { map { /(\\S+)/; print \\$1 } @\\$_ } @{Fink::PkgVersion->match_package('$package')->get_depends(1, 0)};"`
335   
336    # First builds all dependencies normally (so that we are not checking for others' errors)
337    for deps in $DEPS ; do
338        # Restores intitial packages status
339        dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
340        dpkg --set-selections < /tmp/dpkg-selections.list
341        apt-get $APT_ARGS dselect-upgrade
342       
343        # We install it and not just build it because installation does not build package if it already exists as a binary package
344        echo "Specially building package $package dependency $deps."
345        fink $FINK_ARGS install $deps
346    done
347   
348    # Restores intitial packages status
349    dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
350    dpkg --set-selections < /tmp/dpkg-selections.list
351    apt-get $APT_ARGS dselect-upgrade
352   
353    # Then builds a package
354    # We can just build it as our packages have been probably cached if they have been already built
355    echo "Specially building, testing and validating package $package."
356    fink $FINK_ARGS --maintainer build $package
357done
358
359echo "Restoring initial packages status."
360dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
361dpkg --set-selections < /tmp/dpkg-selections.list
362apt-get $APT_ARGS dselect-upgrade
363rm -f /tmp/dpkg-selections.list
364
365# Cleans unncessary files (we cache them anyway in public repository)
366echo "Cleaning."
367fink $FINK_ARGS cleanup --all
368
369# TODO: Should be called only on a daily build server and not if building locally
370/Users/ailabc/mount-dirs.sh
371
372echo "Preparing public biolab Fink info and binary files repository."
373mkdir -p /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
374chmod +rx /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
375mkdir -p /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/
376chmod +rx /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
377
378echo "Copying to repository all binary packages."
379cp $FINK_ROOT/fink/debs/*.deb /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
380if (shopt -s nullglob; f=($FINK_ROOT/var/cache/apt/archives/*.deb); ((${#f[@]}))); then
381    # We have to test if there are any deb files available as otherwise cp fails
382    cp $FINK_ROOT/var/cache/apt/archives/*.deb /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
383fi
384
385cd /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
386
387echo "Fixing possible problems with binary packages filenames."
388# Some packages include Fink epoch which uses colon as a delimiter and breaks package retrieval from the repository web server
389# We remove epoch as it should not be there in the first place
390perl -e '
391for (<*.deb>) {
392    if (m/^(.+)_\d+%3a(.+)$/) {
393        rename $_, "$1_$2";
394    }
395}
396'
397
398echo "Removing old binary packages."
399# (Versions of packages which have more then 5 versions and those old versions are more than one month old.)
400perl -e '
401for (<*.deb>) {
402    m/(.*?)_/;
403    $fs{$1}++;
404}
405while (($f,$n) = each(%fs)) {
406    next if $n <= 5;
407    unlink for grep {-M > 30} <$f_*.deb>;
408}
409'
410
411echo "Making packages list."
412cd /Volumes/fink/
413perl -MFink::Scanpackages -e "Fink::Scanpackages->scan('dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/');" | gzip - > dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/Packages.gz
414
415echo "Archive: biolab
416Origin: Fink
417Component: main
418Architecture: darwin-$ARCH
419Label: Fink" > dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/Release
420
421echo "Setting permissions."
422chmod -R +r /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
423
424echo "Copying to repository all info files."
425rm -f /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/*
426cp $FINK_ROOT/fink/dists/biolab/main/finkinfo/* /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/
427
428echo "Making an archive of all info files."
429cd $FINK_ROOT/fink/dists/biolab/main/finkinfo/
430tar -czf /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/all.tgz *
431
432echo "Setting permissions."
433chmod -R +r /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/
434
435echo "Removing unnecessary source archives."
436perl -e "
437for (</Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/orange-*.deb>) {
438    m/_(.+)-\\d+_darwin-$ARCH\\.deb/;
439    \$versions{\$1} = 1;
440}
441for (</Volumes/fink/dists/10.$MAC_VERSION/main/source/*.tgz>) {
442    m/.+-(.+)\\.tgz/;
443    next if \$versions{\$1} or -M() < 30;
444    unlink;
445}
446"
Note: See TracBrowser for help on using the repository browser.