Skip to content

Commit f7f3759

Browse files
danakjAravind Vasudevan
authored andcommitted
Strip binaries in rust-toolchain/bin before putting them into a tarball
This will reduce the size of the tarball a little bit. R=hans@chromium.org Bug: 1439640 Change-Id: I8901fc129d7fac843e8b481b8fc999bb21a0af8a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4501207 Reviewed-by: Hans Wennborg <hans@chromium.org> Commit-Queue: danakj <danakj@chromium.org> Cr-Commit-Position: refs/heads/main@{#1139530} NOKEYCHECK=True GitOrigin-RevId: 95433419c7af1b4fc43a01946c3099228072053b
1 parent d4c0ade commit f7f3759

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

package_rust.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import platform
1010
import shutil
11+
import subprocess
1112
import sys
1213
import tarfile
1314

@@ -91,6 +92,14 @@ def main():
9192

9293
BuildCrubit(args.build_mac_arm)
9394

95+
# Strip everything in bin/ to reduce the package size.
96+
bin_dir_path = os.path.join(RUST_TOOLCHAIN_OUT_DIR, 'bin')
97+
if sys.platform != 'win32' and os.path.exists(bin_dir_path):
98+
for f in os.listdir(bin_dir_path):
99+
file_path = os.path.join(bin_dir_path, f)
100+
if not os.path.islink(file_path):
101+
subprocess.call(['strip', file_path])
102+
94103
with tarfile.open(os.path.join(THIRD_PARTY_DIR,
95104
RUST_TOOLCHAIN_PACKAGE_NAME),
96105
'w:xz',

0 commit comments

Comments
 (0)