Skip to content

Commit 018b10b

Browse files
ahornbyfacebook-github-bot
authored andcommitted
use system patchelf in eden fs build
Summary: X-link: facebookincubator/velox#7072 use system patchelf in eden fs build Saves us from doing a fetch and build of autoconf, libtool, automake and patchelf during the arfifacts part of CI X-link: facebook/sapling#750 Reviewed By: sggutier Differential Revision: D50313417 Pulled By: genevievehelsel fbshipit-source-id: 7c585357c848c15a65c5797d6c8750d1119b6efd
1 parent d57a95d commit 018b10b

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

build/fbcode_builder/getdeps.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,12 @@ def run_project_cmd(self, args, loader, manifest):
497497
manifests = [manifest]
498498

499499
for m in manifests:
500+
fetcher = loader.create_fetcher(m)
501+
if isinstance(fetcher, SystemPackageFetcher):
502+
# We are guaranteed that if the fetcher is set to
503+
# SystemPackageFetcher then this item is completely
504+
# satisfied by the appropriate system packages
505+
continue
500506
inst_dir = loader.get_project_install_dir_respecting_install_prefix(m)
501507
print(inst_dir)
502508

@@ -1056,6 +1062,11 @@ def write_job_for_platform(self, platform, args): # noqa: C901
10561062
out.write(
10571063
f" run: {sudo_arg}python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive {manifest.name}\n"
10581064
)
1065+
if build_opts.is_linux() or build_opts.is_freebsd():
1066+
out.write(" - name: Install packaging system deps\n")
1067+
out.write(
1068+
f" run: {sudo_arg}python3 build/fbcode_builder/getdeps.py --allow-system-packages install-system-deps --recursive patchelf\n"
1069+
)
10591070

10601071
projects = loader.manifests_in_dependency_order()
10611072

build/fbcode_builder/getdeps/dyndeps.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,16 +336,21 @@ def __init__(self, buildopts, install_dirs, strip) -> None:
336336
super(ElfDeps, self).__init__(buildopts, install_dirs, strip)
337337

338338
# We need patchelf to rewrite deps, so ensure that it is built...
339-
subprocess.check_call([sys.executable, sys.argv[0], "build", "patchelf"])
339+
args = [sys.executable, sys.argv[0]]
340+
if buildopts.allow_system_packages:
341+
args.append("--allow-system-packages")
342+
subprocess.check_call(args + ["build", "patchelf"])
343+
340344
# ... and that we know where it lives
341-
self.patchelf = os.path.join(
342-
os.fsdecode(
343-
subprocess.check_output(
344-
[sys.executable, sys.argv[0], "show-inst-dir", "patchelf"]
345-
).strip()
346-
),
347-
"bin/patchelf",
345+
patchelf_install = os.fsdecode(
346+
subprocess.check_output(args + ["show-inst-dir", "patchelf"]).strip()
348347
)
348+
if not patchelf_install:
349+
# its a system package, so we assume it is in the path
350+
patchelf_install = "patchelf"
351+
else:
352+
patchelf_install = os.path.join(patchelf_install, "bin", "patchelf")
353+
self.patchelf = patchelf_install
349354

350355
def list_dynamic_deps(self, objfile):
351356
out = (

0 commit comments

Comments
 (0)