Whamcloud - gitweb
LU-7699 build: Convert lustre_ver.h.in into a static .h file 11/18111/13
authorChristopher J. Morrone <morrone2@llnl.gov>
Sun, 24 Jan 2016 00:44:48 +0000 (16:44 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 21 Apr 2016 02:26:38 +0000 (02:26 +0000)
The AC_LUSTRE_{MAJOR,MINOR,PATCH,FIX} autoconf output values are
no longer necessary.  We can instead use AC_DEFINE to set the
LUSTRE_{MAJOR,MINOR,PATCH,FIX} CPP macros directly.  As a result,
the lustre_ver.h file no longer needs to be generated by autoconf
and it can be made into a static file.

At the same time we set LUSTRE_VERSION_STRING, even though it
is not strictly needed, to avoid additional divergence from
the client code in the upstream Linux kernel staging area.

Change-Id: I6b0364a7af1869beb6acedc63c034565af00ef06
Signed-off-by: Christopher J. Morrone <morrone2@llnl.gov>
Reviewed-on: http://review.whamcloud.com/18111
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
config/lustre-version.m4
configure.ac
contrib/lbuild/lbuild
lustre/autoconf/lustre-core.m4
lustre/include/.gitignore
lustre/include/lustre_ver.h [moved from lustre/include/lustre_ver.h.in with 70% similarity]

index 9507a50..d5485af 100644 (file)
@@ -1,23 +1,20 @@
 #
-# LUSTRE_VERSION_VARIABLES
+# LUSTRE_VERSION_CPP_MACROS
 #
-AC_DEFUN([LUSTRE_VERSION_VARIABLES], [
-
+AC_DEFUN([LUSTRE_VERSION_CPP_MACROS], [
 LUSTRE_MAJOR=`echo AC_PACKAGE_VERSION | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\1/']`
 LUSTRE_MINOR=`echo AC_PACKAGE_VERSION | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\2/']`
 LUSTRE_PATCH=`echo AC_PACKAGE_VERSION | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\3/']`
 LUSTRE_FIX=`echo AC_PACKAGE_VERSION | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\5/']`
 AS_IF([test -z "$LUSTRE_FIX"], [LUSTRE_FIX="0"])
 
-m4_pattern_allow(AC_LUSTRE)
-[AC_LUSTRE_MAJOR]=$LUSTRE_MAJOR
-[AC_LUSTRE_MINOR]=$LUSTRE_MINOR
-[AC_LUSTRE_PATCH]=$LUSTRE_PATCH
-[AC_LUSTRE_FIX]=$LUSTRE_FIX
-
-AC_SUBST([AC_LUSTRE_MAJOR])
-AC_SUBST([AC_LUSTRE_MINOR])
-AC_SUBST([AC_LUSTRE_PATCH])
-AC_SUBST([AC_LUSTRE_FIX])
+AC_DEFINE_UNQUOTED([LUSTRE_MAJOR], [$LUSTRE_MAJOR], [First number in the Lustre version])
+AC_DEFINE_UNQUOTED([LUSTRE_MINOR], [$LUSTRE_MINOR], [Second number in the Lustre version])
+AC_DEFINE_UNQUOTED([LUSTRE_PATCH], [$LUSTRE_PATCH], [Third number in the Lustre version])
+AC_DEFINE_UNQUOTED([LUSTRE_FIX], [$LUSTRE_FIX], [Fourth number in the Lustre version])
+# Even though the code could just use VERSION or PACKAGE_VERSION directly,
+# we use this copy named LUSTRE_VERSION_STRING instead to maintain less
+# divergence from the Lustre client code in the upstream Linux kernel code.
+AC_DEFINE_UNQUOTED([LUSTRE_VERSION_STRING], ["$PACKAGE_VERSION"], [A copy of PACKAGE_VERSION])
 
 ])
index 0295c7c..2e8b837 100644 (file)
@@ -20,5 +20,5 @@ AM_PROG_AS
 AC_PATH_PROG(RPMBUILD, rpmbuild)
 AC_CHECK_TOOLS(AR, ar)
 
-LUSTRE_VERSION_VARIABLES
+LUSTRE_VERSION_CPP_MACROS
 LB_CONFIGURE
index 85d3878..9d6a600 100755 (executable)
@@ -836,7 +836,7 @@ build_lustre() {
 
 # Only zfs Lustre DKMS Server is supported
 build_lustre_dkms() {
-    local ver=$(eval echo  $(awk '/LUSTRE_VERSION_STRING/ {print $3}'  lustre/include/lustre_ver.h))
+    local ver=$(sed -n -e 's/^LUSTRE_VERSION = //p' LUSTRE-VERSION-FILE)
     echo "Building Lustre DKMS RPMs for: $BUILD_ARCHS..."
     ./configure --enable-dist || return 255
 
index d9294bf..9f59979 100644 (file)
@@ -2506,7 +2506,6 @@ lustre/conf/Makefile
 lustre/contrib/Makefile
 lustre/doc/Makefile
 lustre/include/Makefile
-lustre/include/lustre_ver.h
 lustre/include/lustre/Makefile
 lustre/kernel_patches/targets/3.10-rhel7.target
 lustre/kernel_patches/targets/2.6-rhel6.7.target
index d106e44..6466325 100644 (file)
@@ -4,4 +4,3 @@
 /stamp-h1
 /stamp-h.in
 /Makefile.in
-/lustre_ver.h
similarity index 70%
rename from lustre/include/lustre_ver.h.in
rename to lustre/include/lustre_ver.h
index 15f3327..0557c2d 100644 (file)
@@ -1,14 +1,16 @@
 #ifndef _LUSTRE_VER_H_
 #define _LUSTRE_VER_H_
-/* This file automatically generated from lustre/include/lustre_ver.h.in,
- * based on parameters in lustre/autoconf/lustre-version.ac.
- * Changes made directly to this file will be lost. */
 
-#define LUSTRE_MAJOR @AC_LUSTRE_MAJOR@
-#define LUSTRE_MINOR @AC_LUSTRE_MINOR@
-#define LUSTRE_PATCH @AC_LUSTRE_PATCH@
-#define LUSTRE_FIX @AC_LUSTRE_FIX@
-#define LUSTRE_VERSION_STRING "@PACKAGE_VERSION@"
+/*
+ * LUSTRE_VERSION_STRING
+ *
+ * Note that some files may seem to include this header unnecessarily.
+ * If the file uses LUSTRE_VERSION_STRING, it is likely doing the include
+ * for compatibility with the Lustre code in the Linux kernel.
+ * In the Linux kernel, they are likely hard coding LUSTRE_VERSION_STRING
+ * right here in this file.  The out-of-kernel Lustre code generates
+ * LUSTRE_VERSION_STRING in autoconf with AC_DEFINE.
+ */
 
 #define OBD_OCD_VERSION(major, minor, patch, fix)                      \
        (((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix))