source: orange/install-scripts/mac/build-source.sh @ 10849:100e1e2e99dd

Revision 10849:100e1e2e99dd, 1.4 KB checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Clean repo for sources build.

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Build an Orange source package from a hg repo
4#
5# $1 hg repo
6# $2 local repository inside work dir
7# $3 hg revision
8# $4 work dir
9# $5 distribution name
10# $6 source and egg distribution dir ($4 by default)
11# $7 force
12#
13# Example ./build-source.sh http://bitbucket.org/biolab/orange orange tip /private/tmp/repos Orange
14
15HG_REPO=$1
16REPO_DIRNAME=$2
17HG_REV=$3
18WORK_DIR=$4
19DIST_NAME=$5
20DIST_DIR=${6:-$WORK_DIR}
21FORCE=$7
22
23# dist name with '-' replaced
24UDIST_NAME=`echo $DIST_NAME | sed s/-/_/g`
25
26LOCAL_REPO=$WORK_DIR/$REPO_DIRNAME
27
28LATEST_REVISION=`hg id $HG_REPO`
29
30if [ -e $WORK_DIR/$UDIST_NAME.egg-info/PKG-INFO ]; then
31    CURRENT_REVISION=`grep "^Version: " $WORK_DIR/$UDIST_NAME.egg-info/PKG-INFO | cut -d "-" -f 3`
32else
33    CURRENT_REVISION=""
34fi
35
36if [[ $CURRENT_REVISION != $LATEST_REVISION  || $FORCE ]]; then
37    BUILD=1
38else
39    BUILD=
40fi
41
42if [ $BUILD ]; then
43    if [ ! -e $LOCAL_REPO ]; then
44        hg clone $HG_REPO $LOCAL_REPO
45    fi
46
47    if hg incoming -R $LOCAL_REPO; then
48        hg pull -R $LOCAL_REPO
49    fi
50
51    hg update -r $HG_REV -R $LOCAL_REPO
52
53    hg --config extensions.purge= clean --all -R $LOCAL_REPO
54
55    cd $LOCAL_REPO
56
57    # Build the source distribution
58    BUILD_TAG=`hg parent --template=".dev-r{rev}-{node|short}"`
59
60    python setup.py egg_info --tag-build=$BUILD_TAG --egg-base=$DIST_DIR sdist --dist-dir=$DIST_DIR
61    python setup.py rotate --match=.tar.gz --dist-dir=$DIST_DIR --keep=20
62fi
Note: See TracBrowser for help on using the repository browser.