Current build will sync to the head of TinyCBOR's master branch.
To remove this unpredictability from the build, always sync to
a particular release tag.
Change-Id: I471ac19aedc787bca64ee01c4733ab319d6f32d3
Signed-off-by: Kevin Kane <kkane@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14165
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
(cherry picked from commit
6b368cb9e7f45efccad93455aff98ad5b4e0ccb0)
Reviewed-on: https://gerrit.iotivity.org/gerrit/14425
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
import os
+import subprocess
Import('env')
src_dir = env.get('SRC_DIR')
+target_os = env.get('TARGET_OS')
cborDir = os.path.join(src_dir, 'extlibs','tinycbor','tinycbor')
+cborRevision = 'v0.4'
if not os.path.exists(cborDir):
print '''
'''
Exit(1)
+start_dir = os.getcwd()
+os.chdir(cborDir)
+
+# Tizen uses a separate process to sync to a particular revision of TinyCBOR.
+# Make sure tinycbor_revision stays in sync with extlibs/tinycbor/prep.sh.
+# This code also assumes tinycbor_revision is a tag; if it changes to a branch
+# or an arbitrary commit, disable this check below.
+if target_os != 'tizen' and os.path.exists('.git/HEAD'):
+ out = subprocess.check_output('git tag -l ' + cborRevision, shell = True)
+ if cborRevision not in out:
+ print out
+ print '''
+*********************************** Error: ****************************************
+* Your TinyCBOR repo is not up to date with the latest version we require. Please *
+* update with the following commands: *
+* $ cd extlibs/tinycbor/tinycbor *
+* $ git fetch *
+***********************************************************************************
+ '''
+ Exit(1)
+
+
+# Point TinyCBOR repo to desired release tag
+if os.path.exists('.git/HEAD'):
+ cmd = 'git reset --hard ' + cborRevision
+ os.system(cmd)
+else:
+ print 'Assume TinyCBOR is on tag ', cborRevision
+
+os.chdir(start_dir)
+
cbor_src = [
os.path.join(cborDir,'src/cborparser.c'),
os.path.join(cborDir,'src/cborparser_dup_string.c'),
--- /dev/null
+#!/bin/sh
+
+set -e
+
+# Keep cborRevision in sync with extlibs/tinycbor/SConscript's setting. Right now this script
+# assumes cborRevision is a tag; comment out the second clause if cborRevision becomes
+# a branch or a specific commit.
+cborDir="./extlibs/tinycbor/tinycbor"
+cborRevision="v0.4"
+if [ ! -d ${cborDir} ]; then
+ echo ""
+ echo "*********************************** Error: ****************************************"
+ echo "* Please download TinyCBOR using the following command: *"
+ echo "* $ git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor *"
+ echo "***********************************************************************************"
+ echo ""
+ exit
+elif [ ! -z $(git tag -l $cborRevision) ]; then
+ echo ""
+ echo "*********************************** Error: *******************************************"
+ echo "* TinyCBOR repo is out of date. Please update TinyCBOR using the following commands: *"
+ echo "* $ cd (authoritative TinyCBOR source repo location) *"
+ echo "* $ git fetch *"
+ echo "**************************************************************************************"
+ echo ""
+ exit
+elif [ -d ${cborDir}/.git ]; then
+ cd ${cborDir}
+ git reset --hard ${cborRevision}
+ cd -
+ rm -rf ${cborDir}/.git*
+else
+ echo "Assuming TinyCBOR is already on correct revision ${cborRevision}"
+fi
$SHELL ./extlibs/mbedtls/prep.sh
fi
-rm -rf ./extlibs/tinycbor/tinycbor/.git*
+# Prepare TinyCBOR dependency
+$SHELL ./extlibs/tinycbor/prep.sh
# Initialize Git repositoryㅣ
if [ ! -d .git ]; then
mkdir ./tmp/extlibs/
mkdir ./tmp/packaging
cp -LR ./extlibs/tinycbor $sourcedir/tmp/extlibs
-rm -rf $sourcedir/tmp/extlibs/tinycbor/tinycbor/.git
cp -Rf ./extlibs/mbedtls $sourcedir/tmp/extlibs
cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs
# Prepare mbedTLS dependency
$SHELL ./extlibs/mbedtls/prep.sh
+# Prepare TinyCBOR dependency
+$SHELL ./extlibs/tinycbor/prep.sh
+
whoami
# Initialize Git repository
if [ ! -d .git ]; then
# tinycbor is available as soft-link, so copying with 'dereference' option.
cp -LR ./extlibs/tinycbor $sourcedir/tmp/extlibs
-rm -rf $sourcedir/tmp/extlibs/tinycbor/tinycbor/.git
cp -R ./extlibs/cjson $sourcedir/tmp/extlibs
cp -R ./extlibs/mbedtls $sourcedir/tmp/extlibs
# Prepare mbedTLS dependency
$SHELL ./extlibs/mbedtls/prep.sh
-rm -rf ./extlibs/tinycbor/tinycbor/.git*
+# Prepare TinyCBOR dependency
+$SHELL ./extlibs/tinycbor/prep.sh
# Build IoTivity
# Initialize Git repository