DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all...
@ 2019-03-07 11:54 Bruce Richardson
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 1/4] build: add single source of DPDK version number Bruce Richardson
                   ` (6 more replies)
  0 siblings, 7 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 11:54 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Right now with DPDK we have two sources of version information - the
rte_version.h header file containing macros for C use, and the project
version number in the project definition in meson.build. This is not
optimal, so this patchset aims to provide a single source for the DPDK
version. The options considered are:

* Keep version info in rte_version.h only. The two reasons this was not
  chosen were:
  1) parsing the version number from the header is awkward, as seen in the
     rte.sdkconfig.mk file, and a script to do so would be needed to
     integrate that into the meson build project definition.
  2) rte_version.h is not in an obvious location inside the project when
     a user clones from git. It's hidden away in the
     "lib/librte_eal/common/include" folder. Ideally the version number
     should be evident at the top level of the DPDK tree.

* Keep version info in meson.build file only. This seemed a better option
  than keeping the info in rte_version.h, but it still had disadvantages:
  1) For make, using grep on meson.build to extract the version seemed a
     bit awkward, though doable. Splitting the version was tricky too, but
     managable with a small amount of scripting.
  2) There was no easy way to have users access the version number when
     "make showversion" was deprecated with the make build system.

* Store the version number in a new version file at the root level of the
  repo.
  * This did have the advantage of being easily discoverable on clone
  * Still had the disadvantage of needing some parsing to generate the
    defines from rte_version.h

Since the last option seemed best, that is what is implemented in this set.
The file DPDK_VERSION is added to store the version number, and make and
meson both use that as their source of version info. For C code, the
rte_version.h header remains, except that the basic definitions of the
release YEAR, MONTH, MINOR etc. are moved to be automatically generated as
part of rte_config.h. For make builds, this is done via using the
preprocessor to insert the values when it generates the config. For meson
builds, this is done by just adding the values to the dpdk_conf
configuration object.

Bruce Richardson (4):
  build: add single source of DPDK version number
  build: use version number from config file
  build: move meson version handling to config directory
  eal: remove unneeded version logic

 DPDK_VERSION                                |  1 +
 config/common_base                          | 14 ++++++++
 config/meson.build                          | 26 +++++++++++++++
 config/rte_config.h                         |  5 +++
 lib/librte_eal/common/include/rte_version.h | 36 +--------------------
 meson.build                                 | 14 +-------
 mk/rte.sdkconfig.mk                         | 18 +++--------
 7 files changed, 52 insertions(+), 62 deletions(-)
 create mode 100644 DPDK_VERSION

-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH 1/4] build: add single source of DPDK version number
  2019-03-07 11:54 [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Bruce Richardson
@ 2019-03-07 11:54 ` Bruce Richardson
  2019-03-07 12:33   ` David Marchand
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 2/4] build: use version number from config file Bruce Richardson
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 11:54 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Add a new file DPDK_VERSION to hold the current DPDK version number.
Have meson use this file for it's project version, and have make use
it for reporting out "showversion" and "showversionum".

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 DPDK_VERSION        |  1 +
 meson.build         |  2 +-
 mk/rte.sdkconfig.mk | 16 ++--------------
 3 files changed, 4 insertions(+), 15 deletions(-)
 create mode 100644 DPDK_VERSION

diff --git a/DPDK_VERSION b/DPDK_VERSION
new file mode 100644
index 000000000..c4a4cd00b
--- /dev/null
+++ b/DPDK_VERSION
@@ -0,0 +1 @@
+19.05.0-rc0
diff --git a/meson.build b/meson.build
index 69833de82..757618144 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 project('DPDK', 'C',
-	version: '19.05.0-rc0',
+	# get version number from file
+	# use "more" rather than "cat" for windows compatiblity
+	version: run_command('more', files('DPDK_VERSION')).stdout().strip(),
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
 	meson_version: '>= 0.47.1'
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index fa77331cb..8dc31d7cf 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -3,23 +3,11 @@
 
 .PHONY: showversion
 showversion:
-	@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.%02d.%d' "$$1" "$$2" "$$3"; \
-		if [ -z "$$5" ]; then echo; \
-		else printf '%s' "$$4"; \
-			if [ $$5 -lt 16 ] ; then echo $$5; \
-			else echo $$(($$5 - 16)); fi; \
-		fi
+	@cat $(RTE_SRCDIR)/DPDK_VERSION
 
 .PHONY: showversionum
 showversionum:
-	@set -- \
-		$$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
-			$(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h); \
-		printf '%02d%02d\n' "$$1" "$$2"
+	@cat ${RTE_SRCDIR}/DPDK_VERSION | awk -F '.' '{print $$1$$2}'
 
 INSTALL_CONFIGS := $(sort $(filter-out %~,\
 	$(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH 2/4] build: use version number from config file
  2019-03-07 11:54 [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Bruce Richardson
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 1/4] build: add single source of DPDK version number Bruce Richardson
@ 2019-03-07 11:54 ` Bruce Richardson
  2019-03-07 12:37   ` David Marchand
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 3/4] build: move meson version handling to config directory Bruce Richardson
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 11:54 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

Since we have the version number in a separate file at the root level,
we should not need to duplicate this in rte_version.h too. Best
approach here is to move the macros for specifying the year/month/etc.
parts from the version header file to the build config file - leaving
the other utility macros for e.g. printing the version string, where they
are.

For make this is done by having a little bit of awk parse the version
file and pass the results through to the preprocessor for the config
generation stage.

For meson, this is done by parsing the version and adding it to the
standard dpdk_conf object.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 DPDK_VERSION                                |  2 +-
 config/common_base                          | 14 +++++++++
 config/rte_config.h                         |  5 ++++
 lib/librte_eal/common/include/rte_version.h | 32 ---------------------
 meson.build                                 | 14 +++++++++
 mk/rte.sdkconfig.mk                         |  2 ++
 6 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/DPDK_VERSION b/DPDK_VERSION
index c4a4cd00b..e013b54dd 100644
--- a/DPDK_VERSION
+++ b/DPDK_VERSION
@@ -1 +1 @@
-19.05.0-rc0
+19.05.1
diff --git a/config/common_base b/config/common_base
index 0b09a9348..6292bc4af 100644
--- a/config/common_base
+++ b/config/common_base
@@ -1,6 +1,20 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2010-2017 Intel Corporation
 
+#
+# String that appears before the version number
+#
+CONFIG_RTE_VER_PREFIX="DPDK"
+
+#
+# Version information completed when this file is processed for a build
+#
+CONFIG_RTE_VER_YEAR=__YEAR
+CONFIG_RTE_VER_MONTH=__MONTH
+CONFIG_RTE_VER_MINOR=__MINOR
+CONFIG_RTE_VER_SUFFIX=__SUFFIX
+CONFIG_RTE_VER_RELEASE=__RELEASE
+
 #
 # define executive environment
 # RTE_EXEC_ENV values are the directories in mk/exec-env/
diff --git a/config/rte_config.h b/config/rte_config.h
index 7606f5d7b..5f1749dbb 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -18,6 +18,11 @@
 
 #include <rte_build_config.h>
 
+/**
+ * String that appears before the version number
+ */
+#define RTE_VER_PREFIX "DPDK"
+
 /****** library defines ********/
 
 /* compat defines */
diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index a7eed7ab7..50867ea81 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -19,38 +19,6 @@ extern "C" {
 #include <stdio.h>
 #include <rte_common.h>
 
-/**
- * String that appears before the version number
- */
-#define RTE_VER_PREFIX "DPDK"
-
-/**
- * Major version/year number i.e. the yy in yy.mm.z
- */
-#define RTE_VER_YEAR 19
-
-/**
- * Minor version/month number i.e. the mm in yy.mm.z
- */
-#define RTE_VER_MONTH 5
-
-/**
- * Patch level number i.e. the z in yy.mm.z
- */
-#define RTE_VER_MINOR 0
-
-/**
- * Extra string to be appended to version number
- */
-#define RTE_VER_SUFFIX "-rc"
-
-/**
- * Patch release number
- *   0-15 = release candidates
- *   16   = release
- */
-#define RTE_VER_RELEASE 0
-
 /**
  * Macro to compute a version number usable for comparisons
  */
diff --git a/meson.build b/meson.build
index 757618144..9d5320395 100644
--- a/meson.build
+++ b/meson.build
@@ -22,6 +22,20 @@ dpdk_app_link_libraries = []
 pver = meson.project_version().split('.')
 major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
 
+# extract all version information into the build configuration
+dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
+dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
+if pver.get(2).contains('-rc')
+	rc_ver = pver.get(2).split('-rc')
+	dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
+	dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
+else
+	dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
+	dpdk_conf.set('RTE_VER_RELEASE', 0)
+endif
+
 pmd_subdir_opt = get_option('drivers_install_subdir')
 if pmd_subdir_opt.contains('<VERSION>')
 	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index 8dc31d7cf..bbfa24dee 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -76,6 +76,8 @@ else
 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
 	$(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
 		$(CPP) -undef -P -x assembler-with-cpp \
+		`cat $(RTE_SRCDIR)/DPDK_VERSION | sed -e 's/-rc/.-rc./' | \
+		awk -F '.' '{print "-D__YEAR="$$1, "-D__MONTH="$$2, "-D__MINOR="$$3, "-D__SUFFIX=\""$$4"\"", "-D__RELEASE="int($$5)}'` \
 		-ffreestanding \
 		-o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
 		config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH 3/4] build: move meson version handling to config directory
  2019-03-07 11:54 [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Bruce Richardson
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 1/4] build: add single source of DPDK version number Bruce Richardson
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 2/4] build: use version number from config file Bruce Richardson
@ 2019-03-07 11:54 ` Bruce Richardson
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 4/4] eal: remove unneeded version logic Bruce Richardson
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 11:54 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

To keep the top-level meson.build file as clean and clear as
possible, we move the version handling - which was originally short
but now is a lot longer - to the config/meson.build file, where the
rest of the build configuration is already being set up.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 config/meson.build | 26 ++++++++++++++++++++++++++
 meson.build        | 26 --------------------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..bbe17c786 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -1,6 +1,32 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+# set the major version, which might be used by drivers and libraries
+# depending on the configuration options
+pver = meson.project_version().split('.')
+major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
+
+# extract all version information into the build configuration
+dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
+dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
+if pver.get(2).contains('-rc')
+	rc_ver = pver.get(2).split('-rc')
+	dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
+	dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
+else
+	dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
+	dpdk_conf.set('RTE_VER_RELEASE', 0)
+endif
+
+pmd_subdir_opt = get_option('drivers_install_subdir')
+if pmd_subdir_opt.contains('<VERSION>')
+	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
+endif
+driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
+eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
+
 # set the machine type and cflags for it
 if meson.is_cross_build()
 	machine = host_machine.cpu()
diff --git a/meson.build b/meson.build
index 9d5320395..b0151f0c7 100644
--- a/meson.build
+++ b/meson.build
@@ -17,32 +17,6 @@ dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
 
