Donald Meyers / Mbed OS evan
Committer:
djmeyers
Date:
Sat Mar 18 22:37:16 2017 +0000
Revision:
0:06ee5f8a484a
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
djmeyers 0:06ee5f8a484a 1 #!/bin/bash
djmeyers 0:06ee5f8a484a 2 # Copyright (c) 2015 ARM Limited. All rights reserved.
djmeyers 0:06ee5f8a484a 3 # SPDX-License-Identifier: Apache-2.0
djmeyers 0:06ee5f8a484a 4 # Licensed under the Apache License, Version 2.0 (the License); you may
djmeyers 0:06ee5f8a484a 5 # not use this file except in compliance with the License.
djmeyers 0:06ee5f8a484a 6 # You may obtain a copy of the License at
djmeyers 0:06ee5f8a484a 7 #
djmeyers 0:06ee5f8a484a 8 # * http://www.apache.org/licenses/LICENSE-2.0
djmeyers 0:06ee5f8a484a 9 #
djmeyers 0:06ee5f8a484a 10 # Unless required by applicable law or agreed to in writing, software
djmeyers 0:06ee5f8a484a 11 # distributed under the License is distributed on an AS IS BASIS, WITHOUT
djmeyers 0:06ee5f8a484a 12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
djmeyers 0:06ee5f8a484a 13 # See the License for the specific language governing permissions and
djmeyers 0:06ee5f8a484a 14 # limitations under the License.
djmeyers 0:06ee5f8a484a 15
djmeyers 0:06ee5f8a484a 16 echo
djmeyers 0:06ee5f8a484a 17 echo "Check version in module json"
djmeyers 0:06ee5f8a484a 18 echo
djmeyers 0:06ee5f8a484a 19 echo $1
djmeyers 0:06ee5f8a484a 20 echo $2
djmeyers 0:06ee5f8a484a 21
djmeyers 0:06ee5f8a484a 22 function version_gt() {
djmeyers 0:06ee5f8a484a 23 test "$(echo "$@" | tr " " "\n" | sort -V | tail -n 1)" == "$1";
djmeyers 0:06ee5f8a484a 24 }
djmeyers 0:06ee5f8a484a 25
djmeyers 0:06ee5f8a484a 26 git clone $1 $PWD/master
djmeyers 0:06ee5f8a484a 27 git clone $1 $PWD/pull_req
djmeyers 0:06ee5f8a484a 28 pushd $PWD/pull_req
djmeyers 0:06ee5f8a484a 29 git checkout $2
djmeyers 0:06ee5f8a484a 30 popd
djmeyers 0:06ee5f8a484a 31 if [ ! -e "$PWD/master/module.json" ]
djmeyers 0:06ee5f8a484a 32 then
djmeyers 0:06ee5f8a484a 33 echo "$PWD/master/module.json not found."
djmeyers 0:06ee5f8a484a 34 exit 1
djmeyers 0:06ee5f8a484a 35 fi
djmeyers 0:06ee5f8a484a 36 if [ ! -e "$PWD/pull_req/module.json" ]
djmeyers 0:06ee5f8a484a 37 then
djmeyers 0:06ee5f8a484a 38 echo "$PWD/pull_req/module.json not found."
djmeyers 0:06ee5f8a484a 39 exit 1
djmeyers 0:06ee5f8a484a 40 fi
djmeyers 0:06ee5f8a484a 41
djmeyers 0:06ee5f8a484a 42 OLD_VERSION=`sed -n 's#version##p' master/module.json | sed 's|[^0-9]*\([0-9\.]*\)|\1 |g'`
djmeyers 0:06ee5f8a484a 43 NEW_VERSION=`sed -n 's#version##p' pull_req/module.json | sed 's|[^0-9]*\([0-9\.]*\)|\1 |g'`
djmeyers 0:06ee5f8a484a 44
djmeyers 0:06ee5f8a484a 45 echo "Version in master branch: $OLD_VERSION"
djmeyers 0:06ee5f8a484a 46 echo "New version: $NEW_VERSION"
djmeyers 0:06ee5f8a484a 47
djmeyers 0:06ee5f8a484a 48 if [[ "$OLD_VERSION" != "$NEW_VERSION" ]]; then
djmeyers 0:06ee5f8a484a 49 if version_gt $NEW_VERSION $OLD_VERSION; then
djmeyers 0:06ee5f8a484a 50 exit 0
djmeyers 0:06ee5f8a484a 51 else
djmeyers 0:06ee5f8a484a 52 echo "Update version in module.json!"
djmeyers 0:06ee5f8a484a 53 exit 1
djmeyers 0:06ee5f8a484a 54 fi
djmeyers 0:06ee5f8a484a 55 else
djmeyers 0:06ee5f8a484a 56 echo "Update version in module.json!"
djmeyers 0:06ee5f8a484a 57 exit 1
djmeyers 0:06ee5f8a484a 58 fi