[x265] [PATCH] Update x265Version.txt for Release_3.4

Janani T E janani.te at multicorewareinc.com
Tue Aug 24 04:43:51 UTC 2021


Thanks for the review Aruna. Please find the new patch attached.

>From 2a9f30c0df659e5dd4ecd9619ba7cdd85da1221d Mon Sep 17 00:00:00 2001
From: Janani TE <janani.te at multicorewareinc.com>
Date: Tue, 24 Aug 2021 10:10:08 +0530
Subject: [PATCH] Update x265Version.txt for Release_3.4

---
 source/CMakeLists.txt      |   4 +-
 source/cmake/Version.cmake | 179
+++++++++++++++++++++++++++++++++++++++++++++
 source/cmake/version.cmake |  97 ------------------------
 x265Version.txt            |   4 +
 4 files changed, 185 insertions(+), 99 deletions(-)
 create mode 100644 source/cmake/Version.cmake
 delete mode 100644 source/cmake/version.cmake
 create mode 100644 x265Version.txt

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 1d1a613..f4a9cb7 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 192)
+set(X265_BUILD 201)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
@@ -485,7 +485,7 @@ if(POWER)
     endif()
 endif()

-include(version) # determine X265_VERSION and X265_LATEST_TAG
+include(Version) # determine X265_VERSION and X265_LATEST_TAG
 include_directories(. common encoder "${PROJECT_BINARY_DIR}")

 option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)