-# set the major version, which might be used by drivers and libraries
-# depending on the configuration options
-pver = meson.project_version().split('.')
-major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
-
-# extract all version information into the build configuration
-dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
-dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
-if pver.get(2).contains('-rc')
-	rc_ver = pver.get(2).split('-rc')
-	dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
-	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
-	dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
-else
-	dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
-	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
-	dpdk_conf.set('RTE_VER_RELEASE', 0)
-endif
-
-pmd_subdir_opt = get_option('drivers_install_subdir')
-if pmd_subdir_opt.contains('<VERSION>')
-	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
-endif
-driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
-eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
-
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH 4/4] eal: remove unneeded version logic
  2019-03-07 11:54 [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Bruce Richardson
                   ` (2 preceding siblings ...)
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 3/4] build: move meson version handling to config directory Bruce Richardson
@ 2019-03-07 11:54 ` Bruce Richardson
  2019-03-07 12:09 ` [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Luca Boccassi
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 11:54 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

The version number in the DPDK_VERSION file will never have an offset
that needs to be subtracted, so remove that logic from the version
string generation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 lib/librte_eal/common/include/rte_version.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index 50867ea81..f7a3a1ebc 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -57,9 +57,7 @@ rte_version(void)
 			RTE_VER_MONTH,
 			RTE_VER_MINOR,
 			RTE_VER_SUFFIX,
-			RTE_VER_RELEASE < 16 ?
-				RTE_VER_RELEASE :
-				RTE_VER_RELEASE - 16);
+			RTE_VER_RELEASE);
 	return version;
 }
 
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all...
  2019-03-07 11:54 [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Bruce Richardson
                   ` (3 preceding siblings ...)
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 4/4] eal: remove unneeded version logic Bruce Richardson
@ 2019-03-07 12:09 ` Luca Boccassi
  2019-03-07 12:14   ` Bruce Richardson
  2019-03-07 13:34 ` [dpdk-dev] [PATCH v2 " Bruce Richardson
  2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
  6 siblings, 1 reply; 40+ messages in thread
From: Luca Boccassi @ 2019-03-07 12:09 UTC (permalink / raw)
  To: Bruce Richardson, dev

On Thu, 2019-03-07 at 11:54 +0000, Bruce Richardson wrote:
> Right now with DPDK we have two sources of version information - the
> rte_version.h header file containing macros for C use, and the
> project
> version number in the project definition in meson.build. This is not
> optimal, so this patchset aims to provide a single source for the
> DPDK
> version. The options considered are:
> 
> * Keep version info in rte_version.h only. The two reasons this was
> not
>   chosen were:
>   1) parsing the version number from the header is awkward, as seen
> in the
>      rte.sdkconfig.mk file, and a script to do so would be needed to
>      integrate that into the meson build project definition.
>   2) rte_version.h is not in an obvious location inside the project
> when
>      a user clones from git. It's hidden away in the
>      "lib/librte_eal/common/include" folder. Ideally the version
> number
>      should be evident at the top level of the DPDK tree.
> 
> * Keep version info in meson.build file only. This seemed a better
> option
>   than keeping the info in rte_version.h, but it still had
> disadvantages:
>   1) For make, using grep on meson.build to extract the version
> seemed a
>      bit awkward, though doable. Splitting the version was tricky
> too, but
>      managable with a small amount of scripting.
>   2) There was no easy way to have users access the version number
> when
>      "make showversion" was deprecated with the make build system.
> 
> * Store the version number in a new version file at the root level of
> the
>   repo.
>   * This did have the advantage of being easily discoverable on clone
>   * Still had the disadvantage of needing some parsing to generate
> the
>     defines from rte_version.h
> 
> Since the last option seemed best, that is what is implemented in
> this set.
> The file DPDK_VERSION is added to store the version number, and make
> and
> meson both use that as their source of version info. For C code, the
> rte_version.h header remains, except that the basic definitions of
> the
> release YEAR, MONTH, MINOR etc. are moved to be automatically
> generated as
> part of rte_config.h. For make builds, this is done via using the
> preprocessor to insert the values when it generates the config. For
> meson
> builds, this is done by just adding the values to the dpdk_conf
> configuration object.
> 
> Bruce Richardson (4):
>   build: add single source of DPDK version number
>   build: use version number from config file
>   build: move meson version handling to config directory
>   eal: remove unneeded version logic
> 
>  DPDK_VERSION                                |  1 +
>  config/common_base                          | 14 ++++++++
>  config/meson.build                          | 26 +++++++++++++++
>  config/rte_config.h                         |  5 +++
>  lib/librte_eal/common/include/rte_version.h | 36 +----------------
> ----
>  meson.build                                 | 14 +-------
>  mk/rte.sdkconfig.mk                         | 18 +++--------
>  7 files changed, 52 insertions(+), 62 deletions(-)
>  create mode 100644 DPDK_VERSION

Series-acked-by: Luca Boccassi <bluca@debian.org>

This is a good change, thanks for that. Too bad there's not yet a meson
--project-version option - it's been discussed but not implemented:

https://github.com/mesonbuild/meson/issues/3535

-- 
Kind regards,
Luca Boccassi

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all...
  2019-03-07 12:09 ` [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Luca Boccassi
@ 2019-03-07 12:14   ` Bruce Richardson
  0 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 12:14 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: dev

On Thu, Mar 07, 2019 at 12:09:44PM +0000, Luca Boccassi wrote:
> On Thu, 2019-03-07 at 11:54 +0000, Bruce Richardson wrote:
> > Right now with DPDK we have two sources of version information - the
> > rte_version.h header file containing macros for C use, and the project
> > version number in the project definition in meson.build. This is not
> > optimal, so this patchset aims to provide a single source for the DPDK
> > version. The options considered are:
> > 
> > * Keep version info in rte_version.h only. The two reasons this was not
> > chosen were: 1) parsing the version number from the header is awkward,
> > as seen in the rte.sdkconfig.mk file, and a script to do so would be
> > needed to integrate that into the meson build project definition.  2)
> > rte_version.h is not in an obvious location inside the project when a
> > user clones from git. It's hidden away in the
> > "lib/librte_eal/common/include" folder. Ideally the version number
> > should be evident at the top level of the DPDK tree.
> > 
> > * Keep version info in meson.build file only. This seemed a better
> > option than keeping the info in rte_version.h, but it still had
> > disadvantages: 1) For make, using grep on meson.build to extract the
> > version seemed a bit awkward, though doable. Splitting the version was
> > tricky too, but managable with a small amount of scripting.  2) There
> > was no easy way to have users access the version number when "make
> > showversion" was deprecated with the make build system.
> > 
> > * Store the version number in a new version file at the root level of
> > the repo.  * This did have the advantage of being easily discoverable
> > on clone * Still had the disadvantage of needing some parsing to
> > generate the defines from rte_version.h
> > 
> > Since the last option seemed best, that is what is implemented in this
> > set.  The file DPDK_VERSION is added to store the version number, and
> > make and meson both use that as their source of version info. For C
> > code, the rte_version.h header remains, except that the basic
> > definitions of the release YEAR, MONTH, MINOR etc. are moved to be
> > automatically generated as part of rte_config.h. For make builds, this
> > is done via using the preprocessor to insert the values when it
> > generates the config. For meson builds, this is done by just adding the
> > values to the dpdk_conf configuration object.
> > 
> > Bruce Richardson (4): build: add single source of DPDK version number
> > build: use version number from config file build: move meson version
> > handling to config directory eal: remove unneeded version logic
> > 
> >  DPDK_VERSION                                |  1 + config/common_base
> >  | 14 ++++++++ config/meson.build                          | 26
> >  +++++++++++++++ config/rte_config.h                         |  5 +++
> >  lib/librte_eal/common/include/rte_version.h | 36 +----------------
> >  ---- meson.build                                 | 14 +-------
> >  mk/rte.sdkconfig.mk                         | 18 +++-------- 7 files
> >  changed, 52 insertions(+), 62 deletions(-) create mode 100644
> >  DPDK_VERSION
> 
> Series-acked-by: Luca Boccassi <bluca@debian.org>
> 
> This is a good change, thanks for that. Too bad there's not yet a meson
> --project-version option - it's been discussed but not implemented:
> 
> https://github.com/mesonbuild/meson/issues/3535
> 
Yes, I saw that request, and considered looking into doing it. However,
even when it is implemented, we wouldn't be able to base anything on it
till our next meson version bump at the earliest. Therefore I felt the most
effective solution is one based in DPDK itself.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH 1/4] build: add single source of DPDK version number
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 1/4] build: add single source of DPDK version number Bruce Richardson
@ 2019-03-07 12:33   ` David Marchand
  0 siblings, 0 replies; 40+ messages in thread
From: David Marchand @ 2019-03-07 12:33 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Thu, Mar 7, 2019 at 12:55 PM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> Add a new file DPDK_VERSION to hold the current DPDK version number.
> Have meson use this file for it's project version, and have make use
> it for reporting out "showversion" and "showversionum".
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  DPDK_VERSION        |  1 +
>  meson.build         |  2 +-
>  mk/rte.sdkconfig.mk | 16 ++--------------
>  3 files changed, 4 insertions(+), 15 deletions(-)
>  create mode 100644 DPDK_VERSION
>
> diff --git a/DPDK_VERSION b/DPDK_VERSION
> new file mode 100644
> index 000000000..c4a4cd00b
> --- /dev/null
> +++ b/DPDK_VERSION
> @@ -0,0 +1 @@
> +19.05.0-rc0
> diff --git a/meson.build b/meson.build
> index 69833de82..757618144 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2,7 +2,9 @@
>  # Copyright(c) 2017 Intel Corporation
>
>  project('DPDK', 'C',
> -       version: '19.05.0-rc0',
> +       # get version number from file
> +       # use "more" rather than "cat" for windows compatiblity
>

compatibility

+       version: run_command('more',
> files('DPDK_VERSION')).stdout().strip(),
>         license: 'BSD',
>         default_options: ['buildtype=release', 'default_library=static'],
>         meson_version: '>= 0.47.1'
> diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
> index fa77331cb..8dc31d7cf 100644
> --- a/mk/rte.sdkconfig.mk
> +++ b/mk/rte.sdkconfig.mk
> @@ -3,23 +3,11 @@
>
>  .PHONY: showversion
>  showversion:
> -       @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.%02d.%d' "$$1" "$$2" "$$3"; \
> -               if [ -z "$$5" ]; then echo; \
> -               else printf '%s' "$$4"; \
> -                       if [ $$5 -lt 16 ] ; then echo $$5; \
> -                       else echo $$(($$5 - 16)); fi; \
> -               fi
> +       @cat $(RTE_SRCDIR)/DPDK_VERSION
>
>  .PHONY: showversionum
>  showversionum:
> -       @set -- \
> -               $$(sed -rne 's,^#define
> RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
> -
>  $(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h); \
> -               printf '%02d%02d\n' "$$1" "$$2"
> +       @cat ${RTE_SRCDIR}/DPDK_VERSION | awk -F '.' '{print $$1$$2}'
>

s/{RTE_SRCDIR}/(RTE_SRCDIR)/


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

-- 
David Marchand

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH 2/4] build: use version number from config file
  2019-03-07 11:54 ` [dpdk-dev] [PATCH 2/4] build: use version number from config file Bruce Richardson
@ 2019-03-07 12:37   ` David Marchand
  2019-03-07 12:42     ` David Marchand
  2019-03-07 13:01     ` Bruce Richardson
  0 siblings, 2 replies; 40+ messages in thread
From: David Marchand @ 2019-03-07 12:37 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Thu, Mar 7, 2019 at 12:55 PM Bruce Richardson <bruce.richardson@intel.com>
wrote:

> Since we have the version number in a separate file at the root level,
> we should not need to duplicate this in rte_version.h too. Best
> approach here is to move the macros for specifying the year/month/etc.
> parts from the version header file to the build config file - leaving
> the other utility macros for e.g. printing the version string, where they
> are.
>
> For make this is done by having a little bit of awk parse the version
> file and pass the results through to the preprocessor for the config
> generation stage.
>
> For meson, this is done by parsing the version and adding it to the
> standard dpdk_conf object.
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  DPDK_VERSION                                |  2 +-
>  config/common_base                          | 14 +++++++++
>  config/rte_config.h                         |  5 ++++
>  lib/librte_eal/common/include/rte_version.h | 32 ---------------------
>  meson.build                                 | 14 +++++++++
>  mk/rte.sdkconfig.mk                         |  2 ++
>  6 files changed, 36 insertions(+), 33 deletions(-)
>
> diff --git a/DPDK_VERSION b/DPDK_VERSION
> index c4a4cd00b..e013b54dd 100644
> --- a/DPDK_VERSION
> +++ b/DPDK_VERSION
> @@ -1 +1 @@
> -19.05.0-rc0
> +19.05.1
>

Might be a bit early for the stable while the 19.05 is still being cooked
:-)


diff --git a/config/common_base b/config/common_base
> index 0b09a9348..6292bc4af 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -1,6 +1,20 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2010-2017 Intel Corporation
>
> +#
> +# String that appears before the version number
> +#
> +CONFIG_RTE_VER_PREFIX="DPDK"
> +
> +#
> +# Version information completed when this file is processed for a build
> +#
> +CONFIG_RTE_VER_YEAR=__YEAR
> +CONFIG_RTE_VER_MONTH=__MONTH
> +CONFIG_RTE_VER_MINOR=__MINOR
> +CONFIG_RTE_VER_SUFFIX=__SUFFIX
> +CONFIG_RTE_VER_RELEASE=__RELEASE
> +
>

?
I think you broke make support.

== Build lib/librte_eal/linuxapp/eal
  CC eal.o
In file included from
/home/dmarchan/git/pub/dpdk/lib/librte_eal/linuxapp/eal/eal.c:49:0:
/home/dmarchan/git/pub/dpdk/master/include/rte_version.h: In function
‘rte_version’:
/home/dmarchan/git/pub/dpdk/master/include/rte_version.h:47:13: error:
‘RTE_VER_SUFFIX’ undeclared (first use in this function)
  if (strlen(RTE_VER_SUFFIX) == 0)
             ^
/home/dmarchan/git/pub/dpdk/master/include/rte_version.h:47:13: note: each
undeclared identifier is reported only once for each function it appears in
/home/dmarchan/git/pub/dpdk/master/include/rte_version.h:49:4: error:
‘RTE_VER_PREFIX’ undeclared (first use in this function)
    RTE_VER_PREFIX,
    ^
/home/dmarchan/git/pub/dpdk/master/include/rte_version.h:50:4: error:
‘RTE_VER_YEAR’ undeclared (first use in this function)
    RTE_VER_YEAR,
    ^
/home/dmarchan/git/pub/dpdk/master/include/rte_version.h:51:4: error:
‘RTE_VER_MONTH’ undeclared (first use in this function)
    RTE_VER_MONTH,
    ^
/home/dmarchan/git/pub/dpdk/master/include/rte_version.h:52:4: error:
‘RTE_VER_MINOR’ undeclared (first use in this function)
    RTE_VER_MINOR);
    ^
/home/dmarchan/git/pub/dpdk/master/include/rte_version.h:60:4: error:
‘RTE_VER_RELEASE’ undeclared (first use in this function)
    RTE_VER_RELEASE);
    ^
make[5]: *** [eal.o] Error 1
make[4]: *** [eal] Error 2
make[3]: *** [linuxapp] Error 2
make[2]: *** [librte_eal] Error 2
make[1]: *** [lib] Error 2
make: *** [all] Error 2



 #
>  # define executive environment
>  # RTE_EXEC_ENV values are the directories in mk/exec-env/
> diff --git a/config/rte_config.h b/config/rte_config.h
> index 7606f5d7b..5f1749dbb 100644
> --- a/config/rte_config.h
> +++ b/config/rte_config.h
> @@ -18,6 +18,11 @@
>
>  #include <rte_build_config.h>
>
> +/**
> + * String that appears before the version number
> + */
> +#define RTE_VER_PREFIX "DPDK"
> +
>  /****** library defines ********/
>
>  /* compat defines */
> diff --git a/lib/librte_eal/common/include/rte_version.h
> b/lib/librte_eal/common/include/rte_version.h
> index a7eed7ab7..50867ea81 100644
> --- a/lib/librte_eal/common/include/rte_version.h
> +++ b/lib/librte_eal/common/include/rte_version.h
> @@ -19,38 +19,6 @@ extern "C" {
>  #include <stdio.h>
>  #include <rte_common.h>
>
> -/**
> - * String that appears before the version number
> - */
> -#define RTE_VER_PREFIX "DPDK"
> -
> -/**
> - * Major version/year number i.e. the yy in yy.mm.z
> - */
> -#define RTE_VER_YEAR 19
> -
> -/**
> - * Minor version/month number i.e. the mm in yy.mm.z
> - */
> -#define RTE_VER_MONTH 5
> -
> -/**
> - * Patch level number i.e. the z in yy.mm.z
> - */
> -#define RTE_VER_MINOR 0
> -
> -/**
> - * Extra string to be appended to version number
> - */
> -#define RTE_VER_SUFFIX "-rc"
> -
> -/**
> - * Patch release number
> - *   0-15 = release candidates
> - *   16   = release
> - */
> -#define RTE_VER_RELEASE 0
> -
>  /**
>   * Macro to compute a version number usable for comparisons
>   */
> diff --git a/meson.build b/meson.build
> index 757618144..9d5320395 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -22,6 +22,20 @@ dpdk_app_link_libraries = []
>  pver = meson.project_version().split('.')
>  major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
>
> +# extract all version information into the build configuration
> +dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
> +dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
> +if pver.get(2).contains('-rc')
> +       rc_ver = pver.get(2).split('-rc')
> +       dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
> +       dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
> +       dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
> +else
> +       dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
> +       dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
> +       dpdk_conf.set('RTE_VER_RELEASE', 0)
> +endif
> +
>  pmd_subdir_opt = get_option('drivers_install_subdir')
>  if pmd_subdir_opt.contains('<VERSION>')
>         pmd_subdir_opt =
> major_version.join(pmd_subdir_opt.split('<VERSION>'))
> diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
> index 8dc31d7cf..bbfa24dee 100644
> --- a/mk/rte.sdkconfig.mk
> +++ b/mk/rte.sdkconfig.mk
> @@ -76,6 +76,8 @@ else
>  $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
>         $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f
> "$(RTE_CONFIG_TEMPLATE)" ]; then \
>                 $(CPP) -undef -P -x assembler-with-cpp \
> +               `cat $(RTE_SRCDIR)/DPDK_VERSION | sed -e 's/-rc/.-rc./' | \
> +               awk -F '.' '{print "-D__YEAR="$$1, "-D__MONTH="$$2,
> "-D__MINOR="$$3, "-D__SUFFIX=\""$$4"\"", "-D__RELEASE="int($$5)}'` \
>

