From: Kevin Kane Date: Wed, 9 Nov 2016 17:38:22 +0000 (-0800) Subject: [IOT-1529] Sync TinyCBOR to release tag before using X-Git-Tag: 1.3.0~1052^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59452ec5d086c9e6942a16e0d26975653082ff8d;p=platform%2Fupstream%2Fiotivity.git [IOT-1529] Sync TinyCBOR to release tag before using 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/14165 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi Reviewed-by: Phil Coval (cherry picked from commit 6b368cb9e7f45efccad93455aff98ad5b4e0ccb0) Reviewed-on: https://gerrit.iotivity.org/gerrit/14425 --- diff --git a/extlibs/tinycbor/SConscript b/extlibs/tinycbor/SConscript index cc989dc..3be061e 100644 --- a/extlibs/tinycbor/SConscript +++ b/extlibs/tinycbor/SConscript @@ -19,12 +19,15 @@ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 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 ''' @@ -35,6 +38,37 @@ if not os.path.exists(cborDir): ''' 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'), diff --git a/extlibs/tinycbor/prep.sh b/extlibs/tinycbor/prep.sh new file mode 100755 index 0000000..b136253 --- /dev/null +++ b/extlibs/tinycbor/prep.sh @@ -0,0 +1,34 @@ +#!/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 diff --git a/gbsbuild.sh b/gbsbuild.sh index 5c85f44..c90d7b3 100755 --- a/gbsbuild.sh +++ b/gbsbuild.sh @@ -95,7 +95,8 @@ if [ $secured -eq 1 ];then $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 diff --git a/resource/csdk/stack/samples/tizen/build/gbsbuild.sh b/resource/csdk/stack/samples/tizen/build/gbsbuild.sh index ddc18cb..1af1de6 100644 --- a/resource/csdk/stack/samples/tizen/build/gbsbuild.sh +++ b/resource/csdk/stack/samples/tizen/build/gbsbuild.sh @@ -51,7 +51,6 @@ mkdir ./tmp 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 @@ -92,6 +91,9 @@ echo `pwd` # Prepare mbedTLS dependency $SHELL ./extlibs/mbedtls/prep.sh +# Prepare TinyCBOR dependency +$SHELL ./extlibs/tinycbor/prep.sh + whoami # Initialize Git repository if [ ! -d .git ]; then diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh index c66fc44..bdf7a8a 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh @@ -30,7 +30,6 @@ cp -R ./examples $sourcedir/tmp # 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 @@ -62,7 +61,8 @@ echo `pwd` # 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