source: orange/install-scripts/mac/build-source.sh @ 10909:4a21ccfd0eb2

Revision 10909:4a21ccfd0eb2, 1.4 KB checked in by Ales Erjavec <ales.erjavec@…>, 23 months ago (diff)

Fixed existing source package version discovery.

The build-source.sh script would look in the wrong directory
(the work dir instead of the publish dir).

  • 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 https://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 -r $HG_REV $HG_REPO`
29
30if [ -e $DIST_DIR/$UDIST_NAME.egg-info/PKG-INFO ]; then
31    CURRENT_REVISION=`grep "^Version: " $DIST_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    echo "$DIST_NAME source distribution rev:$CURRENT_REVISION already exists."
40    BUILD=
41fi
42
43if [ $BUILD ]; then
44    if [ ! -e $LOCAL_REPO ]; then
45        hg clone $HG_REPO $LOCAL_REPO
46    fi
47
48    if hg incoming -R $LOCAL_REPO; then
49        hg pull -R $LOCAL_REPO
50    fi
51
52    hg update -r $HG_REV -R $LOCAL_REPO
53
54    hg --config extensions.purge= clean --all -R $LOCAL_REPO
55
56    cd $LOCAL_REPO
57
58    # Build the source distribution
59    BUILD_TAG=`hg parent --template=".dev-r{rev}-{node|short}"`
60
61    python setup.py egg_info --tag-build=$BUILD_TAG --egg-base=$DIST_DIR sdist --dist-dir=$DIST_DIR
62    python setup.py rotate --match=.tar.gz --dist-dir=$DIST_DIR --keep=20
63fi
Note: See TracBrowser for help on using the repository browser.