[26988] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | ################################################################################
|
---|
| 4 | # Wrapper script to build, package, and transfer to ISSM Web site ISSM
|
---|
| 5 | # distributable package for Linux with Python 2 API.
|
---|
| 6 | #
|
---|
| 7 | # Normally, we would put this directly into the project configuration under
|
---|
| 8 | # 'Build' -> 'Excute shell', but becasue it is a bit more involved, it is a
|
---|
| 9 | # good idea to version it.
|
---|
| 10 | #
|
---|
| 11 | # When no failures/errors occur, performs the following:
|
---|
| 12 | # - Builds ISSM according to configuration.
|
---|
| 13 | # - Packages executables and libraries.
|
---|
| 14 | # - Runs test suite against package.
|
---|
| 15 | # - Transmits package to ISSM Web site for distribution.
|
---|
| 16 | #
|
---|
| 17 | # Options:
|
---|
| 18 | # -b/--skipbuild Skip ISSM compilation.
|
---|
| 19 | # -s/--skiptests Skip ISSM compilation and testing during packaging
|
---|
| 20 | # step. Use if packaging fails for some reason but build
|
---|
| 21 | # is valid.
|
---|
| 22 | # -t/--transferonly Transfer package to ISSM Web site only. Use if transfer
|
---|
| 23 | # fails for some reason to skip building, packaging, and
|
---|
| 24 | # signing.
|
---|
| 25 | #
|
---|
| 26 | # NOTE:
|
---|
| 27 | # - Use only *one* of the above options at a time, and make sure it is removed
|
---|
| 28 | # again after a single run.
|
---|
| 29 | # - Builds will fail when any of the above options are used on a clean
|
---|
| 30 | # workspace. For example, if 'Source Code Management' -> 'Check-out Strategy'
|
---|
| 31 | # select menu is set to "Always check out a fresh copy".
|
---|
| 32 | ################################################################################
|
---|
| 33 |
|
---|
| 34 | ## Constants
|
---|
| 35 | #
|
---|
| 36 | PKG="ISSM-Linux-Python-2" # Name of directory to copy distributable files to
|
---|
| 37 |
|
---|
| 38 | COMPRESSED_PKG="${PKG}.tar.gz"
|
---|
| 39 |
|
---|
| 40 | ## Environment
|
---|
| 41 | #
|
---|
| 42 | export COMPRESSED_PKG
|
---|
| 43 | export PKG
|
---|
| 44 |
|
---|
| 45 | ## Parse options
|
---|
| 46 | #
|
---|
| 47 | if [ $# -gt 1 ]; then
|
---|
| 48 | echo "Can use only one option at a time"
|
---|
| 49 | exit 1
|
---|
| 50 | fi
|
---|
| 51 |
|
---|
| 52 | # NOTE: We could do this with binary switching (i.e. 0011 to sign and transfer,
|
---|
| 53 | # but the following is self-documenting).
|
---|
| 54 | #
|
---|
| 55 | build=1
|
---|
| 56 | package=1
|
---|
| 57 | transfer=1
|
---|
| 58 |
|
---|
| 59 | if [ $# -eq 1 ]; then
|
---|
| 60 | case $1 in
|
---|
| 61 | -b|--skipbuild) build=0; shift ;;
|
---|
| 62 | -s|--skiptests) build=0; ;;
|
---|
| 63 | -t|--transferonly) build=0; package=0; ;;
|
---|
| 64 | *) echo "Unknown parameter passed: $1"; exit 1 ;;
|
---|
| 65 | esac
|
---|
| 66 | fi
|
---|
| 67 |
|
---|
| 68 | # Build
|
---|
| 69 | if [ ${build} -eq 1 ]; then
|
---|
| 70 | ./jenkins/jenkins.sh ./jenkins/ross-debian_linux-binaries-python-2
|
---|
| 71 |
|
---|
| 72 | if [ $? -ne 0 ]; then
|
---|
| 73 | exit 1
|
---|
| 74 | fi
|
---|
| 75 | fi
|
---|
| 76 |
|
---|
| 77 | # Package
|
---|
| 78 | if [ ${package} -eq 1 ]; then
|
---|
| 79 | ./packagers/linux/package-issm-linux-binaries-python-2.sh $1
|
---|
| 80 |
|
---|
| 81 | if [ $? -ne 0 ]; then
|
---|
| 82 | exit 1
|
---|
| 83 | fi
|
---|
| 84 | fi
|
---|
| 85 |
|
---|
| 86 | # Transfer distributable package to ISSM Web site
|
---|
| 87 | if [ ${transfer} -eq 1 ]; then
|
---|
| 88 | ./packagers/linux/transfer-issm-linux-binaries.sh
|
---|
| 89 |
|
---|
| 90 | if [ $? -ne 0 ]; then
|
---|
| 91 | exit 1
|
---|
| 92 | fi
|
---|
| 93 | fi
|
---|
| 94 |
|
---|