source: orange/install-scripts/mac/bundle-inject-hg.sh @ 10276:1245e7085b58

Revision 10276:1245e7085b58, 1.6 KB checked in by ales_erjavec, 2 years ago (diff)

Checking for incoming changesets before pulling. Printing more useful info.

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Install an setup.py installable package from a
4# hg repository in to a .app bundle template
5#
6# $1 hg repo path
7# $2 repo clone name inside the working dir
8# $3 revision
9# $4 working directory where the repos will be cloned
10# $5 bundle template path
11#
12
13REPO=$1
14CLONE_NAME=$2
15REVISION=$3
16WORK_DIR=$4
17TEMPLATE_PATH=$5
18
19# Python interpreter in the bundle
20PYTHON=${TEMPLATE_PATH}/Contents/MacOS/python
21
22# Sets error handler
23trap "echo \"Script failed\"" ERR
24
25# Path to the local repo clone
26CLONE_FULLPATH=${WORK_DIR}/${CLONE_NAME}
27
28# Path to the local archived source. This is where the building
29# will actually take place to prevent the polution of the repo
30CLONE_ARCHIVE_NAME=${CLONE_NAME}_archive
31CLONE_ARCHIVE_FULLPATH=${WORK_DIR}/${CLONE_ARCHIVE_NAME}
32 
33
34if [ ! -e $CLONE_FULLPATH ]; then
35    echo "Cloning $REPO to $CLONE_FULLPATH"
36    hg clone $REPO $CLONE_FULLPATH
37else
38    echo "Repository $CLONE_FULLPATH already present".
39fi
40
41echo "Checking for incomming changesets"
42if hg incoming -R $CLONE_FULLPATH; then
43    echo "Changesets found. Pulling and updating."
44    hg pull --update -R $CLONE_FULLPATH
45fi
46
47# Remove old archive if it exists
48if [ -e $CLONE_ARCHIVE_FULLPATH ]; then
49    echo "Removing old archive at $CLONE_ARCHIVE_FULLPATH"
50    rm -rf $CLONE_ARCHIVE_FULLPATH
51fi
52
53# Create an archive
54echo "Creating archive $CLONE_ARCHIVE_FULLPATH"
55
56hg archive -r $REVISION $CLONE_ARCHIVE_FULLPATH -R $CLONE_FULLPATH
57
58cd $CLONE_ARCHIVE_FULLPATH
59
60# Run installation
61echo "Running setup.py install with python '$PYTHON'"
62$PYTHON setup.py install
63
64# Clean up the archive
65cd $WORK_DIR
66echo "Cleaning up the archive at $CLONE_ARCHIVE_FULLPATH"
67rm -rf $CLONE_ARCHIVE_FULLPATH
68
69true
Note: See TracBrowser for help on using the repository browser.