Skip to content

Commit 8730e92

Browse files
committed
cpatch.py: misc minor fixes to cpatch.py
Check that files are ELF format before attempting to strip them. Add additional exclude directories to prevent copying unused python files and speedup build. Update list of libraries copied for RGW to those that are used by rgw binaries. Signed-off-by: John Agombar <[email protected]>
1 parent 6052bfa commit 8730e92

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/script/cpatch.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,9 @@ def _copy_binary(self, src_path, dst_path):
502502
if self._ctx.strip_binaries:
503503
log.debug("copy and strip: %s", dst_path)
504504
shutil.copy2(src_path, dst_path)
505-
_run(["strip", str(dst_path)]).check_returncode()
505+
output = _run(["file", str(dst_path)], capture_output=True, text=True)
506+
if "ELF" in output.stdout:
507+
_run(["strip", str(dst_path)]).check_returncode()
506508
return
507509
log.debug("hard linking: %s", dst_path)
508510
try:
@@ -583,7 +585,7 @@ def _py_mgr_job(self, component):
583585
exclude_dirs = ("tests",)
584586
else:
585587
log.debug("Excluding dashboard from mgr")
586-
exclude_dirs = ("tests", "node_modules")
588+
exclude_dirs = ("tests", "node_modules", ".tox", ".angular" )
587589
exclude_file_suffixes = (".pyc", ".pyo", ".tmp", "~")
588590
with tarfile.open(self._workdir / name, mode="w") as tar:
589591
with ChangeDir(self._ctx.source_dir / "src/pybind/mgr"):
@@ -596,7 +598,7 @@ def _py_mgr_job(self, component):
596598

597599
def _py_common_job(self, component):
598600
name = "python_common.tar"
599-
exclude_dirs = ("tests", "node_modules")
601+
exclude_dirs = ("tests", "node_modules", ".tox" )
600602
exclude_file_suffixes = (".pyc", ".pyo", ".tmp", "~")
601603
with tarfile.open(self._workdir / name, mode="w") as tar:
602604
with ChangeDir(self._ctx.source_dir / "src/python-common"):
@@ -676,7 +678,7 @@ def _rgw_job(self, component):
676678
return self._bins_and_libs(
677679
prefix="rgw",
678680
bin_patterns=["radosgw", "radosgw-admin"],
679-
lib_patterns=["libradosgw.so*"],
681+
lib_patterns=["librados.so*", "libceph-common.so*"],
680682
)
681683
return out
682684

0 commit comments

Comments
 (0)