You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/04/20 02:02:57 UTC
[incubator-nuttx] 02/04: tools/: Update version generation tools to
account for the patch number.
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch releases/9.0
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 8d3f953a31b90469b273642ae497d3cac4f348ee
Author: Ouss4 <ab...@gmail.com>
AuthorDate: Sat Apr 18 19:47:04 2020 +0100
tools/: Update version generation tools to account for the patch number.
---
tools/Makefile.unix | 2 +-
tools/Makefile.win | 4 +++-
tools/README.txt | 18 +++++++++---------
tools/mkconfigvars.sh | 6 +++---
tools/mkversion.c | 6 ++++--
tools/version.sh | 31 +++++++++++++++++++++++--------
tools/zipme.sh | 6 +++---
7 files changed, 46 insertions(+), 27 deletions(-)
diff --git a/tools/Makefile.unix b/tools/Makefile.unix
index 550493a..f71e91a 100644
--- a/tools/Makefile.unix
+++ b/tools/Makefile.unix
@@ -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)
diff --git a/tools/Makefile.win b/tools/Makefile.win
index a9eaee1..12f6d05 100644
--- a/tools/Makefile.win
+++ b/tools/Makefile.win
@@ -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)
diff --git a/tools/README.txt b/tools/README.txt
index dc43240..42c71fd 100644
--- a/tools/README.txt
+++ b/tools/README.txt
@@ -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.
diff --git a/tools/mkconfigvars.sh b/tools/mkconfigvars.sh
index c01a2e4..c22176a 100755
--- a/tools/mkconfigvars.sh
+++ b/tools/mkconfigvars.sh
@@ -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"
diff --git a/tools/mkversion.c b/tools/mkversion.c
index 879545f..34291e3 100644
--- a/tools/mkversion.c
+++ b/tools/mkversion.c
@@ -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);
diff --git a/tools/version.sh b/tools/version.sh
index 64b2b1a..d5574d3 100755
--- a/tools/version.sh
+++ b/tools/version.sh
@@ -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}
diff --git a/tools/zipme.sh b/tools/zipme.sh
index 0b8c05b..b46cacc 100755
--- a/tools/zipme.sh
+++ b/tools/zipme.sh
@@ -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
;;