#137 replace cp -r by cp -al
Merged 3 years ago by pbokoc. Opened 3 years ago by jibecfed.
fedora-docs/ jibecfed/docs-fp-o prod  into  prod

@@ -177,11 +177,11 @@ 

                      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 @@ 

              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 @@ 

              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 @@ 

  

              # 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:")

limit the impact on filesystem for rsync, as asked by infra team in https://pagure.io/fedora-infrastructure/issue/8964

note: I tested it on my computer with all languages, it takes 35 minutes instead of 2h30, which may be too good to be true :)

Pull-Request has been merged by pbokoc

3 years ago
Metadata