Can't we just pass the RTE_VER_XXX as CFLAGS here ?

                -ffreestanding \
>                 -o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
>                 config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
> --
> 2.20.1
>
>

-- 
David Marchand

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH 2/4] build: use version number from config file
  2019-03-07 12:37   ` David Marchand
@ 2019-03-07 12:42     ` David Marchand
  2019-03-07 13:12       ` Bruce Richardson
  2019-03-07 13:01     ` Bruce Richardson
  1 sibling, 1 reply; 40+ messages in thread
From: David Marchand @ 2019-03-07 12:42 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev

On Thu, Mar 7, 2019 at 1:37 PM David Marchand <david.marchand@redhat.com>
wrote:

>
>
> On Thu, Mar 7, 2019 at 12:55 PM Bruce Richardson <
> bruce.richardson@intel.com> wrote:
>
>> Since we have the version number in a separate file at the root level,
>> we should not need to duplicate this in rte_version.h too. Best
>> approach here is to move the macros for specifying the year/month/etc.
>> parts from the version header file to the build config file - leaving
>> the other utility macros for e.g. printing the version string, where they
>> are.
>>
>> For make this is done by having a little bit of awk parse the version
>> file and pass the results through to the preprocessor for the config
>> generation stage.
>>
>> For meson, this is done by parsing the version and adding it to the
>> standard dpdk_conf object.
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> ---
>>  DPDK_VERSION                                |  2 +-
>>  config/common_base                          | 14 +++++++++
>>  config/rte_config.h                         |  5 ++++
>>  lib/librte_eal/common/include/rte_version.h | 32 ---------------------
>>  meson.build                                 | 14 +++++++++
>>  mk/rte.sdkconfig.mk                         |  2 ++
>>  6 files changed, 36 insertions(+), 33 deletions(-)
>>
>> diff --git a/DPDK_VERSION b/DPDK_VERSION
>> index c4a4cd00b..e013b54dd 100644
>> --- a/DPDK_VERSION
>> +++ b/DPDK_VERSION
>> @@ -1 +1 @@
>> -19.05.0-rc0
>> +19.05.1
>>
>
> Might be a bit early for the stable while the 19.05 is still being cooked
> :-)
>
>
> diff --git a/config/common_base b/config/common_base
>> index 0b09a9348..6292bc4af 100644
>> --- a/config/common_base
>> +++ b/config/common_base
>> @@ -1,6 +1,20 @@
>>  # SPDX-License-Identifier: BSD-3-Clause
>>  # Copyright(c) 2010-2017 Intel Corporation
>>
>> +#
>> +# String that appears before the version number
>> +#
>> +CONFIG_RTE_VER_PREFIX="DPDK"
>> +
>> +#
>> +# Version information completed when this file is processed for a build
>> +#
>> +CONFIG_RTE_VER_YEAR=__YEAR
>> +CONFIG_RTE_VER_MONTH=__MONTH
>> +CONFIG_RTE_VER_MINOR=__MINOR
>> +CONFIG_RTE_VER_SUFFIX=__SUFFIX
>> +CONFIG_RTE_VER_RELEASE=__RELEASE
>> +
>>
>
> ?
> I think you broke make support.
>
> == Build lib/librte_eal/linuxapp/eal
>   CC eal.o
> In file included from
> /home/dmarchan/git/pub/dpdk/lib/librte_eal/linuxapp/eal/eal.c:49:0:
> /home/dmarchan/git/pub/dpdk/master/include/rte_version.h: In function
> ‘rte_version’:
> /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:47:13: error:
> ‘RTE_VER_SUFFIX’ undeclared (first use in this function)
>   if (strlen(RTE_VER_SUFFIX) == 0)
>              ^
> /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:47:13: note: each
> undeclared identifier is reported only once for each function it appears in
> /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:49:4: error:
> ‘RTE_VER_PREFIX’ undeclared (first use in this function)
>     RTE_VER_PREFIX,
>     ^
> /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:50:4: error:
> ‘RTE_VER_YEAR’ undeclared (first use in this function)
>     RTE_VER_YEAR,
>     ^
> /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:51:4: error:
> ‘RTE_VER_MONTH’ undeclared (first use in this function)
>     RTE_VER_MONTH,
>     ^
> /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:52:4: error:
> ‘RTE_VER_MINOR’ undeclared (first use in this function)
>     RTE_VER_MINOR);
>     ^
> /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:60:4: error:
> ‘RTE_VER_RELEASE’ undeclared (first use in this function)
>     RTE_VER_RELEASE);
>     ^
> make[5]: *** [eal.o] Error 1
> make[4]: *** [eal] Error 2
> make[3]: *** [linuxapp] Error 2
> make[2]: *** [librte_eal] Error 2
> make[1]: *** [lib] Error 2
> make: *** [all] Error 2
>
>
>
>  #
>>  # define executive environment
>>  # RTE_EXEC_ENV values are the directories in mk/exec-env/
>> diff --git a/config/rte_config.h b/config/rte_config.h
>> index 7606f5d7b..5f1749dbb 100644
>> --- a/config/rte_config.h
>> +++ b/config/rte_config.h
>> @@ -18,6 +18,11 @@
>>
>>  #include <rte_build_config.h>
>>
>> +/**
>> + * String that appears before the version number
>> + */
>> +#define RTE_VER_PREFIX "DPDK"
>> +
>>  /****** library defines ********/
>>
>>  /* compat defines */
>> diff --git a/lib/librte_eal/common/include/rte_version.h
>> b/lib/librte_eal/common/include/rte_version.h
>> index a7eed7ab7..50867ea81 100644
>> --- a/lib/librte_eal/common/include/rte_version.h
>> +++ b/lib/librte_eal/common/include/rte_version.h
>> @@ -19,38 +19,6 @@ extern "C" {
>>  #include <stdio.h>
>>  #include <rte_common.h>
>>
>> -/**
>> - * String that appears before the version number
>> - */
>> -#define RTE_VER_PREFIX "DPDK"
>> -
>> -/**
>> - * Major version/year number i.e. the yy in yy.mm.z
>> - */
>> -#define RTE_VER_YEAR 19
>> -
>> -/**
>> - * Minor version/month number i.e. the mm in yy.mm.z
>> - */
>> -#define RTE_VER_MONTH 5
>> -
>> -/**
>> - * Patch level number i.e. the z in yy.mm.z
>> - */
>> -#define RTE_VER_MINOR 0
>> -
>> -/**
>> - * Extra string to be appended to version number
>> - */
>> -#define RTE_VER_SUFFIX "-rc"
>> -
>> -/**
>> - * Patch release number
>> - *   0-15 = release candidates
>> - *   16   = release
>> - */
>> -#define RTE_VER_RELEASE 0
>> -
>>  /**
>>   * Macro to compute a version number usable for comparisons
>>   */
>> diff --git a/meson.build b/meson.build
>> index 757618144..9d5320395 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -22,6 +22,20 @@ dpdk_app_link_libraries = []
>>  pver = meson.project_version().split('.')
>>  major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
>>
>> +# extract all version information into the build configuration
>> +dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
>> +dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
>> +if pver.get(2).contains('-rc')
>> +       rc_ver = pver.get(2).split('-rc')
>> +       dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
>> +       dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
>> +       dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
>> +else
>> +       dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
>> +       dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
>> +       dpdk_conf.set('RTE_VER_RELEASE', 0)
>> +endif
>> +
>>  pmd_subdir_opt = get_option('drivers_install_subdir')
>>  if pmd_subdir_opt.contains('<VERSION>')
>>         pmd_subdir_opt =
>> major_version.join(pmd_subdir_opt.split('<VERSION>'))
>> diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
>> index 8dc31d7cf..bbfa24dee 100644
>> --- a/mk/rte.sdkconfig.mk
>> +++ b/mk/rte.sdkconfig.mk
>> @@ -76,6 +76,8 @@ else
>>  $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
>>         $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f
>> "$(RTE_CONFIG_TEMPLATE)" ]; then \
>>                 $(CPP) -undef -P -x assembler-with-cpp \
>> +               `cat $(RTE_SRCDIR)/DPDK_VERSION | sed -e 's/-rc/.-rc./' |
>> \
>> +               awk -F '.' '{print "-D__YEAR="$$1, "-D__MONTH="$$2,
>> "-D__MINOR="$$3, "-D__SUFFIX=\""$$4"\"", "-D__RELEASE="int($$5)}'` \
>>
>
> Can't we just pass the RTE_VER_XXX as CFLAGS here ?
>

Argh no, I mean passing RTE_VER_XXX as global CFLAGS.
I am not really a fan of having the version in the config file, but I have
no real argument against it.


-- 
David Marchand

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH 2/4] build: use version number from config file
  2019-03-07 12:37   ` David Marchand
  2019-03-07 12:42     ` David Marchand
@ 2019-03-07 13:01     ` Bruce Richardson
  1 sibling, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 13:01 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Thu, Mar 07, 2019 at 01:37:08PM +0100, David Marchand wrote:
>    On Thu, Mar 7, 2019 at 12:55 PM Bruce Richardson
>    <[1]bruce.richardson@intel.com> wrote:
> 
>      Since we have the version number in a separate file at the root
>      level,
>      we should not need to duplicate this in rte_version.h too. Best
>      approach here is to move the macros for specifying the
>      year/month/etc.
>      parts from the version header file to the build config file -
>      leaving
>      the other utility macros for e.g. printing the version string, where
>      they
>      are.
>      For make this is done by having a little bit of awk parse the
>      version
>      file and pass the results through to the preprocessor for the config
>      generation stage.
>      For meson, this is done by parsing the version and adding it to the
>      standard dpdk_conf object.
>      Signed-off-by: Bruce Richardson <[2]bruce.richardson@intel.com>
>      ---
>       DPDK_VERSION                                |  2 +-
>       config/common_base                          | 14 +++++++++
>       config/rte_config.h                         |  5 ++++
>       lib/librte_eal/common/include/rte_version.h | 32
>      ---------------------
>       meson.build                                 | 14 +++++++++
>       mk/[3]rte.sdkconfig.mk                         |  2 ++
>       6 files changed, 36 insertions(+), 33 deletions(-)
>      diff --git a/DPDK_VERSION b/DPDK_VERSION
>      index c4a4cd00b..e013b54dd 100644
>      --- a/DPDK_VERSION
>      +++ b/DPDK_VERSION
>      @@ -1 +1 @@
>      -19.05.0-rc0
>      +19.05.1
> 
>    Might be a bit early for the stable while the 19.05 is still being
>    cooked :-)
> 
Oops, didn't realise that testing change had crept in.

>      diff --git a/config/common_base b/config/common_base
>      index 0b09a9348..6292bc4af 100644
>      --- a/config/common_base
>      +++ b/config/common_base
>      @@ -1,6 +1,20 @@
>       # SPDX-License-Identifier: BSD-3-Clause
>       # Copyright(c) 2010-2017 Intel Corporation
>      +#
>      +# String that appears before the version number
>      +#
>      +CONFIG_RTE_VER_PREFIX="DPDK"
>      +
>      +#
>      +# Version information completed when this file is processed for a
>      build
>      +#
>      +CONFIG_RTE_VER_YEAR=__YEAR
>      +CONFIG_RTE_VER_MONTH=__MONTH
>      +CONFIG_RTE_VER_MINOR=__MINOR
>      +CONFIG_RTE_VER_SUFFIX=__SUFFIX
>      +CONFIG_RTE_VER_RELEASE=__RELEASE
>      +
> 
>    ?
>    I think you broke make support.

Well, yes and no. It should be fine if you remove the build directory and
recreate it, as the code for generating the build config has changed.

/Bruce

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH 2/4] build: use version number from config file
  2019-03-07 12:42     ` David Marchand
