1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-05 18:42:29 +01:00
ScreenPlay/Tools/create_sha512.py

33 lines
1.0 KiB
Python
Raw Normal View History

2023-11-01 12:33:19 +01:00
#!/usr/bin/python3
# SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
2023-08-18 20:23:12 +02:00
import hashlib
import os
2023-08-20 12:44:38 +02:00
from pathlib import Path
import util
2023-08-18 20:23:12 +02:00
def combine_sha256():
2023-08-20 12:44:38 +02:00
tag = os.environ['CI_COMMIT_TAG']
# Get the repo root path as a Path object
root_path = Path(util.repo_root_path())
2023-08-18 20:23:12 +02:00
files = [
2023-08-20 12:44:38 +02:00
Path(
f"{root_path}/build-x64-windows-release/ScreenPlay-{tag}-x64-windows-release.zip"),
Path(
f"{root_path}/build-x64-linux-release/ScreenPlay-{tag}-x64-linux-release.zip"),
Path(f"{root_path}/build-64-osx-universal-release/ScreenPlay-{tag}-64-osx-universal-release.zip")
2023-08-18 20:23:12 +02:00
]
with open('SHA512-SUMS.txt', 'w') as f_out:
for file in files:
2023-08-20 12:44:38 +02:00
with open(file.with_name(f"{file.name}.sha256.txt"), 'r') as f_in:
2023-08-18 20:23:12 +02:00
sha256_hash = f_in.read().strip()
sha512_hash = hashlib.sha512(sha256_hash.encode()).hexdigest()
2023-08-24 08:40:10 +02:00
f_out.write(f"{sha512_hash} {file.name}\n")
2023-08-18 20:23:12 +02:00
if __name__ == "__main__":
combine_sha256()