aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-04 02:14:09 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commit3d7802afb6fcd2a8e80a48067f0c94cebeedbc9f (patch)
tree91d0126eab04a6d61a077c1c5f59ec0b8944a663
parent1b941c7782f07c61c61be36d7772a5c0ee9c420e (diff)
Improve package performance, use one checksum file instead of multiple
-rw-r--r--distribute/linux_x86_64/sibs.tar.gzbin0 -> 3179931 bytes
-rwxr-xr-xscripts/package.py26
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
new file mode 100644
index 0000000..173ae07
--- /dev/null
+++ b/distribute/linux_x86_64/sibs.tar.gz
Binary files differ
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] ])