@ 2019-03-07 13:12       ` Bruce Richardson
  0 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 13:12 UTC (permalink / raw)
  To: David Marchand; +Cc: dev

On Thu, Mar 07, 2019 at 01:42:36PM +0100, David Marchand wrote:
>    On Thu, Mar 7, 2019 at 1:37 PM David Marchand
>    <[1]david.marchand@redhat.com> wrote:
> 
>    On Thu, Mar 7, 2019 at 12:55 PM Bruce Richardson
>    <[2]bruce.richardson@intel.com> wrote:
> 
>      Since we have the version number in a separate file at the root
>      level,
>      we should not need to duplicate this in rte_version.h too. Best
>      approach here is to move the macros for specifying the
>      year/month/etc.
>      parts from the version header file to the build config file -
>      leaving
>      the other utility macros for e.g. printing the version string, where
>      they
>      are.
>      For make this is done by having a little bit of awk parse the
>      version
>      file and pass the results through to the preprocessor for the config
>      generation stage.
>      For meson, this is done by parsing the version and adding it to the
>      standard dpdk_conf object.
>      Signed-off-by: Bruce Richardson <[3]bruce.richardson@intel.com>
>      ---
>       DPDK_VERSION                                |  2 +-
>       config/common_base                          | 14 +++++++++
>       config/rte_config.h                         |  5 ++++
>       lib/librte_eal/common/include/rte_version.h | 32
>      ---------------------
>       meson.build                                 | 14 +++++++++
>       mk/[4]rte.sdkconfig.mk                         |  2 ++
>       6 files changed, 36 insertions(+), 33 deletions(-)
>      diff --git a/DPDK_VERSION b/DPDK_VERSION
>      index c4a4cd00b..e013b54dd 100644
>      --- a/DPDK_VERSION
>      +++ b/DPDK_VERSION
>      @@ -1 +1 @@
>      -19.05.0-rc0
>      +19.05.1
> 
>    Might be a bit early for the stable while the 19.05 is still being
>    cooked :-)
> 
>      diff --git a/config/common_base b/config/common_base
>      index 0b09a9348..6292bc4af 100644
>      --- a/config/common_base
>      +++ b/config/common_base
>      @@ -1,6 +1,20 @@
>       # SPDX-License-Identifier: BSD-3-Clause
>       # Copyright(c) 2010-2017 Intel Corporation
>      +#
>      +# String that appears before the version number
>      +#
>      +CONFIG_RTE_VER_PREFIX="DPDK"
>      +
>      +#
>      +# Version information completed when this file is processed for a
>      build
>      +#
>      +CONFIG_RTE_VER_YEAR=__YEAR
>      +CONFIG_RTE_VER_MONTH=__MONTH
>      +CONFIG_RTE_VER_MINOR=__MINOR
>      +CONFIG_RTE_VER_SUFFIX=__SUFFIX
>      +CONFIG_RTE_VER_RELEASE=__RELEASE
>      +
> 
>    ?
>    I think you broke make support.
>    == Build lib/librte_eal/linuxapp/eal
>      CC eal.o
>    In file included from
>    /home/dmarchan/git/pub/dpdk/lib/librte_eal/linuxapp/eal/eal.c:49:0:
>    /home/dmarchan/git/pub/dpdk/master/include/rte_version.h: In function
>    ‘rte_version’:
>    /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:47:13: error:
>    ‘RTE_VER_SUFFIX’ undeclared (first use in this function)
>      if (strlen(RTE_VER_SUFFIX) == 0)
>                 ^
>    /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:47:13: note:
>    each undeclared identifier is reported only once for each function it
>    appears in
>    /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:49:4: error:
>    ‘RTE_VER_PREFIX’ undeclared (first use in this function)
>        RTE_VER_PREFIX,
>        ^
>    /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:50:4: error:
>    ‘RTE_VER_YEAR’ undeclared (first use in this function)
>        RTE_VER_YEAR,
>        ^
>    /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:51:4: error:
>    ‘RTE_VER_MONTH’ undeclared (first use in this function)
>        RTE_VER_MONTH,
>        ^
>    /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:52:4: error:
>    ‘RTE_VER_MINOR’ undeclared (first use in this function)
>        RTE_VER_MINOR);
>        ^
>    /home/dmarchan/git/pub/dpdk/master/include/rte_version.h:60:4: error:
>    ‘RTE_VER_RELEASE’ undeclared (first use in this function)
>        RTE_VER_RELEASE);
>        ^
>    make[5]: *** [eal.o] Error 1
>    make[4]: *** [eal] Error 2
>    make[3]: *** [linuxapp] Error 2
>    make[2]: *** [librte_eal] Error 2
>    make[1]: *** [lib] Error 2
>    make: *** [all] Error 2
> 
>       #
>       # define executive environment
>       # RTE_EXEC_ENV values are the directories in mk/exec-env/
>      diff --git a/config/rte_config.h b/config/rte_config.h
>      index 7606f5d7b..5f1749dbb 100644
>      --- a/config/rte_config.h
>      +++ b/config/rte_config.h
>      @@ -18,6 +18,11 @@
>       #include <rte_build_config.h>
>      +/**
>      + * String that appears before the version number
>      + */
>      +#define RTE_VER_PREFIX "DPDK"
>      +
>       /****** library defines ********/
>       /* compat defines */
>      diff --git a/lib/librte_eal/common/include/rte_version.h
>      b/lib/librte_eal/common/include/rte_version.h
>      index a7eed7ab7..50867ea81 100644
>      --- a/lib/librte_eal/common/include/rte_version.h
>      +++ b/lib/librte_eal/common/include/rte_version.h
>      @@ -19,38 +19,6 @@ extern "C" {
>       #include <stdio.h>
>       #include <rte_common.h>
>      -/**
>      - * String that appears before the version number
>      - */
>      -#define RTE_VER_PREFIX "DPDK"
>      -
>      -/**
>      - * Major version/year number i.e. the yy in yy.mm.z
>      - */
>      -#define RTE_VER_YEAR 19
>      -
>      -/**
>      - * Minor version/month number i.e. the mm in yy.mm.z
>      - */
>      -#define RTE_VER_MONTH 5
>      -
>      -/**
>      - * Patch level number i.e. the z in yy.mm.z
>      - */
>      -#define RTE_VER_MINOR 0
>      -
>      -/**
>      - * Extra string to be appended to version number
>      - */
>      -#define RTE_VER_SUFFIX "-rc"
>      -
>      -/**
>      - * Patch release number
>      - *   0-15 = release candidates
>      - *   16   = release
>      - */
>      -#define RTE_VER_RELEASE 0
>      -
>       /**
>        * Macro to compute a version number usable for comparisons
>        */
>      diff --git a/meson.build b/meson.build
>      index 757618144..9d5320395 100644
>      --- a/meson.build
>      +++ b/meson.build
>      @@ -22,6 +22,20 @@ dpdk_app_link_libraries = []
>       pver = meson.project_version().split('.')
>       major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
>      +# extract all version information into the build configuration
>      +dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
>      +dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
>      +if pver.get(2).contains('-rc')
>      +       rc_ver = pver.get(2).split('-rc')
>      +       dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
>      +       dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
>      +       dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
>      +else
>      +       dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
>      +       dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
>      +       dpdk_conf.set('RTE_VER_RELEASE', 0)
>      +endif
>      +
>       pmd_subdir_opt = get_option('drivers_install_subdir')
>       if pmd_subdir_opt.contains('<VERSION>')
>              pmd_subdir_opt =
>      major_version.join(pmd_subdir_opt.split('<VERSION>'))
>      diff --git a/mk/[5]rte.sdkconfig.mk b/mk/[6]rte.sdkconfig.mk
>      index 8dc31d7cf..bbfa24dee 100644
>      --- a/mk/[7]rte.sdkconfig.mk
>      +++ b/mk/[8]rte.sdkconfig.mk
>      @@ -76,6 +76,8 @@ else
>       $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
>              $(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f
>      "$(RTE_CONFIG_TEMPLATE)" ]; then \
>                      $(CPP) -undef -P -x assembler-with-cpp \
>      +               `cat $(RTE_SRCDIR)/DPDK_VERSION | sed -e
>      's/-rc/.-rc./' | \
>      +               awk -F '.' '{print "-D__YEAR="$$1, "-D__MONTH="$$2,
>      "-D__MINOR="$$3, "-D__SUFFIX=\""$$4"\"", "-D__RELEASE="int($$5)}'` \
> 
>    Can't we just pass the RTE_VER_XXX as CFLAGS here ?
> 
>    Argh no, I mean passing RTE_VER_XXX as global CFLAGS.
>    I am not really a fan of having the version in the config file, but I
>    have no real argument against it.
>    --

We could do that, but that makes things more awkward for consumers as they
need to pass those same flags when compiling up their application. Better
to have them placed in the header file along with the other defines.

