mirror of
https://github.com/facebook/proxygen.git
synced 2025-08-05 19:55:47 +03:00
getdeps: dynamic dependency munging
Summary: This diff adds a `fixup-dyn-deps` subcommand that is intended to aid in packaging on multiple platforms. Its purpose is to copy a set of executable object files from the getdeps installation directories and place them into an installation staging area that will then be used to create some kind of package (rpm, tarball etc.). The dynamic dependencies of the executables are determined and also copied into the destination area, and the important part: the execute is rewritten such that it will load the deps out of an alternate installation prefix. The implementation of this command draws on similar scripts in use for the watchman and eden packaging on windows and macos. This diff adds linux support using the `patchelf` utility. Reviewed By: pkaush Differential Revision: D16101902 fbshipit-source-id: 5885125971947139407841e08c0cf9f35fdf5895
This commit is contained in:
committed by
Facebook Github Bot
parent
ecc5dd6d71
commit
94da945325
@@ -16,6 +16,7 @@ import subprocess
|
||||
import sys
|
||||
|
||||
from getdeps.buildopts import setup_build_options
|
||||
from getdeps.dyndeps import create_dyn_dep_munger
|
||||
from getdeps.errors import TransientFailure
|
||||
from getdeps.load import load_project, manifests_in_dependency_order
|
||||
from getdeps.manifest import ManifestParser
|
||||
@@ -307,6 +308,64 @@ class BuildCmd(SubCmd):
|
||||
)
|
||||
|
||||
|
||||
@cmd("fixup-dyn-deps", "Adjusts dynamic dependencies for packaging purposes")
|
||||
class FixupDeps(SubCmd):
|
||||
def run(self, args):
|
||||
opts = setup_build_options(args)
|
||||
|
||||
manifest = load_project(opts, args.project)
|
||||
|
||||
ctx = context_from_host_tuple(facebook_internal=args.facebook_internal)
|
||||
projects = manifests_in_dependency_order(opts, manifest, ctx)
|
||||
manifests_by_name = {m.name: m for m in projects}
|
||||
|
||||
# Accumulate the install directories so that the build steps
|
||||
# can find their dep installation
|
||||
install_dirs = []
|
||||
|
||||
for m in projects:
|
||||
ctx = dict(ctx)
|
||||
if args.enable_tests and m.name == manifest.name:
|
||||
ctx["test"] = "on"
|
||||
else:
|
||||
ctx["test"] = "off"
|
||||
fetcher = m.create_fetcher(opts, ctx)
|
||||
|
||||
dirs = opts.compute_dirs(m, fetcher, manifests_by_name, ctx)
|
||||
inst_dir = dirs["inst_dir"]
|
||||
|
||||
install_dirs.append(inst_dir)
|
||||
|
||||
if m == manifest:
|
||||
dep_munger = create_dyn_dep_munger(opts, install_dirs)
|
||||
dep_munger.process_deps(args.destdir, args.final_install_prefix)
|
||||
|
||||
def setup_parser(self, parser):
|
||||
parser.add_argument(
|
||||
"project",
|
||||
help=(
|
||||
"name of the project or path to a manifest "
|
||||
"file describing the project"
|
||||
),
|
||||
)
|
||||
parser.add_argument("destdir", help=("Where to copy the fixed up executables"))
|
||||
parser.add_argument(
|
||||
"--final-install-prefix", help=("specify the final installation prefix")
|
||||
)
|
||||
parser.add_argument(
|
||||
"--enable-tests",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help=(
|
||||
"For the named project, build tests so that the test command "
|
||||
"is able to execute tests"
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--schedule-type", help="Indicates how the build was activated"
|
||||
)
|
||||
|
||||
|
||||
@cmd("test", "test a given project")
|
||||
class TestCmd(SubCmd):
|
||||
def run(self, args):
|
||||
|
Reference in New Issue
Block a user