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