/Bruce

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v2 0/4] One versionfile to rule them all...
  2019-03-07 11:54 [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Bruce Richardson
                   ` (4 preceding siblings ...)
  2019-03-07 12:09 ` [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Luca Boccassi
@ 2019-03-07 13:34 ` Bruce Richardson
  2019-03-07 13:34   ` [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number Bruce Richardson
                     ` (3 more replies)
  2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
  6 siblings, 4 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 13:34 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Bruce Richardson

Right now with DPDK we have two sources of version information - the
rte_version.h header file containing macros for C use, and the project
version number in the project definition in meson.build. This is not
optimal, so this patchset aims to provide a single source for the DPDK
version. The options considered are:

* Keep version info in rte_version.h only. The two reasons this was not
  chosen were:
  1) parsing the version number from the header is awkward, as seen in the
     rte.sdkconfig.mk file, and a script to do so would be needed to
     integrate that into the meson build project definition.
  2) rte_version.h is not in an obvious location inside the project when
     a user clones from git. It's hidden away in the
     "lib/librte_eal/common/include" folder. Ideally the version number
     should be evident at the top level of the DPDK tree.

* Keep version info in meson.build file only. This seemed a better option
  than keeping the info in rte_version.h, but it still had disadvantages:
  1) For make, using grep on meson.build to extract the version seemed a
     bit awkward, though doable. Splitting the version was tricky too, but
     managable with a small amount of scripting.
  2) There was no easy way to have users access the version number when
     "make showversion" was deprecated with the make build system.

* Store the version number in a new version file at the root level of the
  repo.
  * This did have the advantage of being easily discoverable on clone
  * Still had the disadvantage of needing some parsing to generate the
    defines from rte_version.h

Since the last option seemed best, that is what is implemented in this set.
The file DPDK_VERSION is added to store the version number, and make and
meson both use that as their source of version info. For C code, the
rte_version.h header remains, except that the basic definitions of the
release YEAR, MONTH, MINOR etc. are moved to be automatically generated as
part of rte_config.h. For make builds, this is done via using the
preprocessor to insert the values when it generates the config. For meson
builds, this is done by just adding the values to the dpdk_conf
configuration object.

---
V2: Updated following review from David Marchand.

Bruce Richardson (4):
  build: add single source of DPDK version number
  build: use version number from config file
  build: move meson version handling to config directory
  eal: remove unneeded version logic

 DPDK_VERSION                                |  1 +
 config/common_base                          | 14 ++++++++
 config/meson.build                          | 26 +++++++++++++++
 config/rte_config.h                         |  5 +++
 lib/librte_eal/common/include/rte_version.h | 36 +--------------------
 meson.build                                 | 16 ++-------
 mk/rte.sdkconfig.mk                         | 18 +++--------
 7 files changed, 54 insertions(+), 62 deletions(-)
 create mode 100644 DPDK_VERSION

-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number
  2019-03-07 13:34 ` [dpdk-dev] [PATCH v2 " Bruce Richardson
@ 2019-03-07 13:34   ` Bruce Richardson
  2019-03-13 11:06     ` Thomas Monjalon
  2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 2/4] build: use version number from config file Bruce Richardson
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 13:34 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Bruce Richardson, Luca Boccassi

Add a new file DPDK_VERSION to hold the current DPDK version number.
Have meson use this file for it's project version, and have make use
it for reporting out "showversion" and "showversionum".

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>

---
v2: fix typos and include Luca's ack.
---
 DPDK_VERSION        |  1 +
 meson.build         |  4 +++-
 mk/rte.sdkconfig.mk | 16 ++--------------
 3 files changed, 6 insertions(+), 15 deletions(-)
 create mode 100644 DPDK_VERSION

diff --git a/DPDK_VERSION b/DPDK_VERSION
new file mode 100644
index 000000000..c4a4cd00b
--- /dev/null
+++ b/DPDK_VERSION
@@ -0,0 +1 @@
+19.05.0-rc0
diff --git a/meson.build b/meson.build
index 69833de82..aaa6002ae 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 project('DPDK', 'C',
-	version: '19.05.0-rc0',
+	# get version number from file
+	# use "more" rather than "cat" for windows compatibility
+	version: run_command('more', files('DPDK_VERSION')).stdout().strip(),
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
 	meson_version: '>= 0.47.1'
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index fa77331cb..d9c8d53d2 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -3,23 +3,11 @@
 
 .PHONY: showversion
 showversion:
-	@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.%02d.%d' "$$1" "$$2" "$$3"; \
-		if [ -z "$$5" ]; then echo; \
-		else printf '%s' "$$4"; \
-			if [ $$5 -lt 16 ] ; then echo $$5; \
-			else echo $$(($$5 - 16)); fi; \
-		fi
+	@cat $(RTE_SRCDIR)/DPDK_VERSION
 
 .PHONY: showversionum
 showversionum:
-	@set -- \
-		$$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
-			$(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h); \
-		printf '%02d%02d\n' "$$1" "$$2"
+	@cat $(RTE_SRCDIR)/DPDK_VERSION | awk -F '.' '{print $$1$$2}'
 
 INSTALL_CONFIGS := $(sort $(filter-out %~,\
 	$(patsubst $(RTE_SRCDIR)/config/defconfig_%,%,\
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v2 2/4] build: use version number from config file
  2019-03-07 13:34 ` [dpdk-dev] [PATCH v2 " Bruce Richardson
  2019-03-07 13:34   ` [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number Bruce Richardson
@ 2019-03-07 13:35   ` Bruce Richardson
  2019-03-13 11:13     ` Thomas Monjalon
  2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 3/4] build: move meson version handling to config directory Bruce Richardson
  2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 4/4] eal: remove unneeded version logic Bruce Richardson
  3 siblings, 1 reply; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 13:35 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Bruce Richardson, Luca Boccassi

Since we have the version number in a separate file at the root level,
we should not need to duplicate this in rte_version.h too. Best
approach here is to move the macros for specifying the year/month/etc.
parts from the version header file to the build config file - leaving
the other utility macros for e.g. printing the version string, where they
are.

For make this is done by having a little bit of awk parse the version
file and pass the results through to the preprocessor for the config
generation stage.

For meson, this is done by parsing the version and adding it to the
standard dpdk_conf object.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V2: removed extra change to DPDK_VERSION that crept into patch. Added ack
---
 config/common_base                          | 14 +++++++++
 config/rte_config.h                         |  5 ++++
 lib/librte_eal/common/include/rte_version.h | 32 ---------------------
 meson.build                                 | 14 +++++++++
 mk/rte.sdkconfig.mk                         |  2 ++
 5 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/config/common_base b/config/common_base
index 0b09a9348..6292bc4af 100644
--- a/config/common_base
+++ b/config/common_base
@@ -1,6 +1,20 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2010-2017 Intel Corporation
 
+#
+# String that appears before the version number
+#
+CONFIG_RTE_VER_PREFIX="DPDK"
+
+#
+# Version information completed when this file is processed for a build
+#
+CONFIG_RTE_VER_YEAR=__YEAR
+CONFIG_RTE_VER_MONTH=__MONTH
+CONFIG_RTE_VER_MINOR=__MINOR
+CONFIG_RTE_VER_SUFFIX=__SUFFIX
+CONFIG_RTE_VER_RELEASE=__RELEASE
+
 #
 # define executive environment
 # RTE_EXEC_ENV values are the directories in mk/exec-env/
diff --git a/config/rte_config.h b/config/rte_config.h
index 7606f5d7b..5f1749dbb 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -18,6 +18,11 @@
 
 #include <rte_build_config.h>
 
+/**
+ * String that appears before the version number
+ */
+#define RTE_VER_PREFIX "DPDK"
+
 /****** library defines ********/
 
 /* compat defines */
diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index a7eed7ab7..50867ea81 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -19,38 +19,6 @@ extern "C" {
 #include <stdio.h>
 #include <rte_common.h>
 
-/**
- * String that appears before the version number
- */
-#define RTE_VER_PREFIX "DPDK"
-
-/**
- * Major version/year number i.e. the yy in yy.mm.z
- */
-#define RTE_VER_YEAR 19
-
-/**
- * Minor version/month number i.e. the mm in yy.mm.z
- */
-#define RTE_VER_MONTH 5
-
-/**
- * Patch level number i.e. the z in yy.mm.z
- */
-#define RTE_VER_MINOR 0
-
-/**
- * Extra string to be appended to version number
- */
-#define RTE_VER_SUFFIX "-rc"
-
-/**
- * Patch release number
- *   0-15 = release candidates
- *   16   = release
- */
-#define RTE_VER_RELEASE 0
-
 /**
  * Macro to compute a version number usable for comparisons
  */
diff --git a/meson.build b/meson.build
index aaa6002ae..9fefa1b75 100644
--- a/meson.build
+++ b/meson.build
@@ -24,6 +24,20 @@ dpdk_app_link_libraries = []
 pver = meson.project_version().split('.')
 major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
 
+# extract all version information into the build configuration
+dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
+dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
+if pver.get(2).contains('-rc')
+	rc_ver = pver.get(2).split('-rc')
+	dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
+	dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
+else
+	dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
+	dpdk_conf.set('RTE_VER_RELEASE', 0)
+endif
+
 pmd_subdir_opt = get_option('drivers_install_subdir')
 if pmd_subdir_opt.contains('<VERSION>')
 	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index d9c8d53d2..007022adf 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -76,6 +76,8 @@ else
 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
 	$(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
 		$(CPP) -undef -P -x assembler-with-cpp \
+		`cat $(RTE_SRCDIR)/DPDK_VERSION | sed -e 's/-rc/.-rc./' | \
+		awk -F '.' '{print "-D__YEAR="$$1, "-D__MONTH="$$2, "-D__MINOR="$$3, "-D__SUFFIX=\""$$4"\"", "-D__RELEASE="int($$5)}'` \
 		-ffreestanding \
 		-o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
 		config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v2 3/4] build: move meson version handling to config directory
  2019-03-07 13:34 ` [dpdk-dev] [PATCH v2 " Bruce Richardson
  2019-03-07 13:34   ` [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number Bruce Richardson
  2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 2/4] build: use version number from config file Bruce Richardson
@ 2019-03-07 13:35   ` Bruce Richardson
  2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 4/4] eal: remove unneeded version logic Bruce Richardson
  3 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 13:35 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Bruce Richardson, Luca Boccassi

To keep the top-level meson.build file as clean and clear as
possible, we move the version handling - which was originally short
but now is a lot longer - to the config/meson.build file, where the
rest of the build configuration is already being set up.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V2: No changes, added Luca's ack
---
 config/meson.build | 26 ++++++++++++++++++++++++++
 meson.build        | 26 --------------------------
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..bbe17c786 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -1,6 +1,32 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+# set the major version, which might be used by drivers and libraries
+# depending on the configuration options
+pver = meson.project_version().split('.')
+major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
+
+# extract all version information into the build configuration
+dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
+dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
+if pver.get(2).contains('-rc')
+	rc_ver = pver.get(2).split('-rc')
+	dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
+	dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
+else
+	dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
+	dpdk_conf.set('RTE_VER_RELEASE', 0)
+endif
+
+pmd_subdir_opt = get_option('drivers_install_subdir')
+if pmd_subdir_opt.contains('<VERSION>')
+	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
+endif
+driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
+eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
+
 # set the machine type and cflags for it
 if meson.is_cross_build()
 	machine = host_machine.cpu()
diff --git a/meson.build b/meson.build
index 9fefa1b75..9fba06767 100644
--- a/meson.build
+++ b/meson.build
@@ -19,32 +19,6 @@ dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
 
-# set the major version, which might be used by drivers and libraries
-# depending on the configuration options
-pver = meson.project_version().split('.')
-major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
-
-# extract all version information into the build configuration
-dpdk_conf.set('RTE_VER_YEAR', pver.get(0))
-dpdk_conf.set('RTE_VER_MONTH', pver.get(1))
-if pver.get(2).contains('-rc')
-	rc_ver = pver.get(2).split('-rc')
-	dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0))
-	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
-	dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1))
-else
-	dpdk_conf.set('RTE_VER_MINOR', pver.get(2))
-	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
-	dpdk_conf.set('RTE_VER_RELEASE', 0)
-endif
-
-pmd_subdir_opt = get_option('drivers_install_subdir')
-if pmd_subdir_opt.contains('<VERSION>')
-	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
-endif
-driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
-eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
-
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v2 4/4] eal: remove unneeded version logic
  2019-03-07 13:34 ` [dpdk-dev] [PATCH v2 " Bruce Richardson
                     ` (2 preceding siblings ...)
  2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 3/4] build: move meson version handling to config directory Bruce Richardson
@ 2019-03-07 13:35   ` Bruce Richardson
  3 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-07 13:35 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Bruce Richardson, Luca Boccassi

The version number in the DPDK_VERSION file will never have an offset
that needs to be subtracted, so remove that logic from the version
string generation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V2: No changes - added Luca's ack
---
 lib/librte_eal/common/include/rte_version.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index 50867ea81..f7a3a1ebc 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -57,9 +57,7 @@ rte_version(void)
 			RTE_VER_MONTH,
 			RTE_VER_MINOR,
 			RTE_VER_SUFFIX,
-			RTE_VER_RELEASE < 16 ?
-				RTE_VER_RELEASE :
-				RTE_VER_RELEASE - 16);
+			RTE_VER_RELEASE);
 	return version;
 }
 
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number
  2019-03-07 13:34   ` [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number Bruce Richardson
@ 2019-03-13 11:06     ` Thomas Monjalon
  2019-03-13 11:17       ` Bruce Richardson
  0 siblings, 1 reply; 40+ messages in thread
From: Thomas Monjalon @ 2019-03-13 11:06 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Luca Boccassi

07/03/2019 14:34, Bruce Richardson:
> Add a new file DPDK_VERSION to hold the current DPDK version number.
> Have meson use this file for it's project version, and have make use
> it for reporting out "showversion" and "showversionum".
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
[...]
> --- /dev/null
> +++ b/DPDK_VERSION

Why not VERSION ?

[...]
> --- a/mk/rte.sdkconfig.mk
> +++ b/mk/rte.sdkconfig.mk
>  showversion:
> -	@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.%02d.%d' "$$1" "$$2" "$$3"; \
> -		if [ -z "$$5" ]; then echo; \
> -		else printf '%s' "$$4"; \
> -			if [ $$5 -lt 16 ] ; then echo $$5; \
> -			else echo $$(($$5 - 16)); fi; \
> -		fi
> +	@cat $(RTE_SRCDIR)/DPDK_VERSION

I'm a bit sad about removing this complex command ;)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/4] build: use version number from config file
  2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 2/4] build: use version number from config file Bruce Richardson
@ 2019-03-13 11:13     ` Thomas Monjalon
  2019-03-13 11:20       ` Bruce Richardson
  0 siblings, 1 reply; 40+ messages in thread
From: Thomas Monjalon @ 2019-03-13 11:13 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Luca Boccassi

07/03/2019 14:35, Bruce Richardson:
> +#
> +# Version information completed when this file is processed for a build
> +#
> +CONFIG_RTE_VER_YEAR=__YEAR
> +CONFIG_RTE_VER_MONTH=__MONTH
> +CONFIG_RTE_VER_MINOR=__MINOR
> +CONFIG_RTE_VER_SUFFIX=__SUFFIX
> +CONFIG_RTE_VER_RELEASE=__RELEASE
[...]
> -/**
> - * Patch release number
> - *   0-15 = release candidates
> - *   16   = release
> - */
> -#define RTE_VER_RELEASE 0

So you are removing the special value 16.
Is it replaced by an empty value?

I think it is an issue for version comparison with RTE_VERSION_NUM() macro.
The -rc3 must be lower than the final release (which had number 16
for this reason).

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number
  2019-03-13 11:06     ` Thomas Monjalon
@ 2019-03-13 11:17       ` Bruce Richardson
  2019-03-13 11:23         ` Thomas Monjalon
  0 siblings, 1 reply; 40+ messages in thread
From: Bruce Richardson @ 2019-03-13 11:17 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, David Marchand, Luca Boccassi

On Wed, Mar 13, 2019 at 12:06:38PM +0100, Thomas Monjalon wrote:
> 07/03/2019 14:34, Bruce Richardson:
> > Add a new file DPDK_VERSION to hold the current DPDK version number.
> > Have meson use this file for it's project version, and have make use
> > it for reporting out "showversion" and "showversionum".
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > Acked-by: Luca Boccassi <bluca@debian.org>
> [...]
> > --- /dev/null
> > +++ b/DPDK_VERSION
> 
> Why not VERSION ?
> 

No particular reason. I just picked a name I thought reasonable, but I'm
fine with just VERSION on its own.

The one advantage of having DPDK in the title is that if one has a clone to
a directory called e.g. "temp", a quick "ls" will show the forgetful what
product it was that they cloned to a directory with such an unhelpful name.

> [...]
> > --- a/mk/rte.sdkconfig.mk
> > +++ b/mk/rte.sdkconfig.mk
> >  showversion:
> > -	@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.%02d.%d' "$$1" "$$2" "$$3"; \
> > -		if [ -z "$$5" ]; then echo; \
> > -		else printf '%s' "$$4"; \
> > -			if [ $$5 -lt 16 ] ; then echo $$5; \
> > -			else echo $$(($$5 - 16)); fi; \
> > -		fi
> > +	@cat $(RTE_SRCDIR)/DPDK_VERSION
> 
> I'm a bit sad about removing this complex command ;)
> 
Yes, but don't worry, I'm proposing a bit of an addition of sed and awk
to other makefile commands to compensate, though sadly not quite as
unintelligable to the masses as this. :-)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/4] build: use version number from config file
  2019-03-13 11:13     ` Thomas Monjalon
@ 2019-03-13 11:20       ` Bruce Richardson
  2019-03-13 11:24         ` Thomas Monjalon
  0 siblings, 1 reply; 40+ messages in thread
From: Bruce Richardson @ 2019-03-13 11:20 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, David Marchand, Luca Boccassi

On Wed, Mar 13, 2019 at 12:13:52PM +0100, Thomas Monjalon wrote:
> 07/03/2019 14:35, Bruce Richardson:
> > +#
> > +# Version information completed when this file is processed for a build
> > +#
> > +CONFIG_RTE_VER_YEAR=__YEAR
> > +CONFIG_RTE_VER_MONTH=__MONTH
> > +CONFIG_RTE_VER_MINOR=__MINOR
> > +CONFIG_RTE_VER_SUFFIX=__SUFFIX
> > +CONFIG_RTE_VER_RELEASE=__RELEASE
> [...]
> > -/**
> > - * Patch release number
> > - *   0-15 = release candidates
> > - *   16   = release
> > - */
> > -#define RTE_VER_RELEASE 0
> 
> So you are removing the special value 16.
> Is it replaced by an empty value?
> 
> I think it is an issue for version comparison with RTE_VERSION_NUM() macro.
> The -rc3 must be lower than the final release (which had number 16
> for this reason).
> 
Aha, that explains the reason for the 16 value. I did wonder why we
bothered with it when it wasn't actually used in printing etc. Let me go
back and look into this set again, armed with this new info. [We also need
to document this reason in the code comments for future information]

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number
  2019-03-13 11:17       ` Bruce Richardson
@ 2019-03-13 11:23         ` Thomas Monjalon
  2019-03-13 11:27           ` Bruce Richardson
  0 siblings, 1 reply; 40+ messages in thread
From: Thomas Monjalon @ 2019-03-13 11:23 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Luca Boccassi

13/03/2019 12:17, Bruce Richardson:
> On Wed, Mar 13, 2019 at 12:06:38PM +0100, Thomas Monjalon wrote:
> > 07/03/2019 14:34, Bruce Richardson:
> > > Add a new file DPDK_VERSION to hold the current DPDK version number.
> > > Have meson use this file for it's project version, and have make use
> > > it for reporting out "showversion" and "showversionum".
> > > 
> > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > Acked-by: Luca Boccassi <bluca@debian.org>
> > [...]
> > > --- /dev/null
> > > +++ b/DPDK_VERSION
> > 
> > Why not VERSION ?
> > 
> 
> No particular reason. I just picked a name I thought reasonable, but I'm
> fine with just VERSION on its own.
> 
> The one advantage of having DPDK in the title is that if one has a clone to
> a directory called e.g. "temp", a quick "ls" will show the forgetful what
> product it was that they cloned to a directory with such an unhelpful name.

Good try of justification :)

I think I prefer just VERSION.

> > [...]
> > > --- a/mk/rte.sdkconfig.mk
> > > +++ b/mk/rte.sdkconfig.mk
> > >  showversion:
> > > -	@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.%02d.%d' "$$1" "$$2" "$$3"; \
> > > -		if [ -z "$$5" ]; then echo; \
> > > -		else printf '%s' "$$4"; \
> > > -			if [ $$5 -lt 16 ] ; then echo $$5; \
> > > -			else echo $$(($$5 - 16)); fi; \
> > > -		fi
> > > +	@cat $(RTE_SRCDIR)/DPDK_VERSION
> > 
> > I'm a bit sad about removing this complex command ;)
> > 
> Yes, but don't worry, I'm proposing a bit of an addition of sed and awk
> to other makefile commands to compensate, though sadly not quite as
> unintelligable to the masses as this. :-)

I can teach you :)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v2 2/4] build: use version number from config file
  2019-03-13 11:20       ` Bruce Richardson
@ 2019-03-13 11:24         ` Thomas Monjalon
  0 siblings, 0 replies; 40+ messages in thread
From: Thomas Monjalon @ 2019-03-13 11:24 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Luca Boccassi

13/03/2019 12:20, Bruce Richardson:
> On Wed, Mar 13, 2019 at 12:13:52PM +0100, Thomas Monjalon wrote:
> > 07/03/2019 14:35, Bruce Richardson:
> > > +#
> > > +# Version information completed when this file is processed for a build
> > > +#
> > > +CONFIG_RTE_VER_YEAR=__YEAR
> > > +CONFIG_RTE_VER_MONTH=__MONTH
> > > +CONFIG_RTE_VER_MINOR=__MINOR
> > > +CONFIG_RTE_VER_SUFFIX=__SUFFIX
> > > +CONFIG_RTE_VER_RELEASE=__RELEASE
> > [...]
> > > -/**
> > > - * Patch release number
> > > - *   0-15 = release candidates
> > > - *   16   = release
> > > - */
> > > -#define RTE_VER_RELEASE 0
> > 
> > So you are removing the special value 16.
> > Is it replaced by an empty value?
> > 
> > I think it is an issue for version comparison with RTE_VERSION_NUM() macro.
> > The -rc3 must be lower than the final release (which had number 16
> > for this reason).
> > 
> Aha, that explains the reason for the 16 value. I did wonder why we
> bothered with it when it wasn't actually used in printing etc. Let me go
> back and look into this set again, armed with this new info. [We also need
> to document this reason in the code comments for future information]

