Make ReactOS report the Git revision as output by "git describe".
authorColin Finck <colin@reactos.org>
Tue, 3 Oct 2017 10:55:38 +0000 (12:55 +0200)
committerColin Finck <colin@reactos.org>
Tue, 3 Oct 2017 10:55:38 +0000 (12:55 +0200)
- REVISION is now something like "0.4.7-dev-53-g1304b53" instead of "r12345".
- Change WINDOWS_NT_BANNER to better represent the ReactOS version and the reported NT version.
- Introduce REACTOS_COMMIT_HASH which contains the full 40-character commit hash (for comparing revisions, e.g. in rosautotest/testman).

modules/rostests/rosautotest/CConfiguration.cpp
ntoskrnl/ex/init.c
sdk/include/reactos/buildno.h.cmake
sdk/include/reactos/mc/bugcodes.mc
sdk/include/reactos/version.cmake
sdk/include/reactos/version.h.cmake

index 51d3f98..2a605b4 100644 (file)
@@ -119,7 +119,7 @@ CConfiguration::GetSystemInformation()
 
     /* Get the build from the define */
     ss << "&revision=";
-    ss << KERNEL_VERSION_BUILD_HEX;
+    ss << KERNEL_VERSION_COMMIT_HASH;
 
     ss << "&platform=";
 
