From 6ade1055d56e8d70822e2d6deb0ee733e0c02c05 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 12 Dec 2024 16:56:35 +0000 Subject: [PATCH] bin/test_backend_sizes.py fix compile flags and s3 reporting This now compiles rclone with CGO_ENABLED=0 which is closer to the release compile. It also removes pikpak if testing s3 as the two depend on each other. --- bin/test_backend_sizes.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/test_backend_sizes.py b/bin/test_backend_sizes.py index 945d0f5ff..dc14bb2ff 100755 --- a/bin/test_backend_sizes.py +++ b/bin/test_backend_sizes.py @@ -7,15 +7,18 @@ Run with no arguments to test all backends or a supply a list of backends to test. """ +import os +import re +import sys +import subprocess + all_backends = "backend/all/all.go" # compile command which is more or less like the production builds compile_command = ["go", "build", "--ldflags", "-s", "-trimpath"] -import os -import re -import sys -import subprocess +# disable CGO as that makes a lot of difference to binary size +os.environ["CGO_ENABLED"]="0" match_backend = re.compile(r'"github.com/rclone/rclone/backend/(.*?)"') @@ -43,6 +46,9 @@ def write_all(orig_all, backend): # Comment out line matching backend if match and match.group(1) == backend: line = "// " + line + # s3 and pikpak depend on each other + if backend == "s3" and "pikpak" in line: + line = "// " + line fd.write(line+"\n") def compile():