Yes it was not documented, sorry.
Thanks for working on it.

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number
  2019-03-13 11:23         ` Thomas Monjalon
@ 2019-03-13 11:27           ` Bruce Richardson
  0 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-13 11:27 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, David Marchand, Luca Boccassi

On Wed, Mar 13, 2019 at 12:23:16PM +0100, Thomas Monjalon wrote:
> 13/03/2019 12:17, Bruce Richardson:
> > On Wed, Mar 13, 2019 at 12:06:38PM +0100, Thomas Monjalon wrote:
> > > 07/03/2019 14:34, Bruce Richardson:
> > > > Add a new file DPDK_VERSION to hold the current DPDK version number.
> > > > Have meson use this file for it's project version, and have make use
> > > > it for reporting out "showversion" and "showversionum".
> > > > 
> > > > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > > > Acked-by: Luca Boccassi <bluca@debian.org>
> > > [...]
> > > > --- /dev/null
> > > > +++ b/DPDK_VERSION
> > > 
> > > Why not VERSION ?
> > > 
> > 
> > No particular reason. I just picked a name I thought reasonable, but I'm
> > fine with just VERSION on its own.
> > 
> > The one advantage of having DPDK in the title is that if one has a clone to
> > a directory called e.g. "temp", a quick "ls" will show the forgetful what
> > product it was that they cloned to a directory with such an unhelpful name.
> 
> Good try of justification :)
>
Worth a shot! :-)
 
> I think I prefer just VERSION.
> 
Ok, will change in V2.

> > > [...]
> > > > --- a/mk/rte.sdkconfig.mk
> > > > +++ b/mk/rte.sdkconfig.mk
> > > >  showversion:
> > > > -	@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.%02d.%d' "$$1" "$$2" "$$3"; \
> > > > -		if [ -z "$$5" ]; then echo; \
> > > > -		else printf '%s' "$$4"; \
> > > > -			if [ $$5 -lt 16 ] ; then echo $$5; \
> > > > -			else echo $$(($$5 - 16)); fi; \
> > > > -		fi
> > > > +	@cat $(RTE_SRCDIR)/DPDK_VERSION
> > > 
> > > I'm a bit sad about removing this complex command ;)
> > > 
> > Yes, but don't worry, I'm proposing a bit of an addition of sed and awk
> > to other makefile commands to compensate, though sadly not quite as
> > unintelligable to the masses as this. :-)
> 
> I can teach you :)
>
Thanks, but I think I'll pass on that opportunity! :-)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all...
  2019-03-07 11:54 [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Bruce Richardson
                   ` (5 preceding siblings ...)
  2019-03-07 13:34 ` [dpdk-dev] [PATCH v2 " Bruce Richardson
@ 2019-03-15 18:20 ` Bruce Richardson
  2019-03-15 18:20   ` Bruce Richardson
                     ` (5 more replies)
  6 siblings, 6 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

Right now with DPDK we have two sources of version information - the
rte_version.h header file containing macros for C use, and the project
version number in the project definition in meson.build. This is not
optimal, so this patchset aims to provide a single source for the DPDK
version. The options considered are:

* Keep version info in rte_version.h only. The two reasons this was not
  chosen were:
  1) parsing the version number from the header is awkward, as seen in the
     rte.sdkconfig.mk file, and a script to do so would be needed to
     integrate that into the meson build project definition.
  2) rte_version.h is not in an obvious location inside the project when
     a user clones from git. It's hidden away in the
     "lib/librte_eal/common/include" folder. Ideally the version number
     should be evident at the top level of the DPDK tree.

* Keep version info in meson.build file only. This seemed a better option
  than keeping the info in rte_version.h, but it still had disadvantages:
  1) For make, using grep on meson.build to extract the version seemed a
     bit awkward, though doable. Splitting the version was tricky too, but
     manageable with a small amount of scripting.
  2) There was no easy way to have users access the version number when
     "make showversion" was deprecated with the make build system.

* Store the version number in a new version file at the root level of the
  repo.
  * This did have the advantage of being easily discoverable on clone
  * Still had the disadvantage of needing some parsing to generate the
    defines from rte_version.h

Since the last option seemed best, that is what is implemented in this set.
The file DPDK_VERSION is added to store the version number, and make and
meson both use that as their source of version info. For C code, the
rte_version.h header remains, except that the basic definitions of the
release YEAR, MONTH, MINOR etc. are moved to be automatically generated as
part of rte_config.h. For make builds, this is done via using the
preprocessor to insert the values when it generates the config. For meson
builds, this is done by just adding the values to the dpdk_conf
configuration object.

---
V3: Reworked following review from Thomas Monjalon. Main change is to how
    the RTE_VER_RELEASE value is computed for non-release candidates.
    Also added int() conversion to each version value to remove leading
    zeros
V2: Updated following review from David Marchand.

Bruce Richardson (4):
  build: add single source of DPDK version number
  build: move meson version handling to config directory
  build: use version number from config file
  eal: remove unneeded version logic

 VERSION                                     |  1 +
 config/common_base                          | 14 ++++++++
 config/meson.build                          | 26 +++++++++++++++
 config/rte_config.h                         |  3 ++
 lib/librte_eal/common/include/rte_version.h | 36 +--------------------
 meson.build                                 | 21 +++++-------
 mk/rte.sdkconfig.mk                         | 23 ++++++-------
 7 files changed, 62 insertions(+), 62 deletions(-)
 create mode 100644 VERSION

-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all...
  2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
@ 2019-03-15 18:20   ` Bruce Richardson
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number Bruce Richardson
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

Right now with DPDK we have two sources of version information - the
rte_version.h header file containing macros for C use, and the project
version number in the project definition in meson.build. This is not
optimal, so this patchset aims to provide a single source for the DPDK
version. The options considered are:

* Keep version info in rte_version.h only. The two reasons this was not
  chosen were:
  1) parsing the version number from the header is awkward, as seen in the
     rte.sdkconfig.mk file, and a script to do so would be needed to
     integrate that into the meson build project definition.
  2) rte_version.h is not in an obvious location inside the project when
     a user clones from git. It's hidden away in the
     "lib/librte_eal/common/include" folder. Ideally the version number
     should be evident at the top level of the DPDK tree.

* Keep version info in meson.build file only. This seemed a better option
  than keeping the info in rte_version.h, but it still had disadvantages:
  1) For make, using grep on meson.build to extract the version seemed a
     bit awkward, though doable. Splitting the version was tricky too, but
     manageable with a small amount of scripting.
  2) There was no easy way to have users access the version number when
     "make showversion" was deprecated with the make build system.

* Store the version number in a new version file at the root level of the
  repo.
  * This did have the advantage of being easily discoverable on clone
  * Still had the disadvantage of needing some parsing to generate the
    defines from rte_version.h

Since the last option seemed best, that is what is implemented in this set.
The file DPDK_VERSION is added to store the version number, and make and
meson both use that as their source of version info. For C code, the
rte_version.h header remains, except that the basic definitions of the
release YEAR, MONTH, MINOR etc. are moved to be automatically generated as
part of rte_config.h. For make builds, this is done via using the
preprocessor to insert the values when it generates the config. For meson
builds, this is done by just adding the values to the dpdk_conf
configuration object.

---
V3: Reworked following review from Thomas Monjalon. Main change is to how
    the RTE_VER_RELEASE value is computed for non-release candidates.
    Also added int() conversion to each version value to remove leading
    zeros
V2: Updated following review from David Marchand.

Bruce Richardson (4):
  build: add single source of DPDK version number
  build: move meson version handling to config directory
  build: use version number from config file
  eal: remove unneeded version logic

 VERSION                                     |  1 +
 config/common_base                          | 14 ++++++++
 config/meson.build                          | 26 +++++++++++++++
 config/rte_config.h                         |  3 ++
 lib/librte_eal/common/include/rte_version.h | 36 +--------------------
 meson.build                                 | 21 +++++-------
 mk/rte.sdkconfig.mk                         | 23 ++++++-------
 7 files changed, 62 insertions(+), 62 deletions(-)
 create mode 100644 VERSION

-- 
2.20.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number
  2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
  2019-03-15 18:20   ` Bruce Richardson
@ 2019-03-15 18:20   ` Bruce Richardson
  2019-03-15 18:20     ` Bruce Richardson
  2019-03-16 18:01     ` Rami Rosen
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 2/4] build: move meson version handling to config directory Bruce Richardson
                     ` (3 subsequent siblings)
  5 siblings, 2 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

Add a new file VERSION to hold the current DPDK version number.
Have meson use this file for it's project version, and have make use
it for reporting out "showversion" and "showversionum".

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>

---
v3: rename file from DPDK_VERSION to VERSION
v2: fix typos and include Luca's ack.
---
 VERSION             |  1 +
 meson.build         |  4 +++-
 mk/rte.sdkconfig.mk | 16 ++--------------
 3 files changed, 6 insertions(+), 15 deletions(-)
 create mode 100644 VERSION

diff --git a/VERSION b/VERSION
new file mode 100644
index 000000000..c4a4cd00b
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+19.05.0-rc0
diff --git a/meson.build b/meson.build
index 69833de82..1b31e0da5 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 project('DPDK', 'C',
-	version: '19.05.0-rc0',
+	# Get version number from file.
+	# Use "more" rather than "cat" for windows compatibility.
+	version: run_command('more', files('VERSION')).stdout().strip(),
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
 	meson_version: '>= 0.47.1'
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index c79bec179..46ec9e76d 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -3,23 +3,11 @@
 
 .PHONY: showversion
 showversion:
-	@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.%02d.%d' "$$1" "$$2" "$$3"; \
-		if [ -z "$$5" ]; then echo; \
-		else printf '%s' "$$4"; \
-			if [ $$5 -lt 16 ] ; then echo $$5; \
-			else echo $$(($$5 - 16)); fi; \
-		fi
+	@cat $(RTE_SRCDIR)/VERSION
 
 .PHONY: showversionum
 showversionum:
-	@set -- \
-		$$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
-			$(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h); \
-		printf '%02d%02d\n' "$$1" "$$2"
+	@cat $(RTE_SRCDIR)/VERSION | awk -F '.' '{print $$1$$2}'
 
 INSTALL_CONFIGS := $(sort $(filter-out %app-icc,$(filter-out %app-clang,\
 	$(filter-out %app-gcc,$(filter-out %~,\
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number Bruce Richardson
@ 2019-03-15 18:20     ` Bruce Richardson
  2019-03-16 18:01     ` Rami Rosen
  1 sibling, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

Add a new file VERSION to hold the current DPDK version number.
Have meson use this file for it's project version, and have make use
it for reporting out "showversion" and "showversionum".

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>

---
v3: rename file from DPDK_VERSION to VERSION
v2: fix typos and include Luca's ack.
---
 VERSION             |  1 +
 meson.build         |  4 +++-
 mk/rte.sdkconfig.mk | 16 ++--------------
 3 files changed, 6 insertions(+), 15 deletions(-)
 create mode 100644 VERSION

diff --git a/VERSION b/VERSION
new file mode 100644
index 000000000..c4a4cd00b
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+19.05.0-rc0
diff --git a/meson.build b/meson.build
index 69833de82..1b31e0da5 100644
--- a/meson.build
+++ b/meson.build
@@ -2,7 +2,9 @@
 # Copyright(c) 2017 Intel Corporation
 
 project('DPDK', 'C',
-	version: '19.05.0-rc0',
+	# Get version number from file.
+	# Use "more" rather than "cat" for windows compatibility.
+	version: run_command('more', files('VERSION')).stdout().strip(),
 	license: 'BSD',
 	default_options: ['buildtype=release', 'default_library=static'],
 	meson_version: '>= 0.47.1'
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index c79bec179..46ec9e76d 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -3,23 +3,11 @@
 
 .PHONY: showversion
 showversion:
-	@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.%02d.%d' "$$1" "$$2" "$$3"; \
-		if [ -z "$$5" ]; then echo; \
-		else printf '%s' "$$4"; \
-			if [ $$5 -lt 16 ] ; then echo $$5; \
-			else echo $$(($$5 - 16)); fi; \
-		fi
+	@cat $(RTE_SRCDIR)/VERSION
 
 .PHONY: showversionum
 showversionum:
-	@set -- \
-		$$(sed -rne 's,^#define RTE_VER_[A-Z_]*[[:space:]]+([0-9]+).*,\1,p' \
-			$(RTE_SRCDIR)/lib/librte_eal/common/include/rte_version.h); \
-		printf '%02d%02d\n' "$$1" "$$2"
+	@cat $(RTE_SRCDIR)/VERSION | awk -F '.' '{print $$1$$2}'
 
 INSTALL_CONFIGS := $(sort $(filter-out %app-icc,$(filter-out %app-clang,\
 	$(filter-out %app-gcc,$(filter-out %~,\
-- 
2.20.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 2/4] build: move meson version handling to config directory
  2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
  2019-03-15 18:20   ` Bruce Richardson
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number Bruce Richardson
@ 2019-03-15 18:20   ` Bruce Richardson
  2019-03-15 18:20     ` Bruce Richardson
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 3/4] build: use version number from config file Bruce Richardson
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

To keep the top-level meson.build file as clean and clear as possible, we
move the version handling to the config/meson.build file, where the rest of
the build configuration is already being set up.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V3: Reordered patch in set
V2: No changes, added Luca's ack
---
 config/meson.build | 12 ++++++++++++
 meson.build        | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..999dea91e 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -1,6 +1,18 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+# set the major version, which might be used by drivers and libraries
+# depending on the configuration options
+pver = meson.project_version().split('.')
+major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
+
+pmd_subdir_opt = get_option('drivers_install_subdir')
+if pmd_subdir_opt.contains('<VERSION>')
+	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
+endif
+driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
+eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
+
 # set the machine type and cflags for it
 if meson.is_cross_build()
 	machine = host_machine.cpu()
diff --git a/meson.build b/meson.build
index 1b31e0da5..6a83c827e 100644
--- a/meson.build
+++ b/meson.build
@@ -19,18 +19,6 @@ dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
 
