Skip to content

Commit 317a649

Browse files
muirdmmeta-codesync[bot]
authored andcommitted
Use universal binaries in rpm.builder for macOS
Summary: The fb-eden rpm.builder Mac configuration was producing single-arch (x86_64) binaries because it just built each target for the default platform. This resulted in .noarch RPMs with Intel-only binaries being rolled out via conveyor/slowroll to all Mac users. Fix by defining universal binary targets (using rust_universal_binary, which works for both C++ and Rust executables) and using select() in make_rpm_features() to pick the universal binary on macOS. This mirrors the approach used by fb-sapling packaging. There exists a C++ cxx_universal_executable target, but that cannot be run on linux (where rpm.builder is required to run), so just use rust_universal_binary even though some of the binaries aren't Rust. Also add edenfs_config_manager_rust to the Sandcastle signing command, which was missing since D91632819. Reviewed By: genevievehelsel, MichaelCuevas Differential Revision: D102232257 fbshipit-source-id: 1cbc3a758ed02904555c00b21a4c6ca992c9432a
1 parent 791fde8 commit 317a649

2 files changed

Lines changed: 83 additions & 4 deletions

File tree

eden/fs/BUCK

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ load(
77
load("@fbcode//registry:defs.bzl", "rpm")
88
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
99
load("@fbcode_macros//build_defs:python_binary.bzl", "python_binary")
10+
load("@fbcode_macros//build_defs:rust_universal_binary.bzl", "rust_universal_binary")
1011

1112
oncall("scm_client_infra")
1213

@@ -18,6 +19,54 @@ cpp_library(
1819
],
1920
)
2021

22+
# Universal (x86_64 + arm64) binary targets for macOS packaging.
23+
# rust_universal_binary works for both Rust and C++ executables.
24+
25+
rust_universal_binary(
26+
name = "edenfs_universal",
27+
source = "//eden/fs/service:edenfs",
28+
)
29+
30+
rust_universal_binary(
31+
name = "edenfs_privhelper_universal",
32+
source = "//eden/fs/service:edenfs_privhelper",
33+
)
34+
35+
rust_universal_binary(
36+
name = "eden-fb303-collector_universal",
37+
source = "//eden/fs/facebook:eden-fb303-collector",
38+
)
39+
40+
rust_universal_binary(
41+
name = "eden_fsck_universal",
42+
source = "//eden/fs/inodes/fscatalog:eden_fsck",
43+
)
44+
45+
rust_universal_binary(
46+
name = "trace_stream_universal",
47+
source = "//eden/fs/cli/trace:trace_stream",
48+
)
49+
50+
rust_universal_binary(
51+
name = "edenfsctl_universal",
52+
source = "//eden/fs/cli_rs/edenfsctl:edenfsctl",
53+
)
54+
55+
rust_universal_binary(
56+
name = "edenfs_config_manager_rust_universal",
57+
source = "//eden/fs/config/facebook/config_manager_rs:edenfs_config_manager_rust",
58+
)
59+
60+
rust_universal_binary(
61+
name = "edenfs_monitor_universal",
62+
source = "//eden/fs/monitor:edenfs_monitor",
63+
)
64+
65+
rust_universal_binary(
66+
name = "eden_apfs_mount_helper_universal",
67+
source = "//eden/scm/exec/eden_apfs_mount_helper:eden_apfs_mount_helper",
68+
)
69+
2170
rpm.builder(
2271
name = "fb-eden",
2372
# We are setting up conveyor+slowroll after which we can much lower this

eden/fs/build_targets.bzl

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ EDENFS_TARGETS = {
2626
"//eden/fs/service:edenfs_privhelper": "/usr/local/libexec/eden/edenfs_privhelper",
2727
}
2828

29+
# Targets that have universal (x86_64 + arm64) binary variants for macOS.
30+
# Maps the default target to its universal binary target in //eden/fs:BUCK.
31+
# Python targets (edenfsctl PAR, edenfs_restarter, edenfs_config_manager) are
32+
# Intel-only and not included here.
33+
UNIVERSAL_BINARY_TARGETS = {
34+
"//eden/fs/cli/trace:trace_stream": "//eden/fs:trace_stream_universal",
35+
"//eden/fs/cli_rs/edenfsctl:edenfsctl": "//eden/fs:edenfsctl_universal",
36+
"//eden/fs/config/facebook/config_manager_rs:edenfs_config_manager_rust": "//eden/fs:edenfs_config_manager_rust_universal",
37+
"//eden/fs/facebook:eden-fb303-collector": "//eden/fs:eden-fb303-collector_universal",
38+
"//eden/fs/inodes/fscatalog:eden_fsck": "//eden/fs:eden_fsck_universal",
39+
"//eden/fs/monitor:edenfs_monitor": "//eden/fs:edenfs_monitor_universal",
40+
"//eden/fs/service:edenfs": "//eden/fs:edenfs_universal",
41+
"//eden/fs/service:edenfs_privhelper": "//eden/fs:edenfs_privhelper_universal",
42+
}
43+
2944
SYMLINKS = {
3045
"/usr/local/bin/edenfsctl": "/usr/local/bin/eden",
3146
}
@@ -82,13 +97,24 @@ MAC_TARGETS = {
8297
"//eden/scm/exec/eden_apfs_mount_helper:eden_apfs_mount_helper": "/usr/local/libexec/eden/eden_apfs_mount_helper",
8398
}
8499

100+
MAC_UNIVERSAL_BINARY_TARGETS = {
101+
"//eden/scm/exec/eden_apfs_mount_helper:eden_apfs_mount_helper": "//eden/fs:eden_apfs_mount_helper_universal",
102+
}
103+
85104
def make_rpm_features():
86105
features = []
87106
for target, install_path in EDENFS_TARGETS.items():
107+
if target in UNIVERSAL_BINARY_TARGETS:
108+
src = select({
109+
"DEFAULT": "fbcode" + target,
110+
"ovr_config//os:macos": "fbcode" + UNIVERSAL_BINARY_TARGETS[target],
111+
})
112+
else:
113+
src = "fbcode" + target
88114
if target in TARGET_MODES:
89-
features.append(rpm.install(src = "fbcode" + target, dst = install_path, mode = TARGET_MODES.get(target)))
115+
features.append(rpm.install(src = src, dst = install_path, mode = TARGET_MODES.get(target)))
90116
else:
91-
features.append(rpm.install(src = "fbcode" + target, dst = install_path))
117+
features.append(rpm.install(src = src, dst = install_path))
92118
if install_path in SYMLINKS:
93119
features.append(rpm.file_symlink(link = SYMLINKS.get(install_path), target = install_path))
94120
for dir in DIRS:
@@ -114,10 +140,14 @@ def make_rpm_features():
114140
mac_features = []
115141

116142
for target, install_path in MAC_TARGETS.items():
143+
if target in MAC_UNIVERSAL_BINARY_TARGETS:
144+
src = "fbcode" + MAC_UNIVERSAL_BINARY_TARGETS[target]
145+
else:
146+
src = "fbcode" + target
117147
if target in TARGET_MODES:
118-
mac_features.append(rpm.install(src = "fbcode" + target, dst = install_path, mode = TARGET_MODES.get(target)))
148+
mac_features.append(rpm.install(src = src, dst = install_path, mode = TARGET_MODES.get(target)))
119149
else:
120-
mac_features.append(rpm.install(src = "fbcode" + target, dst = install_path))
150+
mac_features.append(rpm.install(src = src, dst = install_path))
121151
for mac_feature in mac_features:
122152
features.append(
123153
select({

0 commit comments

Comments
 (0)