Start development cycle for version 1.7.0.

This new development workflow introduces a new versioning scheme.
Instead of having releases r0, r1, r2, etc, there will be release
candidates. Last number has special meanings:
< 16 numbers are reserved for release candidates (RTE_VER_SUFFIX is -rc)
16 is reserved for the release (RTE_VER_SUFFIX must be unset)
> 16 numbers can be used locally (RTE_VER_SUFFIX must be set)

Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 lib/librte_eal/common/include/rte_version.h | 55 +++++++++++++++++------------
 mk/rte.sdkconfig.mk                         | 13 +++++--
 2 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_version.h 
b/lib/librte_eal/common/include/rte_version.h
index 419de24..e64cccc 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -59,7 +59,7 @@ extern "C" {
 /**
  * Minor version number i.e. the y in x.y.z
  */
-#define RTE_VER_MINOR 6
+#define RTE_VER_MINOR 7

 /**
  * Patch level number i.e. the z in x.y.z
@@ -67,9 +67,16 @@ extern "C" {
 #define RTE_VER_PATCH_LEVEL 0

 /**
- * Patch release number i.e. the w in x.y.zrw
+ * Extra string to be appended to version number
  */
-#define RTE_VER_PATCH_RELEASE 2
+#define RTE_VER_SUFFIX "-rc"
+
+/**
+ * Patch release number
+ *   0-15 = release candidates
+ *   16   = release
+ */
+#define RTE_VER_PATCH_RELEASE 0

 /**
  * Macro to compute a version number usable for comparisons
@@ -86,31 +93,33 @@ extern "C" {
                        RTE_VER_PATCH_RELEASE)

 /**
- * Extra string to be appended to version number,
- * for example: pre1, EAR, final etc.
- */
-#define RTE_VER_SUFFIX ""
-
-/**
- * Function returning string of version number: "RTE x.y.zrw"
+ * Function returning version string
  * @return
  *     string
  */
 static inline const char *
-rte_version(void) {
-       if (sizeof(RTE_VER_SUFFIX) > sizeof(""))
-               return RTE_VER_PREFIX" "
-                               RTE_STR(RTE_VER_MAJOR)"."
-                               RTE_STR(RTE_VER_MINOR)"."
-                               RTE_STR(RTE_VER_PATCH_LEVEL)"r"
-                               RTE_STR(RTE_VER_PATCH_RELEASE)
-                               "-"RTE_VER_SUFFIX;
+rte_version(void)
+{
+       static char version[32];
+       if (version[0] != 0)
+               return version;
+       if (strlen(RTE_VER_SUFFIX) == 0)
+               sprintf(version, "%s %d.%d.%d",
+                       RTE_VER_PREFIX,
+                       RTE_VER_MAJOR,
+                       RTE_VER_MINOR,
+                       RTE_VER_PATCH_LEVEL);
        else
-               return RTE_VER_PREFIX" "
-                               RTE_STR(RTE_VER_MAJOR)"."
-                               RTE_STR(RTE_VER_MINOR)"."
-                               RTE_STR(RTE_VER_PATCH_LEVEL)"r"
-                               RTE_STR(RTE_VER_PATCH_RELEASE);
+               sprintf(version, "%s %d.%d.%d%s%d",
+                       RTE_VER_PREFIX,
+                       RTE_VER_MAJOR,
+                       RTE_VER_MINOR,
+                       RTE_VER_PATCH_LEVEL,
+                       RTE_VER_SUFFIX,
+                       RTE_VER_PATCH_RELEASE < 16 ?
+                               RTE_VER_PATCH_RELEASE :
+                               RTE_VER_PATCH_RELEASE - 16);
+       return version;
 }

 #ifdef __cplusplus
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index a96beeb..d0692e7 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -31,9 +31,16 @@

 .PHONY: showversion
 showversion:
-       @sed -rn 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
-               $(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h | \
-               tr '\n' '.' | sed -r 's,\.([0-9]+)\.$$,r\1\n,'
+       @set -- \
+               $$(sed -rne 's,^#define 
RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
+                       -e 's,^#define RTE_VER_SUFFIX[[:space:]]+"(.*)",\1,p' \
+                       
$(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h) ;\
+               printf '%d.%d.%d' "$$1" "$$2" "$$3"; \
+               if [ -z "$$4" ]; then echo; \
+               else printf '%s' "$$4"; \
+                       if [ $$5 -lt 16 ] ; then echo $$5; \
+                       else echo $$(($$5 - 16)); fi; \
+               fi

 INSTALL_CONFIGS := $(sort $(filter-out %~,\
        $(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
-- 
1.9.2

Reply via email to