From f478f77894cd8c8de383b8eeb1521822b2d22524 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Jun 15 2020 13:00:02 +0000 Subject: replace cp -r by cp -al limit the impact on filesystem for rsync, as asked by infra team --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index c478e40..529814a 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -177,11 +177,11 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): original_module_dir = os.path.join(repo_dir, "modules", module) module_dir = os.path.join(en_sources, component, version, "modules", module) - subprocess.run(["cp", "-r", original_module_dir, module_dir]) + subprocess.run(["cp", "-al", original_module_dir, module_dir]) if module == "ROOT" or "nav" in antora_yml: # if this is the main antora.yml file - subprocess.run(["cp", "-r", antora_yml_file, os.path.join(en_sources, component, version, "antora.yml")]) + subprocess.run(["cp", "-al", antora_yml_file, os.path.join(en_sources, component, version, "antora.yml")]) log("----- copying antora.yml for {component} {module} {version}".format( component=component, module=module, version=version)) else: @@ -202,13 +202,13 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): lang_dir = os.path.join(translated_sources, language) for component in components: en_component_dir = os.path.join(en_sources, component) - subprocess.run(["cp", "-r", en_component_dir, lang_dir]) + subprocess.run(["cp", "-al", en_component_dir, lang_dir]) # And finally copy the original translated sources # into translated_sources for language in languages: src = os.path.join(translated_sources_original, language) - subprocess.run(["cp", "-r", src, translated_sources + "/"]) + subprocess.run(["cp", "-al", src, translated_sources + "/"]) return components @@ -312,7 +312,7 @@ def main(): target_dir_copied = "/antora/output/en-US.building/en-US" target_dir_final = "/antora/output/en-US" shutil.rmtree(target_dir_copying, ignore_errors=True) - subprocess.run(["cp", "-r", source_dir, target_dir_copying]) + subprocess.run(["cp", "-al", source_dir, target_dir_copying]) shutil.rmtree(target_dir_final, ignore_errors=True) shutil.move(target_dir_copied, target_dir_final) shutil.rmtree(target_dir_copying, ignore_errors=True) @@ -408,7 +408,7 @@ def main(): # Copy results from local partition to a mounted partition log("Copying between partitions...") - subprocess.run(["cp", "-r", results_dir, "{}/".format(copying_dir)]) + subprocess.run(["cp", "-al", results_dir, "{}/".format(copying_dir)]) # Swap the old tree for the new one for each language log("Moving languages to the final place:")