tools/: Update version generation tools to account for the patch number.

This commit is contained in:
Ouss4 2020-04-18 19:47:04 +01:00 committed by Brennan Ashton
parent 2ec8f60e53
commit 2c58b11e50
7 changed files with 46 additions and 27 deletions

View File

@ -50,7 +50,7 @@ ifneq ($(GIT_DIR),y)
# In case the version file does not exist
CONFIG_VERSION_STRING ?= "0.0"
CONFIG_VERSION_STRING ?= "0.0.0"
CONFIG_VERSION_BUILD ?= "0"
VERSION_ARG = -v $(CONFIG_VERSION_STRING) -b $(CONFIG_VERSION_BUILD)

View File

@ -44,9 +44,10 @@ include $(TOPDIR)\tools\Config.mk
# In case .version file does not exist
CONFIG_VERSION_STRING ?= "0.0"
CONFIG_VERSION_STRING ?= "0.0.0"
CONFIG_VERSION_MAJOR ?= 0
CONFIG_VERSION_MINOR ?= 0
CONFIG_VERSION_PATCH ?= 0
CONFIG_VERSION_BUILD ?= "0"
# Control build verbosity
@ -255,6 +256,7 @@ $(TOPDIR)\.version:
$(Q) echo CONFIG_VERSION_STRING="0" > .version
$(Q) echo CONFIG_VERSION_MAJOR=0 >> .version
$(Q) echo CONFIG_VERSION_MINOR=0 >> .version
$(Q) echo CONFIG_VERSION_PATCH=0 >> .version
$(Q) echo CONFIG_VERSION_BUILD="0" >> .version
include\nuttx\version.h: $(TOPDIR)\.version tools\mkversion$(HOSTEXEEXT)

View File

@ -207,11 +207,11 @@ mkconfigvars.sh
$ tools/mkconfigvars.sh -h
tools/mkconfigvars.sh is a tool for generation of configuration variable documentation
USAGE: tools/mkconfigvars.sh [-d|h] [-v <major.minor>]
USAGE: tools/mkconfigvars.sh [-d|h] [-v <major.minor.patch>]
Where:
-v <major.minor>
The NuttX version number expressed as a major and minor number separated
-v <major.minor.patch>
The NuttX version number expressed as a major, minor and patch number separated
by a period
-d
Enable script debug
@ -1129,11 +1129,11 @@ zipme.sh
Any VCS files or directories are excluded from the final tarballs.
$ ./tools/zipme.sh -h
USAGE="USAGE: ./tools/zipme.sh [-d|h|v|s] [-b <build]> [-e <exclude>] [-k <key-id>] <major.minor>"
USAGE="USAGE: ./tools/zipme.sh [-d|h|v|s] [-b <build]> [-e <exclude>] [-k <key-id>] <major.minor.patch>"
Examples:
./tools/zipme.sh -s 9.0
Create version 9.0 tarballs and sign them.
./tools/zipme.sh -s -k XXXXXX 9.0
./tools/zipme.sh -s 9.0.0
Create version 9.0.0 tarballs and sign them.
./tools/zipme.sh -s -k XXXXXX 9.0.0
Same as above but use the key-id XXXXXX to sign the tarballs
./tools/zipme.sh -e "*.swp tmp" 9.0
Create the tarballs but exclude any *.swp file and the "tmp" directory.
./tools/zipme.sh -e "*.swp tmp" 9.0.0
Create the tarballs but exclude any .swp file and the "tmp" directory.

View File

@ -32,7 +32,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#
USAGE="USAGE: $0 [-d|h] [-v <major.minor>]"
USAGE="USAGE: $0 [-d|h] [-v <major.minor.patch>]"
ADVICE="Try '$0 -h' for more information"
unset VERSION
@ -52,8 +52,8 @@ while [ ! -z "$1" ]; do
echo $USAGE
echo ""
echo "Where:"
echo " -v <major.minor>"
echo " The NuttX version number expressed as a major and minor number separated"
echo " -v <major.minor.patch>"
echo " The NuttX version number expressed as a major, minor and patch number separated"
echo " by a period"
echo " -d"
echo " Enable script debug"

View File

