#138 run hardlink at the end
Merged 3 years ago by nb. Opened 3 years ago by jibecfed.
fedora-docs/ jibecfed/docs-fp-o prod  into  prod

file modified
+10 -6
@@ -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", "-al", original_module_dir, module_dir])

+                     subprocess.run(["cp", "-a", original_module_dir, module_dir])

  

                      if module == "ROOT" or "nav" in antora_yml:

                          # if this is the main antora.yml file

-                         subprocess.run(["cp", "-al", antora_yml_file, os.path.join(en_sources, component, version, "antora.yml")])

+                         subprocess.run(["cp", "-a", 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", "-al", en_component_dir, lang_dir])

+                 subprocess.run(["cp", "-a", 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", "-al", src, translated_sources + "/"])

+             subprocess.run(["cp", "-a", 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", "-al", source_dir, target_dir_copying])

+             subprocess.run(["cp", "-a", 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", "-al", results_dir, "{}/".format(copying_dir)])

+             subprocess.run(["cp", "-a", results_dir, "{}/".format(copying_dir)])

  

              # Swap the old tree for the new one for each language

              log("Moving languages to the final place:")
@@ -417,6 +417,10 @@ 

                  shutil.rmtree(os.path.join(publish_dir, lang), ignore_errors=True)

                  subprocess.run(["mv", os.path.join(copying_dir, "public", lang), "{}/".format(publish_dir)])

  

+             # https://pagure.io/fedora-infrastructure/issue/8964

+             log("Consolidate files with hardlink...")

+             subprocess.run(["hardlink", "-v", "{}/".format(publish_dir)])

+ 

              # And finally remove the copying dir

              log("Removing the copying dir...")

              shutil.rmtree(copying_dir, ignore_errors=True)

as asked in https://pagure.io/fedora-infrastructure/issue/8964
tested on my computer with podman run --rm -it -e "BUILD_ENV=prod" -e "BUILD_LANGS=all" -v $(pwd)/output:/antora/output:Z fedora-docs-openshift-rebuild

+1. looks good to me!

Pull-Request has been merged by nb

3 years ago
Metadata