<div dir="ltr">pushed</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 14, 2020 at 10:03 AM Srikanth Kurapati <<a href="mailto:srikanth.kurapati@multicorewareinc.com">srikanth.kurapati@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">From ba724aa39a938695b821e5f2bda1112687f3dde0 Mon Sep 17 00:00:00 2001<br>From: Srikanth Kurapati <<a href="mailto:srikanth.kurapati@multicorewareinc.com" target="_blank">srikanth.kurapati@multicorewareinc.com</a>><br>Date: Thu, 26 Nov 2020 19:13:42 +0530<br>Subject: [PATCH] Fix version information reporting for x265 git archival<br><br>Release branch 3.5<br>---<br> doc/reST/cli.rst | 17 +++-<br> source/CMakeLists.txt | 2 +-<br> source/cmake/Version.cmake | 193 +++++++++++++++++++++++++++++++++++++<br> source/cmake/version.cmake | 97 -------------------<br> x265Version.txt | 5 +<br> 5 files changed, 214 insertions(+), 100 deletions(-)<br> create mode 100644 source/cmake/Version.cmake<br> delete mode 100644 source/cmake/version.cmake<br> create mode 100644 x265Version.txt<br><br>diff --git a/doc/reST/cli.rst b/doc/reST/cli.rst<br>index dcb240202..f19a28734 100755<br>--- a/doc/reST/cli.rst<br>+++ b/doc/reST/cli.rst<br>@@ -36,13 +36,26 @@ Executable Options<br> <br> .. option:: --help, -h<br> <br>- Display help text<br>+ Displays help text<br> <br> **CLI ONLY**<br> <br> .. option:: --version, -V<br> <br>- Display version details<br>+ Displays version details in the following manner *[Version Name]+/-[Number of commits from the release changeset]-/+[repository's head changeset SHA-1 paraphrase identifier]*<br>+ along with the compilation platform, build information and supported cpu capabilities.<br>+<br>+ In case of release tar balls version information is partly derived from configuration file *x265Version.txt*<br>+ .. seeAlso:: For more information on how to configure the version file please refer to `<<a href="https://bitbucket.org/multicoreware/x265_git/wiki/Home" target="_blank">https://bitbucket.org/multicoreware/x265_git/wiki/Home</a>>`_ and Contribute pages for updates specific<br>+ release and version control management.<br>+<br>+ **Example:**<br>+<br>+ *x265 [info]: HEVC encoder version 3.4+27-'d9217cf00'*<br>+<br>+ *x265 [info]: build info [Windows][MSVC 1916][64 bit] 10bit*<br>+<br>+ *x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2*<br> <br> **CLI ONLY**<br> <br>diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt<br>index 67e737512..95218f5dc 100755<br>--- a/source/CMakeLists.txt<br>+++ b/source/CMakeLists.txt<br>@@ -485,7 +485,7 @@ if(POWER)<br> endif()<br> endif()<br> <br>-include(version) # determine X265_VERSION and X265_LATEST_TAG<br>+include(Version) # determine X265_VERSION and X265_LATEST_TAG<br> include_directories(. common encoder "${PROJECT_BINARY_DIR}")<br> <br> option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)<br>diff --git a/source/cmake/Version.cmake b/source/cmake/Version.cmake<br>new file mode 100644<br>index 000000000..37c759268<br>--- /dev/null<br>+++ b/source/cmake/Version.cmake<br>@@ -0,0 +1,193 @@<br>+ #################################################################################################################<br>+ #<br>+ # Copyright (C) 2013-2020 MulticoreWare, Inc<br>+ #<br>+ # This program is free software; you can redistribute it and/or modify<br>+ # it under the terms of the GNU General Public License as published by<br>+ # the Free Software Foundation; either version 2 of the License, or<br>+ # (at your option) any later version.<br>+ #<br>+ # This program is distributed in the hope that it will be useful,<br>+ # but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>+ # GNU General Public License for more details.<br>+ #<br>+ # You should have received a copy of the GNU General Public License<br>+ # along with this program; if not, write to the Free Software<br>+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.<br>+ #<br>+ # This program is also available under a commercial proprietary license.<br>+ # For more information, contact us at license @ <a href="http://x265.com" target="_blank">x265.com</a><br>+ #<br>+ # Authors: Janani T.E <<a href="mailto:janani.te@multicorewareinc.com" target="_blank">janani.te@multicorewareinc.com</a>>, Srikanth Kurapati <<a href="mailto:srikanthkurapati@multicorewareinc.com" target="_blank">srikanthkurapati@multicorewareinc.com</a>><br>+ #<br>+ #################################################################################################################<br>+ # PURPOSE: Identity version control software version display, also read version files to present x265 version.<br>+ #################################################################################################################<br>+ #Default Settings, for user to be vigilant about x265 version being reported during product build.<br>+set(X265_VERSION "unknown")<br>+set(X265_LATEST_TAG "0.0")<br>+set(X265_TAG_DISTANCE "0")<br>+set(HG_ARCHETYPE "0")<br>+set(GIT_ARCHETYPE "0")<br>+<br>+#Find version control software to be used for live and extracted repositories from compressed tarballs<br>+if(CMAKE_VERSION VERSION_LESS "2.8.10")<br>+ find_program(HG_EXECUTABLE hg)<br>+ if(EXISTS "${HG_EXECUTABLE}.bat")<br>+ set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")<br>+ endif()<br>+ message(STATUS "hg found at ${HG_EXECUTABLE}")<br>+else()<br>+ find_package(Hg QUIET)<br>+endif()<br>+if(HG_EXECUTABLE)<br>+ #Set Version Control binary for source code kind<br>+ if(EXISTS CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)<br>+ set(HG_ARCHETYPE "1")<br>+ elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)<br>+ set(HG_ARCHETYPE "2")<br>+ endif()<br>+endif(HG_EXECUTABLE)<br>+find_package(Git QUIET) #No restrictions on Git versions used, any versions from 1.8.x to 2.2.x or later should do.<br>+if(Git_FOUND)<br>+ find_program(GIT_EXECUTABLE git)<br>+ message(STATUS "GIT_EXECUTABLE ${GIT_EXECUTABLE}")<br>+ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)<br>+ set(GIT_ARCHETYPE "2")<br>+ elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt)<br>+ set(GIT_ARCHETYPE "1")<br>+ endif()<br>+endif(Git_FOUND)<br>+if(HG_ARCHETYPE STREQUAL "1")<br>+ #Read the lines of the archive summary file to extract the version<br>+ message(STATUS "SOURCE CODE IS FROM x265 ARCHIVED ZIP OR TAR BALL")<br>+ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)<br>+ STRING(REGEX REPLACE "\n" ";" archive "${archive}")<br>+ foreach(f ${archive})<br>+ string(FIND "${f}" ": " pos)<br>+ string(SUBSTRING "${f}" 0 ${pos} key)<br>+ string(SUBSTRING "${f}" ${pos} -1 value)<br>+ string(SUBSTRING "${value}" 2 -1 value)<br>+ set(hg_${key} ${value})<br>+ endforeach()<br>+ if(DEFINED hg_tag)<br>+ set(X265_LATEST_TAG ${hg_tag})<br>+ elseif(DEFINED hg_node)<br>+ set(X265_LATEST_TAG ${hg_latesttag})<br>+ set(X265_TAG_DISTANCE ${hg_latesttagdistance})<br>+ string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)<br>+ endif()<br>+ message(STATUS "HG ARCHIVAL INFORMATION PROCESSED")<br>+elseif(HG_ARCHETYPE STREQUAL "2")<br>+ execute_process(COMMAND<br>+ ${HG_EXECUTABLE} log -r. --template "{latesttag}"<br>+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+ OUTPUT_VARIABLE X265_LATEST_TAG<br>+ ERROR_QUIET<br>+ OUTPUT_STRIP_TRAILING_WHITESPACE<br>+ )<br>+ execute_process(COMMAND<br>+ ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"<br>+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+ OUTPUT_VARIABLE X265_TAG_DISTANCE<br>+ ERROR_QUIET<br>+ OUTPUT_STRIP_TRAILING_WHITESPACE<br>+ )<br>+ execute_process(<br>+ COMMAND<br>+ ${HG_EXECUTABLE} log -r. --template "{node}"<br>+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+ OUTPUT_VARIABLE X265_REVISION_ID<br>+ ERROR_QUIET<br>+ OUTPUT_STRIP_TRAILING_WHITESPACE<br>+ )<br>+ string(SUBSTRING "${X265_REVISION_ID}" 0 12 X265_REVISION_ID)<br>+ if(X265_LATEST_TAG MATCHES "^r")<br>+ string(SUBSTRING ${X265_LATEST_TAG} 1 -1 X265_LATEST_TAG)<br>+ endif()<br>+ message(STATUS "HG LIVE REPO STATUS CHECK DONE")<br>+elseif(GIT_ARCHETYPE STREQUAL "2")<br>+ execute_process(<br>+ COMMAND<br>+ ${GIT_EXECUTABLE} describe --abbrev=0 --tags<br>+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+ OUTPUT_VARIABLE X265_LATEST_TAG<br>+ ERROR_QUIET<br>+ OUTPUT_STRIP_TRAILING_WHITESPACE<br>+ )<br>+ execute_process(<br>+ COMMAND<br>+ ${GIT_EXECUTABLE} rev-list ${X265_LATEST_TAG}.. --count --first-parent<br>+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+ OUTPUT_VARIABLE X265_TAG_DISTANCE<br>+ ERROR_QUIET<br>+ OUTPUT_STRIP_TRAILING_WHITESPACE<br>+ )<br>+ execute_process(<br>+ COMMAND<br>+ ${GIT_EXECUTABLE} log --pretty=format:%h -n 1<br>+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>+ OUTPUT_VARIABLE X265_REVISION_ID<br>+ ERROR_QUIET<br>+ OUTPUT_STRIP_TRAILING_WHITESPACE<br>+ )<br>+elseif(GIT_ARCHETYPE STREQUAL "1")<br>+ message(STATUS "X265 GIT ARCHIVE EXTRACT VERSION INFORMATION PROCESSING")<br>+ #Read the lines of the archive summary file to extract the version<br>+ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../x265Version.txt filebuf)<br>+ STRING(REGEX REPLACE "\n" ";" filebuf "${filebuf}")<br>+ foreach(line ${filebuf})<br>+ string(FIND "${line}" ": " pos)<br>+ string(SUBSTRING "${line}" 0 ${pos} key)<br>+ string(SUBSTRING "${line}" ${pos} -1 value)<br>+ string(SUBSTRING "${value}" 2 -1 value)<br>+ set(git_${key} ${value})<br>+ endforeach()<br>+ if(DEFINED git_releasetag)<br>+ set(X265_LATEST_TAG ${git_releasetag})<br>+ if(DEFINED git_releasetagcommitid)<br>+ string(SUBSTRING "${git_releasetagcommitid}" 0 9 X265_REVISION_ID)<br>+ else()<br>+ message(WARNING "RELEASE CHANGESET INFO NOT PRESENT IN VERSION FILE")<br>+ endif()<br>+ if(DEFINED git_repositorychangeset)<br>+ string(SUBSTRING "${git_repositorychangeset}" 0 9 X265_REPO_ID)<br>+ else()<br>+ message(STATUS "X265 LATEST COMMIT TIP INFORMATION NOT AVAILABLE")<br>+ endif()<br>+ if(DEFINED git_releasetagdistance)<br>+ set(X265_TAG_DISTANCE ${git_releasetagdistance})<br>+ else()<br>+ message(WARNING "COMMIT INFORMATION AFTER LATEST REVISION UNAVAILABLE")<br>+ endif()<br>+ else()<br>+ message(WARNING "X265 RELEASE VERSION LABEL MISSING: ${X265_LATEST_TAG}")<br>+ endif()<br>+endif()<br>+<br>+# formatting based on positive or negative distance from tag<br>+if(X265_TAG_DISTANCE STREQUAL "0")<br>+ if(X265_REVISION_ID STREQUAL X265_REPO_ID)<br>+ set(X265_VERSION "${X265_LATEST_TAG}")<br>+ else()<br>+ message(WARNING "REPO AND RELEASE CHANGESETS NOT MATCHING")<br>+ endif()<br>+elseif(X265_TAG_DISTANCE STRGREATER "0")<br>+ if(X265_REVISION_ID STRLESS X265_REPO_ID)<br>+ set(X265_VERSION "${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${X265_REVISION_ID}")<br>+ else()<br>+ message(WARNING "ARCCHIVE TIP CHANGESET TO BE GREATER THAN REVISION ID")<br>+ endif()<br>+elseif(X265_TAG_DISTANCE STRLESS "0")<br>+ if(X265_REVISION_ID STRGREATER X265_REPO_ID)<br>+ set(X265_VERSION "${X265_LATEST_TAG}${X265_TAG_DISTANCE}+${X265_REPO_ID}")<br>+ else()<br>+ message(WARNING "REVISION ID EXPECTED TO BE LARGER THAN ARCHIVE TIP CHANGESET")<br>+ endif()<br>+else()<br>+ message(ERROR "Inappropriate set of version information")<br>+endif()<br>+<br>+#will always be printed in its entirety based on version file configuration to avail revision monitoring by repo owners<br>+message(STATUS "x265 RELEASE VERSION ${X265_VERSION}")<br>diff --git a/source/cmake/version.cmake b/source/cmake/version.cmake<br>deleted file mode 100644<br>index 35302249a..000000000<br>--- a/source/cmake/version.cmake<br>+++ /dev/null<br>@@ -1,97 +0,0 @@<br>-if(CMAKE_VERSION VERSION_LESS "2.8.10")<br>- find_program(HG_EXECUTABLE hg)<br>-else()<br>- find_package(Hg QUIET)<br>-endif()<br>-find_package(Git QUIET) # present in 2.8.8<br>-<br>-# defaults, in case everything below fails<br>-set(X265_VERSION "unknown")<br>-set(X265_LATEST_TAG "0.0")<br>-set(X265_TAG_DISTANCE "0")<br>-<br>-if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt)<br>- # read the lines of the archive summary file to extract the version<br>- file(READ ${CMAKE_CURRENT_SOURCE_DIR}/../.hg_archival.txt archive)<br>- STRING(REGEX REPLACE "\n" ";" archive "${archive}")<br>- foreach(f ${archive})<br>- string(FIND "${f}" ": " pos)<br>- string(SUBSTRING "${f}" 0 ${pos} key)<br>- string(SUBSTRING "${f}" ${pos} -1 value)<br>- string(SUBSTRING "${value}" 2 -1 value)<br>- set(hg_${key} ${value})<br>- endforeach()<br>- if(DEFINED hg_tag)<br>- set(X265_LATEST_TAG ${hg_tag})<br>- elseif(DEFINED hg_node)<br>- set(X265_LATEST_TAG ${hg_latesttag})<br>- set(X265_TAG_DISTANCE ${hg_latesttagdistance})<br>- string(SUBSTRING "${hg_node}" 0 12 X265_REVISION_ID)<br>- endif()<br>-elseif(HG_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.hg)<br>- if(EXISTS "${HG_EXECUTABLE}.bat")<br>- # mercurial source installs on Windows require .bat extension<br>- set(HG_EXECUTABLE "${HG_EXECUTABLE}.bat")<br>- endif()<br>- message(STATUS "hg found at ${HG_EXECUTABLE}")<br>-<br>- execute_process(COMMAND<br>- ${HG_EXECUTABLE} log -r. --template "{latesttag}"<br>- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>- OUTPUT_VARIABLE X265_LATEST_TAG<br>- ERROR_QUIET<br>- OUTPUT_STRIP_TRAILING_WHITESPACE<br>- )<br>- execute_process(COMMAND<br>- ${HG_EXECUTABLE} log -r. --template "{latesttagdistance}"<br>- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>- OUTPUT_VARIABLE X265_TAG_DISTANCE<br>- ERROR_QUIET<br>- OUTPUT_STRIP_TRAILING_WHITESPACE<br>- )<br>- execute_process(<br>- COMMAND<br>- ${HG_EXECUTABLE} log -r. --template "{node}"<br>- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>- OUTPUT_VARIABLE X265_REVISION_ID<br>- ERROR_QUIET<br>- OUTPUT_STRIP_TRAILING_WHITESPACE<br>- )<br>- string(SUBSTRING "${X265_REVISION_ID}" 0 12 X265_REVISION_ID)<br>-<br>- if(X265_LATEST_TAG MATCHES "^r")<br>- string(SUBSTRING ${X265_LATEST_TAG} 1 -1 X265_LATEST_TAG)<br>- endif()<br>-elseif(GIT_EXECUTABLE AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../.git)<br>- execute_process(<br>- COMMAND<br>- ${GIT_EXECUTABLE} describe --abbrev=0 --tags<br>- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>- OUTPUT_VARIABLE X265_LATEST_TAG<br>- ERROR_QUIET<br>- OUTPUT_STRIP_TRAILING_WHITESPACE<br>- )<br>- execute_process(<br>- COMMAND<br>- ${GIT_EXECUTABLE} rev-list ${X265_LATEST_TAG}.. --count --first-parent<br>- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>- OUTPUT_VARIABLE X265_TAG_DISTANCE<br>- ERROR_QUIET<br>- OUTPUT_STRIP_TRAILING_WHITESPACE<br>- )<br>- execute_process(<br>- COMMAND<br>- ${GIT_EXECUTABLE} log -1 --format=g%h<br>- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}<br>- OUTPUT_VARIABLE X265_REVISION_ID<br>- ERROR_QUIET<br>- OUTPUT_STRIP_TRAILING_WHITESPACE<br>- )<br>-endif()<br>-if(X265_TAG_DISTANCE STREQUAL "0")<br>- set(X265_VERSION "${X265_LATEST_TAG}")<br>-else()<br>- set(X265_VERSION "${X265_LATEST_TAG}+${X265_TAG_DISTANCE}-${X265_REVISION_ID}")<br>-endif()<br>-<br>-message(STATUS "x265 version ${X265_VERSION}")<br>diff --git a/x265Version.txt b/x265Version.txt<br>new file mode 100644<br>index 000000000..ea179871e<br>--- /dev/null<br>+++ b/x265Version.txt<br>@@ -0,0 +1,5 @@<br>+#Attribute: Values<br>+repositorychangeset: 6722fce1f<br>+releasetagcommitid: a4f320054<br>+releasetagdistance: 31<br>+releasetag: 3.4<br>-- <br>2.20.1.windows.1<br><br><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><b style="background-color:rgb(255,255,255)"><font color="#0b5394">With Regards,</font></b><div><b style="background-color:rgb(255,255,255)"><font color="#0b5394">Srikanth Kurapati.</font></b></div></div></div></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font face="georgia, serif">Regards,</font><div><b><font face="georgia, serif">Aruna Matheswaran,</font></b></div><div><font face="georgia, serif">Video Codec Engineer,</font></div><div><font face="georgia, serif">Media & AI analytics BU,</font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" width="96" height="36" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><span style="border:none;display:inline-block;overflow:hidden;width:153px;height:58px"><img src="https://lh5.googleusercontent.com/gjX5cPNIZgwUrhfqkTwQUZWztIKmmo0qs3kbwvkS5H-bDVE2ftte9pMTVnFLSjOcjYWLtfc6_OGpxW4vraLg2r5QAIf1Q3MpldFDgWtzK_gXi8ptw5B3joIbsGL6mxj-JRdjHzT5" style="margin-left: 0px; margin-top: 0px;"></span></span></span><font face="georgia, serif"><br></font></div><div><font face="georgia, serif"><br></font></div></div></div></div></div></div></div></div></div>