diff options
| author | Trial97 <alexandru.tripon97@gmail.com> | 2026-03-21 11:40:11 +0200 |
|---|---|---|
| committer | Sefa Eyeoglu <contact@scrumplex.net> | 2026-03-21 10:49:03 +0100 |
| commit | 9dd74cdf487e19a3cf0b60c224a2c798471a493a (patch) | |
| tree | a16d7cb6320d6aa311a9fb94b38fac5cc40b031b /meta | |
| parent | 8218afe5dc299cc5b6dec3b162ad25d8355ff952 (diff) | |
| download | Project-Tick-9dd74cdf487e19a3cf0b60c224a2c798471a493a.tar.gz Project-Tick-9dd74cdf487e19a3cf0b60c224a2c798471a493a.zip | |
update sha1 cahcing check
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/common/__init__.py | 3 | ||||
| -rwxr-xr-x | meta/run/update_forge.py | 23 | ||||
| -rw-r--r-- | meta/run/update_neoforge.py | 23 |
3 files changed, 22 insertions, 27 deletions
diff --git a/meta/common/__init__.py b/meta/common/__init__.py index 1f358cdbd7..533f832917 100644 --- a/meta/common/__init__.py +++ b/meta/common/__init__.py @@ -117,7 +117,8 @@ def get_file_sha1_from_file(file_name: str, sha1_file: str) -> Optional[str]: if os.path.isfile(sha1_file): with open(sha1_file, "r") as file: return file.read() - + if not os.path.isfile(jar_path): + return None new_sha1 = file_hash(file_name, hashlib.sha1) with open(sha1_file, "w") as file: file.write(new_sha1) diff --git a/meta/run/update_forge.py b/meta/run/update_forge.py index 23ad333955..c74865b31f 100755 --- a/meta/run/update_forge.py +++ b/meta/run/update_forge.py @@ -150,19 +150,16 @@ def process_forge_version(version, jar_path): new_sha1 = None sha1_file = jar_path + ".sha1" - if not os.path.isfile(jar_path): - remove_files([profile_path, installer_info_path]) - else: - fileSha1 = get_file_sha1_from_file(jar_path, sha1_file) - try: - rfile = sess.get(version.url() + ".sha1") - rfile.raise_for_status() - new_sha1 = rfile.text.strip() - if fileSha1 != new_sha1: - remove_files([jar_path, profile_path, installer_info_path, sha1_file]) - except Exception as e: - eprint("Failed to check sha1 %s" % version.url()) - eprint("Error is %s" % e) + fileSha1 = get_file_sha1_from_file(jar_path, sha1_file) + try: + rfile = sess.get(version.url() + ".sha1") + rfile.raise_for_status() + new_sha1 = rfile.text.strip() + if fileSha1 != new_sha1: + remove_files([jar_path, profile_path, installer_info_path, sha1_file]) + except Exception as e: + eprint("Failed to check sha1 %s" % version.url()) + eprint("Error is %s" % e) installer_refresh_required = not os.path.isfile(profile_path) or not os.path.isfile( installer_info_path diff --git a/meta/run/update_neoforge.py b/meta/run/update_neoforge.py index 242ad8a6b1..9957aad1bd 100644 --- a/meta/run/update_neoforge.py +++ b/meta/run/update_neoforge.py @@ -141,19 +141,16 @@ def process_neoforge_version(key, entry): new_sha1 = None sha1_file = jar_path + ".sha1" - if not os.path.isfile(jar_path): - remove_files([profile_path, installer_info_path]) - else: - fileSha1 = get_file_sha1_from_file(jar_path, sha1_file) - try: - rfile = sess.get(version.url() + ".sha1") - rfile.raise_for_status() - new_sha1 = rfile.text.strip() - if fileSha1 != new_sha1: - remove_files([jar_path, profile_path, installer_info_path, sha1_file]) - except Exception as e: - eprint("Failed to check sha1 %s" % version.url()) - eprint("Error is %s" % e) + fileSha1 = get_file_sha1_from_file(jar_path, sha1_file) + try: + rfile = sess.get(version.url() + ".sha1") + rfile.raise_for_status() + new_sha1 = rfile.text.strip() + if fileSha1 != new_sha1: + remove_files([jar_path, profile_path, installer_info_path, sha1_file]) + except Exception as e: + eprint("Failed to check sha1 %s" % version.url()) + eprint("Error is %s" % e) installer_refresh_required = not os.path.isfile(profile_path) or not os.path.isfile( installer_info_path |
