From 1e8aafba61af8a6dc5b685fe7fe0ca10af6de85e Mon Sep 17 00:00:00 2001 From: Stepan Oksanichenko Date: Fri, 23 Aug 2024 19:21:32 +0300 Subject: [PATCH] - Write in a new format if you use SHA512 checksum - A version is bumbed --- almalinux/gitutils/blob_upload.py | 12 ++++++++---- setup.py | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/almalinux/gitutils/blob_upload.py b/almalinux/gitutils/blob_upload.py index d7b7f88..31fb3c3 100644 --- a/almalinux/gitutils/blob_upload.py +++ b/almalinux/gitutils/blob_upload.py @@ -149,13 +149,17 @@ def main(): ) out_fd = None if args.append_metadata: - file_mdoe = 'a' + file_mode = 'a' else: - file_mdoe = 'w' + file_mode = 'w' if args.output_metadata: - out_fd = open(args.output_metadata, file_mdoe) + out_fd = open(args.output_metadata, file_mode) try: for rel_path, checksum, checksum_type in iterator: + if args.sha512: + line_to_write = f'SHA512 ({rel_path}) = {checksum}\n' + else: + line_to_write = f'{checksum} {rel_path}\n' file_path = normalize_path(rel_path) if not args.file: real_checksum = get_file_checksum(file_path, checksum_type) @@ -172,7 +176,7 @@ def main(): else: logging.info(f'{rel_path} is already uploaded: {file_url}') if out_fd: - out_fd.write(f'{checksum} {rel_path}\n') + out_fd.write(line_to_write) finally: if out_fd: out_fd.close() diff --git a/setup.py b/setup.py index ff258ad..bf8d18a 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fd: setup( name="almalinux-git-utils", - version="0.0.2", + version="0.0.3", author="Eugene Zamriy", author_email="ezamriy@almalinux.org", description="Utilities for working with the AlmaLinux OS Git server",