mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Format all shell scripts in tools folder
Change-Id: Ieef2eb93d56c03972b4dc63a1c55aabf1fb0d169 Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
+58
-58
@@ -44,89 +44,89 @@ unset BUILD
|
||||
unset OUTFILE
|
||||
|
||||
while [ ! -z "$1" ]; do
|
||||
case $1 in
|
||||
-b )
|
||||
shift
|
||||
BUILD=$1
|
||||
;;
|
||||
-d )
|
||||
set -x
|
||||
;;
|
||||
-v )
|
||||
shift
|
||||
VERSION=$1
|
||||
;;
|
||||
-h )
|
||||
echo "$0 is a tool for generation of proper version files for the NuttX build"
|
||||
echo ""
|
||||
echo $USAGE
|
||||
echo ""
|
||||
echo "Where:"
|
||||
echo " -b <build>"
|
||||
echo " Use this build identification string. Default: use GIT build ID"
|
||||
echo " NOTE: GIT build information may not be available in a snapshot"
|
||||
echo " -d"
|
||||
echo " Enable script debug"
|
||||
echo " -h"
|
||||
echo " show this help message and exit"
|
||||
echo " -v <major.minor>"
|
||||
echo " The NuttX version number expressed as a major and minor number separated"
|
||||
echo " by a period"
|
||||
echo " <outfile-path>"
|
||||
echo " The full path to the version file to be created"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
case $1 in
|
||||
-b )
|
||||
shift
|
||||
BUILD=$1
|
||||
;;
|
||||
-d )
|
||||
set -x
|
||||
;;
|
||||
-v )
|
||||
shift
|
||||
VERSION=$1
|
||||
;;
|
||||
-h )
|
||||
echo "$0 is a tool for generation of proper version files for the NuttX build"
|
||||
echo ""
|
||||
echo $USAGE
|
||||
echo ""
|
||||
echo "Where:"
|
||||
echo " -b <build>"
|
||||
echo " Use this build identification string. Default: use GIT build ID"
|
||||
echo " NOTE: GIT build information may not be available in a snapshot"
|
||||
echo " -d"
|
||||
echo " Enable script debug"
|
||||
echo " -h"
|
||||
echo " show this help message and exit"
|
||||
echo " -v <major.minor>"
|
||||
echo " The NuttX version number expressed as a major and minor number separated"
|
||||
echo " by a period"
|
||||
echo " <outfile-path>"
|
||||
echo " The full path to the version file to be created"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
break;
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
OUTFILE=$1
|
||||
|
||||
if [ -z ${VERSION} ] ; then
|
||||
VERSION=`git tag --sort=taggerdate | tail -1 | cut -d'-' -f2`
|
||||
VERSION=`git tag --sort=taggerdate | tail -1 | cut -d'-' -f2`
|
||||
fi
|
||||
|
||||
# Make sure we know what is going on
|
||||
|
||||
if [ -z ${VERSION} ] ; then
|
||||
echo "Missing versioning information"
|
||||
echo $USAGE
|
||||
echo $ADVICE
|
||||
exit 1
|
||||
echo "Missing versioning information"
|
||||
echo $USAGE
|
||||
echo $ADVICE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z ${OUTFILE} ] ; then
|
||||
echo "Missing path to the output file"
|
||||
echo $USAGE
|
||||
echo $ADVICE
|
||||
exit 1
|
||||
echo "Missing path to the output file"
|
||||
echo $USAGE
|
||||
echo $ADVICE
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the major and minor version numbers
|
||||
|
||||
MAJOR=`echo ${VERSION} | cut -d'.' -f1`
|
||||
if [ "X${MAJOR}" = "X${VERSION}" ]; then
|
||||
echo "Missing minor version number"
|
||||
echo $USAGE
|
||||
echo $ADVICE
|
||||
exit 2
|
||||
echo "Missing minor version number"
|
||||
echo $USAGE
|
||||
echo $ADVICE
|
||||
exit 2
|
||||
fi
|
||||
MINOR=`echo ${VERSION} | cut -d'.' -f2`
|
||||
|
||||
# Get GIT information (if not provided on the command line)
|
||||
|
||||
if [ -z "${BUILD}" ]; then
|
||||
BUILD=`git log --oneline -1 | cut -d' ' -f1 2>/dev/null`
|
||||
if [ -z "${BUILD}" ]; then
|
||||
echo "GIT version information is not available"
|
||||
exit 3
|
||||
fi
|
||||
if [ -n "`git diff-index --name-only HEAD | head -1`" ]; then
|
||||
BUILD=${BUILD}-dirty
|
||||
fi
|
||||
BUILD=`git log --oneline -1 | cut -d' ' -f1 2>/dev/null`
|
||||
if [ -z "${BUILD}" ]; then
|
||||
echo "GIT version information is not available"
|
||||
exit 3
|
||||
fi
|
||||
if [ -n "`git diff-index --name-only HEAD | head -1`" ]; then
|
||||
BUILD=${BUILD}-dirty
|
||||
fi
|
||||
fi
|
||||
|
||||
# Write a version file into the NuttX directoy. The syntax of file is such that it
|
||||
|
||||
Reference in New Issue
Block a user