index 1c1d264..71f27ef 100644 (file)
@@ -1428,15 +1428,12 @@ Phase1InitializationDiscard(IN PVOID Context)
     if (CmCSDVersionString.Length)
     {
         /* Print the version string */
-        /* ReactOS specific: Append also the revision number */
         Status = RtlStringCbPrintfExA(StringBuffer,
                                       Remaining,
                                       &EndBuffer,
                                       &Remaining,
                                       0,
-                                      " r%u"
                                       ": %wZ",
-                                      KERNEL_VERSION_BUILD_HEX,
                                       &CmCSDVersionString);
         if (!NT_SUCCESS(Status))
         {
@@ -1471,9 +1468,12 @@ Phase1InitializationDiscard(IN PVOID Context)
     if (NT_SUCCESS(MsgStatus))
     {
         /* Create the banner message */
+        /* ReactOS specific: Report ReactOS version, NtBuildLab information and reported NT kernel version */
         Status = RtlStringCbPrintfA(EndBuffer,
                                     Remaining,
                                     (PCHAR)MsgEntry->Text,
+                                    KERNEL_VERSION_STR,
+                                    NtBuildLab,
                                     StringBuffer,
                                     NtBuildNumber & 0xFFFF,
                                     BeginBuffer);
index 4f1e912..0dfc9f3 100644 (file)
@@ -3,13 +3,14 @@
 #define _INC_REACTOS_BUILDNO
 
 #define KERNEL_VERSION_BUILD        @KERNEL_VERSION_BUILD@
-#define KERNEL_VERSION_BUILD_HEX    0x@KERNEL_VERSION_BUILD_HEX@
 #define KERNEL_VERSION_BUILD_STR    "@KERNEL_VERSION_BUILD@-@REVISION@"
 #define KERNEL_VERSION_BUILD_RC     "@KERNEL_VERSION_BUILD@-@REVISION@\0"
 
 #define KERNEL_VERSION_RC           "@KERNEL_VERSION@\0"
 #define KERNEL_VERSION_STR          "@KERNEL_VERSION@"
 
+#define KERNEL_VERSION_COMMIT_HASH  "@COMMIT_HASH@"
+
 #define REACTOS_DLL_VERSION_MAJOR   @REACTOS_DLL_VERSION_MAJOR@
 #define REACTOS_DLL_VERSION_RC      "@DLL_VERSION_STR@\0"
 #define REACTOS_DLL_VERSION_STR     "@DLL_VERSION_STR@"
index 005447a..574e006 100644 (file)
@@ -19,7 +19,9 @@ Severity=Informational
 Facility=System\r
 SymbolicName=WINDOWS_NT_BANNER\r
 Language=English\r
-ReactOS (R) Kernel Version %hs (Build %u%hs)\r
+ReactOS Version %s\r
+Build %s\r
+Reporting NT %s (Build %u%s)\r
 .\r
 \r
 MessageId=0x87\r
index e5f0bb1..6c2247a 100644 (file)
@@ -1,63 +1,50 @@
-macro(inttohex INTVALUE OUTPUT_VARIABLE)
-    list(APPEND HEXLIST 0 1 2 3 4 5 6 7 8 9 a b c d e f)
-    list(GET HEXLIST ${INTVALUE} ${OUTPUT_VARIABLE})
-endmacro()
-
-macro(converttohex INTVALUE OUTPUT_VARIABLE)
-    set(${OUTPUT_VARIABLE} "")
-    set(REMAINING ${INTVALUE})
-    while(REMAINING)
-        math(EXPR REMAINDER "${REMAINING}%16")
-        inttohex(${REMAINDER} HEXCHAR)
-        math(EXPR REMAINING "${REMAINING}/16")
-        set(${OUTPUT_VARIABLE} "${HEXCHAR}${${OUTPUT_VARIABLE}}")
-    endwhile()
-endmacro()
-
 string(TIMESTAMP KERNEL_VERSION_BUILD %Y%m%d UTC)
 
 set(KERNEL_VERSION_MAJOR "0")
-set(KERNEL_VERSION_MINOR "5")
-set(KERNEL_VERSION_PATCH_LEVEL "0")
+set(KERNEL_VERSION_MINOR "4")
+set(KERNEL_VERSION_PATCH_LEVEL "7")
 set(COPYRIGHT_YEAR "2017")
 
-# KERNEL_VERSION_BUILD_TYPE is "SVN" or "" (for the release)
-set(KERNEL_VERSION_BUILD_TYPE "SVN")
+# KERNEL_VERSION_BUILD_TYPE is "dev" for Git builds
+# or "RC1", "RC2", "" for releases.
+set(KERNEL_VERSION_BUILD_TYPE "dev")
 
-# KERNEL_VERSION_RELEASE_TYPE is "RC1", "RC2" or "" (for the final one)
-set(KERNEL_VERSION_RELEASE_TYPE "")
-
-set(KERNEL_VERSION "${KERNEL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}")
-if(KERNEL_VERSION_PATCH_LEVEL)
-    set(KERNEL_VERSION "${KERNEL_VERSION}.${KERNEL_VERSION_PATCH_LEVEL}")
-endif()
-if(KERNEL_VERSION_BUILD_TYPE STREQUAL "SVN")
+set(KERNEL_VERSION "${KERNEL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}.${KERNEL_VERSION_PATCH_LEVEL}")
+if(NOT KERNEL_VERSION_BUILD_TYPE STREQUAL "")
     set(KERNEL_VERSION "${KERNEL_VERSION}-${KERNEL_VERSION_BUILD_TYPE}")
-elseif(NOT KERNEL_VERSION_RELEASE_TYPE STREQUAL "")
-    set(KERNEL_VERSION "${KERNEL_VERSION}-${KERNEL_VERSION_RELEASE_TYPE}")
 endif()
 
 math(EXPR REACTOS_DLL_VERSION_MAJOR "${KERNEL_VERSION_MAJOR}+42")
-set(DLL_VERSION_STR "${REACTOS_DLL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}")
-if(KERNEL_VERSION_PATCH_LEVEL)
-    set(DLL_VERSION_STR "${DLL_VERSION_STR}.${KERNEL_VERSION_PATCH_LEVEL}")
-endif()
-if(KERNEL_VERSION_BUILD_TYPE STREQUAL "SVN")
+set(DLL_VERSION_STR "${REACTOS_DLL_VERSION_MAJOR}.${KERNEL_VERSION_MINOR}.${KERNEL_VERSION_PATCH_LEVEL}")
+if(NOT KERNEL_VERSION_BUILD_TYPE STREQUAL "")
     set(DLL_VERSION_STR "${DLL_VERSION_STR}-${KERNEL_VERSION_BUILD_TYPE}")
-elseif(NOT KERNEL_VERSION_RELEASE_TYPE STREQUAL "")
-    set(DLL_VERSION_STR "${DLL_VERSION_STR}-${KERNEL_VERSION_RELEASE_TYPE}")
 endif()
 
-# get svn revision number
-set(REVISION "rUNKNOWN")
-set(KERNEL_VERSION_BUILD_HEX "0")
-if(EXISTS "${REACTOS_SOURCE_DIR}/.svn" OR EXISTS "${REACTOS_SOURCE_DIR}/../.svn")
-    find_package(Subversion)
-    if(Subversion_FOUND)
-        subversion_wc_info(${REACTOS_SOURCE_DIR} SVNINFO)
-        if(SVNINFO_WC_REVISION)
-            set(REVISION "r${SVNINFO_WC_REVISION}")
-            converttohex(${SVNINFO_WC_REVISION} KERNEL_VERSION_BUILD_HEX)
+# Get Git revision through "git describe"
+set(COMMIT_HASH "unknown-hash")
+set(REVISION "unknown-revision")
+
+if(EXISTS "${REACTOS_SOURCE_DIR}/.git")
+    find_package(Git)
+    if(GIT_FOUND)
+        execute_process(
+            COMMAND "${GIT_EXECUTABLE}" rev-parse HEAD
+            OUTPUT_VARIABLE GIT_COMMIT_HASH
+            RESULT_VARIABLE GIT_CALL_RESULT
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+        if(GIT_CALL_RESULT EQUAL 0)
+            set(COMMIT_HASH "${GIT_COMMIT_HASH}")
+        endif()
+
+        execute_process(
+            COMMAND "${GIT_EXECUTABLE}" describe
+            OUTPUT_VARIABLE GIT_DESCRIBE_REVISION
+            RESULT_VARIABLE GIT_CALL_RESULT
+            OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+        if(GIT_CALL_RESULT EQUAL 0)
+            set(REVISION "${GIT_DESCRIBE_REVISION}")
         endif()
     endif()
 endif()
index 628d497..2ac1a47 100644 (file)
 
 #define COPYRIGHT_YEAR "@COPYRIGHT_YEAR@"
 
-/* KERNEL_VERSION_BUILD_TYPE is "SVN" or "" (for the release) */
-#define KERNEL_VERSION_BUILD_TYPE   "@KERNEL_VERSION_BUILD_TYPE@"
-/* KERNEL_VERSION_RELEASE_TYPE is "RC1", "RC2" or "" (for the final one) */
-#define KERNEL_VERSION_RELEASE_TYPE "@KERNEL_VERSION_RELEASE_TYPE@"
-
 #endif
 
 /* EOF */