-# set the major version, which might be used by drivers and libraries
-# depending on the configuration options
-pver = meson.project_version().split('.')
-major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
-
-pmd_subdir_opt = get_option('drivers_install_subdir')
-if pmd_subdir_opt.contains('<VERSION>')
-	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
-endif
-driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
-eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
-
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 2/4] build: move meson version handling to config directory
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 2/4] build: move meson version handling to config directory Bruce Richardson
@ 2019-03-15 18:20     ` Bruce Richardson
  0 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

To keep the top-level meson.build file as clean and clear as possible, we
move the version handling to the config/meson.build file, where the rest of
the build configuration is already being set up.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V3: Reordered patch in set
V2: No changes, added Luca's ack
---
 config/meson.build | 12 ++++++++++++
 meson.build        | 12 ------------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/config/meson.build b/config/meson.build
index 0419607d3..999dea91e 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -1,6 +1,18 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+# set the major version, which might be used by drivers and libraries
+# depending on the configuration options
+pver = meson.project_version().split('.')
+major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
+
+pmd_subdir_opt = get_option('drivers_install_subdir')
+if pmd_subdir_opt.contains('<VERSION>')
+	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
+endif
+driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
+eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
+
 # set the machine type and cflags for it
 if meson.is_cross_build()
 	machine = host_machine.cpu()
diff --git a/meson.build b/meson.build
index 1b31e0da5..6a83c827e 100644
--- a/meson.build
+++ b/meson.build
@@ -19,18 +19,6 @@ dpdk_drivers = []
 dpdk_extra_ldflags = []
 dpdk_app_link_libraries = []
 
-# set the major version, which might be used by drivers and libraries
-# depending on the configuration options
-pver = meson.project_version().split('.')
-major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
-
-pmd_subdir_opt = get_option('drivers_install_subdir')
-if pmd_subdir_opt.contains('<VERSION>')
-	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
-endif
-driver_install_path = join_paths(get_option('libdir'), pmd_subdir_opt)
-eal_pmd_path = join_paths(get_option('prefix'), driver_install_path)
-
 # configure the build, and make sure configs here and in config folder are
 # able to be included in any file. We also store a global array of include dirs
 # for passing to pmdinfogen scripts
-- 
2.20.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 3/4] build: use version number from config file
  2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
                     ` (2 preceding siblings ...)
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 2/4] build: move meson version handling to config directory Bruce Richardson
@ 2019-03-15 18:20   ` Bruce Richardson
  2019-03-15 18:20     ` Bruce Richardson
  2019-03-27  0:27     ` Thomas Monjalon
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 4/4] eal: remove unneeded version logic Bruce Richardson
  2019-03-27  0:34   ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Thomas Monjalon
  5 siblings, 2 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

Since we have the version number in a separate file at the root level,
we should not need to duplicate this in rte_version.h too. Best
approach here is to move the macros for specifying the year/month/etc.
parts from the version header file to the build config file - leaving
the other utility macros for e.g. printing the version string, where they
are.

For "make", this is done by having a little bit of awk parse the version
file and pass the results through to the preprocessor for the config
generation stage.

For "meson", this is done by parsing the version and adding it to the
standard dpdk_conf object.

In both cases, we need to append a large number - in this case "99",
previously 16 in original code - to the version number when we want to do
version number comparisons. Without this, the release version e.g. 19.05.0
will compare as less than it's RC's e.g. 19.05.0-rc4. With it, the
comparison is correct as "19.05.0.99 > 19.05.0-rc4.99".

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V3: following Thomas review, include appending .99 to version numbers to
    ensure correct comparison. Make sure the reason for this is properly
    documented in the code for future reference. Add in "int" casts for
    numeric values to strip leading zeros e.g. in "05" month.
V2: removed extra change to DPDK_VERSION that crept into patch. Added ack
---
 config/common_base                          | 14 +++++++++
 config/meson.build                          | 16 +++++++++++
 config/rte_config.h                         |  3 ++
 lib/librte_eal/common/include/rte_version.h | 32 ---------------------
 mk/rte.sdkconfig.mk                         |  7 +++++
 5 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/config/common_base b/config/common_base
index 0b09a9348..6292bc4af 100644
--- a/config/common_base
+++ b/config/common_base
@@ -1,6 +1,20 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2010-2017 Intel Corporation
 
+#
+# String that appears before the version number
+#
+CONFIG_RTE_VER_PREFIX="DPDK"
+
+#
+# Version information completed when this file is processed for a build
+#
+CONFIG_RTE_VER_YEAR=__YEAR
+CONFIG_RTE_VER_MONTH=__MONTH
+CONFIG_RTE_VER_MINOR=__MINOR
+CONFIG_RTE_VER_SUFFIX=__SUFFIX
+CONFIG_RTE_VER_RELEASE=__RELEASE
+
 #
 # define executive environment
 # RTE_EXEC_ENV values are the directories in mk/exec-env/
diff --git a/config/meson.build b/config/meson.build
index 999dea91e..30a7261a5 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -6,6 +6,22 @@
 pver = meson.project_version().split('.')
 major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
 
+# extract all version information into the build configuration
+dpdk_conf.set('RTE_VER_YEAR', pver.get(0).to_int())
+dpdk_conf.set('RTE_VER_MONTH', pver.get(1).to_int())
+if pver.get(2).contains('-rc')
+	rc_ver = pver.get(2).split('-rc')
+	dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0).to_int())
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
+	dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1).to_int())
+else
+	dpdk_conf.set('RTE_VER_MINOR', pver.get(2).to_int())
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
+# for actual, non-rc releases, set the release value to 99 to ensure releases
+# have higher version numbers than their respective release candidates
+	dpdk_conf.set('RTE_VER_RELEASE', 99)
+endif
+
 pmd_subdir_opt = get_option('drivers_install_subdir')
 if pmd_subdir_opt.contains('<VERSION>')
 	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
diff --git a/config/rte_config.h b/config/rte_config.h
index 1690f4d98..cda51af47 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -26,6 +26,9 @@
 #define RTE_EXEC_ENV_BSDAPP 1
 #endif
 
+/* String that appears before the version number */
+#define RTE_VER_PREFIX "DPDK"
+
 /****** library defines ********/
 
 /* compat defines */
diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index a7eed7ab7..50867ea81 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -19,38 +19,6 @@ extern "C" {
 #include <stdio.h>
 #include <rte_common.h>
 
-/**
- * String that appears before the version number
- */
-#define RTE_VER_PREFIX "DPDK"
-
-/**
- * Major version/year number i.e. the yy in yy.mm.z
- */
-#define RTE_VER_YEAR 19
-
-/**
- * Minor version/month number i.e. the mm in yy.mm.z
- */
-#define RTE_VER_MONTH 5
-
-/**
- * Patch level number i.e. the z in yy.mm.z
- */
-#define RTE_VER_MINOR 0
-
-/**
- * Extra string to be appended to version number
- */
-#define RTE_VER_SUFFIX "-rc"
-
-/**
- * Patch release number
- *   0-15 = release candidates
- *   16   = release
- */
-#define RTE_VER_RELEASE 0
-
 /**
  * Macro to compute a version number usable for comparisons
  */
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index 46ec9e76d..f538649f2 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -74,9 +74,16 @@ else
 # To do so the temp config is checked for duplicate keys with cut/sort/uniq
 # Then for each of those identified duplicates as long as there are more than
 # just one left the last match is removed.
+# Part of the config includes the version information taken from "VERSION"
+# in the repo. This needs to be split into the various parts using sed and awk.
+# To ensure correct version comparison, we append ".99" to the version number
+# so that the version of a release is higher than that of its rc's.
 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
 	$(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
 		$(CPP) -undef -P -x assembler-with-cpp \
+		`cat $(RTE_SRCDIR)/VERSION | \
+		sed -e 's/-rc/.-rc./' -e 's/$$/..99/' | \
+		awk -F '.' '{print "-D__YEAR="int($$1), "-D__MONTH="int($$2), "-D__MINOR="int($$3), "-D__SUFFIX=\""$$4"\"", "-D__RELEASE="int($$5)}'` \
 		-ffreestanding \
 		-o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
 		config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 3/4] build: use version number from config file
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 3/4] build: use version number from config file Bruce Richardson
@ 2019-03-15 18:20     ` Bruce Richardson
  2019-03-27  0:27     ` Thomas Monjalon
  1 sibling, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

Since we have the version number in a separate file at the root level,
we should not need to duplicate this in rte_version.h too. Best
approach here is to move the macros for specifying the year/month/etc.
parts from the version header file to the build config file - leaving
the other utility macros for e.g. printing the version string, where they
are.

For "make", this is done by having a little bit of awk parse the version
file and pass the results through to the preprocessor for the config
generation stage.

For "meson", this is done by parsing the version and adding it to the
standard dpdk_conf object.

In both cases, we need to append a large number - in this case "99",
previously 16 in original code - to the version number when we want to do
version number comparisons. Without this, the release version e.g. 19.05.0
will compare as less than it's RC's e.g. 19.05.0-rc4. With it, the
comparison is correct as "19.05.0.99 > 19.05.0-rc4.99".

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V3: following Thomas review, include appending .99 to version numbers to
    ensure correct comparison. Make sure the reason for this is properly
    documented in the code for future reference. Add in "int" casts for
    numeric values to strip leading zeros e.g. in "05" month.
V2: removed extra change to DPDK_VERSION that crept into patch. Added ack
---
 config/common_base                          | 14 +++++++++
 config/meson.build                          | 16 +++++++++++
 config/rte_config.h                         |  3 ++
 lib/librte_eal/common/include/rte_version.h | 32 ---------------------
 mk/rte.sdkconfig.mk                         |  7 +++++
 5 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/config/common_base b/config/common_base
index 0b09a9348..6292bc4af 100644
--- a/config/common_base
+++ b/config/common_base
@@ -1,6 +1,20 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2010-2017 Intel Corporation
 
+#
+# String that appears before the version number
+#
+CONFIG_RTE_VER_PREFIX="DPDK"
+
+#
+# Version information completed when this file is processed for a build
+#
+CONFIG_RTE_VER_YEAR=__YEAR
+CONFIG_RTE_VER_MONTH=__MONTH
+CONFIG_RTE_VER_MINOR=__MINOR
+CONFIG_RTE_VER_SUFFIX=__SUFFIX
+CONFIG_RTE_VER_RELEASE=__RELEASE
+
 #
 # define executive environment
 # RTE_EXEC_ENV values are the directories in mk/exec-env/
diff --git a/config/meson.build b/config/meson.build
index 999dea91e..30a7261a5 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -6,6 +6,22 @@
 pver = meson.project_version().split('.')
 major_version = '@0@.@1@'.format(pver.get(0), pver.get(1))
 
+# extract all version information into the build configuration
+dpdk_conf.set('RTE_VER_YEAR', pver.get(0).to_int())
+dpdk_conf.set('RTE_VER_MONTH', pver.get(1).to_int())
+if pver.get(2).contains('-rc')
+	rc_ver = pver.get(2).split('-rc')
+	dpdk_conf.set('RTE_VER_MINOR', rc_ver.get(0).to_int())
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '-rc')
+	dpdk_conf.set('RTE_VER_RELEASE', rc_ver.get(1).to_int())
+else
+	dpdk_conf.set('RTE_VER_MINOR', pver.get(2).to_int())
+	dpdk_conf.set_quoted('RTE_VER_SUFFIX', '')
+# for actual, non-rc releases, set the release value to 99 to ensure releases
+# have higher version numbers than their respective release candidates
+	dpdk_conf.set('RTE_VER_RELEASE', 99)
+endif
+
 pmd_subdir_opt = get_option('drivers_install_subdir')
 if pmd_subdir_opt.contains('<VERSION>')
 	pmd_subdir_opt = major_version.join(pmd_subdir_opt.split('<VERSION>'))
diff --git a/config/rte_config.h b/config/rte_config.h
index 1690f4d98..cda51af47 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -26,6 +26,9 @@
 #define RTE_EXEC_ENV_BSDAPP 1
 #endif
 
+/* String that appears before the version number */
+#define RTE_VER_PREFIX "DPDK"
+
 /****** library defines ********/
 
 /* compat defines */
diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index a7eed7ab7..50867ea81 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -19,38 +19,6 @@ extern "C" {
 #include <stdio.h>
 #include <rte_common.h>
 
-/**
- * String that appears before the version number
- */
-#define RTE_VER_PREFIX "DPDK"
-
-/**
- * Major version/year number i.e. the yy in yy.mm.z
- */
-#define RTE_VER_YEAR 19
-
-/**
- * Minor version/month number i.e. the mm in yy.mm.z
- */
-#define RTE_VER_MONTH 5
-
-/**
- * Patch level number i.e. the z in yy.mm.z
- */
-#define RTE_VER_MINOR 0
-
-/**
- * Extra string to be appended to version number
- */
-#define RTE_VER_SUFFIX "-rc"
-
-/**
- * Patch release number
- *   0-15 = release candidates
- *   16   = release
- */
-#define RTE_VER_RELEASE 0
-
 /**
  * Macro to compute a version number usable for comparisons
  */
diff --git a/mk/rte.sdkconfig.mk b/mk/rte.sdkconfig.mk
index 46ec9e76d..f538649f2 100644
--- a/mk/rte.sdkconfig.mk
+++ b/mk/rte.sdkconfig.mk
@@ -74,9 +74,16 @@ else
 # To do so the temp config is checked for duplicate keys with cut/sort/uniq
 # Then for each of those identified duplicates as long as there are more than
 # just one left the last match is removed.
+# Part of the config includes the version information taken from "VERSION"
+# in the repo. This needs to be split into the various parts using sed and awk.
+# To ensure correct version comparison, we append ".99" to the version number
+# so that the version of a release is higher than that of its rc's.
 $(RTE_OUTPUT)/.config: $(RTE_CONFIG_TEMPLATE) FORCE | $(RTE_OUTPUT)
 	$(Q)if [ "$(RTE_CONFIG_TEMPLATE)" != "" -a -f "$(RTE_CONFIG_TEMPLATE)" ]; then \
 		$(CPP) -undef -P -x assembler-with-cpp \
+		`cat $(RTE_SRCDIR)/VERSION | \
+		sed -e 's/-rc/.-rc./' -e 's/$$/..99/' | \
+		awk -F '.' '{print "-D__YEAR="int($$1), "-D__MONTH="int($$2), "-D__MINOR="int($$3), "-D__SUFFIX=\""$$4"\"", "-D__RELEASE="int($$5)}'` \
 		-ffreestanding \
 		-o $(RTE_OUTPUT)/.config_tmp $(RTE_CONFIG_TEMPLATE) ; \
 		config=$$(cat $(RTE_OUTPUT)/.config_tmp) ; \
-- 
2.20.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 4/4] eal: remove unneeded version logic
  2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
                     ` (3 preceding siblings ...)
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 3/4] build: use version number from config file Bruce Richardson
@ 2019-03-15 18:20   ` Bruce Richardson
  2019-03-15 18:20     ` Bruce Richardson
  2019-03-27  0:34   ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Thomas Monjalon
  5 siblings, 1 reply; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

