Skip to content

Commit 1e4dd5a

Browse files
grievejiafacebook-github-bot
authored andcommitted
Fix crashes in servicelab jobs
Reviewed By: stroxler Differential Revision: D30457421 fbshipit-source-id: 1969a33ee3ca3f95d7bfd959ff9557c708933738
1 parent ed82d93 commit 1e4dd5a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

scripts/setup.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import os
1212
import shutil
1313
import subprocess
14+
import sys
1415
from enum import Enum
1516
from pathlib import Path
1617
from tempfile import mkdtemp
@@ -51,6 +52,19 @@ class BuildType(Enum):
5152
FACEBOOK = "facebook"
5253

5354

55+
def _custom_linker_option(pyre_directory: Path, build_type: BuildType) -> str:
56+
# HACK: This is a temporary workaround for inconsistent OS installations
57+
# in FB-internal CI. Can be removed once all fleets are upgraded.
58+
if build_type == BuildType.FACEBOOK and sys.platform == "linux":
59+
return (
60+
(pyre_directory / "facebook" / "scripts" / "custom_linker_options.txt")
61+
.read_text()
62+
.rstrip()
63+
)
64+
else:
65+
return ""
66+
67+
5468
class Setup(NamedTuple):
5569
opam_root: Path
5670

@@ -91,7 +105,12 @@ def produce_dune_file(
91105
with open(pyre_directory / "source" / "dune.in") as dune_in:
92106
with open(pyre_directory / "source" / "dune", "w") as dune:
93107
dune_data = dune_in.read()
94-
dune.write(dune_data.replace("%VERSION%", build_type.value))
108+
dune.write(
109+
dune_data.replace("%VERSION%", build_type.value).replace(
110+
"%CUSTOM_LINKER_OPTION%",
111+
_custom_linker_option(pyre_directory, build_type),
112+
)
113+
)
95114

96115
def check_if_preinstalled(self) -> None:
97116
if self.environment_variables.get(

source/dune.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@
207207
ppx_compare ppx_sexp_conv))
208208
(ocamlc_flags
209209
(:standard -custom))
210+
%CUSTOM_LINKER_OPTION%
210211
(libraries pyrelib))
211212

212213
(alias

0 commit comments

Comments
 (0)