make-version.py: Add support for Stratoshark version tags
This commit is contained in:
parent
2632c259e8
commit
9fbd4f4779
@ -280,7 +280,7 @@ Source Package:
|
|||||||
- !reference [.if-w-w-only-merged]
|
- !reference [.if-w-w-only-merged]
|
||||||
- !reference [.if-2x-daily-schedule]
|
- !reference [.if-2x-daily-schedule]
|
||||||
script:
|
script:
|
||||||
- ../tools/make-version.py --set-release --version-file=wireshark_version.txt ..
|
- ../tools/make-version.py --set-release --wireshark-version-file=wireshark_version.txt ..
|
||||||
- ../tools/update-appdata.py
|
- ../tools/update-appdata.py
|
||||||
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
|
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
|
||||||
- cmake -G Ninja $CMAKE_ARGS ..
|
- cmake -G Ninja $CMAKE_ARGS ..
|
||||||
@ -437,7 +437,7 @@ Arch Linux :
|
|||||||
image: registry.gitlab.com/wireshark/wireshark-containers/arch-dev
|
image: registry.gitlab.com/wireshark/wireshark-containers/arch-dev
|
||||||
script:
|
script:
|
||||||
- COMMON_PACMAN_ARGS="--sync --refresh --sysupgrade --needed --noconfirm"
|
- COMMON_PACMAN_ARGS="--sync --refresh --sysupgrade --needed --noconfirm"
|
||||||
- ./tools/make-version.py --set-release --version-file=wireshark_version.txt .
|
- ./tools/make-version.py --set-release --wireshark-version-file=wireshark_version.txt .
|
||||||
- WIRESHARK_VERSION=$(cat wireshark_version.txt)
|
- WIRESHARK_VERSION=$(cat wireshark_version.txt)
|
||||||
- WIRESHARK_PREFIX="/opt/wireshark-$WIRESHARK_VERSION"
|
- WIRESHARK_PREFIX="/opt/wireshark-$WIRESHARK_VERSION"
|
||||||
# There are no falcosecurity/libs or falcosecurity/plugins packages for Arch,
|
# There are no falcosecurity/libs or falcosecurity/plugins packages for Arch,
|
||||||
@ -495,7 +495,7 @@ Windows x64 Package:
|
|||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
script:
|
script:
|
||||||
- C:\Windows\py.exe ..\tools\make-version.py --set-release --version-file=wireshark_version.txt ..
|
- C:\Windows\py.exe ..\tools\make-version.py --set-release --wireshark-version-file=wireshark_version.txt --stratoshark-version-file=stratoshark_version.txt ..
|
||||||
- cmake -G "Visual Studio 17 2022" -A x64 -DENABLE_LTO=off -DBUILD_stratoshark=on -DBUILD_sshdig=on -DBUILD_falcodump=on -DENABLE_SIGNED_NSIS=on ..
|
- cmake -G "Visual Studio 17 2022" -A x64 -DENABLE_LTO=off -DBUILD_stratoshark=on -DBUILD_sshdig=on -DBUILD_falcodump=on -DENABLE_SIGNED_NSIS=on ..
|
||||||
- msbuild /verbosity:minimal "/consoleloggerparameters:PerformanceSummary;NoSummary" /maxcpucount Wireshark.sln
|
- msbuild /verbosity:minimal "/consoleloggerparameters:PerformanceSummary;NoSummary" /maxcpucount Wireshark.sln
|
||||||
- msbuild /verbosity:minimal /maxcpucount test-programs.vcxproj
|
- msbuild /verbosity:minimal /maxcpucount test-programs.vcxproj
|
||||||
@ -519,6 +519,7 @@ Windows x64 Package:
|
|||||||
- if (Test-Path env:MC_DESTINATION_WINDOWS_X64) { C:\gitlab-builds\bin\mc --quiet cp $packages "$env:MC_DESTINATION_WINDOWS_X64/" }
|
- if (Test-Path env:MC_DESTINATION_WINDOWS_X64) { C:\gitlab-builds\bin\mc --quiet cp $packages "$env:MC_DESTINATION_WINDOWS_X64/" }
|
||||||
- $nsisSha256 = (Get-FileHash -Algorithm SHA256 .\packaging\nsis\Wireshark-*-x64.exe).Hash
|
- $nsisSha256 = (Get-FileHash -Algorithm SHA256 .\packaging\nsis\Wireshark-*-x64.exe).Hash
|
||||||
- $wiresharkVersion = Get-Content .\wireshark_version.txt
|
- $wiresharkVersion = Get-Content .\wireshark_version.txt
|
||||||
|
- $stratosharkVersion = Get-Content .\stratoshark_version.txt
|
||||||
- Set-Content -Path release-info-$($wiresharkVersion)-windows-x64.ini -Value ("[DEFAULT]`nnsis_sha256 = $nsisSha256")
|
- Set-Content -Path release-info-$($wiresharkVersion)-windows-x64.ini -Value ("[DEFAULT]`nnsis_sha256 = $nsisSha256")
|
||||||
- if (Test-Path env:MC_DESTINATION_RELEASE) { C:\gitlab-builds\bin\mc --quiet cp release-info-$($wiresharkVersion)-windows-x64.ini "$env:MC_DESTINATION_RELEASE/" }
|
- if (Test-Path env:MC_DESTINATION_RELEASE) { C:\gitlab-builds\bin\mc --quiet cp release-info-$($wiresharkVersion)-windows-x64.ini "$env:MC_DESTINATION_RELEASE/" }
|
||||||
- C:\Windows\py.exe -m pytest
|
- C:\Windows\py.exe -m pytest
|
||||||
@ -540,7 +541,7 @@ Windows Arm64 Package:
|
|||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
script:
|
script:
|
||||||
- C:\Windows\py.exe ..\tools\make-version.py --set-release --version-file=wireshark_version.txt ..
|
- C:\Windows\py.exe ..\tools\make-version.py --set-release --wireshark-version-file=wireshark_version.txt --stratoshark-version-file=stratoshark_version.txt ..
|
||||||
- cmake -G "Visual Studio 17 2022" -A arm64 -DENABLE_LTO=off -DBUILD_stratoshark=on -DBUILD_sshdig=on -DBUILD_falcodump=on -DENABLE_SIGNED_NSIS=on ..
|
- cmake -G "Visual Studio 17 2022" -A arm64 -DENABLE_LTO=off -DBUILD_stratoshark=on -DBUILD_sshdig=on -DBUILD_falcodump=on -DENABLE_SIGNED_NSIS=on ..
|
||||||
- msbuild /verbosity:minimal "/consoleloggerparameters:PerformanceSummary;NoSummary" /maxcpucount Wireshark.sln
|
- msbuild /verbosity:minimal "/consoleloggerparameters:PerformanceSummary;NoSummary" /maxcpucount Wireshark.sln
|
||||||
- msbuild /verbosity:minimal /maxcpucount test-programs.vcxproj
|
- msbuild /verbosity:minimal /maxcpucount test-programs.vcxproj
|
||||||
@ -558,6 +559,7 @@ Windows Arm64 Package:
|
|||||||
- if (Test-Path env:MC_DESTINATION_WINDOWS_ARM64) { C:\gitlab-builds\bin\mc --quiet cp $packages "$env:MC_DESTINATION_WINDOWS_ARM64/" }
|
- if (Test-Path env:MC_DESTINATION_WINDOWS_ARM64) { C:\gitlab-builds\bin\mc --quiet cp $packages "$env:MC_DESTINATION_WINDOWS_ARM64/" }
|
||||||
- $nsisSha256 = (Get-FileHash -Algorithm SHA256 .\packaging\nsis\Wireshark-*-arm64.exe).Hash
|
- $nsisSha256 = (Get-FileHash -Algorithm SHA256 .\packaging\nsis\Wireshark-*-arm64.exe).Hash
|
||||||
- $wiresharkVersion = Get-Content .\wireshark_version.txt
|
- $wiresharkVersion = Get-Content .\wireshark_version.txt
|
||||||
|
- $stratosharkVersion = Get-Content .\stratoshark_version.txt
|
||||||
- Set-Content -Path release-info-$($wiresharkVersion)-windows-arm64.ini -Value ("[DEFAULT]`nnsis_sha256 = $nsisSha256")
|
- Set-Content -Path release-info-$($wiresharkVersion)-windows-arm64.ini -Value ("[DEFAULT]`nnsis_sha256 = $nsisSha256")
|
||||||
- if (Test-Path env:MC_DESTINATION_RELEASE) { C:\gitlab-builds\bin\mc --quiet cp release-info-$($wiresharkVersion)-windows-arm64.ini "$env:MC_DESTINATION_RELEASE/" }
|
- if (Test-Path env:MC_DESTINATION_RELEASE) { C:\gitlab-builds\bin\mc --quiet cp release-info-$($wiresharkVersion)-windows-arm64.ini "$env:MC_DESTINATION_RELEASE/" }
|
||||||
- C:\Windows\py.exe -m pytest
|
- C:\Windows\py.exe -m pytest
|
||||||
@ -594,7 +596,7 @@ macOS Arm Package:
|
|||||||
- export PATH="$PATH:$HOME/bin"
|
- export PATH="$PATH:$HOME/bin"
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- ../tools/make-version.py --set-release --version-file=wireshark_version.txt ..
|
- ../tools/make-version.py --set-release --wireshark-version-file=wireshark_version.txt --stratoshark-version-file=stratoshark_version.txt ..
|
||||||
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
|
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
|
||||||
- cmake -DENABLE_CCACHE=ON -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES=arm64 -DBUILD_stratoshark=on -DBUILD_sshdig=on -DBUILD_falcodump=on -DFALCO_PLUGINS=/usr/local/lib/falco-plugins/libcloudtrail.so -DTEST_EXTRA_ARGS=--enable-release -G Ninja ..
|
- cmake -DENABLE_CCACHE=ON -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_OSX_ARCHITECTURES=arm64 -DBUILD_stratoshark=on -DBUILD_sshdig=on -DBUILD_falcodump=on -DFALCO_PLUGINS=/usr/local/lib/falco-plugins/libcloudtrail.so -DTEST_EXTRA_ARGS=--enable-release -G Ninja ..
|
||||||
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
|
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
|
||||||
@ -622,6 +624,7 @@ macOS Arm Package:
|
|||||||
- $CI_PROJECT_DIR/build/run/tshark --version
|
- $CI_PROJECT_DIR/build/run/tshark --version
|
||||||
- DMG_SHA256=$( shasum --algorithm 256 Wireshark?[1-9]*.dmg | awk '{print $1}' )
|
- DMG_SHA256=$( shasum --algorithm 256 Wireshark?[1-9]*.dmg | awk '{print $1}' )
|
||||||
- WIRESHARK_VERSION=$(< ../wireshark_version.txt)
|
- WIRESHARK_VERSION=$(< ../wireshark_version.txt)
|
||||||
|
- STRATOSHARK_VERSION=$(< ../stratoshark_version.txt)
|
||||||
- printf '[DEFAULT]\nsparkle_signature = %s\ndmg_sha256 = %s\n' "$SPARKLE_SIGNATURE" "$DMG_SHA256" > release-info-${WIRESHARK_VERSION}-macos-arm64.ini
|
- printf '[DEFAULT]\nsparkle_signature = %s\ndmg_sha256 = %s\n' "$SPARKLE_SIGNATURE" "$DMG_SHA256" > release-info-${WIRESHARK_VERSION}-macos-arm64.ini
|
||||||
- if [[ -n "$S3_DESTINATION_RELEASE" ]] ; then aws s3 cp release-info-${WIRESHARK_VERSION}-macos-arm64.ini "$S3_DESTINATION_RELEASE/" ; fi
|
- if [[ -n "$S3_DESTINATION_RELEASE" ]] ; then aws s3 cp release-info-${WIRESHARK_VERSION}-macos-arm64.ini "$S3_DESTINATION_RELEASE/" ; fi
|
||||||
- cd ..
|
- cd ..
|
||||||
@ -646,7 +649,7 @@ macOS Intel Package:
|
|||||||
- export PATH="$PATH:$HOME/bin"
|
- export PATH="$PATH:$HOME/bin"
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- ../tools/make-version.py --set-release --version-file=wireshark_version.txt ..
|
- ../tools/make-version.py --set-release --wireshark-version-file=wireshark_version.txt --stratoshark-version-file=stratoshark_version.txt ..
|
||||||
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
|
- printf "\e[0Ksection_start:%s:cmake_section[collapsed=true]\r\e[0KRunning CMake" "$( date +%s)"
|
||||||
- cmake -DENABLE_CCACHE=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DBUILD_stratoshark=on -DBUILD_sshdig=on -DBUILD_falcodump=on -DFALCO_PLUGINS=/usr/local/lib/falco-plugins/libcloudtrail.so -DTEST_EXTRA_ARGS=--enable-release -G Ninja ..
|
- cmake -DENABLE_CCACHE=ON -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DBUILD_stratoshark=on -DBUILD_sshdig=on -DBUILD_falcodump=on -DFALCO_PLUGINS=/usr/local/lib/falco-plugins/libcloudtrail.so -DTEST_EXTRA_ARGS=--enable-release -G Ninja ..
|
||||||
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
|
- printf "\e[0Ksection_end:%s:cmake_section\r\e[0K" "$( date +%s)"
|
||||||
@ -674,6 +677,7 @@ macOS Intel Package:
|
|||||||
- $CI_PROJECT_DIR/build/run/tshark --version
|
- $CI_PROJECT_DIR/build/run/tshark --version
|
||||||
- DMG_SHA256=$( shasum --algorithm 256 Wireshark?[1-9]*.dmg | awk '{print $1}' )
|
- DMG_SHA256=$( shasum --algorithm 256 Wireshark?[1-9]*.dmg | awk '{print $1}' )
|
||||||
- WIRESHARK_VERSION=$(< ../wireshark_version.txt)
|
- WIRESHARK_VERSION=$(< ../wireshark_version.txt)
|
||||||
|
- STRATOSHARK_VERSION=$(< ../stratoshark_version.txt)
|
||||||
- printf '[DEFAULT]\nsparkle_signature = %s\ndmg_sha256 = %s\n' "$SPARKLE_SIGNATURE" "$DMG_SHA256" > release-info-${WIRESHARK_VERSION}-macos-intel64.ini
|
- printf '[DEFAULT]\nsparkle_signature = %s\ndmg_sha256 = %s\n' "$SPARKLE_SIGNATURE" "$DMG_SHA256" > release-info-${WIRESHARK_VERSION}-macos-intel64.ini
|
||||||
- if [[ -n "$S3_DESTINATION_RELEASE" ]] ; then aws s3 cp release-info-${WIRESHARK_VERSION}-macos-intel64.ini "$S3_DESTINATION_RELEASE/" ; fi
|
- if [[ -n "$S3_DESTINATION_RELEASE" ]] ; then aws s3 cp release-info-${WIRESHARK_VERSION}-macos-intel64.ini "$S3_DESTINATION_RELEASE/" ; fi
|
||||||
- cd ..
|
- cd ..
|
||||||
|
@ -65,7 +65,7 @@ set(STRATOSHARK_MAJOR_VERSION 0)
|
|||||||
set(STRATOSHARK_MINOR_VERSION 9)
|
set(STRATOSHARK_MINOR_VERSION 9)
|
||||||
set(STRATOSHARK_PATCH_VERSION 0)
|
set(STRATOSHARK_PATCH_VERSION 0)
|
||||||
set(STRATOSHARK_BUILD_VERSION 0)
|
set(STRATOSHARK_BUILD_VERSION 0)
|
||||||
set(STRATOSHARK_VERSION_EXTENSION ${PROJECT_VERSION_EXTENSION})
|
set(STRATOSHARK_VERSION_EXTENSION "")
|
||||||
|
|
||||||
if(DEFINED ENV{STRATOSHARK_VERSION_EXTRA})
|
if(DEFINED ENV{STRATOSHARK_VERSION_EXTRA})
|
||||||
set(STRATOSHARK_VERSION_EXTENSION "$ENV{STRATOSHARK_VERSION_EXTRA}")
|
set(STRATOSHARK_VERSION_EXTENSION "$ENV{STRATOSHARK_VERSION_EXTRA}")
|
||||||
|
@ -58,7 +58,7 @@ Using Wireshark’s GitLab project you can:
|
|||||||
Like most revision control systems, Git uses
|
Like most revision control systems, Git uses
|
||||||
https://en.wikipedia.org/wiki/Branching_%28revision_control%29[branching]
|
https://en.wikipedia.org/wiki/Branching_%28revision_control%29[branching]
|
||||||
to manage different copies of the source code and allow parallel development.
|
to manage different copies of the source code and allow parallel development.
|
||||||
Wireshark uses the following branch naming conventions:
|
Wireshark releases use the following branch naming conventions:
|
||||||
|
|
||||||
.master.
|
.master.
|
||||||
Main feature development and odd-numbered development releases.
|
Main feature development and odd-numbered development releases.
|
||||||
@ -66,9 +66,11 @@ Main feature development and odd-numbered development releases.
|
|||||||
.release-x.y.
|
.release-x.y.
|
||||||
Stable release maintenance. For example, release-4.4 is used to manage the 4.4.x official releases.
|
Stable release maintenance. For example, release-4.4 is used to manage the 4.4.x official releases.
|
||||||
|
|
||||||
Tags for major releases and release candidates consist of a “v” followed by a version number such as “v4.4.1” or “v4.4.3rc0”.
|
Tags for major Wireshark releases and release candidates consist of a “v” followed by a version number such as “v4.4.1” or “v4.4.3rc0”.
|
||||||
Major releases additionally have a tag prefixed with “wireshark-” followed by a version number, such as “wireshark-4.4.0”.
|
Major releases additionally have a tag prefixed with “wireshark-” followed by a version number, such as “wireshark-4.4.0”.
|
||||||
|
|
||||||
|
Tags for major Stratoshark releases and release candidates consist of an “ssv” followed by a version number such as “ssv1.2.3” or “ssv1.3.4rc0”.
|
||||||
|
|
||||||
Tags created after August 1, 2024 are signed using SSH. This includes the tags for versions 4.4.0rc1, 4.4.0, 4.2.7, and 4.0.17. If you wish to verify these tags, you must have
|
Tags created after August 1, 2024 are signed using SSH. This includes the tags for versions 4.4.0rc1, 4.4.0, 4.2.7, and 4.0.17. If you wish to verify these tags, you must have
|
||||||
https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgsshallowedSignersFile[gpg.ssh.allowedSignersFile]
|
https://git-scm.com/docs/git-config#Documentation/git-config.txt-gpgsshallowedSignersFile[gpg.ssh.allowedSignersFile]
|
||||||
configured and have the following entry in your “allowed signers” file:
|
configured and have the following entry in your “allowed signers” file:
|
||||||
|
@ -34,6 +34,10 @@ import shutil
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
Flavor = Enum('Flavor', ['Wireshark', 'Stratoshark'])
|
||||||
|
|
||||||
GIT_ABBREV_LENGTH = 12
|
GIT_ABBREV_LENGTH = 12
|
||||||
|
|
||||||
# `git archive` will use an 'export-subst' entry in .gitattributes to replace
|
# `git archive` will use an 'export-subst' entry in .gitattributes to replace
|
||||||
@ -50,7 +54,7 @@ IS_GIT_ARCHIVE = not GIT_EXPORT_SUBST_H.startswith('$Format')
|
|||||||
|
|
||||||
|
|
||||||
def update_cmakelists_txt(src_dir, set_version, repo_data):
|
def update_cmakelists_txt(src_dir, set_version, repo_data):
|
||||||
if not set_version and repo_data['package_string'] == "":
|
if not set_version and repo_data['ws_package_string'] == "" and repo_data['ss_package_string'] == "":
|
||||||
return
|
return
|
||||||
|
|
||||||
cmake_filepath = os.path.join(src_dir, "CMakeLists.txt")
|
cmake_filepath = os.path.join(src_dir, "CMakeLists.txt")
|
||||||
@ -58,26 +62,38 @@ def update_cmakelists_txt(src_dir, set_version, repo_data):
|
|||||||
with open(cmake_filepath, encoding='utf-8') as fh:
|
with open(cmake_filepath, encoding='utf-8') as fh:
|
||||||
cmake_contents = fh.read()
|
cmake_contents = fh.read()
|
||||||
|
|
||||||
MAJOR_PATTERN = r"^set *\( *PROJECT_MAJOR_VERSION *\d+ *\)$"
|
|
||||||
MINOR_PATTERN = r"^set *\( *PROJECT_MINOR_VERSION *\d+ *\)$"
|
|
||||||
PATCH_PATTERN = r"^set *\( *PROJECT_PATCH_VERSION *\d+ *\)$"
|
|
||||||
VERSION_EXTENSION_PATTERN = r"^set *\( *PROJECT_VERSION_EXTENSION .*?$"
|
|
||||||
|
|
||||||
new_cmake_contents = cmake_contents
|
new_cmake_contents = cmake_contents
|
||||||
new_cmake_contents = re.sub(MAJOR_PATTERN,
|
new_cmake_contents = re.sub(r"^set *\( *PROJECT_MAJOR_VERSION *\d+ *\)$",
|
||||||
f"set(PROJECT_MAJOR_VERSION {repo_data['version_major']})",
|
f"set(PROJECT_MAJOR_VERSION {repo_data['ws_version_major']})",
|
||||||
new_cmake_contents,
|
new_cmake_contents,
|
||||||
flags=re.MULTILINE)
|
flags=re.MULTILINE)
|
||||||
new_cmake_contents = re.sub(MINOR_PATTERN,
|
new_cmake_contents = re.sub(r"^set *\( *PROJECT_MINOR_VERSION *\d+ *\)$",
|
||||||
f"set(PROJECT_MINOR_VERSION {repo_data['version_minor']})",
|
f"set(PROJECT_MINOR_VERSION {repo_data['ws_version_minor']})",
|
||||||
new_cmake_contents,
|
new_cmake_contents,
|
||||||
flags=re.MULTILINE)
|
flags=re.MULTILINE)
|
||||||
new_cmake_contents = re.sub(PATCH_PATTERN,
|
new_cmake_contents = re.sub(r"^set *\( *PROJECT_PATCH_VERSION *\d+ *\)$",
|
||||||
f"set(PROJECT_PATCH_VERSION {repo_data['version_patch']})",
|
f"set(PROJECT_PATCH_VERSION {repo_data['ws_version_patch']})",
|
||||||
new_cmake_contents,
|
new_cmake_contents,
|
||||||
flags=re.MULTILINE)
|
flags=re.MULTILINE)
|
||||||
new_cmake_contents = re.sub(VERSION_EXTENSION_PATTERN,
|
new_cmake_contents = re.sub(r"^set *\( *PROJECT_VERSION_EXTENSION .*?$",
|
||||||
f"set(PROJECT_VERSION_EXTENSION \"{repo_data['package_string']}\")",
|
f"set(PROJECT_VERSION_EXTENSION \"{repo_data['ws_package_string']}\")",
|
||||||
|
new_cmake_contents,
|
||||||
|
flags=re.MULTILINE)
|
||||||
|
|
||||||
|
new_cmake_contents = re.sub(r"^set *\( *STRATOSHARK_MAJOR_VERSION *\d+ *\)$",
|
||||||
|
f"set(STRATOSHARK_MAJOR_VERSION {repo_data['ss_version_major']})",
|
||||||
|
new_cmake_contents,
|
||||||
|
flags=re.MULTILINE)
|
||||||
|
new_cmake_contents = re.sub(r"^set *\( *STRATOSHARK_MINOR_VERSION *\d+ *\)$",
|
||||||
|
f"set(STRATOSHARK_MINOR_VERSION {repo_data['ss_version_minor']})",
|
||||||
|
new_cmake_contents,
|
||||||
|
flags=re.MULTILINE)
|
||||||
|
new_cmake_contents = re.sub(r"^set *\( *STRATOSHARK_PATCH_VERSION *\d+ *\)$",
|
||||||
|
f"set(STRATOSHARK_PATCH_VERSION {repo_data['ss_version_patch']})",
|
||||||
|
new_cmake_contents,
|
||||||
|
flags=re.MULTILINE)
|
||||||
|
new_cmake_contents = re.sub(r"^set *\( *STRATOSHARK_VERSION_EXTENSION .*?$",
|
||||||
|
f"set(STRATOSHARK_VERSION_EXTENSION \"{repo_data['ss_package_string']}\")",
|
||||||
new_cmake_contents,
|
new_cmake_contents,
|
||||||
flags=re.MULTILINE)
|
flags=re.MULTILINE)
|
||||||
|
|
||||||
@ -94,7 +110,7 @@ def update_debian_changelog(src_dir, repo_data):
|
|||||||
changelog_contents = fh.read()
|
changelog_contents = fh.read()
|
||||||
|
|
||||||
CHANGELOG_PATTERN = r"^.*"
|
CHANGELOG_PATTERN = r"^.*"
|
||||||
text_replacement = f"wireshark ({repo_data['version_major']}.{repo_data['version_minor']}.{repo_data['version_patch']}{repo_data['package_string']}) UNRELEASED; urgency=low"
|
text_replacement = f"wireshark ({repo_data['ws_version_major']}.{repo_data['ws_version_minor']}.{repo_data['ws_version_patch']}{repo_data['ws_package_string']}) UNRELEASED; urgency=low"
|
||||||
# Note: Only need to replace the first line, so we don't use re.MULTILINE or re.DOTALL
|
# Note: Only need to replace the first line, so we don't use re.MULTILINE or re.DOTALL
|
||||||
new_changelog_contents = re.sub(CHANGELOG_PATTERN, text_replacement, changelog_contents)
|
new_changelog_contents = re.sub(CHANGELOG_PATTERN, text_replacement, changelog_contents)
|
||||||
with open(deb_changelog_filepath, mode='w', encoding='utf-8') as fh:
|
with open(deb_changelog_filepath, mode='w', encoding='utf-8') as fh:
|
||||||
@ -102,25 +118,26 @@ def update_debian_changelog(src_dir, repo_data):
|
|||||||
print(deb_changelog_filepath + " has been updated.")
|
print(deb_changelog_filepath + " has been updated.")
|
||||||
|
|
||||||
|
|
||||||
def create_version_file(version_f, repo_data):
|
def create_version_file(version_f, repo_data, flavor):
|
||||||
'Write the version to the specified file handle'
|
'Write the version to the specified file handle'
|
||||||
|
fpfx = 'ss' if flavor == Flavor.Stratoshark else 'ws'
|
||||||
|
|
||||||
version_f.write(f"{repo_data['version_major']}.{repo_data['version_minor']}.{repo_data['version_patch']}{repo_data['package_string']}\n")
|
version_f.write(f"{repo_data[f'{fpfx}_version_major']}.{repo_data[f'{fpfx}_version_minor']}.{repo_data[f'{fpfx}_version_patch']}{repo_data[f'{fpfx}_package_string']}\n")
|
||||||
print(version_f.name + " has been created.")
|
print(version_f.name + " has been created.")
|
||||||
|
|
||||||
|
|
||||||
def update_attributes_asciidoc(src_dir, repo_data):
|
def update_attributes_asciidoc(src_dir, repo_data):
|
||||||
# Read doc/attributes.adoc, then write it back out with an updated
|
# Read doc/attributes.adoc, then write it back out with an updated
|
||||||
# wireshark-version replacement line.
|
# wireshark-version replacement line.
|
||||||
asiidoc_filepath = os.path.join(src_dir, "doc", "attributes.adoc")
|
asiidoc_filepath = os.path.join(src_dir, "doc", "attributes.adoc")
|
||||||
with open(asiidoc_filepath, encoding='utf-8') as fh:
|
with open(asiidoc_filepath, encoding='utf-8') as fh:
|
||||||
asciidoc_contents = fh.read()
|
new_asciidoc_contents = fh.read()
|
||||||
|
|
||||||
# Sample line (without quotes): ":wireshark-version: 2.3.1"
|
# Sample line (without quotes): ":wireshark-version: 4.3.1"
|
||||||
ASCIIDOC_PATTERN = r"^:wireshark-version:.*$"
|
ws_replacement = f":wireshark-version: {repo_data['ws_version_major']}.{repo_data['ws_version_minor']}.{repo_data['ws_version_patch']}"
|
||||||
text_replacement = f":wireshark-version: {repo_data['version_major']}.{repo_data['version_minor']}.{repo_data['version_patch']}"
|
ss_replacement = f":stratoshark-version: {repo_data['ss_version_major']}.{repo_data['ss_version_minor']}.{repo_data['ss_version_patch']}"
|
||||||
|
|
||||||
new_asciidoc_contents = re.sub(ASCIIDOC_PATTERN, text_replacement, asciidoc_contents, flags=re.MULTILINE)
|
new_asciidoc_contents = re.sub(r"^:wireshark-version:.*$", ws_replacement, new_asciidoc_contents, flags=re.MULTILINE)
|
||||||
|
new_asciidoc_contents = re.sub(r"^:stratoshark-version:.*$", ss_replacement, new_asciidoc_contents, flags=re.MULTILINE)
|
||||||
|
|
||||||
with open(asiidoc_filepath, mode='w', encoding='utf-8') as fh:
|
with open(asiidoc_filepath, mode='w', encoding='utf-8') as fh:
|
||||||
fh.write(new_asciidoc_contents)
|
fh.write(new_asciidoc_contents)
|
||||||
@ -138,7 +155,7 @@ def update_docinfo_asciidoc(src_dir, repo_data):
|
|||||||
|
|
||||||
# Sample line (without quotes): "<subtitle>For Wireshark 1.2</subtitle>"
|
# Sample line (without quotes): "<subtitle>For Wireshark 1.2</subtitle>"
|
||||||
DOC_PATTERN = r"^<subtitle>For Wireshark \d+.\d+<\/subtitle>$"
|
DOC_PATTERN = r"^<subtitle>For Wireshark \d+.\d+<\/subtitle>$"
|
||||||
text_replacement = f"<subtitle>For Wireshark {repo_data['version_major']}.{repo_data['version_minor']}</subtitle>"
|
text_replacement = f"<subtitle>For Wireshark {repo_data['ws_version_major']}.{repo_data['ws_version_minor']}</subtitle>"
|
||||||
|
|
||||||
new_doc_contents = re.sub(DOC_PATTERN, text_replacement, doc_contents, flags=re.MULTILINE)
|
new_doc_contents = re.sub(DOC_PATTERN, text_replacement, doc_contents, flags=re.MULTILINE)
|
||||||
|
|
||||||
@ -160,7 +177,7 @@ def update_cmake_lib_releases(src_dir, repo_data):
|
|||||||
|
|
||||||
# Sample line (without quotes; note leading tab: " VERSION "0.0.0" SOVERSION 0")
|
# Sample line (without quotes; note leading tab: " VERSION "0.0.0" SOVERSION 0")
|
||||||
VERSION_PATTERN = r'^(\s*VERSION\s+"\d+\.\d+\.)\d+'
|
VERSION_PATTERN = r'^(\s*VERSION\s+"\d+\.\d+\.)\d+'
|
||||||
replacement_text = f"\\g<1>{repo_data['version_patch']}"
|
replacement_text = f"\\g<1>{repo_data['ws_version_patch']}"
|
||||||
new_cmakelists_contents = re.sub(VERSION_PATTERN,
|
new_cmakelists_contents = re.sub(VERSION_PATTERN,
|
||||||
replacement_text,
|
replacement_text,
|
||||||
cmakelists_contents,
|
cmakelists_contents,
|
||||||
@ -190,31 +207,39 @@ def generate_version_h(repo_data):
|
|||||||
ws_commit_id_line = '/* #undef WIRESHARK_VCS_COMMIT_ID */'
|
ws_commit_id_line = '/* #undef WIRESHARK_VCS_COMMIT_ID */'
|
||||||
|
|
||||||
ss_vcs_line = '#define STRATOHARK_VCS_VERSION "Git Rev Unknown from unknown"'
|
ss_vcs_line = '#define STRATOHARK_VCS_VERSION "Git Rev Unknown from unknown"'
|
||||||
ss_num_commits_line = '#define STRATOSHARK_VCS_NUM_COMMITS WIRESHARK_VCS_NUM_COMMITS'
|
ss_num_commits_line = '#define STRATOSHARK_VCS_NUM_COMMITS "0"'
|
||||||
ss_commit_id_line = '/* #undef STRATOSHARK_VCS_COMMIT_ID */'
|
ss_commit_id_line = '/* #undef STRATOSHARK_VCS_COMMIT_ID */'
|
||||||
|
|
||||||
if repo_data.get('num_commits'):
|
if repo_data.get('ws_num_commits'):
|
||||||
ws_num_commits_line = f'#define WIRESHARK_VCS_NUM_COMMITS "{int(repo_data["num_commits"])}"'
|
ws_num_commits_line = f'#define WIRESHARK_VCS_NUM_COMMITS "{int(repo_data["ws_num_commits"])}"'
|
||||||
|
|
||||||
|
if repo_data.get('ss_num_commits'):
|
||||||
|
ss_num_commits_line = f'#define STRATOSHARK_VCS_NUM_COMMITS "{int(repo_data["ss_num_commits"])}"'
|
||||||
|
|
||||||
if repo_data.get('commit_id'):
|
if repo_data.get('commit_id'):
|
||||||
ws_commit_id_line = f'#define WIRESHARK_VCS_COMMIT_ID "{repo_data["commit_id"]}"'
|
ws_commit_id_line = f'#define WIRESHARK_VCS_COMMIT_ID "{repo_data["commit_id"]}"'
|
||||||
ss_commit_id_line = f'#define STRATOSHARK_VCS_COMMIT_ID WIRESHARK_VCS_COMMIT_ID'
|
ss_commit_id_line = f'#define STRATOSHARK_VCS_COMMIT_ID WIRESHARK_VCS_COMMIT_ID'
|
||||||
|
|
||||||
if repo_data.get('enable_vcsversion'):
|
if repo_data.get('enable_vcsversion'):
|
||||||
if repo_data.get('git_description'):
|
if repo_data.get('ws_git_description'):
|
||||||
# Do not bother adding the git branch, the git describe output
|
# Do not bother adding the git branch, the git describe output
|
||||||
# normally contains the base tag and commit ID which is more
|
# normally contains the base tag and commit ID which is more
|
||||||
# than sufficient to determine the actual source tree.
|
# than sufficient to determine the actual source tree.
|
||||||
ws_vcs_line = f'#define WIRESHARK_VCS_VERSION "{repo_data["git_description"]}"'
|
ws_vcs_line = f'#define WIRESHARK_VCS_VERSION "{repo_data["ws_git_description"]}"'
|
||||||
elif repo_data.get('last_change') and repo_data.get('num_commits'):
|
elif repo_data.get('last_change') and repo_data.get('ws_num_commits'):
|
||||||
version_string = f"v{repo_data['version_major']}.{repo_data['version_minor']}.{repo_data['version_patch']}"
|
version_string = f"v{repo_data['ws_version_major']}.{repo_data['ws_version_minor']}.{repo_data['ws_version_patch']}"
|
||||||
ws_vcs_line = f'#define WIRESHARK_VCS_VERSION "{version_string}-Git-{repo_data["num_commits"]}"'
|
ws_vcs_line = f'#define WIRESHARK_VCS_VERSION "{version_string}-Git-{repo_data["ws_num_commits"]}"'
|
||||||
return ws_vcs_line + ws_num_commits_line + ws_commit_id_line
|
|
||||||
elif repo_data.get('commit_id'):
|
elif repo_data.get('commit_id'):
|
||||||
ws_vcs_line = f'#define WIRESHARK_VCS_VERSION "Git commit {repo_data["commit_id"]}"'
|
ws_vcs_line = f'#define WIRESHARK_VCS_VERSION "Git commit {repo_data["commit_id"]}"'
|
||||||
return ws_vcs_line + ws_num_commits_line + ws_commit_id_line
|
|
||||||
|
|
||||||
ss_vcs_line = '#define STRATOSHARK_VCS_VERSION WIRESHARK_VCS_VERSION'
|
if repo_data.get('ss_git_description'):
|
||||||
|
# Do not bother adding the git branch, same as above.
|
||||||
|
ss_vcs_line = f'#define STRATOSHARK_VCS_VERSION "{repo_data["ss_git_description"]}"'
|
||||||
|
elif repo_data.get('last_change') and repo_data.get('ss_num_commits'):
|
||||||
|
version_string = f"v{repo_data['ss_version_major']}.{repo_data['ss_version_minor']}.{repo_data['ss_version_patch']}"
|
||||||
|
ss_vcs_line = f'#define STRATOSHARK_VCS_VERSION "{version_string}-Git-{repo_data["ss_num_commits"]}"'
|
||||||
|
elif repo_data.get('commit_id'):
|
||||||
|
ss_vcs_line = f'#define STRATOSHARK_VCS_VERSION "Git commit {repo_data["commit_id"]}"'
|
||||||
|
|
||||||
|
|
||||||
return f'''\
|
return f'''\
|
||||||
@ -260,27 +285,28 @@ def print_VCS_REVISION(version_file, repo_data, set_vcs):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def get_version(cmakelists_file_data):
|
def get_version(cmakelists_file_data, flavor):
|
||||||
# Reads major, minor, and patch
|
# Reads major, minor, and patch
|
||||||
# Sample data:
|
# Sample data:
|
||||||
# set(PROJECT_MAJOR_VERSION 3)
|
# set(PROJECT_MAJOR_VERSION 3)
|
||||||
# set(PROJECT_MINOR_VERSION 7)
|
# set(PROJECT_MINOR_VERSION 7)
|
||||||
# set(PROJECT_PATCH_VERSION 2)
|
# set(PROJECT_PATCH_VERSION 2)
|
||||||
|
|
||||||
MAJOR_PATTERN = r"^set *\( *PROJECT_MAJOR_VERSION *(\d+) *\)$"
|
fpfx = 'STRATOSHARK' if flavor == Flavor.Stratoshark else 'PROJECT'
|
||||||
MINOR_PATTERN = r"^set *\( *PROJECT_MINOR_VERSION *(\d+) *\)$"
|
MAJOR_PATTERN = rf"^set *\( *{fpfx}_MAJOR_VERSION *(\d+) *\)$"
|
||||||
PATCH_PATTERN = r"^set *\( *PROJECT_PATCH_VERSION *(\d+) *\)$"
|
MINOR_PATTERN = rf"^set *\( *{fpfx}_MINOR_VERSION *(\d+) *\)$"
|
||||||
|
PATCH_PATTERN = rf"^set *\( *{fpfx}_PATCH_VERSION *(\d+) *\)$"
|
||||||
|
|
||||||
major_match = re.search(MAJOR_PATTERN, cmakelists_file_data, re.MULTILINE)
|
major_match = re.search(MAJOR_PATTERN, cmakelists_file_data, re.MULTILINE)
|
||||||
minor_match = re.search(MINOR_PATTERN, cmakelists_file_data, re.MULTILINE)
|
minor_match = re.search(MINOR_PATTERN, cmakelists_file_data, re.MULTILINE)
|
||||||
patch_match = re.search(PATCH_PATTERN, cmakelists_file_data, re.MULTILINE)
|
patch_match = re.search(PATCH_PATTERN, cmakelists_file_data, re.MULTILINE)
|
||||||
|
|
||||||
if not major_match:
|
if not major_match:
|
||||||
raise Exception("Couldn't get major version")
|
raise Exception(f"Couldn't get {flavor.name} major version")
|
||||||
if not minor_match:
|
if not minor_match:
|
||||||
raise Exception("Couldn't get minor version")
|
raise Exception(f"Couldn't get {flavor.name} minor version")
|
||||||
if not patch_match:
|
if not patch_match:
|
||||||
raise Exception("Couldn't get patch version")
|
raise Exception(f"Couldn't get {flavor.name} patch version")
|
||||||
|
|
||||||
major_version = major_match.groups()[0]
|
major_version = major_match.groups()[0]
|
||||||
minor_version = minor_match.groups()[0]
|
minor_version = minor_match.groups()[0]
|
||||||
@ -304,25 +330,26 @@ def read_git_archive(tagged_version_extra, untagged_version_extra):
|
|||||||
|
|
||||||
if is_tagged:
|
if is_tagged:
|
||||||
print(f"We are on tag {vcs_tag}.")
|
print(f"We are on tag {vcs_tag}.")
|
||||||
package_string = tagged_version_extra
|
ws_package_string = tagged_version_extra
|
||||||
else:
|
else:
|
||||||
print("We are not tagged.")
|
print("We are not tagged.")
|
||||||
package_string = untagged_version_extra
|
ws_package_string = untagged_version_extra
|
||||||
|
|
||||||
# Always 0 commits for a git archive
|
# Always 0 commits for a git archive
|
||||||
num_commits = 0
|
ws_num_commits = 0
|
||||||
|
|
||||||
# Assume a full commit hash, abbreviate it.
|
# Assume a full commit hash, abbreviate it.
|
||||||
commit_id = GIT_EXPORT_SUBST_H[:GIT_ABBREV_LENGTH]
|
commit_id = GIT_EXPORT_SUBST_H[:GIT_ABBREV_LENGTH]
|
||||||
package_string = package_string.replace("{vcsinfo}", str(num_commits) + "-" + commit_id)
|
ws_package_string = ws_package_string.replace("{vcsinfo}", str(ws_num_commits) + "-" + commit_id)
|
||||||
|
|
||||||
repo_data = {}
|
repo_data = {}
|
||||||
repo_data['commit_id'] = commit_id
|
repo_data['commit_id'] = commit_id
|
||||||
repo_data['enable_vcsversion'] = True
|
repo_data['enable_vcsversion'] = True
|
||||||
repo_data['info_source'] = "git archive"
|
repo_data['info_source'] = "git archive"
|
||||||
repo_data['is_tagged'] = is_tagged
|
repo_data['ws_num_commits'] = ws_num_commits
|
||||||
repo_data['num_commits'] = num_commits
|
repo_data['ws_package_string'] = ws_package_string
|
||||||
repo_data['package_string'] = package_string
|
# XXX Do we need a separate Stratoshark package string?
|
||||||
|
repo_data['ss_package_string'] = ws_package_string
|
||||||
return repo_data
|
return repo_data
|
||||||
|
|
||||||
|
|
||||||
@ -350,56 +377,64 @@ def read_git_repo(src_dir, tagged_version_extra, untagged_version_extra):
|
|||||||
# Commits since last annotated tag.
|
# Commits since last annotated tag.
|
||||||
# Output could be something like: v3.7.2rc0-64-g84d83a8292cb
|
# Output could be something like: v3.7.2rc0-64-g84d83a8292cb
|
||||||
# Or g84d83a8292cb
|
# Or g84d83a8292cb
|
||||||
git_last_annotated_cmd = shlex.split(f'git --git-dir="{GIT_DIR}" describe --abbrev={GIT_ABBREV_LENGTH} --long --always --match "v[1-9]*"')
|
git_describe_cmd = shlex.split(f'git --git-dir="{GIT_DIR}" describe --abbrev={GIT_ABBREV_LENGTH} --long --always --match "v[1-9]*"')
|
||||||
git_last_annotated = subprocess.check_output(git_last_annotated_cmd, universal_newlines=True).strip()
|
ws_git_description = subprocess.check_output(git_describe_cmd, universal_newlines=True).strip()
|
||||||
parts = git_last_annotated.split('-')
|
parts = ws_git_description.split('-')
|
||||||
git_description = git_last_annotated
|
|
||||||
if len(parts) > 1:
|
if len(parts) > 1:
|
||||||
num_commits = int(parts[1])
|
ws_num_commits = int(parts[1])
|
||||||
else:
|
else:
|
||||||
num_commits = 0
|
ws_num_commits = 0
|
||||||
commit_id = parts[-1]
|
commit_id = parts[-1]
|
||||||
|
|
||||||
|
git_describe_cmd = shlex.split(f'git --git-dir="{GIT_DIR}" describe --abbrev={GIT_ABBREV_LENGTH} --long --always --match "ssv[0-9]*"')
|
||||||
|
ss_git_description = subprocess.check_output(git_describe_cmd, universal_newlines=True).strip()
|
||||||
|
parts = ss_git_description.split('-')
|
||||||
|
if len(parts) > 1:
|
||||||
|
ss_num_commits = int(parts[1])
|
||||||
|
else:
|
||||||
|
ss_num_commits = 0
|
||||||
|
|
||||||
release_candidate = ''
|
release_candidate = ''
|
||||||
RC_PATTERN = r'^v\d+\.\d+\.\d+(rc\d+)$'
|
RC_PATTERN = r'^v\d+\.\d+\.\d+(rc\d+)$'
|
||||||
match = re.match(RC_PATTERN, parts[0])
|
match = re.match(RC_PATTERN, parts[0])
|
||||||
if match:
|
if match:
|
||||||
release_candidate = match.groups()[0]
|
release_candidate = match.groups()[0]
|
||||||
|
|
||||||
# This command is expected to fail if the version is not tagged
|
|
||||||
try:
|
try:
|
||||||
|
# This command is expected to fail if the version is not tagged
|
||||||
git_vcs_tag_cmd = shlex.split(f'git --git-dir="{GIT_DIR}" describe --exact-match --match "v[1-9]*"')
|
git_vcs_tag_cmd = shlex.split(f'git --git-dir="{GIT_DIR}" describe --exact-match --match "v[1-9]*"')
|
||||||
git_vcs_tag = subprocess.check_output(git_vcs_tag_cmd, stderr=subprocess.DEVNULL, universal_newlines=True).strip()
|
git_vcs_tag = subprocess.check_output(git_vcs_tag_cmd, stderr=subprocess.DEVNULL, universal_newlines=True).strip()
|
||||||
is_tagged = True
|
print(f"We are on Wireshark tag {git_vcs_tag}.")
|
||||||
|
ws_package_string = tagged_version_extra
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
is_tagged = False
|
print("We are not on a Wireshark tag.")
|
||||||
|
ws_package_string = untagged_version_extra
|
||||||
|
|
||||||
# git_timestamp = ""
|
ws_package_string = release_candidate + ws_package_string.replace("{vcsinfo}", str(ws_num_commits) + "-" + commit_id)
|
||||||
# if num_commits == 0:
|
|
||||||
# # Get the timestamp; format is similar to: 2022-06-27 23:09:20 -0400
|
|
||||||
# # Note: This doesn't appear to be used, only checked for command success
|
|
||||||
# git_timestamp_cmd = shlex.split(f'git --git-dir="{GIT_DIR}" log --format="%ad" -n 1 --date=iso')
|
|
||||||
# git_timestamp = subprocess.check_output(git_timestamp_cmd, universal_newlines=True).strip()
|
|
||||||
|
|
||||||
if is_tagged:
|
try:
|
||||||
print(f"We are on tag {git_vcs_tag}.")
|
# This command is expected to fail if the version is not tagged
|
||||||
package_string = tagged_version_extra
|
git_vcs_tag_cmd = shlex.split(f'git --git-dir="{GIT_DIR}" describe --exact-match --match "ssv[0-9]*"')
|
||||||
else:
|
git_vcs_tag = subprocess.check_output(git_vcs_tag_cmd, stderr=subprocess.DEVNULL, universal_newlines=True).strip()
|
||||||
print("We are not tagged.")
|
print(f"We are on Stratoshark tag {git_vcs_tag}.")
|
||||||
package_string = untagged_version_extra
|
ss_package_string = tagged_version_extra
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
print("We are not on a Stratoshark tag.")
|
||||||
|
ss_package_string = untagged_version_extra
|
||||||
|
|
||||||
package_string = release_candidate + package_string.replace("{vcsinfo}", str(num_commits) + "-" + commit_id)
|
ss_package_string = release_candidate + ss_package_string.replace("{vcsinfo}", str(ss_num_commits) + "-" + commit_id)
|
||||||
|
|
||||||
repo_data = {}
|
repo_data = {}
|
||||||
repo_data['commit_id'] = commit_id
|
repo_data['commit_id'] = commit_id
|
||||||
repo_data['enable_vcsversion'] = enable_vcsversion
|
repo_data['enable_vcsversion'] = enable_vcsversion
|
||||||
# repo_data['git_timestamp'] = git_timestamp
|
repo_data['ws_git_description'] = ws_git_description
|
||||||
repo_data['git_description'] = git_description
|
repo_data['ss_git_description'] = ss_git_description
|
||||||
repo_data['info_source'] = "Command line (git)"
|
repo_data['info_source'] = "Command line (git)"
|
||||||
repo_data['is_tagged'] = is_tagged
|
|
||||||
repo_data['last_change'] = git_last_changetime
|
repo_data['last_change'] = git_last_changetime
|
||||||
repo_data['num_commits'] = num_commits
|
repo_data['ws_num_commits'] = ws_num_commits
|
||||||
repo_data['package_string'] = package_string
|
repo_data['ss_num_commits'] = ss_num_commits
|
||||||
|
repo_data['ws_package_string'] = ws_package_string
|
||||||
|
repo_data['ss_package_string'] = ss_package_string
|
||||||
return repo_data
|
return repo_data
|
||||||
|
|
||||||
|
|
||||||
@ -425,13 +460,6 @@ def read_repo_info(src_dir, tagged_version_extra, untagged_version_extra):
|
|||||||
else:
|
else:
|
||||||
raise Exception(src_dir + " does not appear to be a git repo or git archive!")
|
raise Exception(src_dir + " does not appear to be a git repo or git archive!")
|
||||||
|
|
||||||
cmake_path = os.path.join(src_dir, "CMakeLists.txt")
|
|
||||||
with open(cmake_path, encoding='utf-8') as fh:
|
|
||||||
version_major, version_minor, version_patch = get_version(fh.read())
|
|
||||||
repo_data['version_major'] = version_major
|
|
||||||
repo_data['version_minor'] = version_minor
|
|
||||||
repo_data['version_patch'] = version_patch
|
|
||||||
|
|
||||||
return repo_data
|
return repo_data
|
||||||
|
|
||||||
|
|
||||||
@ -442,40 +470,67 @@ def read_repo_info(src_dir, tagged_version_extra, untagged_version_extra):
|
|||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description='Wireshark file and package versions')
|
parser = argparse.ArgumentParser(description='Wireshark file and package versions')
|
||||||
action_group = parser.add_mutually_exclusive_group()
|
action_group = parser.add_mutually_exclusive_group()
|
||||||
action_group.add_argument('--set-version', '-v', metavar='<x.y.z>', type=parse_versionstring, help='Set the major, minor, and patch versions in the top-level CMakeLists.txt, doc/attributes.adoc, packaging/debian/changelog, and the CMakeLists.txt for all libraries to the provided version number')
|
action_group.add_argument('--set-wireshark-version', '-v', metavar='<x.y.z>', type=parse_versionstring, help='Set the Wireshark major, minor, and patch versions in the top-level CMakeLists.txt, doc/attributes.adoc, packaging/debian/changelog, and the CMakeLists.txt for all libraries to the provided version number')
|
||||||
|
action_group.add_argument('--set-stratoshark-version', '-S', metavar='<x.y.z>', type=parse_versionstring, help='Set the Stratoshark major, minor, and patch versions in the top-level CMakeLists.txt and doc/attributes.adoc')
|
||||||
action_group.add_argument('--set-release', '-r', action='store_true', help='Set the extra release information in the top-level CMakeLists.txt based on either default or command-line specified options.')
|
action_group.add_argument('--set-release', '-r', action='store_true', help='Set the extra release information in the top-level CMakeLists.txt based on either default or command-line specified options.')
|
||||||
setrel_group = parser.add_argument_group()
|
setrel_group = parser.add_argument_group()
|
||||||
setrel_group.add_argument('--tagged-version-extra', '-t', default="", help="Extra version information format to use when a tag is found. No format \
|
setrel_group.add_argument('--tagged-version-extra', '-t', default="", help="Extra version information format to use when a tag is found. No format \
|
||||||
(an empty string) is used by default.")
|
(an empty string) is used by default.")
|
||||||
setrel_group.add_argument('--untagged-version-extra', '-u', default='-{vcsinfo}', help='Extra version information format to use when no tag is found. The format "-{vcsinfo}" (the number of commits and commit ID) is used by default.')
|
setrel_group.add_argument('--untagged-version-extra', '-u', default='-{vcsinfo}', help='Extra version information format to use when no tag is found. The format "-{vcsinfo}" (the number of commits and commit ID) is used by default.')
|
||||||
parser.add_argument('--version-file', '-f', metavar='<file>', type=argparse.FileType('w'), help='path to version file')
|
parser.add_argument('--wireshark-version-file', '-f', metavar='<file>', type=argparse.FileType('w'), help='path to file containing a bare Wireshark version string')
|
||||||
|
parser.add_argument('--stratoshark-version-file', metavar='<file>', type=argparse.FileType('w'), help='path to file containing a bare Stratoshark version string')
|
||||||
parser.add_argument("src_dir", metavar='src_dir', nargs=1, help="path to source code")
|
parser.add_argument("src_dir", metavar='src_dir', nargs=1, help="path to source code")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.version_file and not args.set_release:
|
if args.wireshark_version_file and not args.set_release:
|
||||||
sys.stderr.write('Error: --version-file must be used with --set-release.\n')
|
sys.stderr.write('Error: --wireshark-version-file must be used with --set-release.\n')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if args.stratoshark_version_file and not args.set_release:
|
||||||
|
sys.stderr.write('Error: --stratoshark-version-file must be used with --set-release.\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
src_dir = args.src_dir[0]
|
src_dir = args.src_dir[0]
|
||||||
|
set_version = args.set_wireshark_version or args.set_stratoshark_version
|
||||||
|
|
||||||
if args.set_version:
|
# Always get our version info from CMakeLists.txt
|
||||||
repo_data = {}
|
repo_data = {'ws_package_string': '', 'ss_package_string': ''}
|
||||||
repo_data['version_major'] = args.set_version[0]
|
cmake_path = os.path.join(src_dir, "CMakeLists.txt")
|
||||||
repo_data['version_minor'] = args.set_version[1]
|
with open(cmake_path, encoding='utf-8') as fh:
|
||||||
repo_data['version_patch'] = args.set_version[2]
|
cmakelists_file_data = fh.read()
|
||||||
repo_data['package_string'] = ''
|
version_major, version_minor, version_patch = get_version(cmakelists_file_data, Flavor.Wireshark)
|
||||||
|
repo_data['ws_version_major'] = version_major
|
||||||
|
repo_data['ws_version_minor'] = version_minor
|
||||||
|
repo_data['ws_version_patch'] = version_patch
|
||||||
|
|
||||||
|
version_major, version_minor, version_patch = get_version(cmakelists_file_data, Flavor.Stratoshark)
|
||||||
|
repo_data['ss_version_major'] = version_major
|
||||||
|
repo_data['ss_version_minor'] = version_minor
|
||||||
|
repo_data['ss_version_patch'] = version_patch
|
||||||
|
|
||||||
|
if args.set_wireshark_version:
|
||||||
|
repo_data['ws_version_major'] = args.set_wireshark_version[0]
|
||||||
|
repo_data['ws_version_minor'] = args.set_wireshark_version[1]
|
||||||
|
repo_data['ws_version_patch'] = args.set_wireshark_version[2]
|
||||||
|
elif args.set_stratoshark_version:
|
||||||
|
repo_data['ss_version_major'] = args.set_stratoshark_version[0]
|
||||||
|
repo_data['ss_version_minor'] = args.set_stratoshark_version[1]
|
||||||
|
repo_data['ss_version_patch'] = args.set_stratoshark_version[2]
|
||||||
else:
|
else:
|
||||||
repo_data = read_repo_info(src_dir, args.tagged_version_extra, args.untagged_version_extra)
|
repo_data.update(read_repo_info(src_dir, args.tagged_version_extra, args.untagged_version_extra))
|
||||||
|
|
||||||
set_vcs = not (args.set_release or args.set_version)
|
set_vcs = not (args.set_release or set_version)
|
||||||
VERSION_FILE = 'vcs_version.h'
|
VERSION_FILE = 'vcs_version.h'
|
||||||
print_VCS_REVISION(VERSION_FILE, repo_data, set_vcs)
|
print_VCS_REVISION(VERSION_FILE, repo_data, set_vcs)
|
||||||
|
|
||||||
if args.set_release or args.set_version:
|
if args.set_release or set_version:
|
||||||
update_versioned_files(src_dir, args.set_version, repo_data)
|
update_versioned_files(src_dir, set_version, repo_data)
|
||||||
|
|
||||||
if args.version_file:
|
if args.wireshark_version_file:
|
||||||
create_version_file(args.version_file, repo_data)
|
create_version_file(args.wireshark_version_file, repo_data, Flavor.Wireshark)
|
||||||
|
|
||||||
|
if args.stratoshark_version_file:
|
||||||
|
create_version_file(args.stratoshark_version_file, repo_data, Flavor.Stratoshark)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user