The version number in the DPDK_VERSION file will never have an offset
that needs to be subtracted, so remove that logic from the version
string generation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V2,V3: No changes, added Luca's ack

 lib/librte_eal/common/include/rte_version.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index 50867ea81..f7a3a1ebc 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -57,9 +57,7 @@ rte_version(void)
 			RTE_VER_MONTH,
 			RTE_VER_MINOR,
 			RTE_VER_SUFFIX,
-			RTE_VER_RELEASE < 16 ?
-				RTE_VER_RELEASE :
-				RTE_VER_RELEASE - 16);
+			RTE_VER_RELEASE);
 	return version;
 }
 
-- 
2.20.1

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [dpdk-dev] [PATCH v3 4/4] eal: remove unneeded version logic
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 4/4] eal: remove unneeded version logic Bruce Richardson
@ 2019-03-15 18:20     ` Bruce Richardson
  0 siblings, 0 replies; 40+ messages in thread
From: Bruce Richardson @ 2019-03-15 18:20 UTC (permalink / raw)
  To: dev; +Cc: David Marchand, Thomas Monjalon, Luca Boccassi, Bruce Richardson

The version number in the DPDK_VERSION file will never have an offset
that needs to be subtracted, so remove that logic from the version
string generation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
---
V2,V3: No changes, added Luca's ack

 lib/librte_eal/common/include/rte_version.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_version.h b/lib/librte_eal/common/include/rte_version.h
index 50867ea81..f7a3a1ebc 100644
--- a/lib/librte_eal/common/include/rte_version.h
+++ b/lib/librte_eal/common/include/rte_version.h
@@ -57,9 +57,7 @@ rte_version(void)
 			RTE_VER_MONTH,
 			RTE_VER_MINOR,
 			RTE_VER_SUFFIX,
-			RTE_VER_RELEASE < 16 ?
-				RTE_VER_RELEASE :
-				RTE_VER_RELEASE - 16);
+			RTE_VER_RELEASE);
 	return version;
 }
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number Bruce Richardson
  2019-03-15 18:20     ` Bruce Richardson
@ 2019-03-16 18:01     ` Rami Rosen
  2019-03-16 18:01       ` Rami Rosen
  1 sibling, 1 reply; 40+ messages in thread
From: Rami Rosen @ 2019-03-16 18:01 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Thomas Monjalon, Luca Boccassi

 Bruce Richardson ‏<bruce.richardson@intel.com>:

> Add a new file VERSION to hold the current DPDK version number.
> Have meson use this file for it's project version, and have make use
> it for reporting out "showversion" and "showversionum".
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
>

Reviewed-by: Rami Rosen <ramirose@gmail.com>

>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number
  2019-03-16 18:01     ` Rami Rosen
@ 2019-03-16 18:01       ` Rami Rosen
  0 siblings, 0 replies; 40+ messages in thread
From: Rami Rosen @ 2019-03-16 18:01 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Thomas Monjalon, Luca Boccassi

 Bruce Richardson ‏<bruce.richardson@intel.com>:

> Add a new file VERSION to hold the current DPDK version number.
> Have meson use this file for it's project version, and have make use
> it for reporting out "showversion" and "showversionum".
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
>

Reviewed-by: Rami Rosen <ramirose@gmail.com>

>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/4] build: use version number from config file
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 3/4] build: use version number from config file Bruce Richardson
  2019-03-15 18:20     ` Bruce Richardson
@ 2019-03-27  0:27     ` Thomas Monjalon
  2019-03-27  0:27       ` Thomas Monjalon
  1 sibling, 1 reply; 40+ messages in thread
From: Thomas Monjalon @ 2019-03-27  0:27 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Luca Boccassi

15/03/2019 19:20, Bruce Richardson:
> Since we have the version number in a separate file at the root level,
> we should not need to duplicate this in rte_version.h too. Best
> approach here is to move the macros for specifying the year/month/etc.
> parts from the version header file to the build config file - leaving
> the other utility macros for e.g. printing the version string, where they
> are.
> 
> For "make", this is done by having a little bit of awk parse the version
> file and pass the results through to the preprocessor for the config
> generation stage.
> 
> For "meson", this is done by parsing the version and adding it to the
> standard dpdk_conf object.
> 
> In both cases, we need to append a large number - in this case "99",
> previously 16 in original code - to the version number when we want to do
> version number comparisons. Without this, the release version e.g. 19.05.0
> will compare as less than it's RC's e.g. 19.05.0-rc4. With it, the
> comparison is correct as "19.05.0.99 > 19.05.0-rc4.99".
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
> ---
> V3: following Thomas review, include appending .99 to version numbers to
>     ensure correct comparison. Make sure the reason for this is properly
>     documented in the code for future reference. Add in "int" casts for
>     numeric values to strip leading zeros e.g. in "05" month.

Acked-by: Thomas Monjalon <thomas@monjalon.net>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/4] build: use version number from config file
  2019-03-27  0:27     ` Thomas Monjalon
@ 2019-03-27  0:27       ` Thomas Monjalon
  0 siblings, 0 replies; 40+ messages in thread
From: Thomas Monjalon @ 2019-03-27  0:27 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Luca Boccassi

15/03/2019 19:20, Bruce Richardson:
> Since we have the version number in a separate file at the root level,
> we should not need to duplicate this in rte_version.h too. Best
> approach here is to move the macros for specifying the year/month/etc.
> parts from the version header file to the build config file - leaving
> the other utility macros for e.g. printing the version string, where they
> are.
> 
> For "make", this is done by having a little bit of awk parse the version
> file and pass the results through to the preprocessor for the config
> generation stage.
> 
> For "meson", this is done by parsing the version and adding it to the
> standard dpdk_conf object.
> 
> In both cases, we need to append a large number - in this case "99",
> previously 16 in original code - to the version number when we want to do
> version number comparisons. Without this, the release version e.g. 19.05.0
> will compare as less than it's RC's e.g. 19.05.0-rc4. With it, the
> comparison is correct as "19.05.0.99 > 19.05.0-rc4.99".
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Acked-by: Luca Boccassi <bluca@debian.org>
> ---
> V3: following Thomas review, include appending .99 to version numbers to
>     ensure correct comparison. Make sure the reason for this is properly
>     documented in the code for future reference. Add in "int" casts for
>     numeric values to strip leading zeros e.g. in "05" month.

Acked-by: Thomas Monjalon <thomas@monjalon.net>



^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all...
  2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
                     ` (4 preceding siblings ...)
  2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 4/4] eal: remove unneeded version logic Bruce Richardson
@ 2019-03-27  0:34   ` Thomas Monjalon
  2019-03-27  0:34     ` Thomas Monjalon
  5 siblings, 1 reply; 40+ messages in thread
From: Thomas Monjalon @ 2019-03-27  0:34 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Luca Boccassi

15/03/2019 19:20, Bruce Richardson:
> Right now with DPDK we have two sources of version information - the
> rte_version.h header file containing macros for C use, and the project
> version number in the project definition in meson.build. This is not
> optimal, so this patchset aims to provide a single source for the DPDK
> version. The options considered are:
> 
> * Keep version info in rte_version.h only. The two reasons this was not
>   chosen were:
>   1) parsing the version number from the header is awkward, as seen in the
>      rte.sdkconfig.mk file, and a script to do so would be needed to
>      integrate that into the meson build project definition.
>   2) rte_version.h is not in an obvious location inside the project when
>      a user clones from git. It's hidden away in the
>      "lib/librte_eal/common/include" folder. Ideally the version number
>      should be evident at the top level of the DPDK tree.
> 
> * Keep version info in meson.build file only. This seemed a better option
>   than keeping the info in rte_version.h, but it still had disadvantages:
>   1) For make, using grep on meson.build to extract the version seemed a
>      bit awkward, though doable. Splitting the version was tricky too, but
>      manageable with a small amount of scripting.
>   2) There was no easy way to have users access the version number when
>      "make showversion" was deprecated with the make build system.
> 
> * Store the version number in a new version file at the root level of the
>   repo.
>   * This did have the advantage of being easily discoverable on clone
>   * Still had the disadvantage of needing some parsing to generate the
>     defines from rte_version.h
> 
> Since the last option seemed best, that is what is implemented in this set.
> The file DPDK_VERSION is added to store the version number, and make and
> meson both use that as their source of version info. For C code, the
> rte_version.h header remains, except that the basic definitions of the
> release YEAR, MONTH, MINOR etc. are moved to be automatically generated as
> part of rte_config.h. For make builds, this is done via using the
> preprocessor to insert the values when it generates the config. For meson
> builds, this is done by just adding the values to the dpdk_conf
> configuration object.
> 
> ---
> V3: Reworked following review from Thomas Monjalon. Main change is to how
>     the RTE_VER_RELEASE value is computed for non-release candidates.
>     Also added int() conversion to each version value to remove leading
>     zeros
> V2: Updated following review from David Marchand.
> 
> Bruce Richardson (4):
>   build: add single source of DPDK version number
>   build: move meson version handling to config directory
>   build: use version number from config file
>   eal: remove unneeded version logic

Applied, thanks

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all...
  2019-03-27  0:34   ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Thomas Monjalon
@ 2019-03-27  0:34     ` Thomas Monjalon
  0 siblings, 0 replies; 40+ messages in thread
From: Thomas Monjalon @ 2019-03-27  0:34 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: dev, David Marchand, Luca Boccassi

15/03/2019 19:20, Bruce Richardson:
> Right now with DPDK we have two sources of version information - the
> rte_version.h header file containing macros for C use, and the project
> version number in the project definition in meson.build. This is not
> optimal, so this patchset aims to provide a single source for the DPDK
> version. The options considered are:
> 
> * Keep version info in rte_version.h only. The two reasons this was not
>   chosen were:
>   1) parsing the version number from the header is awkward, as seen in the
>      rte.sdkconfig.mk file, and a script to do so would be needed to
>      integrate that into the meson build project definition.
>   2) rte_version.h is not in an obvious location inside the project when
>      a user clones from git. It's hidden away in the
>      "lib/librte_eal/common/include" folder. Ideally the version number
>      should be evident at the top level of the DPDK tree.
> 
> * Keep version info in meson.build file only. This seemed a better option
>   than keeping the info in rte_version.h, but it still had disadvantages:
>   1) For make, using grep on meson.build to extract the version seemed a
>      bit awkward, though doable. Splitting the version was tricky too, but
>      manageable with a small amount of scripting.
>   2) There was no easy way to have users access the version number when
>      "make showversion" was deprecated with the make build system.
> 
> * Store the version number in a new version file at the root level of the
>   repo.
>   * This did have the advantage of being easily discoverable on clone
>   * Still had the disadvantage of needing some parsing to generate the
>     defines from rte_version.h
> 
> Since the last option seemed best, that is what is implemented in this set.
> The file DPDK_VERSION is added to store the version number, and make and
> meson both use that as their source of version info. For C code, the
> rte_version.h header remains, except that the basic definitions of the
> release YEAR, MONTH, MINOR etc. are moved to be automatically generated as
> part of rte_config.h. For make builds, this is done via using the
> preprocessor to insert the values when it generates the config. For meson
> builds, this is done by just adding the values to the dpdk_conf
> configuration object.
> 
> ---
> V3: Reworked following review from Thomas Monjalon. Main change is to how
>     the RTE_VER_RELEASE value is computed for non-release candidates.
>     Also added int() conversion to each version value to remove leading
>     zeros
> V2: Updated following review from David Marchand.
> 
> Bruce Richardson (4):
>   build: add single source of DPDK version number
>   build: move meson version handling to config directory
>   build: use version number from config file
>   eal: remove unneeded version logic

Applied, thanks



^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2019-03-27  0:34 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 11:54 [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Bruce Richardson
2019-03-07 11:54 ` [dpdk-dev] [PATCH 1/4] build: add single source of DPDK version number Bruce Richardson
2019-03-07 12:33   ` David Marchand
2019-03-07 11:54 ` [dpdk-dev] [PATCH 2/4] build: use version number from config file Bruce Richardson
2019-03-07 12:37   ` David Marchand
2019-03-07 12:42     ` David Marchand
2019-03-07 13:12       ` Bruce Richardson
2019-03-07 13:01     ` Bruce Richardson
2019-03-07 11:54 ` [dpdk-dev] [PATCH 3/4] build: move meson version handling to config directory Bruce Richardson
2019-03-07 11:54 ` [dpdk-dev] [PATCH 4/4] eal: remove unneeded version logic Bruce Richardson
2019-03-07 12:09 ` [dpdk-dev] [RFC PATCH 0/4] One versionfile to rule them all Luca Boccassi
2019-03-07 12:14   ` Bruce Richardson
2019-03-07 13:34 ` [dpdk-dev] [PATCH v2 " Bruce Richardson
2019-03-07 13:34   ` [dpdk-dev] [PATCH v2 1/4] build: add single source of DPDK version number Bruce Richardson
2019-03-13 11:06     ` Thomas Monjalon
2019-03-13 11:17       ` Bruce Richardson
2019-03-13 11:23         ` Thomas Monjalon
2019-03-13 11:27           ` Bruce Richardson
2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 2/4] build: use version number from config file Bruce Richardson
2019-03-13 11:13     ` Thomas Monjalon
2019-03-13 11:20       ` Bruce Richardson
2019-03-13 11:24         ` Thomas Monjalon
2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 3/4] build: move meson version handling to config directory Bruce Richardson
2019-03-07 13:35   ` [dpdk-dev] [PATCH v2 4/4] eal: remove unneeded version logic Bruce Richardson
2019-03-15 18:20 ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Bruce Richardson
2019-03-15 18:20   ` Bruce Richardson
2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 1/4] build: add single source of DPDK version number Bruce Richardson
2019-03-15 18:20     ` Bruce Richardson
2019-03-16 18:01     ` Rami Rosen
2019-03-16 18:01       ` Rami Rosen
2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 2/4] build: move meson version handling to config directory Bruce Richardson
2019-03-15 18:20     ` Bruce Richardson
2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 3/4] build: use version number from config file Bruce Richardson
2019-03-15 18:20     ` Bruce Richardson
2019-03-27  0:27     ` Thomas Monjalon
2019-03-27  0:27       ` Thomas Monjalon
2019-03-15 18:20   ` [dpdk-dev] [PATCH v3 4/4] eal: remove unneeded version logic Bruce Richardson
2019-03-15 18:20     ` Bruce Richardson
2019-03-27  0:34   ` [dpdk-dev] [PATCH v3 0/4] One versionfile to rule them all Thomas Monjalon
2019-03-27  0:34     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).