blob: 909acc9ff5fb27da41557cc60fdd64d27e6512e5 [file] [log] [blame]
Brian O'Connord27d4372016-10-12 15:06:21 -07001#!/bin/bash
2
3DEFAULT_TAG=${TAG:-$(date +v%Y.%m.%d.01)}
4NO_BUCKD=1
5
6DOWNLOAD_BASE="http://onlab.vicci.org/onos/third-party"
7BUCK_ZIP="buck-$DEFAULT_TAG.zip"
8ZIP_STAGE="buck-bin"
9
10rm -rf $ZIP_STAGE
11
12set -e
13set -x
14
15# build plugins
16
17pushd onos
18buck build //tools/build/buck-plugin:onosjar
19popd #onos
20
21pushd onos-yang-tools
22mvn clean package
23popd #onos-yang-tools
24
25# assemble zip
26
27mkdir -p buck-bin/plugins
28
29cp buck/buck-out/gen/programs/buck.pex $ZIP_STAGE/buck
30cp onos/buck-out/gen/tools/build/buck-plugin/onosjar.jar $ZIP_STAGE/plugins/onos.jar
31cp onos-yang-tools/plugin/buck/target/onos-yang-buck-plugin-1.9-SNAPSHOT.jar $ZIP_STAGE/plugins/yang.jar
32
33BUCK_VERSION=$(buck/buck-out/gen/programs/buck.pex -V)
34echo $BUCK_VERSION > $ZIP_STAGE/.buck_version
35
36chmod 555 $ZIP_STAGE/buck
37chmod 444 $ZIP_STAGE/.buck_version
38
39pushd $ZIP_STAGE
40zip -r ../$BUCK_ZIP buck .buck_version plugins
41popd #$ZIP_STAGE
42
43# publish zip
44#FIXME check for s3 credentials
45uploadToS3.py --dest third-party/ $BUCK_ZIP
46
47# update version in onos-buck
48URL="$DOWNLOAD_BASE/$BUCK_ZIP"
49SHA=$(shasum $BUCK_ZIP | cut -d' ' -f1)
50
51sed -i "" -E "s#BUCK_URL=.*#BUCK_URL=\"$URL\"#" onos/tools/build/onos-buck
52sed -i "" -E "s#BUCK_SHA=.*#BUCK_SHA=\"$SHA\"#" onos/tools/build/onos-buck
53sed -i "" -E "s#REQUIRED_VERSION=.*#REQUIRED_VERSION=\"$BUCK_VERSION\"#" onos/tools/build/onos-buck
54
55set +x
56echo
57echo "Commit and push change to onos-buck on the onos directory."