diff --git a/source/cmake/Version.cmake b/source/cmake/Version.cmake
new file mode 100644
index 0000000..3bbf42f
--- /dev/null
+++ b/source/cmake/Version.cmake
@@ -0,0 +1,179 @@
+
#################################################################################################################
+ #
+ #    Copyright (C) 2013-2020 MulticoreWare, Inc
+ #
+ # This program is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+ # (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111,
USA.
+ #
+ # This program is also available under a commercial proprietary license.
+ # For more information, contact us at license @ x265.com
+ #
+ # Authors: Janani T.E <janani.te at multicorewareinc.com>, Srikanth Kurapati
<srikanthkurapati at multicorewareinc.com>
+ #
+
#################################################################################################################
+ # PURPOSE: Identity version control software version display, also read
version files to present x265 version.
+
#################################################################################################################
+ #Default Settings, for user to be vigilant about x265 version being
reported during product build.
+set(X265_VERSION "unknown")
+set(X265_LATEST_TAG "0.0")
+set(X265_TAG_DISTANCE "0")
+
+#Find version control software to be used for live and extracted
repositories from compressed tarballs
+if(CMAKE_VERSION VERSION_LESS "2.8.10")
+    find_program(HG_EXECUTABLE hg)
+    if(EXISTS "${HG_EXECUTABLE}.bat")
+        set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")
+    endif()
+    message(STATUS "hg found at ${HG_EXECUTABLE}")
+else()
+    find_package(Hg QUIET)
+endif()
+if(HG_EXECUTABLE)
+    #Set Version Control binary for source code kind
+    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)
+        set(HG_ARCHETYPE "1")
+    elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)
+        set(HG_ARCHETYPE "0")
+    endif()
+endif(HG_EXECUTABLE)
+find_package(Git QUIET) #No restrictions on Git versions used, any
versions from 1.8.x to 2.2.x or later should do.
+if(GIT_FOUND)
+    find_program(GIT_EXECUTABLE git)
+    message(STATUS "GIT_EXECUTABLE ${GIT_EXECUTABLE}")
+    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)
+        set(GIT_ARCHETYPE "0")
+    elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt)
+        set(GIT_ARCHETYPE "1")
+    endif()
+endif(GIT_FOUND)
+if(HG_ARCHETYPE)
+    #Read the lines of the archive summary file to extract the version
+    message(STATUS "SOURCE CODE IS FROM x265 HG ARCHIVED ZIP OR TAR BALL")
+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)
+    STRING(REGEX REPLACE "\n" ";" archive "${archive}")
+    foreach(f ${archive})
+        string(FIND "${f}" ": " pos)
+        string(SUBSTRING "${f}" 0 ${pos} key)
+        string(SUBSTRING "${f}" ${pos} -1 value)
+        string(SUBSTRING "${value}" 2 -1 value)
+        set(hg_${key} ${value})
+    endforeach()
+    if(DEFINED hg_tag)
+        set(X265_LATEST_TAG ${hg_tag})
+    elseif(DEFINED hg_node)
+        set(X265_LATEST_TAG ${hg_latesttag})
+        set(X265_TAG_DISTANCE ${hg_latesttagdistance})
+        string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)
+    endif()
+    message(STATUS "HG ARCHIVAL INFORMATION PROCESSED")
+elseif(NOT DEFINED GIT_ARCHETYPE)
+# means that's its neither hg archive nor git clone/archive hence it has
to be hg live repo as these are only four cases that need to processed in
mutual exclusion.
+    execute_process(COMMAND
+        ${HG_EXECUTABLE} log -r. --template "{latesttag}"
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        OUTPUT_VARIABLE X265_LATEST_TAG
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+    execute_process(COMMAND
+        ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        OUTPUT_VARIABLE X265_TAG_DISTANCE
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+    execute_process(
+        COMMAND
+        ${HG_EXECUTABLE} log -r. --template "{node}"
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        OUTPUT_VARIABLE X265_REVISION_ID
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+    string(SUBSTRING "${X265_REVISION_ID}" 0 12 X265_REVISION_ID)
+    if(X265_LATEST_TAG MATCHES "^r")
+        string(SUBSTRING ${X265_LATEST_TAG} 1 -1 X265_LATEST_TAG)
+    endif()
+    message(STATUS "HG LIVE REPO STATUS CHECK DONE")
+elseif(GIT_ARCHETYPE)
+    message(STATUS "SOURCE CODE IS FROM x265 GIT ARCHIVED ZIP OR TAR BALL")
+    #Read the lines of the archive summary file to extract the version
+    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt filebuf)
+    STRING(REGEX REPLACE "\n" ";" filebuf "${filebuf}")
+    foreach(line ${filebuf})
+        string(FIND "${line}" ": " pos)
+        string(SUBSTRING "${line}" 0 ${pos} key)
+        string(SUBSTRING "${line}" ${pos} -1 value)
+        string(SUBSTRING "${value}" 2 -1 value)
+        set(git_${key} ${value})
+    endforeach()
+    if(DEFINED git_releasetag)
+        set(X265_LATEST_TAG ${git_releasetag})
+        if(DEFINED git_releasetagdistance)
+            set(X265_TAG_DISTANCE ${git_releasetagdistance})
+            if(X265_TAG_DISTANCE STRGREATER "0" OR X265_TAG_DISTANCE
STREQUAL "0")
+                #for x265 the repository changeset has to be a tag id or
commit id after the tag
+                #hence mandating it's presence in version file always for
valid tag distances.
+                if(DEFINED git_repositorychangeset)
+                    string(SUBSTRING "${git_repositorychangeset}" 0 9
X265_REVISION_ID)
+                else()
+                    message(WARNING "X265 LATEST COMMIT TIP INFORMATION
NOT AVAILABLE")
+                endif()
+            else()
+                message(WARNING "X265 TAG DISTANCE INVALID")
+            endif()
+        else()
+            message(WARNING "COMMIT INFORMATION AFTER LATEST REVISION
UNAVAILABLE")
+        endif()
+    else()
+        message(WARNING "X265 RELEASE VERSION LABEL MISSING:
${X265_LATEST_TAG}")
+    endif()
+    message(STATUS "GIT ARCHIVAL INFORMATION PROCESSED")
+else()
+    execute_process(
+        COMMAND
+        ${GIT_EXECUTABLE} describe --abbrev=0 --tags
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        OUTPUT_VARIABLE X265_LATEST_TAG
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+    execute_process(
+        COMMAND
+        ${GIT_EXECUTABLE} rev-list ${X265_LATEST_TAG}.. --count
--first-parent
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        OUTPUT_VARIABLE X265_TAG_DISTANCE
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+    execute_process(
+        COMMAND
+        ${GIT_EXECUTABLE} log --pretty=format:%h -n 1
+        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+        OUTPUT_VARIABLE X265_REVISION_ID
+        ERROR_QUIET
+        OUTPUT_STRIP_TRAILING_WHITESPACE
+        )
+    message(STATUS "GIT LIVE REPO VERSION RETRIEVED")
+endif()
+
+# formatting based on distance from tag
+if(X265_TAG_DISTANCE STREQUAL "0")
+    set(X265_VERSION "${X265_LATEST_TAG}")
+elseif(X265_TAG_DISTANCE STRGREATER "0")
+    set(X265_VERSION
"${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${X265_REVISION_ID}")
+endif()
+
+#will always be printed in its entirety based on version file
configuration to avail revision monitoring by repo owners
+message(STATUS "X265 RELEASE VERSION ${X265_VERSION}")
diff --git a/source/cmake/version.cmake b/source/cmake/version.cmake
deleted file mode 100644
index 3530224..0000000
--- a/source/cmake/version.cmake
+++ /dev/null
@@ -1,97 +0,0 @@
-if(CMAKE_VERSION VERSION_LESS "2.8.10")
-    find_program(HG_EXECUTABLE hg)
-else()
-    find_package(Hg QUIET)
-endif()
-find_package(Git QUIET) # present in 2.8.8
-
-# defaults, in case everything below fails
-set(X265_VERSION "unknown")
-set(X265_LATEST_TAG "0.0")
-set(X265_TAG_DISTANCE "0")
-
-if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)
-    # read the lines of the archive summary file to extract the version
-    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)
-    STRING(REGEX REPLACE "\n" ";" archive "${archive}")
-    foreach(f ${archive})
-        string(FIND "${f}" ": " pos)
-        string(SUBSTRING "${f}" 0 ${pos} key)
-        string(SUBSTRING "${f}" ${pos} -1 value)
-        string(SUBSTRING "${value}" 2 -1 value)
-        set(hg_${key} ${value})
-    endforeach()
-    if(DEFINED hg_tag)
-        set(X265_LATEST_TAG ${hg_tag})
-    elseif(DEFINED hg_node)
-        set(X265_LATEST_TAG ${hg_latesttag})
-        set(X265_TAG_DISTANCE ${hg_latesttagdistance})
-        string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)
-    endif()
-elseif(HG_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)
-    if(EXISTS "${HG_EXECUTABLE}.bat")
-        # mercurial source installs on Windows require .bat extension
-        set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")
-    endif()
-    message(STATUS "hg found at ${HG_EXECUTABLE}")
-
-    execute_process(COMMAND
-        ${HG_EXECUTABLE} log -r. --template "{latesttag}"
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        OUTPUT_VARIABLE X265_LATEST_TAG
-        ERROR_QUIET
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-    execute_process(COMMAND
-        ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        OUTPUT_VARIABLE X265_TAG_DISTANCE
-        ERROR_QUIET
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-    execute_process(
-        COMMAND
-        ${HG_EXECUTABLE} log -r. --template "{node}"
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        OUTPUT_VARIABLE X265_REVISION_ID
-        ERROR_QUIET
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-    string(SUBSTRING "${X265_REVISION_ID}" 0 12 X265_REVISION_ID)
-
-    if(X265_LATEST_TAG MATCHES "^r")
-        string(SUBSTRING ${X265_LATEST_TAG} 1 -1 X265_LATEST_TAG)
-    endif()
-elseif(GIT_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)
-    execute_process(
-        COMMAND
-        ${GIT_EXECUTABLE} describe --abbrev=0 --tags
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        OUTPUT_VARIABLE X265_LATEST_TAG
-        ERROR_QUIET
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-    execute_process(
-        COMMAND
-        ${GIT_EXECUTABLE} rev-list ${X265_LATEST_TAG}.. --count
--first-parent
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        OUTPUT_VARIABLE X265_TAG_DISTANCE
-        ERROR_QUIET
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-    execute_process(
-        COMMAND
-        ${GIT_EXECUTABLE} log -1 --format=g%h
-        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-        OUTPUT_VARIABLE X265_REVISION_ID
-        ERROR_QUIET
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-endif()
-if(X265_TAG_DISTANCE STREQUAL "0")
-    set(X265_VERSION "${X265_LATEST_TAG}")
-else()
-    set(X265_VERSION
"${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${X265_REVISION_ID}")
-endif()
-
-message(STATUS "x265 version ${X265_VERSION}")
diff --git a/x265Version.txt b/x265Version.txt
new file mode 100644
index 0000000..9f01be5
--- /dev/null
+++ b/x265Version.txt
@@ -0,0 +1,4 @@
+#Attribute:     Values
+repositorychangeset: 57022ba54
+releasetagdistance: 1
+releasetag: 3.4.1
-- 
1.8.3.1

On Tue, Aug 3, 2021 at 6:57 PM Janani T E <janani.te at multicorewareinc.com>
wrote:

> From a3dd554074f7f02d6589b4661ec0c403aa4cf0c5 Mon Sep 17 00:00:00 2001
> From: Janani TE <janani.te at multicorewareinc.com>
> Date: Tue, 3 Aug 2021 18:46:47 +0530
> Subject: [PATCH] Update x265Version.txt for Release_3.4
>
> ---
>  source/CMakeLists.txt      |   4 +-
>  source/cmake/Version.cmake | 179
> +++++++++++++++++++++++++++++++++++++++++++++
>  x265Version.txt            |   4 +
>  3 files changed, 185 insertions(+), 2 deletions(-)
>  create mode 100644 source/cmake/Version.cmake
>  create mode 100644 x265Version.txt
>
> diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
> index 1d1a613..f4a9cb7 100644
> --- a/source/CMakeLists.txt
> +++ b/source/CMakeLists.txt
> @@ -29,7 +29,7 @@ option(NATIVE_BUILD "Target the build CPU" OFF)
>  option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
>  mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
>  # X265_BUILD must be incremented each time the public API is changed
> -set(X265_BUILD 192)
> +set(X265_BUILD 201)
>  configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
>                 "${PROJECT_BINARY_DIR}/x265.def")
>  configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
> @@ -485,7 +485,7 @@ if(POWER)
>      endif()
>  endif()
>
> -include(version) # determine X265_VERSION and X265_LATEST_TAG
> +include(Version) # determine X265_VERSION and X265_LATEST_TAG
>  include_directories(. common encoder "${PROJECT_BINARY_DIR}")
>
>  option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)
> diff --git a/source/cmake/Version.cmake b/source/cmake/Version.cmake
> new file mode 100644
> index 0000000..3bbf42f
> --- /dev/null
> +++ b/source/cmake/Version.cmake
> @@ -0,0 +1,179 @@
> +
> #################################################################################################################
> + #
> + #    Copyright (C) 2013-2020 MulticoreWare, Inc
> + #
> + # This program is free software; you can redistribute it and/or modify
> + # it under the terms of the GNU General Public License as published by
> + # the Free Software Foundation; either version 2 of the License, or
> + # (at your option) any later version.
> + #
> + # This program is distributed in the hope that it will be useful,
> + # but WITHOUT ANY WARRANTY; without even the implied warranty of
> + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + # GNU General Public License for more details.
> + #
> + # You should have received a copy of the GNU General Public License
> + # along with this program; if not, write to the Free Software
> + # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111,
> USA.
> + #
> + # This program is also available under a commercial proprietary license.
> + # For more information, contact us at license @ x265.com
> + #
> + # Authors: Janani T.E <janani.te at multicorewareinc.com>, Srikanth
> Kurapati <srikanthkurapati at multicorewareinc.com>
> + #
> +
> #################################################################################################################
> + # PURPOSE: Identity version control software version display, also read
> version files to present x265 version.
> +
> #################################################################################################################
> + #Default Settings, for user to be vigilant about x265 version being
> reported during product build.
> +set(X265_VERSION "unknown")
> +set(X265_LATEST_TAG "0.0")
> +set(X265_TAG_DISTANCE "0")
> +
> +#Find version control software to be used for live and extracted
> repositories from compressed tarballs
> +if(CMAKE_VERSION VERSION_LESS "2.8.10")
> +    find_program(HG_EXECUTABLE hg)
> +    if(EXISTS "${HG_EXECUTABLE}.bat")
> +        set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")
> +    endif()
> +    message(STATUS "hg found at ${HG_EXECUTABLE}")
> +else()
> +    find_package(Hg QUIET)
> +endif()
> +if(HG_EXECUTABLE)
> +    #Set Version Control binary for source code kind
> +    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)
> +        set(HG_ARCHETYPE "1")
> +    elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)
> +        set(HG_ARCHETYPE "0")
> +    endif()
> +endif(HG_EXECUTABLE)
> +find_package(Git QUIET) #No restrictions on Git versions used, any
> versions from 1.8.x to 2.2.x or later should do.
> +if(GIT_FOUND)
> +    find_program(GIT_EXECUTABLE git)
> +    message(STATUS "GIT_EXECUTABLE ${GIT_EXECUTABLE}")
> +    if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)
> +        set(GIT_ARCHETYPE "0")
> +    elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt)
> +        set(GIT_ARCHETYPE "1")
> +    endif()
> +endif(GIT_FOUND)
> +if(HG_ARCHETYPE)
> +    #Read the lines of the archive summary file to extract the version
> +    message(STATUS "SOURCE CODE IS FROM x265 HG ARCHIVED ZIP OR TAR BALL")
> +    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)
> +    STRING(REGEX REPLACE "\n" ";" archive "${archive}")
> +    foreach(f ${archive})
> +        string(FIND "${f}" ": " pos)
> +        string(SUBSTRING "${f}" 0 ${pos} key)
> +        string(SUBSTRING "${f}" ${pos} -1 value)
> +        string(SUBSTRING "${value}" 2 -1 value)
> +        set(hg_${key} ${value})
> +    endforeach()
> +    if(DEFINED hg_tag)
> +        set(X265_LATEST_TAG ${hg_tag})
> +    elseif(DEFINED hg_node)
> +        set(X265_LATEST_TAG ${hg_latesttag})
> +        set(X265_TAG_DISTANCE ${hg_latesttagdistance})
> +        string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)
> +    endif()
> +    message(STATUS "HG ARCHIVAL INFORMATION PROCESSED")
> +elseif(NOT DEFINED GIT_ARCHETYPE)
> +# means that's its neither hg archive nor git clone/archive hence it has
> to be hg live repo as these are only four cases that need to processed in
> mutual exclusion.
> +    execute_process(COMMAND
> +        ${HG_EXECUTABLE} log -r. --template "{latesttag}"
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> +        OUTPUT_VARIABLE X265_LATEST_TAG
> +        ERROR_QUIET
> +        OUTPUT_STRIP_TRAILING_WHITESPACE
> +        )
> +    execute_process(COMMAND
> +        ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> +        OUTPUT_VARIABLE X265_TAG_DISTANCE
> +        ERROR_QUIET
> +        OUTPUT_STRIP_TRAILING_WHITESPACE
> +        )
> +    execute_process(
> +        COMMAND
> +        ${HG_EXECUTABLE} log -r. --template "{node}"
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> +        OUTPUT_VARIABLE X265_REVISION_ID
> +        ERROR_QUIET
> +        OUTPUT_STRIP_TRAILING_WHITESPACE
> +        )
> +    string(SUBSTRING "${X265_REVISION_ID}" 0 12 X265_REVISION_ID)
> +    if(X265_LATEST_TAG MATCHES "^r")
> +        string(SUBSTRING ${X265_LATEST_TAG} 1 -1 X265_LATEST_TAG)
> +    endif()
> +    message(STATUS "HG LIVE REPO STATUS CHECK DONE")
> +elseif(GIT_ARCHETYPE)
> +    message(STATUS "SOURCE CODE IS FROM x265 GIT ARCHIVED ZIP OR TAR
> BALL")
> +    #Read the lines of the archive summary file to extract the version
> +    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt filebuf)
> +    STRING(REGEX REPLACE "\n" ";" filebuf "${filebuf}")
> +    foreach(line ${filebuf})
> +        string(FIND "${line}" ": " pos)
> +        string(SUBSTRING "${line}" 0 ${pos} key)
> +        string(SUBSTRING "${line}" ${pos} -1 value)
> +        string(SUBSTRING "${value}" 2 -1 value)
> +        set(git_${key} ${value})
> +    endforeach()
> +    if(DEFINED git_releasetag)
> +        set(X265_LATEST_TAG ${git_releasetag})
> +        if(DEFINED git_releasetagdistance)
> +            set(X265_TAG_DISTANCE ${git_releasetagdistance})
> +            if(X265_TAG_DISTANCE STRGREATER "0" OR X265_TAG_DISTANCE
> STREQUAL "0")
> +                #for x265 the repository changeset has to be a tag id or
> commit id after the tag
> +                #hence mandating it's presence in version file always for
> valid tag distances.
> +                if(DEFINED git_repositorychangeset)
> +                    string(SUBSTRING "${git_repositorychangeset}" 0 9
> X265_REVISION_ID)
> +                else()
> +                    message(WARNING "X265 LATEST COMMIT TIP INFORMATION
> NOT AVAILABLE")
> +                endif()
> +            else()
> +                message(WARNING "X265 TAG DISTANCE INVALID")
> +            endif()
> +        else()
> +            message(WARNING "COMMIT INFORMATION AFTER LATEST REVISION
> UNAVAILABLE")
> +        endif()
> +    else()
> +        message(WARNING "X265 RELEASE VERSION LABEL MISSING:
> ${X265_LATEST_TAG}")
> +    endif()
> +    message(STATUS "GIT ARCHIVAL INFORMATION PROCESSED")
> +else()
> +    execute_process(
> +        COMMAND
> +        ${GIT_EXECUTABLE} describe --abbrev=0 --tags
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> +        OUTPUT_VARIABLE X265_LATEST_TAG
> +        ERROR_QUIET
> +        OUTPUT_STRIP_TRAILING_WHITESPACE
> +        )
> +    execute_process(
> +        COMMAND
> +        ${GIT_EXECUTABLE} rev-list ${X265_LATEST_TAG}.. --count
> --first-parent
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> +        OUTPUT_VARIABLE X265_TAG_DISTANCE
> +        ERROR_QUIET
> +        OUTPUT_STRIP_TRAILING_WHITESPACE
> +        )
> +    execute_process(
> +        COMMAND
> +        ${GIT_EXECUTABLE} log --pretty=format:%h -n 1
> +        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
> +        OUTPUT_VARIABLE X265_REVISION_ID
> +        ERROR_QUIET
> +        OUTPUT_STRIP_TRAILING_WHITESPACE
> +        )
> +    message(STATUS "GIT LIVE REPO VERSION RETRIEVED")
> +endif()
> +
> +# formatting based on distance from tag
> +if(X265_TAG_DISTANCE STREQUAL "0")
> +    set(X265_VERSION "${X265_LATEST_TAG}")
> +elseif(X265_TAG_DISTANCE STRGREATER "0")
> +    set(X265_VERSION
> "${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${X265_REVISION_ID}")
> +endif()
> +
> +#will always be printed in its entirety based on version file
> configuration to avail revision monitoring by repo owners
> +message(STATUS "X265 RELEASE VERSION ${X265_VERSION}")
> diff --git a/x265Version.txt b/x265Version.txt
> new file mode 100644
> index 0000000..9f01be5
> --- /dev/null
> +++ b/x265Version.txt
> @@ -0,0 +1,4 @@
> +#Attribute:     Values
> +repositorychangeset: 57022ba54
> +releasetagdistance: 1
> +releasetag: 3.4.1
> --
> 1.8.3.1
>
> --
> Thanks and Regards,
> Janani.
>


-- 
Thanks and Regards,
Janani.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20210824/fcb6655d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Update-x265Version.txt-for-Release_3.4.patch
Type: application/octet-stream
Size: 13604 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20210824/fcb6655d/attachment-0001.obj>


More information about the x265-devel mailing list