diff options
-rw-r--r-- | distribute/linux_x86_64/sibs.tar.gz | bin | 0 -> 3179931 bytes | |||
-rwxr-xr-x | scripts/package.py | 26 |
2 files changed, 22 insertions, 4 deletions
diff --git a/distribute/linux_x86_64/sibs.tar.gz b/distribute/linux_x86_64/sibs.tar.gz Binary files differnew file mode 100644 index 0000000..173ae07 --- /dev/null +++ b/distribute/linux_x86_64/sibs.tar.gz diff --git a/scripts/package.py b/scripts/package.py index fe3b468..61f12c7 100755 --- a/scripts/package.py +++ b/scripts/package.py @@ -60,6 +60,22 @@ def usage(): print("usage: package.py executable_path program_version destination_path <--bundle|--bundle-install>") exit(1) +def fetch_checksums(url): + checksums = {} + + r = requests.get(url) + if not r.ok: + raise RuntimeError("Failed to fetch checksums from url %s" % url) + + lines = r.text.splitlines() + for line in lines: + split_index = line.find(" ") + checksum = line[0:split_index] + libfile = line[split_index + 1:] + checksums[libfile] = checksum + + return checksums + def main(): if len(sys.argv) <= 4: usage() @@ -95,13 +111,15 @@ def main(): dependencies = [] if package_type == "--bundle-install": new_libs = [] + # TODO: Cache the checksum file at this url + checksums = fetch_checksums("https://raw.githubusercontent.com/DEC05EBA/libraries/master/linux/x86_64/checksums") # Remove libraries from the package that can be downloaded remotely (and which user most likely has if they have another program that uses sibs on their computer) for lib in libs: lib_name = os.path.basename(lib[0]) - r = requests.get("https://raw.githubusercontent.com/DEC05EBA/libraries/master/linux/x86_64/" + lib_name + ".sha1") - # TODO: Remove check if it's so_loader or not, we can use so loader in sibs downloaded lib directory - if r.ok and lib[1] != so_loader: - external_checksum = r.text.splitlines()[0] + # TODO: Remove this check, we can use so loader in sibs downloaded lib directory + lib_checksum = checksums.get(lib_name) + if lib_checksum and lib[1] != so_loader: + external_checksum = lib_checksum file_checksum = file_get_sha1(lib[0]) if external_checksum == file_checksum: mapped_libs.append([ lib_name, lib[1] ]) |