@ -88,7 +88,7 @@ int main(int argc, char **argv, char **envp)
exit(2);
}
stream= fopen(filepath, "r");
stream = fopen(filepath, "r");
if (!stream)
{
fprintf(stderr, "open %s failed: %s\n", filepath, strerror(errno));
@ -99,7 +99,9 @@ int main(int argc, char **argv, char **envp)
printf("#ifndef __INCLUDE_NUTTX_VERSION_H\n");
printf("#define __INCLUDE_NUTTX_VERSION_H\n\n");
generate_definitions(stream);
printf("\n#define CONFIG_VERSION ((CONFIG_VERSION_MAJOR << 8) | (CONFIG_VERSION_MINOR))\n\n");
printf("\n#define CONFIG_VERSION ((CONFIG_VERSION_MAJOR << 16) |\\\n"
" (CONFIG_VERSION_MINOR << 8) |\\\n"
" (CONFIG_VERSION_PATCH))\n\n");
printf("#endif /* __INCLUDE_NUTTX_VERSION_H */\n");
fclose(stream);

View File

@ -36,7 +36,7 @@ WD=`pwd`
# Get command line parameters
USAGE="USAGE: $0 [-d|-h] [-b <build>] [-v <major.minor>] <outfile-path>"
USAGE="USAGE: $0 [-d|-h] [-b <build>] [-v <major.minor.patch>] <outfile-path>"
ADVICE="Try '$0 -h' for more information"
unset VERSION
@ -69,9 +69,9 @@ while [ ! -z "$1" ]; do
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 " -v <major.minor.patch>"
echo " The NuttX version number expressed as a major, minor and patch"
echo " number seperated by a period"
echo " <outfile-path>"
echo " The full path to the version file to be created"
exit 0
@ -87,6 +87,12 @@ OUTFILE=$1
if [ -z ${VERSION} ] ; then
VERSION=`git tag --sort=taggerdate | tail -1 | cut -d'-' -f2`
# Earlier tags used the format "major.minor", append a "0" for a patch.
if [[ ${VERSION} =~ ^([0-9]+[\.][0-9]+)$ ]] ; then
VERSION=${VERSION}.0
fi
fi
# Make sure we know what is going on
@ -102,19 +108,27 @@ if [ -z ${OUTFILE} ] ; then
echo "Missing path to the output file"
echo $USAGE
echo $ADVICE
exit 1
exit 2
fi
# Get the major and minor version numbers
# Get the major, minor and patch 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
exit 3
fi
MINOR=`echo ${VERSION} | cut -d'.' -f2`
if [ "X${MAJOR}.${MINOR}" = "X${VERSION}" ]; then
echo "Missing patch version number"
echo $USAGE
echo $ADVICE
exit 4
fi
PATCH=`echo ${VERSION} | cut -d'.' -f3`
# Get GIT information (if not provided on the command line)
@ -122,7 +136,7 @@ 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
exit 5
fi
if [ -n "`git diff-index --name-only HEAD | head -1`" ]; then
BUILD=${BUILD}-dirty
@ -137,4 +151,5 @@ echo "" >>${OUTFILE}
echo "CONFIG_VERSION_STRING=\"${VERSION}\"" >>${OUTFILE}
echo "CONFIG_VERSION_MAJOR=${MAJOR}" >>${OUTFILE}
echo "CONFIG_VERSION_MINOR=${MINOR}" >>${OUTFILE}
echo "CONFIG_VERSION_PATCH=${PATCH}" >>${OUTFILE}
echo "CONFIG_VERSION_BUILD=\"${BUILD}\"" >>${OUTFILE}

View File

@ -50,7 +50,7 @@ EXCLPAT="
"
# Get command line parameters
USAGE="USAGE: $0 [-d|h|v|s] [-b <build]> [-e <exclude>] [-k <key-id>] <major.minor>"
USAGE="USAGE: $0 [-d|h|v|s] [-b <build]> [-e <exclude>] [-k <key-id>] <major.minor.patch>"
ADVICE="Try '$0 -h' for more information"
unset VERSION
@ -104,8 +104,8 @@ while [ ! -z "$1" ]; do
echo " PGP sign the final tarballs and create digests."
echo " -k"
echo " PGP key ID. If not provided the default ID will be used."
echo " <major.minor>"
echo " The NuttX version number expressed as a major and minor number separated"
echo " <major.minor.patch>"
echo " The NuttX version number expressed as a major, minor and patch number separated"
echo " by a period"
exit 0
;;