#161 Syncing back stg with prod
Merged 2 years ago by pbokoc. Opened 2 years ago by darknao.
fedora-docs/ darknao/docs-fp-o stg  into  stg

file modified
+57 -22
@@ -127,18 +127,23 @@ 

  

          # Get a list of the original English repos

          repos = []

+         default_branch = site_yml["content"].get("branches", ["master"])

+         if type(default_branch) is str:

+             default_branch = [default_branch]

+ 

          for repo_data in site_yml["content"]["sources"]:

  

-             if "branches" not in repo_data:

-                 repo_data["branches"] = ["master"]

-             if "start_path" not in repo_data:

-                 repo_data["start_path"] = ""

+             branches = repo_data.get("branches", default_branch)

+             if type(branches) is str:

+                 branches = [branches]

+ 

+             start_path = repo_data.get("start_path", "")

  

-             for branch in repo_data["branches"]:

+             for branch in branches:

                  repo = {}

                  repo["url"] = repo_data["url"]

                  repo["branch"] = branch

-                 repo["start_path"] = repo_data["start_path"]

+                 repo["start_path"] = start_path

  

                  repos.append(repo)

          
@@ -177,11 +182,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", "-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", "-r", 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 +207,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", "-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", "-r", src, translated_sources + "/"])

+             subprocess.run(["cp", "-a", src, translated_sources + "/"])

  

      return components

  
@@ -299,7 +304,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", "-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)
@@ -363,18 +368,48 @@ 

                      sys.exit(1)

  

              # Copying all the translated sites

+             log("")

+             log("=== Copying translated sites ===")

+ 

+             results_dir = os.path.join(docs_repo, "public")

+             publish_dir = "/antora/output"

+             copying_dir = os.path.join(publish_dir, "copying.tmp")

+ 

+             # I have:

+             # docs_repo/public            <- results_dir  (local partition)

+             # /antora/output/copying.tmp  <- copying_dir  (mounted partition)

+             # /antora/output              <- publish_dir  (mounted partition)

+             #

+             # I need to:

+             #   1/  copy from local to mounted

+             #   2/  remove old in mounted

+             #   3/  move new within mounted

+             #   4/  remove the copying dir

+ 

+             # Make sure copying_dir exists and is empty

+             shutil.rmtree(copying_dir, ignore_errors=True)

+             subprocess.run(["mkdir", copying_dir])

+ 

+             # Copy results from local partition to a mounted partition

+             log("Copying between partitions...")

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

              for lang in languages:

-                 log("")

-                 log("===== Copying the {lang} site =====".format(lang=lang))

-                 source_dir = os.path.join(docs_repo, "public")

-                 target_dir_copying = "/antora/output/{lang}.building".format(lang=lang)

-                 target_dir_copied = "/antora/output/{lang}.building/{lang}".format(lang=lang)

-                 target_dir_final = "/antora/output/{lang}".format(lang=lang)

-                 shutil.rmtree(target_dir_copying, ignore_errors=True)

-                 subprocess.run(["cp", "-r", 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)

+                 log("  - {}".format(lang))

+                 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)

+ 

+             log("DONE!")

      

  

  

file modified
+19 -1
@@ -1,5 +1,5 @@ 

  site:

-   title: Fedora Docs Site

+   title: Fedora Docs

    url: https://docs.fedoraproject.org/en-US/

    start_page: docs::index.adoc

  content:
@@ -14,6 +14,8 @@ 

    - url: https://pagure.io/fedora-docs/release-docs-home.git

      branches:

      - master

+     - f34

+     - f33

      - f32

      - f31

      - f30
@@ -24,6 +26,8 @@ 

    - url: https://pagure.io/fedora-docs/install-guide.git

      branches:

      - master

+     - f34

+     - f33

      - f32

      - f31

      - f30
@@ -34,6 +38,8 @@ 

    - url: https://pagure.io/fedora-docs/system-administrators-guide.git

      branches:

      - master

+     - f34

+     - f33

      - f32

      - f31

      - f30
@@ -44,6 +50,8 @@ 

    - url: https://pagure.io/fedora-docs/release-notes.git

      branches:

      - master

+     - f34

+     - f33

      - f32

      - f31

      - f30
@@ -65,6 +73,8 @@ 

      branches: main

    - url: https://pagure.io/fedora-docs/modularity.git

    - url: https://github.com/fedora-silverblue/silverblue-docs.git

+   - url: https://pagure.io/fedora-kde/kinoite-docs

+     branches: main

    - url: https://pagure.io/fedora-docs/documentation-contributors-guide.git

    - url: https://pagure.io/fedora-docs/flatpak.git

    - url: https://pagure.io/fedora-diversity.git
@@ -88,15 +98,23 @@ 

    - url: https://pagure.io/fedora-magazine.git

    - url: https://pagure.io/minimization.git

    - url: https://github.com/coreos/fedora-coreos-docs.git

+     branches: main

    - url: https://pagure.io/cpe/rawhide-gating-docs.git

    - url: https://pagure.io/cpe/docs.git

    - url: https://pagure.io/fedora-docs/websites.git

+   - url: https://pagure.io/fedora-qa/qa-docs.git

    - url: https://pagure.io/fedora-pgm/pgm_docs.git

      branches: main

    - url: https://pagure.io/Ask-Fedora-SOP-docs.git

    - url: https://pagure.io/fedora-join/fedora-join-docs.git

    - url: https://pagure.io/fedora-docs/localization.git

    - url: https://pagure.io/fedora-l10n/docs.git

+   - url: https://github.com/fedora-eln/eln-docs.git

+   - url: https://pagure.io/i3-sig/docs.git

+   - url: https://github.com/fedora-infra/fedora-accounts-docs.git

+     branches: main

+   - url: https://pagure.io/gaming/documentation.git

+     branches: main

    - url: https://pagure.io/fedora-server.git

      branches: main

      start_path: docs

Related: https://pagure.io/fedora-docs/docs-fp-o/issue/160

These are some missing commits from prod that should also be in stg.
It should be enough to get translated build working on staging again.

1 new commit added

  • disable the edit link for translated pages
2 years ago

11 new commits added

  • Switch Fedora CoreOS docs build to main branch
  • Publish F34 docs
  • Change Accounts branch to main
  • site.yaml: Add Fedora Kinoite docs
  • Gaming switched default branch to main
  • Add Fedora Gaming docs to Engineering
  • Remove "Site" from site title
  • add qa docs
  • replace cp -r by cp -a & run hardlink at the end
  • run hardlink at the end
  • allow single branch and detect default branch
2 years ago

Pull-Request has been merged by pbokoc

2 years ago