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 *
RevLine 
[5216]1#!/bin/bash -e
2#
[5471]3# Should be run as: sudo ./fink-daily-build.sh [stable revision] [daily revision]
[5216]4#
[5735]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#
[5216]9
[5396]10# Those packages should not be installed as we are just building them (and dependencies)
[5410]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)
[5402]13STABLE_PACKAGES="orange-py25 orange"
[8109]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"
[5396]15
[6523]16LAST_MAC_VERSION_FOR_STABLE_PACKAGES=5
17
[5449]18# Packages which, when installing, want special confirmation from the user
19# We keep those packages installed all the time
[5738]20SPECIAL_PACKAGES="passwd xinitrc"
[5449]21
[5396]22# Additional source directories which get packed
[5404]23STABLE_SOURCE_DIRS="install-scripts/mac/bundle-lite/"
24DAILY_SOURCE_DIRS="install-scripts/mac/bundle-lite/ add-ons/Bioinformatics/ add-ons/Text/"
[5258]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
[9198]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"
[5258]31
[8954]32# Miscellaneous extra packages which are maybe not really needed for Orange but are useful for CS research
[9210]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"
[6545]34
[5258]35FINK_ARGS="--yes --build-as-nobody"
[5941]36FINK_SELFUPDATE_ARGS="--yes"
[5400]37APT_ARGS="--assume-yes"
[5248]38
[5396]39# Path to Fink root
40FINK_ROOT=/sw
41
[8058]42ARCH=`perl -MFink::FinkVersion -e 'print Fink::FinkVersion::get_arch'`
[5706]43
[5982]44if [ "$1" ] || [ "$2" ]; then
[5735]45    PACKAGE_SOURCE=1
46fi
47
[5471]48# Sets error handler
49trap "echo \"Script failed\"" ERR
50
[5216]51((`id -u` == 0)) || { echo "Must run as root user (use sudo)."; exit 1; }
52
[5396]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; }
[5216]56
[5735]57if [ $PACKAGE_SOURCE ]; then
58    [ -e /Volumes/download/ ] || { echo "/Volumes/download/ not mounted."; exit 4; }
59fi
[5517]60
[5216]61# Configures environment for Fink
[5396]62. $FINK_ROOT/bin/init.sh
63
[5441]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."
[5517]66    exit 5
[5396]67fi
68
[5441]69if [ ! -x /usr/bin/xcodebuild ]; then
70    echo "It seems Xcode is not installed on a system."
[5517]71    exit 6
[5441]72fi
[5397]73
[6515]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."
[5517]77    exit 7
[5441]78fi
[6524]79if [[ "$MAC_VERSION" -gt "$LAST_MAC_VERSION_FOR_STABLE_PACKAGES" ]]; then
[6523]80    STABLE_PACKAGES=""
81fi
[5441]82
[5446]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
[5396]84    echo "It seems X11 version 2.3.0 or later is not installed on a system."
[5517]85    exit 8
[5396]86fi
[5216]87
[5735]88if [ $PACKAGE_SOURCE ]; then
89    # Defaults are current latest revisions in stable branch and trunk
[7679]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`}
[5735]91    # svn info does not return proper exit status on an error so we check it this way
[5982]92    [ "$STABLE_REVISION" ] || exit 9
[7679]93    DAILY_REVISION=${2:-`svn info --non-interactive http://orange.biolab.si/svn/orange/trunk/ | grep 'Last Changed Rev:' | cut -d ' ' -f 4`}
[5735]94    # svn info does not return proper exit status on an error so we check it this way
[5982]95    [ "$DAILY_REVISION" ] || exit 10
[5735]96fi
[5533]97
[7679]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/*
[5735]101if [ $PACKAGE_SOURCE ]; then   
102    # Gets Fink package info files from SVN
[7679]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/
[5735]104   
105    # Injects revision versions into templates
[7679]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
[5735]108else
109    # Gets current (daily) info files from SVN
[7679]110    echo "Updating local biolab Fink info files repository."
[7680]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
[7679]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
[5735]114fi
[5242]115
[7679]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
[5259]119fi
[5242]120
[5259]121# Adds our binary repository to local Fink (APT) configuration
[7680]122if ! grep -q "deb http://orange.biolab.si/fink 10.$MAC_VERSION main" $FINK_ROOT/etc/apt/sources.list; then
[7679]123    echo "Adding biolab Fink binary packages repository to Fink configuration."
[7680]124    echo "deb http://orange.biolab.si/fink 10.$MAC_VERSION main" >> $FINK_ROOT/etc/apt/sources.list
[5259]125fi
[5216]126
[5449]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
[5735]132if [ $PACKAGE_SOURCE ]; then
[6515]133    mkdir -p "/Volumes/fink/dists/10.$MAC_VERSION/main/source/"
134    chmod +rx "/Volumes/fink/dists/10.$MAC_VERSION/main/source/"
[5396]135   
[6515]136    if [ ! -e /Volumes/fink/dists/10.$MAC_VERSION/main/source/orange-1.0b.$STABLE_REVISION.tgz ]; then
[5735]137        echo "Making source archive orange-1.0b.$STABLE_REVISION."
[5396]138       
[5735]139        rm -rf /tmp/orange-1.0b.$STABLE_REVISION/ /tmp/orange-1.0b.$STABLE_REVISION.tgz
[5396]140       
[7679]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
[5396]146       
[5735]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/
[5396]149       
[5735]150        tar -czf /tmp/orange-1.0b.$STABLE_REVISION.tgz -C /tmp/ orange-1.0b.$STABLE_REVISION
[5396]151       
[5735]152        MD5SUM=`md5 -q /tmp/orange-1.0b.$STABLE_REVISION.tgz`
[5396]153       
[6515]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/"
[5735]156       
157        rm -rf /tmp/orange-1.0b.$STABLE_REVISION/
[5517]158       
159        echo "Registering new source archive."
[5735]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
[5517]162        mv /Volumes/download/filenames_mac.set.new /Volumes/download/filenames_mac.set
[6219]163        chmod +r /Volumes/download/filenames_mac.set
[5402]164    else
[6515]165        MD5SUM=`md5 -q /Volumes/fink/dists/10.$MAC_VERSION/main/source/orange-1.0b.$STABLE_REVISION.tgz`
[5396]166    fi
167   
[7679]168    perl -pi -e "s/__STABLE_MD5SUM_ORANGE__/$MD5SUM/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
[5402]169   
[6515]170    if [ ! -e /Volumes/fink/dists/10.$MAC_VERSION/main/source/orange-svn-0.0.$DAILY_REVISION.tgz ]; then
[5735]171        echo "Making source archive orange-svn-0.0.$DAILY_REVISION."
[5396]172       
[5735]173        rm -rf /tmp/orange-svn-0.0.$DAILY_REVISION/ /tmp/orange-svn-0.0.$DAILY_REVISION.tgz
[5396]174       
[7679]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
[5396]180       
[5735]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/
[5396]183       
[5735]184        tar -czf /tmp/orange-svn-0.0.$DAILY_REVISION.tgz -C /tmp/ orange-svn-0.0.$DAILY_REVISION
[5396]185       
[5735]186        MD5SUM=`md5 -q /tmp/orange-svn-0.0.$DAILY_REVISION.tgz`
[5396]187       
[6515]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/
[5735]190       
191        rm -rf /tmp/orange-svn-0.0.$DAILY_REVISION/
[5517]192       
193        echo "Registering new source archive."
[5735]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
[5517]196        mv /Volumes/download/filenames_mac.set.new /Volumes/download/filenames_mac.set
[6219]197        chmod +r /Volumes/download/filenames_mac.set
[5402]198    else
[6515]199        MD5SUM=`md5 -q /Volumes/fink/dists/10.$MAC_VERSION/main/source/orange-svn-0.0.$DAILY_REVISION.tgz`
[5396]200    fi
[5402]201   
[7679]202    perl -pi -e "s/__DAILY_MD5SUM_ORANGE__/$MD5SUM/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
[5735]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       
[6515]210        if [ ! -e /Volumes/fink/dists/10.$MAC_VERSION/main/source/$STABLE_SOURCE_NAME.tgz ]; then
[5735]211            echo "Making source archive $STABLE_SOURCE_NAME."
212           
213            rm -rf /tmp/$STABLE_SOURCE_NAME/ /tmp/$STABLE_SOURCE_NAME.tgz
214           
[7679]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
[5735]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           
[6515]226            mv /tmp/$STABLE_SOURCE_NAME.tgz /Volumes/fink/dists/10.$MAC_VERSION/main/source/
[5735]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
[6515]235            MD5SUM=`md5 -q /Volumes/fink/dists/10.$MAC_VERSION/main/source/$STABLE_SOURCE_NAME.tgz`
[5735]236        fi
237       
[7679]238        perl -pi -e "s/__STABLE_MD5SUM_\U$SOURCE_NAME\E__/$MD5SUM/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
[5735]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       
[6515]247        if [ ! -e /Volumes/fink/dists/10.$MAC_VERSION/main/source/$DAILY_SOURCE_NAME.tgz ]; then
[5735]248            echo "Making source archive $DAILY_SOURCE_NAME."
249           
250            rm -rf /tmp/$DAILY_SOURCE_NAME/ /tmp/$DAILY_SOURCE_NAME.tgz
251           
[7679]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
[5735]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           
[6515]263            mv /tmp/$DAILY_SOURCE_NAME.tgz /Volumes/fink/dists/10.$MAC_VERSION/main/source/
[5735]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
[6515]272            MD5SUM=`md5 -q /Volumes/fink/dists/10.$MAC_VERSION/main/source/$DAILY_SOURCE_NAME.tgz`
[5735]273        fi
274       
[7679]275        perl -pi -e "s/__DAILY_MD5SUM_\U$SOURCE_NAME\E__/$MD5SUM/g" $FINK_ROOT/fink/dists/biolab/main/finkinfo/*.info
[5735]276    done
277fi
[5396]278
[8245]279# Configures any pending packages from possible interrupted past sessions
280dpkg --configure -a
281
[5396]282# Gets all official Fink package info files
[5260]283echo "Updating installed Fink packages."
[5941]284fink $FINK_SELFUPDATE_ARGS selfupdate --method=rsync
[5449]285fink $FINK_ARGS scanpackages
[5216]286
[5418]287# Updates everything (probably by compiling new packages)
[5449]288fink $FINK_ARGS update-all
289
290# Installs special packages (if they are not already installed)
[5450]291yes | fink $FINK_ARGS install $SPECIAL_PACKAGES
[5418]292
[5468]293# Removes possiblly installed packages which we want built
[6545]294fink $FINK_ARGS purge --recursive $STABLE_PACKAGES $DAILY_PACKAGES $OTHER_PACKAGES $EXTRA_PACKAGES
[5417]295# Sometimes Fink and APT are not in sync so we remove packages also directly
[6545]296for package in $STABLE_PACKAGES $DAILY_PACKAGES $OTHER_PACKAGES $EXTRA_PACKAGES ; do
[5736]297    echo $package "purge" | dpkg --set-selections
298done
299apt-get $APT_ARGS dselect-upgrade
[5396]300
[5258]301# Stores current packages status
302dpkg --get-selections '*' > /tmp/dpkg-selections.list
303
[6576]304for package in $OTHER_PACKAGES ; do
[5258]305    # Restores intitial packages status
[5447]306    dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
[5258]307    dpkg --set-selections < /tmp/dpkg-selections.list
[5449]308    apt-get $APT_ARGS dselect-upgrade
[5258]309   
310    # Builds a package if it has not been rebuilt already (for example, as a dependency)
[5419]311    # We install it and not just build it because installation does not build package if it already exists as a binary package
[5410]312    echo "Specially building package $package."
[5449]313    fink $FINK_ARGS install $package
[5258]314done
315
[6576]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
[5396]332# We build our packages in "maintainer" mode - Fink makes tests and validates packages
333for package in $STABLE_PACKAGES $DAILY_PACKAGES ; do
[5411]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
[5447]339        dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
[5411]340        dpkg --set-selections < /tmp/dpkg-selections.list
[5449]341        apt-get $APT_ARGS dselect-upgrade
[5411]342       
[5419]343        # We install it and not just build it because installation does not build package if it already exists as a binary package
[5417]344        echo "Specially building package $package dependency $deps."
[5449]345        fink $FINK_ARGS install $deps
[5411]346    done
347   
[5396]348    # Restores intitial packages status
[5447]349    dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
[5396]350    dpkg --set-selections < /tmp/dpkg-selections.list
[5449]351    apt-get $APT_ARGS dselect-upgrade
[5396]352   
[5409]353    # Then builds a package
[5419]354    # We can just build it as our packages have been probably cached if they have been already built
[5410]355    echo "Specially building, testing and validating package $package."
[5449]356    fink $FINK_ARGS --maintainer build $package
[5396]357done
358
359echo "Restoring initial packages status."
[5447]360dpkg --get-selections '*' | cut -f 1 | xargs -n 1 -J % echo % purge | dpkg --set-selections
[5258]361dpkg --set-selections < /tmp/dpkg-selections.list
[5449]362apt-get $APT_ARGS dselect-upgrade
[5258]363rm -f /tmp/dpkg-selections.list
364
[5396]365# Cleans unncessary files (we cache them anyway in public repository)
366echo "Cleaning."
[5449]367fink $FINK_ARGS cleanup --all
[5248]368
[7694]369# TODO: Should be called only on a daily build server and not if building locally
[7697]370/Users/ailabc/mount-dirs.sh
[7694]371
[7679]372echo "Preparing public biolab Fink info and binary files repository."
[6515]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/
[5242]377
[5259]378echo "Copying to repository all binary packages."
[6515]379cp $FINK_ROOT/fink/debs/*.deb /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
[6523]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
[6515]385cd /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
[6070]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'
[5216]397
[5259]398echo "Removing old binary packages."
[5216]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
[5259]411echo "Making packages list."
[5216]412cd /Volumes/fink/
[6515]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
[5242]414
[7679]415echo "Archive: biolab
[5245]416Origin: Fink
417Component: main
[5706]418Architecture: darwin-$ARCH
[6515]419Label: Fink" > dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/Release
[5245]420
[6219]421echo "Setting permissions."
[6515]422chmod -R +r /Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/
[6219]423
[5259]424echo "Copying to repository all info files."
[6515]425rm -f /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/*
[7679]426cp $FINK_ROOT/fink/dists/biolab/main/finkinfo/* /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/
[5254]427
[5259]428echo "Making an archive of all info files."
[7679]429cd $FINK_ROOT/fink/dists/biolab/main/finkinfo/
[6583]430tar -czf /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/all.tgz *
[5500]431
[6219]432echo "Setting permissions."
[6515]433chmod -R +r /Volumes/fink/dists/10.$MAC_VERSION/main/finkinfo/
[6219]434
[5500]435echo "Removing unnecessary source archives."
[5706]436perl -e "
[6515]437for (</Volumes/fink/dists/10.$MAC_VERSION/main/binary-darwin-$ARCH/orange-*.deb>) {
[5706]438    m/_(.+)-\\d+_darwin-$ARCH\\.deb/;
439    \$versions{\$1} = 1;
[5500]440}
[6515]441for (</Volumes/fink/dists/10.$MAC_VERSION/main/source/*.tgz>) {
[5706]442    m/.+-(.+)\\.tgz/;
[9176]443    next if \$versions{\$1} or -M() < 30;
[5500]444    unlink;
445}
[5706]446"
Note: See TracBrowser for help on using the repository browser.