From 81b7d5552ddfe40070c14f98de0827c82cd6c080 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 23 2019 13:35:40 +0000 Subject: [PATCH 1/88] fix local preview --- diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..f7093b3 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,14 @@ +server { + listen 80; + server_name localhost; + + location / { + root /antora/public; + index index.html index.htm; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} From 996f323054151f21a248890ebb9f4d31220a3099 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 23 2019 13:35:40 +0000 Subject: [PATCH 2/88] initial search functionality --- diff --git a/pages/search/antora.yml b/pages/search/antora.yml new file mode 100644 index 0000000..d57be41 --- /dev/null +++ b/pages/search/antora.yml @@ -0,0 +1,6 @@ +name: search +title: Fedora Documentation Search +version: master +start-page: ROOT::index.adoc +nav: + - modules/ROOT/nav.adoc diff --git a/pages/search/modules/ROOT/pages/index.adoc b/pages/search/modules/ROOT/pages/index.adoc new file mode 100644 index 0000000..80b522b --- /dev/null +++ b/pages/search/modules/ROOT/pages/index.adoc @@ -0,0 +1,2 @@ += Fedora Documentation Search +:page-layout: search diff --git a/preview.sh b/preview.sh index acc52af..9c5d46f 100755 --- a/preview.sh +++ b/preview.sh @@ -5,7 +5,7 @@ if [ "$(uname)" == "Darwin" ]; then # Let's assume that the user has the Docker CE installed # which doesn't require a root password. echo "The preview will be available at http://localhost:8080/" - docker run --rm -v $(pwd):/antora:ro -v $(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf:ro -p 8080:80 nginx + docker run --rm -v $(pwd)/public:/usr/share/nginx/html:ro -p 8080:80 nginx elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then # Running on Linux. diff --git a/site.yml b/site.yml index 76b1eeb..d29da60 100644 --- a/site.yml +++ b/site.yml @@ -5,6 +5,9 @@ site: content: branches: master sources: + - url: ./ + start_path: pages/search + branches: HEAD - url: https://pagure.io/fedora-docs/docs-fp-o start_path: pages/homepage - url: https://pagure.io/fedora-docs/docs-fp-o @@ -70,7 +73,7 @@ content: - url: https://pagure.io/java-packaging-howto.git ui: bundle: - url: https://asamalik.fedorapeople.org/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip snapshot: true default_layout: with_menu output: From 00baf92855ba6aabe287b407f3ac470ca5b64860 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 23 2019 13:35:40 +0000 Subject: [PATCH 3/88] add Ask Fedora SOPs --- diff --git a/pages/engineering/modules/ROOT/pages/index.adoc b/pages/engineering/modules/ROOT/pages/index.adoc index 5219c6a..0f6bc5e 100644 --- a/pages/engineering/modules/ROOT/pages/index.adoc +++ b/pages/engineering/modules/ROOT/pages/index.adoc @@ -15,6 +15,8 @@ * link:https://fedora-infra-docs.readthedocs.io/en/latest/[**Fedora Infrastructure 🔗**] — Documentation covering the development and administration of the many projects that make Fedora work. +* xref:ask-fedora-sops:ROOT:index.adoc[**Ask Fedora SOPs**] — Ask Fedora is the web application used by the community for user-end troubleshooting. These documents describe the Standard Operating Procedures related to Ask Fedora. + == Other Engineering Resources * xref:flatpak:ROOT:index.adoc[**Flatpak in Fedora**] — Learn how to build Flatpaks out of Fedora RPM packages. diff --git a/site.yml b/site.yml index d29da60..ec46564 100644 --- a/site.yml +++ b/site.yml @@ -71,6 +71,7 @@ content: start_path: docs - url: https://pagure.io/fedora-ci/docs.git - url: https://pagure.io/java-packaging-howto.git + - url: https://pagure.io/Ask-Fedora-SOP-docs.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip From ece05137fddb5418cb14bb64b4819cfad0d5ab49 Mon Sep 17 00:00:00 2001 From: Jibec Date: Apr 23 2019 13:35:40 +0000 Subject: [PATCH 4/88] use latest translated sources --- diff --git a/site-cs-CZ.yml b/site-cs-CZ.yml deleted file mode 100644 index d9d8e9a..0000000 --- a/site-cs-CZ.yml +++ /dev/null @@ -1,92 +0,0 @@ -site: - title: Fedora Docs Site - url: https://docs.fedoraproject.org - start_page: docs::index.adoc -content: - branches: master - sources: -##### Translated sources ##### - - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora/f28 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora/f29 - - -##### Original sources ##### -# (Translated pieces are commented out) - -# - url: . -# start_path: pages/homepage - - url: . - start_path: pages/engineering - - url: . - start_path: pages/mindshare - - url: https://pagure.io/fedora-docs/release-docs-home.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/install-guide.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/system-administrators-guide.git - branches: - - master - - f29 - - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/release-notes.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/quick-docs.git - - url: https://pagure.io/mentored-projects.git - - url: https://pagure.io/fedora-commops.git - start_path: docs - - url: https://pagure.io/Fedora-Council/council-docs.git - start_path: council - - url: https://pagure.io/Fedora-Council/council-docs.git - start_path: project - - url: https://pagure.io/fedora-docs/modularity.git - - url: https://pagure.io/fedora-docs/silverblue.git - - 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 - - url: https://pagure.io/packaging-committee.git - start_path: guidelines - - url: https://pagure.io/mindshare.git - start_path: website - - url: https://pagure.io/fesco/fesco-docs.git - start_path: fesco - - url: https://pagure.io/fedora-iot/iot-docs.git - - url: https://pagure.io/fedora-badges.git - start_path: docs -ui: - bundle: - url: https://asamalik.fedorapeople.org/ui-bundle.zip - snapshot: true - default_layout: with_menu -output: - clean: true - dir: ./public/cs-CZ - destinations: - - provider: archive -runtime: - pull: true - cache_dir: ./cache -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js diff --git a/site-cs.yml b/site-cs.yml new file mode 100644 index 0000000..2348e1b --- /dev/null +++ b/site-cs.yml @@ -0,0 +1,140 @@ +site: + title: Fedora Docs Site + url: https://docs.fedoraproject.org + start_page: docs::index.adoc +content: + branches: master + sources: +##### Translated sources ##### + + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/project/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/quick-docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/engineering/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/badges/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/containers/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/mentored-projects/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/fedora-silverblue/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/diversity-inclusion/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/fesco/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/neurofedora/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/fedora/rawhide + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/fedora/f28 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/fedora/f26 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/fedora/f29 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/fedora/f27 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/teleirc-sig/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/remix-building/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/java-packaging-howto/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/mindshare/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/iot/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/modularity/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/mindshare-committee/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/packaging-guidelines/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/flatpak/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/commops/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/fedora-docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: cs/council/master + +##### Original sources ##### +# (Translated pieces are commented out) + +# - url: . +# start_path: pages/homepage +# - url: . +# start_path: pages/engineering +# - url: . +# start_path: pages/mindshare +# - url: https://pagure.io/fedora-docs/release-docs-home.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/install-guide.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/system-administrators-guide.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/release-notes.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/quick-docs.git +# - url: https://pagure.io/mentored-projects.git +# - url: https://pagure.io/fedora-commops.git +# start_path: docs +# - url: https://pagure.io/Fedora-Council/council-docs.git +# start_path: council +# - url: https://pagure.io/Fedora-Council/council-docs.git +# start_path: project +# - url: https://pagure.io/fedora-docs/modularity.git +# - 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 +# - url: https://pagure.io/packaging-committee.git +# start_path: guidelines +# - url: https://pagure.io/mindshare.git +# start_path: website +# - url: https://pagure.io/fesco/fesco-docs.git +# start_path: fesco +# - url: https://pagure.io/fedora-iot/iot-docs.git +# - url: https://pagure.io/fedora-badges.git +# start_path: docs +ui: + bundle: + url: https://asamalik.fedorapeople.org/ui-bundle.zip + snapshot: true + default_layout: with_menu +output: + clean: true + dir: ./public/cs + destinations: + - provider: archive +runtime: +# pull: true + cache_dir: ./cache +asciidoc: + extensions: + - ./lib/extensions/package-inline-macro.js \ No newline at end of file diff --git a/site-fr-FR.yml b/site-fr-FR.yml deleted file mode 100644 index 85e9582..0000000 --- a/site-fr-FR.yml +++ /dev/null @@ -1,92 +0,0 @@ -site: - title: Fedora Docs Site - url: https://docs.fedoraproject.org - start_page: docs::index.adoc -content: - branches: master - sources: -##### Translated sources ##### - - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora/f28 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora/f29 - - -##### Original sources ##### -# (Translated pieces are commented out) - -# - url: . -# start_path: pages/homepage - - url: . - start_path: pages/engineering - - url: . - start_path: pages/mindshare - - url: https://pagure.io/fedora-docs/release-docs-home.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/install-guide.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/system-administrators-guide.git - branches: - - master - - f29 - - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/release-notes.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/quick-docs.git - - url: https://pagure.io/mentored-projects.git - - url: https://pagure.io/fedora-commops.git - start_path: docs - - url: https://pagure.io/Fedora-Council/council-docs.git - start_path: council - - url: https://pagure.io/Fedora-Council/council-docs.git - start_path: project - - url: https://pagure.io/fedora-docs/modularity.git - - url: https://pagure.io/fedora-docs/silverblue.git - - 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 - - url: https://pagure.io/packaging-committee.git - start_path: guidelines - - url: https://pagure.io/mindshare.git - start_path: website - - url: https://pagure.io/fesco/fesco-docs.git - start_path: fesco - - url: https://pagure.io/fedora-iot/iot-docs.git - - url: https://pagure.io/fedora-badges.git - start_path: docs -ui: - bundle: - url: https://asamalik.fedorapeople.org/ui-bundle.zip - snapshot: true - default_layout: with_menu -output: - clean: true - dir: ./public/fr-FR - destinations: - - provider: archive -runtime: - pull: true - cache_dir: ./cache -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js diff --git a/site-fr.yml b/site-fr.yml new file mode 100644 index 0000000..6e823b6 --- /dev/null +++ b/site-fr.yml @@ -0,0 +1,140 @@ +site: + title: Fedora Docs Site + url: https://docs.fedoraproject.org + start_page: docs::index.adoc +content: + branches: master + sources: +##### Translated sources ##### + + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/project/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/quick-docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/engineering/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/badges/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/containers/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/mentored-projects/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/fedora-silverblue/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/diversity-inclusion/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/fesco/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/neurofedora/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/fedora/rawhide + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/fedora/f28 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/fedora/f26 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/fedora/f29 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/fedora/f27 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/teleirc-sig/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/remix-building/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/java-packaging-howto/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/mindshare/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/iot/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/modularity/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/mindshare-committee/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/packaging-guidelines/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/flatpak/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/commops/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/fedora-docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: fr/council/master + +##### Original sources ##### +# (Translated pieces are commented out) + +# - url: . +# start_path: pages/homepage +# - url: . +# start_path: pages/engineering +# - url: . +# start_path: pages/mindshare +# - url: https://pagure.io/fedora-docs/release-docs-home.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/install-guide.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/system-administrators-guide.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/release-notes.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/quick-docs.git +# - url: https://pagure.io/mentored-projects.git +# - url: https://pagure.io/fedora-commops.git +# start_path: docs +# - url: https://pagure.io/Fedora-Council/council-docs.git +# start_path: council +# - url: https://pagure.io/Fedora-Council/council-docs.git +# start_path: project +# - url: https://pagure.io/fedora-docs/modularity.git +# - 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 +# - url: https://pagure.io/packaging-committee.git +# start_path: guidelines +# - url: https://pagure.io/mindshare.git +# start_path: website +# - url: https://pagure.io/fesco/fesco-docs.git +# start_path: fesco +# - url: https://pagure.io/fedora-iot/iot-docs.git +# - url: https://pagure.io/fedora-badges.git +# start_path: docs +ui: + bundle: + url: https://asamalik.fedorapeople.org/ui-bundle.zip + snapshot: true + default_layout: with_menu +output: + clean: true + dir: ./public/fr + destinations: + - provider: archive +runtime: +# pull: true + cache_dir: ./cache +asciidoc: + extensions: + - ./lib/extensions/package-inline-macro.js \ No newline at end of file diff --git a/site-jp-JP.yml b/site-jp-JP.yml deleted file mode 100644 index 2e00076..0000000 --- a/site-jp-JP.yml +++ /dev/null @@ -1,92 +0,0 @@ -site: - title: Fedora Docs Site - url: https://docs.fedoraproject.org - start_page: docs::index.adoc -content: - branches: master - sources: -##### Translated sources ##### - - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora/f28 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora/f29 - - -##### Original sources ##### -# (Translated pieces are commented out) - -# - url: . -# start_path: pages/homepage - - url: . - start_path: pages/engineering - - url: . - start_path: pages/mindshare - - url: https://pagure.io/fedora-docs/release-docs-home.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/install-guide.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/system-administrators-guide.git - branches: - - master - - f29 - - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/release-notes.git - branches: - - master -# - f29 -# - f28 - - f27 - - f26 - - url: https://pagure.io/fedora-docs/quick-docs.git - - url: https://pagure.io/mentored-projects.git - - url: https://pagure.io/fedora-commops.git - start_path: docs - - url: https://pagure.io/Fedora-Council/council-docs.git - start_path: council - - url: https://pagure.io/Fedora-Council/council-docs.git - start_path: project - - url: https://pagure.io/fedora-docs/modularity.git - - url: https://pagure.io/fedora-docs/silverblue.git - - 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 - - url: https://pagure.io/packaging-committee.git - start_path: guidelines - - url: https://pagure.io/mindshare.git - start_path: website - - url: https://pagure.io/fesco/fesco-docs.git - start_path: fesco - - url: https://pagure.io/fedora-iot/iot-docs.git - - url: https://pagure.io/fedora-badges.git - start_path: docs -ui: - bundle: - url: https://asamalik.fedorapeople.org/ui-bundle.zip - snapshot: true - default_layout: with_menu -output: - clean: true - dir: ./public/jp-JP - destinations: - - provider: archive -runtime: - pull: true - cache_dir: ./cache -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js diff --git a/site-jp.yml b/site-jp.yml new file mode 100644 index 0000000..63c94bc --- /dev/null +++ b/site-jp.yml @@ -0,0 +1,140 @@ +site: + title: Fedora Docs Site + url: https://docs.fedoraproject.org + start_page: docs::index.adoc +content: + branches: master + sources: +##### Translated sources ##### + + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/project/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/quick-docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/engineering/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/badges/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/containers/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/mentored-projects/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/fedora-silverblue/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/diversity-inclusion/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/fesco/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/neurofedora/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/fedora/rawhide + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/fedora/f28 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/fedora/f26 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/fedora/f29 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/fedora/f27 + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/teleirc-sig/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/remix-building/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/java-packaging-howto/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/mindshare/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/iot/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/modularity/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/mindshare-committee/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/packaging-guidelines/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/flatpak/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/commops/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/fedora-docs/master + - url: https://pagure.io/fedora-docs/translated-sources.git + start_path: jp/council/master + +##### Original sources ##### +# (Translated pieces are commented out) + +# - url: . +# start_path: pages/homepage +# - url: . +# start_path: pages/engineering +# - url: . +# start_path: pages/mindshare +# - url: https://pagure.io/fedora-docs/release-docs-home.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/install-guide.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/system-administrators-guide.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/release-notes.git +# branches: +# - master +# - f29 +# - f28 +# - f27 +# - f26 +# - url: https://pagure.io/fedora-docs/quick-docs.git +# - url: https://pagure.io/mentored-projects.git +# - url: https://pagure.io/fedora-commops.git +# start_path: docs +# - url: https://pagure.io/Fedora-Council/council-docs.git +# start_path: council +# - url: https://pagure.io/Fedora-Council/council-docs.git +# start_path: project +# - url: https://pagure.io/fedora-docs/modularity.git +# - 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 +# - url: https://pagure.io/packaging-committee.git +# start_path: guidelines +# - url: https://pagure.io/mindshare.git +# start_path: website +# - url: https://pagure.io/fesco/fesco-docs.git +# start_path: fesco +# - url: https://pagure.io/fedora-iot/iot-docs.git +# - url: https://pagure.io/fedora-badges.git +# start_path: docs +ui: + bundle: + url: https://asamalik.fedorapeople.org/ui-bundle.zip + snapshot: true + default_layout: with_menu +output: + clean: true + dir: ./public/jp + destinations: + - provider: archive +runtime: +# pull: true + cache_dir: ./cache +asciidoc: + extensions: + - ./lib/extensions/package-inline-macro.js \ No newline at end of file From b19ee9120686e4f0b9bbc31017d721f6f005d1ac Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 23 2019 13:35:40 +0000 Subject: [PATCH 5/88] support for translated site --- diff --git a/build-translated.sh b/build-translated.sh index e449d89..ef57ba1 100755 --- a/build-translated.sh +++ b/build-translated.sh @@ -1,20 +1,34 @@ -#!/bin/sh +#!/bin/bash + +languages="cs fr jp" + + +create_language_menu() { + { + echo '
' + echo " " + echo '
' + echo ' en-US' + for lang in $languages; do + echo " $lang" + done + echo '
' + echo '
' + } > ./supplemental-ui/partials/page-languages.hbs +} + if [ "$(uname)" == "Darwin" ]; then - # Running on macOS. - # Let's assume that the user has the Docker CE installed - # which doesn't require a root password. - docker run --rm -it -v $(pwd):/antora antora/antora --html-url-extension-style=indexify site-cs-CZ.yml - docker run --rm -it -v $(pwd):/antora antora/antora --html-url-extension-style=indexify site-fr-FR.yml - docker run --rm -it -v $(pwd):/antora antora/antora --html-url-extension-style=indexify site-jp-JP.yml + for current_lang in $languages; do + create_language_menu "$current_lang" + docker run -e "LANGUAGE=$current_lang" -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora antora/antora --html-url-extension-style=indexify site-$current_lang.yml + done elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then - # Running on Linux. - # Let's assume that it's running the Docker deamon - # which requires root. - echo "" - echo "This build script is using Docker to run the build in an isolated environment. You might be asked for a root password in order to start it." - sudo docker run --rm -it -v $(pwd):/antora:z antora/antora --html-url-extension-style=indexify site-cs-CZ.yml - sudo docker run --rm -it -v $(pwd):/antora:z antora/antora --html-url-extension-style=indexify site-fr-FR.yml - sudo docker run --rm -it -v $(pwd):/antora:z antora/antora --html-url-extension-style=indexify site-jp-JP.yml + for current_lang in $languages; do + create_language_menu "$current_lang" + podman run -e "LANGUAGE=$current_lang" -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora:z antora/antora --html-url-extension-style=indexify site-$current_lang.yml + done fi + +create_language_menu "en-US" diff --git a/site-cs.yml b/site-cs.yml index 2348e1b..74a7b67 100644 --- a/site-cs.yml +++ b/site-cs.yml @@ -124,17 +124,18 @@ content: # start_path: docs ui: bundle: - url: https://asamalik.fedorapeople.org/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip snapshot: true default_layout: with_menu + supplemental_files: ./supplemental-ui output: clean: true dir: ./public/cs destinations: - provider: archive runtime: -# pull: true + pull: true cache_dir: ./cache asciidoc: extensions: - - ./lib/extensions/package-inline-macro.js \ No newline at end of file + - ./lib/extensions/package-inline-macro.js diff --git a/site-fr.yml b/site-fr.yml index 6e823b6..23ae509 100644 --- a/site-fr.yml +++ b/site-fr.yml @@ -124,17 +124,18 @@ content: # start_path: docs ui: bundle: - url: https://asamalik.fedorapeople.org/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip snapshot: true default_layout: with_menu + supplemental_files: ./supplemental-ui output: clean: true dir: ./public/fr destinations: - provider: archive runtime: -# pull: true + pull: true cache_dir: ./cache asciidoc: extensions: - - ./lib/extensions/package-inline-macro.js \ No newline at end of file + - ./lib/extensions/package-inline-macro.js diff --git a/site-jp.yml b/site-jp.yml index 63c94bc..00ffe26 100644 --- a/site-jp.yml +++ b/site-jp.yml @@ -124,17 +124,18 @@ content: # start_path: docs ui: bundle: - url: https://asamalik.fedorapeople.org/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip snapshot: true default_layout: with_menu + supplemental_files: ./supplemental-ui output: clean: true dir: ./public/jp destinations: - provider: archive runtime: -# pull: true + pull: true cache_dir: ./cache asciidoc: extensions: - - ./lib/extensions/package-inline-macro.js \ No newline at end of file + - ./lib/extensions/package-inline-macro.js diff --git a/site.yml b/site.yml index ec46564..fb055e1 100644 --- a/site.yml +++ b/site.yml @@ -77,6 +77,7 @@ ui: url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip snapshot: true default_layout: with_menu + supplemental_files: ./supplemental-ui output: clean: true dir: ./public/en-US diff --git a/supplemental-ui/partials/page-languages.hbs b/supplemental-ui/partials/page-languages.hbs new file mode 100644 index 0000000..c55c578 --- /dev/null +++ b/supplemental-ui/partials/page-languages.hbs @@ -0,0 +1,9 @@ +
+ +
+ en-US + cs + fr + jp +
+
From 7094390b50f1f9d95ef62e46c257612bc06d3856 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 23 2019 13:35:40 +0000 Subject: [PATCH 6/88] add languages UI --- diff --git a/site-cs.yml b/site-cs.yml index 74a7b67..56dc56d 100644 --- a/site-cs.yml +++ b/site-cs.yml @@ -124,7 +124,7 @@ content: # start_path: docs ui: bundle: - url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui diff --git a/site-fr.yml b/site-fr.yml index 23ae509..8e463a2 100644 --- a/site-fr.yml +++ b/site-fr.yml @@ -124,7 +124,7 @@ content: # start_path: docs ui: bundle: - url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui diff --git a/site-jp.yml b/site-jp.yml index 00ffe26..9bd7669 100644 --- a/site-jp.yml +++ b/site-jp.yml @@ -124,7 +124,7 @@ content: # start_path: docs ui: bundle: - url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui diff --git a/site.yml b/site.yml index fb055e1..32e706b 100644 --- a/site.yml +++ b/site.yml @@ -74,7 +74,7 @@ content: - url: https://pagure.io/Ask-Fedora-SOP-docs.git ui: bundle: - url: https://asamalik.fedorapeople.org/docs-dev/ui-bundle.zip + url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 396794ad223a2132c482b08f1449124b85cf7426 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 23 2019 13:35:40 +0000 Subject: [PATCH 7/88] gix build script for translated content --- diff --git a/build-translated.sh b/build-translated.sh index ef57ba1..9317248 100755 --- a/build-translated.sh +++ b/build-translated.sh @@ -2,21 +2,22 @@ languages="cs fr jp" - create_language_menu() { { echo '
' echo " " echo '
' - echo ' en-US' + echo ' en-US' for lang in $languages; do - echo " $lang" + echo " $lang" done echo '
' echo '
' } > ./supplemental-ui/partials/page-languages.hbs } +create_language_menu "en-US" +exit if [ "$(uname)" == "Darwin" ]; then for current_lang in $languages; do diff --git a/supplemental-ui/partials/page-languages.hbs b/supplemental-ui/partials/page-languages.hbs index c55c578..b65342e 100644 --- a/supplemental-ui/partials/page-languages.hbs +++ b/supplemental-ui/partials/page-languages.hbs @@ -1,9 +1,9 @@
- en-US - cs - fr - jp + en-US + cs + fr + jp
From ee71c0a2eaae3c557b06652c581c48e9da28df43 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 23 2019 13:35:40 +0000 Subject: [PATCH 8/88] languages build script --- diff --git a/build-scripts/rebuild-site.sh b/build-scripts/rebuild-site.sh index c49438b..a5f0819 100755 --- a/build-scripts/rebuild-site.sh +++ b/build-scripts/rebuild-site.sh @@ -47,11 +47,49 @@ if ! $BUILD_CMD ; then exit 1 fi +# FIXME: Building languages, this code needs some love + +languages="cs fr jp" + +create_language_menu() { + { + echo '
' + echo " " + echo '
' + echo ' en-US' + for lang in $languages; do + echo " $lang" + done + echo '
' + echo '
' + } > "$workdir/source/supplemental-ui/partials/page-languages.hbs" +} + +for current_lang in $languages; do + create_language_menu "$current_lang" + if ! antora --html-url-extension-style=indexify site-$current_lang.yml ; then + echo "" + echo "Error building translated site for $current_lang." + rm -rf "$workdir" + exit 1 + fi +done + +create_language_menu "en-US" + +# End building languages + popd > /dev/null cp -r "$workdir/source/public/en-US" "$target/output/en-US.building" && rm -rf "$target/output/en-US" && mv "$target/output/en-US.building" "$target/output/en-US" || exit 1 cp "$workdir/source/static/index.html" "$target/output/index.html" || exit 1 +# copy languages +for current_lang in $languages; do + cp -r "$workdir/source/public/$current_lang" "$target/output/$current_lang.building" && mv "$target/output/$current_lang.building" "$target/output/$current_lang" || exit 1 +done +# end languages + rm -rf "$workdir" echo "" From dacf0a9be3f7ada03dced130cf080648d8a6fc61 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Apr 23 2019 14:47:55 +0000 Subject: [PATCH 9/88] fix build for languages --- diff --git a/build-scripts/rebuild-site.sh b/build-scripts/rebuild-site.sh index a5f0819..52b6f34 100755 --- a/build-scripts/rebuild-site.sh +++ b/build-scripts/rebuild-site.sh @@ -86,7 +86,7 @@ cp "$workdir/source/static/index.html" "$target/output/index.html" || exit 1 # copy languages for current_lang in $languages; do - cp -r "$workdir/source/public/$current_lang" "$target/output/$current_lang.building" && mv "$target/output/$current_lang.building" "$target/output/$current_lang" || exit 1 + cp -r "$workdir/source/public/$current_lang" "$target/output/$current_lang.building" && rm -rf "$target/output/$current_lang" && mv "$target/output/$current_lang.building" "$target/output/$current_lang" || exit 1 done # end languages From 063b88afa7e34a99755935335b4453068193b9da Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: May 15 2019 09:45:07 +0000 Subject: [PATCH 10/88] /pages moved to pagure/fedora-docs/pages --- diff --git a/pages/engineering/antora.yml b/pages/engineering/antora.yml deleted file mode 100644 index a36817b..0000000 --- a/pages/engineering/antora.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Name will be mostly visible in the URL. Treat it as an indentifier. -# Tip: If you want to use the local preview scripts that come with this repository, please change this value in the site.yml file as well. (under site/start_page) -name: engineering # <---- PLEASE MODIFY - -# Title will be visible on the page. -title: Engineering Teams # <---- PLEASE MODIFY - -# If you don't plan to have multiple versions of the docs (for example, to document multiple versions of some software), you can ignore this field. Otherwise, change "master" to a specific version. -version: master - -# We encourage you to name the index page as "index.adoc". If you absolutely have to use a different name, please reflect it here. You can ignore this field otherwise. -start_page: ROOT:index - -# This lists all the menu definitions of your component. -#nav: -#- modules/ROOT/nav.adoc diff --git a/pages/engineering/modules/ROOT/pages/index.adoc b/pages/engineering/modules/ROOT/pages/index.adoc deleted file mode 100644 index 0f6bc5e..0000000 --- a/pages/engineering/modules/ROOT/pages/index.adoc +++ /dev/null @@ -1,22 +0,0 @@ -= Engineering Teams -:page-layout: without_menu - -* xref:fesco:ROOT:index.adoc[**Fedora Engineering Steering Committee**] — FESCo is the Fedora Engineering Steering Committee. It is a fully community elected body and represents the technical leadership in Fedora. - -* xref:modularity:ROOT:index.adoc[**Fedora Modularity**] — Modularity introduces an optional Modular repository that provides additional versions of software on independent lifecycles. - -* xref:containers:ROOT:index.adoc[**Fedora Containers**] — Here you will find Documentation and Guidelines regarding creation, usage and maintainance of Containers in Fedora. - -* xref:neurofedora:ROOT:overview.adoc[**NeuroFedora**] — NeuroFedora is an initiative to provide a ready to use Fedora based Free/Open source software platform for neuroscience. - -* xref:teleirc-sig:ROOT:index.adoc[**Fedora Teleirc SIG**] — The Teleirc SIG is a volunteer-driven group to manage Teleirc bridge bots. - -* xref:ci:ROOT:index.adoc[**Fedora CI**] — Fedora Continuous Integration Portal - -* link:https://fedora-infra-docs.readthedocs.io/en/latest/[**Fedora Infrastructure 🔗**] — Documentation covering the development and administration of the many projects that make Fedora work. - -* xref:ask-fedora-sops:ROOT:index.adoc[**Ask Fedora SOPs**] — Ask Fedora is the web application used by the community for user-end troubleshooting. These documents describe the Standard Operating Procedures related to Ask Fedora. - -== Other Engineering Resources - -* xref:flatpak:ROOT:index.adoc[**Flatpak in Fedora**] — Learn how to build Flatpaks out of Fedora RPM packages. diff --git a/pages/homepage/antora.yml b/pages/homepage/antora.yml deleted file mode 100644 index 7cbb65f..0000000 --- a/pages/homepage/antora.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: docs -title: Fedora Documentation -version: master -start-page: ROOT::index.adoc -nav: - - modules/ROOT/nav.adoc \ No newline at end of file diff --git a/pages/homepage/modules/ROOT/pages/index.adoc b/pages/homepage/modules/ROOT/pages/index.adoc deleted file mode 100644 index 48cf3cf..0000000 --- a/pages/homepage/modules/ROOT/pages/index.adoc +++ /dev/null @@ -1,90 +0,0 @@ -= Fedora Documentation -:page-layout: homepage - -++++ -
- - - -
-++++ diff --git a/pages/mindshare/antora.yml b/pages/mindshare/antora.yml deleted file mode 100644 index 1d1dbfe..0000000 --- a/pages/mindshare/antora.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Name will be mostly visible in the URL. Treat it as an indentifier. -# Tip: If you want to use the local preview scripts that come with this repository, please change this value in the site.yml file as well. (under site/start_page) -name: mindshare # <---- PLEASE MODIFY - -# Title will be visible on the page. -title: Mindshare Teams # <---- PLEASE MODIFY - -# If you don't plan to have multiple versions of the docs (for example, to document multiple versions of some software), you can ignore this field. Otherwise, change "master" to a specific version. -version: master - -# We encourage you to name the index page as "index.adoc". If you absolutely have to use a different name, please reflect it here. You can ignore this field otherwise. -start_page: ROOT:index - -# This lists all the menu definitions of your component. -#nav: -#- modules/ROOT/nav.adoc diff --git a/pages/mindshare/modules/ROOT/pages/index.adoc b/pages/mindshare/modules/ROOT/pages/index.adoc deleted file mode 100644 index 98522b4..0000000 --- a/pages/mindshare/modules/ROOT/pages/index.adoc +++ /dev/null @@ -1,12 +0,0 @@ -= Mindshare Teams -:page-layout: without_menu - -Mindshare Teams are focused on helping our community grow both the number of users and contributors. The teams in Mindshare are each focused on a different aspect of this goal. - -* xref:mindshare-committee:ROOT:index.adoc[**Fedora Mindshare Committee**] — The Mindshare Committee fosters communication amongst the Mindshare teams and helps facilitate Council strategy. - -* xref:commops:ROOT:index.adoc[**Fedora Community Operations (CommOps)**] — Community Operations (CommOps) provides tools, resources, and utilities for different sub-projects of Fedora to improve effective communication. - -* xref:fedora-docs:ROOT:index.adoc[**Fedora Documentation (Docs)**] — The group behind this very documentation site. Includes contributors' guidelines to Fedora Docs - -* xref:badges:ROOT:index.adoc[**Fedora Badges**] — The group behind Fedora Badges — a fun website built to recognize contributors to the Fedora Project, help new and existing Fedora contributors find different ways to get involved, and encourage the improvement of Fedora's infrastructure. diff --git a/pages/search/antora.yml b/pages/search/antora.yml deleted file mode 100644 index d57be41..0000000 --- a/pages/search/antora.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: search -title: Fedora Documentation Search -version: master -start-page: ROOT::index.adoc -nav: - - modules/ROOT/nav.adoc diff --git a/pages/search/modules/ROOT/pages/index.adoc b/pages/search/modules/ROOT/pages/index.adoc deleted file mode 100644 index 80b522b..0000000 --- a/pages/search/modules/ROOT/pages/index.adoc +++ /dev/null @@ -1,2 +0,0 @@ -= Fedora Documentation Search -:page-layout: search diff --git a/site.yml b/site.yml index 32e706b..748d738 100644 --- a/site.yml +++ b/site.yml @@ -8,12 +8,12 @@ content: - url: ./ start_path: pages/search branches: HEAD - - url: https://pagure.io/fedora-docs/docs-fp-o - start_path: pages/homepage - - url: https://pagure.io/fedora-docs/docs-fp-o - start_path: pages/engineering - - url: https://pagure.io/fedora-docs/docs-fp-o - start_path: pages/mindshare + - url: https://pagure.io/fedora-docs/pages + start_path: homepage + - url: https://pagure.io/fedora-docs/pages + start_path: engineering + - url: https://pagure.io/fedora-docs/pages + start_path: mindshare - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master From 79c20a3f8d94bdb4cfde08830747f32b0d2aabd9 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: May 17 2019 09:36:42 +0000 Subject: [PATCH 11/88] automatic generation of site.yml for languages --- diff --git a/prepare-translated.py b/prepare-translated.py new file mode 100755 index 0000000..d81f9bb --- /dev/null +++ b/prepare-translated.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +"""Prepare site.yml for each translated sites""" + +import os +import subprocess +import tempfile +import yaml + +def main(): + """ Read site.yml content, replace `sources` content with localized content""" + lang_sources = get_language_sources() + + with open("site.yml", 'r') as stream: + data_loaded = yaml.load(stream, Loader=yaml.SafeLoader) + + for lang in lang_sources: + print(lang) + + with open('site-'+lang+'.yml', 'w') as outfile: + data_loaded['content']['sources'] = lang_sources[lang] + yaml.dump(data_loaded, outfile, default_flow_style=False) + + +def get_language_sources(): + """ Get the list of languages + modules + branches from translated-sources""" + sources = {} + with tempfile.TemporaryDirectory() as tmp: + t_sources_url = "https://pagure.io/fedora-docs/translated-sources.git" + subprocess.run(["git", "clone", t_sources_url], check=True, cwd=tmp) + + path = tmp+"/translated-sources" + + # we don't want ".git" folder + langs = [d for d in next(os.walk(path))[1] if not d[0] == '.'] + for lang in langs: + sources[lang] = [] + for module in next(os.walk(path+"/"+lang))[1]: + for branch in next(os.walk(path+"/"+lang + "/" + module))[1]: + hop = {} + hop["url"] = t_sources_url + hop["start_path"] = lang+"/"+module+"/"+branch + sources[lang].append(hop) + + return sources + + +if __name__ == '__main__': + main() diff --git a/site-cs.yml b/site-cs.yml index 56dc56d..4d407cb 100644 --- a/site-cs.yml +++ b/site-cs.yml @@ -1,141 +1,80 @@ -site: - title: Fedora Docs Site - url: https://docs.fedoraproject.org - start_page: docs::index.adoc +asciidoc: + extensions: + - ./lib/extensions/package-inline-macro.js content: branches: master sources: -##### Translated sources ##### - - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/project/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/quick-docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/engineering/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/badges/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/containers/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/mentored-projects/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora-silverblue/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/diversity-inclusion/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fesco/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/neurofedora/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora/rawhide - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora/f28 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora/f26 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora/f29 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora/f27 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/teleirc-sig/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/remix-building/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/java-packaging-howto/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/mindshare/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/iot/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/modularity/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/mindshare-committee/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/packaging-guidelines/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/flatpak/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/commops/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/fedora-docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: cs/council/master - -##### Original sources ##### -# (Translated pieces are commented out) - -# - url: . -# start_path: pages/homepage -# - url: . -# start_path: pages/engineering -# - url: . -# start_path: pages/mindshare -# - url: https://pagure.io/fedora-docs/release-docs-home.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/install-guide.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/system-administrators-guide.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/release-notes.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/quick-docs.git -# - url: https://pagure.io/mentored-projects.git -# - url: https://pagure.io/fedora-commops.git -# start_path: docs -# - url: https://pagure.io/Fedora-Council/council-docs.git -# start_path: council -# - url: https://pagure.io/Fedora-Council/council-docs.git -# start_path: project -# - url: https://pagure.io/fedora-docs/modularity.git -# - 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 -# - url: https://pagure.io/packaging-committee.git -# start_path: guidelines -# - url: https://pagure.io/mindshare.git -# start_path: website -# - url: https://pagure.io/fesco/fesco-docs.git -# start_path: fesco -# - url: https://pagure.io/fedora-iot/iot-docs.git -# - url: https://pagure.io/fedora-badges.git -# start_path: docs + - start_path: cs/teleirc-sig/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/remix-building/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/quick-docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/project/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/packaging-guidelines/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/neurofedora/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/modularity/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/mindshare/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/mindshare-committee/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/mentored-projects/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/java-packaging-howto/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/iot/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/flatpak/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/fesco/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/fedora/rawhide + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/fedora/f29 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/fedora/f28 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/fedora/f27 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/fedora/f26 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/fedora-silverblue/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/fedora-docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/engineering/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/diversity-inclusion/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/council/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/containers/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/commops/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: cs/badges/master + url: https://pagure.io/fedora-docs/translated-sources.git +output: + clean: true + destinations: + - provider: archive + dir: ./public/en-US +runtime: + cache_dir: ./cache + pull: true +site: + start_page: docs::index.adoc + title: Fedora Docs Site + url: https://docs.fedoraproject.org/en-US/ ui: bundle: - url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip snapshot: true + url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip default_layout: with_menu supplemental_files: ./supplemental-ui -output: - clean: true - dir: ./public/cs - destinations: - - provider: archive -runtime: - pull: true - cache_dir: ./cache -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js diff --git a/site-fr.yml b/site-fr.yml index 8e463a2..0f86a5c 100644 --- a/site-fr.yml +++ b/site-fr.yml @@ -1,141 +1,84 @@ -site: - title: Fedora Docs Site - url: https://docs.fedoraproject.org - start_page: docs::index.adoc +asciidoc: + extensions: + - ./lib/extensions/package-inline-macro.js content: branches: master sources: -##### Translated sources ##### - - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/project/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/quick-docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/engineering/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/badges/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/containers/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/mentored-projects/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora-silverblue/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/diversity-inclusion/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fesco/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/neurofedora/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora/rawhide - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora/f28 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora/f26 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora/f29 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora/f27 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/teleirc-sig/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/remix-building/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/java-packaging-howto/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/mindshare/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/iot/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/modularity/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/mindshare-committee/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/packaging-guidelines/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/flatpak/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/commops/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/fedora-docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: fr/council/master - -##### Original sources ##### -# (Translated pieces are commented out) - -# - url: . -# start_path: pages/homepage -# - url: . -# start_path: pages/engineering -# - url: . -# start_path: pages/mindshare -# - url: https://pagure.io/fedora-docs/release-docs-home.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/install-guide.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/system-administrators-guide.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/release-notes.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/quick-docs.git -# - url: https://pagure.io/mentored-projects.git -# - url: https://pagure.io/fedora-commops.git -# start_path: docs -# - url: https://pagure.io/Fedora-Council/council-docs.git -# start_path: council -# - url: https://pagure.io/Fedora-Council/council-docs.git -# start_path: project -# - url: https://pagure.io/fedora-docs/modularity.git -# - 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 -# - url: https://pagure.io/packaging-committee.git -# start_path: guidelines -# - url: https://pagure.io/mindshare.git -# start_path: website -# - url: https://pagure.io/fesco/fesco-docs.git -# start_path: fesco -# - url: https://pagure.io/fedora-iot/iot-docs.git -# - url: https://pagure.io/fedora-badges.git -# start_path: docs + - start_path: fr/teleirc-sig/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/taiga-docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/remix-building/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/quick-docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/project/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/packaging-guidelines/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/neurofedora/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/modularity/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/mindshare/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/mindshare-committee/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/mentored-projects/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/java-packaging-howto/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/iot/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/flatpak/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/fesco/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/fedora/rawhide + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/fedora/f29 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/fedora/f28 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/fedora/f27 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/fedora/f26 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/fedora-silverblue/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/fedora-docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/engineering/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/diversity-inclusion/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/council/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/containers/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/commops/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/ci/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: fr/badges/master + url: https://pagure.io/fedora-docs/translated-sources.git +output: + clean: true + destinations: + - provider: archive + dir: ./public/en-US +runtime: + cache_dir: ./cache + pull: true +site: + start_page: docs::index.adoc + title: Fedora Docs Site + url: https://docs.fedoraproject.org/en-US/ ui: bundle: - url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip snapshot: true + url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip default_layout: with_menu supplemental_files: ./supplemental-ui -output: - clean: true - dir: ./public/fr - destinations: - - provider: archive -runtime: - pull: true - cache_dir: ./cache -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js diff --git a/site-ja.yml b/site-ja.yml new file mode 100644 index 0000000..3633ba2 --- /dev/null +++ b/site-ja.yml @@ -0,0 +1,80 @@ +asciidoc: + extensions: + - ./lib/extensions/package-inline-macro.js +content: + branches: master + sources: + - start_path: ja/teleirc-sig/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/remix-building/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/quick-docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/project/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/packaging-guidelines/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/neurofedora/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/modularity/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/mindshare/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/mindshare-committee/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/mentored-projects/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/java-packaging-howto/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/iot/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/flatpak/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/fesco/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/fedora/rawhide + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/fedora/f29 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/fedora/f28 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/fedora/f27 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/fedora/f26 + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/fedora-silverblue/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/fedora-docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/engineering/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/docs/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/diversity-inclusion/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/council/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/containers/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/commops/master + url: https://pagure.io/fedora-docs/translated-sources.git + - start_path: ja/badges/master + url: https://pagure.io/fedora-docs/translated-sources.git +output: + clean: true + destinations: + - provider: archive + dir: ./public/en-US +runtime: + cache_dir: ./cache + pull: true +site: + start_page: docs::index.adoc + title: Fedora Docs Site + url: https://docs.fedoraproject.org/en-US/ +ui: + bundle: + snapshot: true + url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip + default_layout: with_menu + supplemental_files: ./supplemental-ui diff --git a/site-jp.yml b/site-jp.yml deleted file mode 100644 index 9bd7669..0000000 --- a/site-jp.yml +++ /dev/null @@ -1,141 +0,0 @@ -site: - title: Fedora Docs Site - url: https://docs.fedoraproject.org - start_page: docs::index.adoc -content: - branches: master - sources: -##### Translated sources ##### - - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/project/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/quick-docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/engineering/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/badges/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/containers/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/mentored-projects/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora-silverblue/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/diversity-inclusion/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fesco/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/neurofedora/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora/rawhide - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora/f28 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora/f26 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora/f29 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora/f27 - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/teleirc-sig/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/remix-building/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/java-packaging-howto/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/mindshare/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/iot/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/modularity/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/mindshare-committee/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/packaging-guidelines/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/flatpak/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/commops/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/fedora-docs/master - - url: https://pagure.io/fedora-docs/translated-sources.git - start_path: jp/council/master - -##### Original sources ##### -# (Translated pieces are commented out) - -# - url: . -# start_path: pages/homepage -# - url: . -# start_path: pages/engineering -# - url: . -# start_path: pages/mindshare -# - url: https://pagure.io/fedora-docs/release-docs-home.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/install-guide.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/system-administrators-guide.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/release-notes.git -# branches: -# - master -# - f29 -# - f28 -# - f27 -# - f26 -# - url: https://pagure.io/fedora-docs/quick-docs.git -# - url: https://pagure.io/mentored-projects.git -# - url: https://pagure.io/fedora-commops.git -# start_path: docs -# - url: https://pagure.io/Fedora-Council/council-docs.git -# start_path: council -# - url: https://pagure.io/Fedora-Council/council-docs.git -# start_path: project -# - url: https://pagure.io/fedora-docs/modularity.git -# - 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 -# - url: https://pagure.io/packaging-committee.git -# start_path: guidelines -# - url: https://pagure.io/mindshare.git -# start_path: website -# - url: https://pagure.io/fesco/fesco-docs.git -# start_path: fesco -# - url: https://pagure.io/fedora-iot/iot-docs.git -# - url: https://pagure.io/fedora-badges.git -# start_path: docs -ui: - bundle: - url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip - snapshot: true - default_layout: with_menu - supplemental_files: ./supplemental-ui -output: - clean: true - dir: ./public/jp - destinations: - - provider: archive -runtime: - pull: true - cache_dir: ./cache -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js From 746dcc7711444816c3190f9b4f802a72619ca054 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: May 17 2019 09:50:28 +0000 Subject: [PATCH 12/88] automatically detect list of languages --- diff --git a/build-translated.sh b/build-translated.sh index 9317248..11b657c 100755 --- a/build-translated.sh +++ b/build-translated.sh @@ -1,6 +1,14 @@ #!/bin/bash -languages="cs fr jp" +languages="" + +for file in site-*; +do + # we have site-???.yml, we want ??? + suffix=${file:5} # remove "site-" + lang=${suffix%.yml} # remove ".yml" + languages="$languages $lang" +done create_language_menu() { { From a2abef7237c7c09a7e20cf2884ef122a4d29d46a Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 01 2019 10:53:26 +0000 Subject: [PATCH 13/88] remove incorrect repo from sources --- diff --git a/site.yml b/site.yml index 748d738..9bdb9c8 100644 --- a/site.yml +++ b/site.yml @@ -5,9 +5,6 @@ site: content: branches: master sources: - - url: ./ - start_path: pages/search - branches: HEAD - url: https://pagure.io/fedora-docs/pages start_path: homepage - url: https://pagure.io/fedora-docs/pages From 0591062d173332dfea60feafaefb18a2cddf40ef Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 01 2019 11:45:38 +0000 Subject: [PATCH 14/88] update sources from prod --- diff --git a/site.yml b/site.yml index 9bdb9c8..642401e 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f30 - f29 - f28 - f27 @@ -21,6 +22,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f30 - f29 - f28 - f27 @@ -28,6 +30,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f30 - f29 - f28 - f27 @@ -35,6 +38,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f30 - f29 - f28 - f27 @@ -47,6 +51,7 @@ content: start_path: council - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project + - url: https://pagure.io/Fedora-Council/status_reports.git - url: https://pagure.io/fedora-docs/modularity.git - url: https://github.com/fedora-silverblue/silverblue-docs.git - url: https://pagure.io/fedora-docs/documentation-contributors-guide.git @@ -68,7 +73,13 @@ content: start_path: docs - url: https://pagure.io/fedora-ci/docs.git - url: https://pagure.io/java-packaging-howto.git - - url: https://pagure.io/Ask-Fedora-SOP-docs.git + - url: https://pagure.io/fedora-docs/taiga-docs.git + - url: https://pagure.io/fedora-magazine.git + - url: https://pagure.io/minimization.git + - url: https://github.com/coreos/fedora-coreos-docs.git + - url: https://pagure.io/cpe/rawhide-gating-docs.git + - url: https://pagure.io/cpe/docs.git + - url: https://pagure.io/fedora-docs/websites.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 59036c2eb15cf5afe22afaa2c7626592b7629694 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 02 2019 18:29:34 +0000 Subject: [PATCH 15/88] rewrite language building --- diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index 2f7cd80..0f41de8 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,13 +1,13 @@ FROM fedora:29 RUN dnf -y module install nodejs:10/default && \ - dnf -y install git && \ + dnf -y install git python3-yaml && \ dnf clean all RUN npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0 -ADD rebuild-site.sh /antora/rebuild-site.sh +ADD build-translated.py /antora/build-translated.py WORKDIR /antora -CMD /antora/rebuild-site.sh +CMD /antora/build-translated.py diff --git a/build-scripts/build-translated.py b/build-scripts/build-translated.py new file mode 100755 index 0000000..fad81b0 --- /dev/null +++ b/build-scripts/build-translated.py @@ -0,0 +1,199 @@ +#!/usr/bin/python3 + +import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys + +GLOBAL_CONFIG = { + "docs_repo_url": "https://pagure.io/fedora-docs/docs-fp-o.git", + "docs_repo_branch": "stg", + "translated_sources_repo_url": "https://pagure.io/fedora-docs/translated-sources.git" +} + + +def log(msg): + print(msg) + + +def get_languages(config): + languages_dict = {} + + with tempfile.TemporaryDirectory() as workdir: + translated_sources_repo = os.path.join(workdir, "translated_sources_repo") + subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_repo]) + + languages = [] + filename_blacklist = [".git"] + for filename in os.listdir(translated_sources_repo): + filepath = os.path.join(translated_sources_repo, filename) + if os.path.isdir(filepath) and filename not in filename_blacklist: + languages.append(filename) + + languages.sort() + + for lang in languages: + languages_dict[lang] = [] + + lang_dir = os.path.join(translated_sources_repo, lang) + for component in os.listdir(lang_dir): + version_dir = os.path.join(lang_dir, component) + for version in os.listdir(version_dir): + start_path = "{lang}/{component}/{version}".format( + lang=lang, component=component, version=version) + + # This is a workaround for cases when a component doesn't have + # the ROOT module that should contain the antora.yml. + # Without the ROOT module the translation scripts won't + # pick up the antora.yml causing the docs build to fail. + # So we're only including directories with the antora.yml file. + if "antora.yml" in os.listdir(os.path.join(version_dir, version)): + languages_dict[lang].append(start_path) + + return languages_dict + + +def generate_lang_switch_ui(languages): + template_start = """ +
+ +
+ """ + template_end = """ +
+
+ """ + + template_list = [] + template_list.append(template_start) + for language in languages: + link = '{language}'.format( + language=language) + template_list.append(link) + template_list.append(template_end) + + return "\n".join(template_list) + + +def main(): + config = GLOBAL_CONFIG + + log("") + log("===== Getting a list of languages =====") + languages = get_languages(config) + log(" Languages: {}".format(" ".join(languages))) + + + log("") + log("===== Generating the language switch UI =====") + lang_switch_ui = generate_lang_switch_ui(["en-US"] + list(languages.keys())) + + + log("") + log("===== Getting the site definition =====") + with tempfile.TemporaryDirectory() as workdir: + docs_repo = os.path.join(workdir, "docs_repo") + subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], config["docs_repo_url"], docs_repo]) + + with open(os.path.join(docs_repo, "site.yml"), "r") as file: + original_site_yml = yaml.safe_load(file) + + + log("") + log("===== Creating the language switch UI files =====") + ui_dir = os.path.join(docs_repo, "supplemental-ui", "partials") + try: + os.makedirs(ui_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + ui_file = os.path.join(ui_dir, "page-languages.hbs") + with open(ui_file, "w") as file: + file.write(lang_switch_ui) + + log("") + log("===== Generating site.lang.yml files =====") + for lang, start_paths in languages.items(): + lang_site_yml = copy.deepcopy(original_site_yml) + + lang_site_yml["output"]["dir"] = "./public/{lang}".format(lang=lang) + + lang_site_yml["content"] = {} + lang_site_yml["content"]["branches"] = "master" + lang_site_yml["content"]["sources"] = [] + + for start_path in start_paths: + source = {} + source["url"] = config["translated_sources_repo_url"] + source["start_path"] = start_path + + lang_site_yml["content"]["sources"].append(source) + + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) + with open(filename, "w") as file: + file.write(yaml.dump(lang_site_yml)) + + log(" {lang} done".format(lang=lang)) + + + # Timestamp to be included in the footer of the docs + timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC') + antora_env = {"ANTORA_DATE": timestamp} + + # First, building and copying the en-US site + log("") + log("===== Building the en-US site =====") + result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) + + if result.returncode != 0: + log("ERROR building the en-US site") + sys.exit(1) + + + log("") + log("===== Copying the en-US site =====") + source_dir = os.path.join(docs_repo, "public") + target_dir_copying = "/antora/output/en-US.building" + 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]) + 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("") + log("===== Copying the index.html =====") + source_index_html = os.path.join(docs_repo, "static", "index.html") + target_index_html = "/antora/output/index.html" + shutil.copy(source_index_html, target_index_html) + + + # Second, building and copying all the translated sites + for lang in languages: + log("") + log("===== Building the {lang} site =====".format(lang=lang)) + filename = "site-{lang}.yml".format(lang=lang) + result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, filename)], env=antora_env) + + if result.returncode != 0: + log("ERROR building the {lang} site".format(lang=lang)) + sys.exit(1) + + + 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) + + + + +if __name__ == "__main__": + main() diff --git a/build-scripts/rebuild-site.sh b/build-scripts/rebuild-site.sh deleted file mode 100755 index 52b6f34..0000000 --- a/build-scripts/rebuild-site.sh +++ /dev/null @@ -1,97 +0,0 @@ -#/bin/bash - -echo "" -echo "$(date +%G-%m-%d-%H%M%S): Building Fedora Docs..." -echo "" - -SOURCE_REPO="https://pagure.io/fedora-docs/docs-fp-o.git" -BUILD_CMD="antora --html-url-extension-style=indexify site.yml" - -target="/antora" - -if [ -z ${BUILD_ENV+x} ]; then - BUILD_ENV="master" -fi - - -if ! workdir=$(mktemp -d) ; then - echo "Error creating a tempdir. Exiting." - exit 1 -fi - -if ! git clone --single-branch --branch $BUILD_ENV $SOURCE_REPO "$workdir/source" ; then - echo "" - echo "Error cloning the source repo." - rm -rf "$workdir" - exit 1 -else - echo "OK cloned source repo" -fi - -if [ ! -f "$workdir/source/site.yml" ]; then - echo "" - echo "Error! There is no site.yml in the source." - rm -rf "$workdir" - exit 1 -fi - -pushd "$workdir/source/" > /dev/null - - -export ANTORA_DATE=$(date -u) - -if ! $BUILD_CMD ; then - echo "" - echo "Error building the site." - rm -rf "$workdir" - exit 1 -fi - -# FIXME: Building languages, this code needs some love - -languages="cs fr jp" - -create_language_menu() { - { - echo '
' - echo " " - echo '
' - echo ' en-US' - for lang in $languages; do - echo " $lang" - done - echo '
' - echo '
' - } > "$workdir/source/supplemental-ui/partials/page-languages.hbs" -} - -for current_lang in $languages; do - create_language_menu "$current_lang" - if ! antora --html-url-extension-style=indexify site-$current_lang.yml ; then - echo "" - echo "Error building translated site for $current_lang." - rm -rf "$workdir" - exit 1 - fi -done - -create_language_menu "en-US" - -# End building languages - -popd > /dev/null - -cp -r "$workdir/source/public/en-US" "$target/output/en-US.building" && rm -rf "$target/output/en-US" && mv "$target/output/en-US.building" "$target/output/en-US" || exit 1 -cp "$workdir/source/static/index.html" "$target/output/index.html" || exit 1 - -# copy languages -for current_lang in $languages; do - cp -r "$workdir/source/public/$current_lang" "$target/output/$current_lang.building" && rm -rf "$target/output/$current_lang" && mv "$target/output/$current_lang.building" "$target/output/$current_lang" || exit 1 -done -# end languages - -rm -rf "$workdir" - -echo "" -echo "$(date +%G-%m-%d-%H%M%S): Building of Fedora Docs has finished successfully!" -echo "" diff --git a/build-translated.sh b/build-translated.sh deleted file mode 100755 index 11b657c..0000000 --- a/build-translated.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash - -languages="" - -for file in site-*; -do - # we have site-???.yml, we want ??? - suffix=${file:5} # remove "site-" - lang=${suffix%.yml} # remove ".yml" - languages="$languages $lang" -done - -create_language_menu() { - { - echo '
' - echo " " - echo '
' - echo ' en-US' - for lang in $languages; do - echo " $lang" - done - echo '
' - echo '
' - } > ./supplemental-ui/partials/page-languages.hbs -} - -create_language_menu "en-US" -exit - -if [ "$(uname)" == "Darwin" ]; then - for current_lang in $languages; do - create_language_menu "$current_lang" - docker run -e "LANGUAGE=$current_lang" -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora antora/antora --html-url-extension-style=indexify site-$current_lang.yml - done - -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then - for current_lang in $languages; do - create_language_menu "$current_lang" - podman run -e "LANGUAGE=$current_lang" -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora:z antora/antora --html-url-extension-style=indexify site-$current_lang.yml - done -fi - -create_language_menu "en-US" diff --git a/prepare-translated.py b/prepare-translated.py deleted file mode 100755 index d81f9bb..0000000 --- a/prepare-translated.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python3 -"""Prepare site.yml for each translated sites""" - -import os -import subprocess -import tempfile -import yaml - -def main(): - """ Read site.yml content, replace `sources` content with localized content""" - lang_sources = get_language_sources() - - with open("site.yml", 'r') as stream: - data_loaded = yaml.load(stream, Loader=yaml.SafeLoader) - - for lang in lang_sources: - print(lang) - - with open('site-'+lang+'.yml', 'w') as outfile: - data_loaded['content']['sources'] = lang_sources[lang] - yaml.dump(data_loaded, outfile, default_flow_style=False) - - -def get_language_sources(): - """ Get the list of languages + modules + branches from translated-sources""" - sources = {} - with tempfile.TemporaryDirectory() as tmp: - t_sources_url = "https://pagure.io/fedora-docs/translated-sources.git" - subprocess.run(["git", "clone", t_sources_url], check=True, cwd=tmp) - - path = tmp+"/translated-sources" - - # we don't want ".git" folder - langs = [d for d in next(os.walk(path))[1] if not d[0] == '.'] - for lang in langs: - sources[lang] = [] - for module in next(os.walk(path+"/"+lang))[1]: - for branch in next(os.walk(path+"/"+lang + "/" + module))[1]: - hop = {} - hop["url"] = t_sources_url - hop["start_path"] = lang+"/"+module+"/"+branch - sources[lang].append(hop) - - return sources - - -if __name__ == '__main__': - main() diff --git a/site-cs.yml b/site-cs.yml deleted file mode 100644 index 4d407cb..0000000 --- a/site-cs.yml +++ /dev/null @@ -1,80 +0,0 @@ -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js -content: - branches: master - sources: - - start_path: cs/teleirc-sig/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/remix-building/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/quick-docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/project/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/packaging-guidelines/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/neurofedora/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/modularity/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/mindshare/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/mindshare-committee/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/mentored-projects/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/java-packaging-howto/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/iot/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/flatpak/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/fesco/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/fedora/rawhide - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/fedora/f29 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/fedora/f28 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/fedora/f27 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/fedora/f26 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/fedora-silverblue/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/fedora-docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/engineering/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/diversity-inclusion/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/council/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/containers/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/commops/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: cs/badges/master - url: https://pagure.io/fedora-docs/translated-sources.git -output: - clean: true - destinations: - - provider: archive - dir: ./public/en-US -runtime: - cache_dir: ./cache - pull: true -site: - start_page: docs::index.adoc - title: Fedora Docs Site - url: https://docs.fedoraproject.org/en-US/ -ui: - bundle: - snapshot: true - url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip - default_layout: with_menu - supplemental_files: ./supplemental-ui diff --git a/site-fr.yml b/site-fr.yml deleted file mode 100644 index 0f86a5c..0000000 --- a/site-fr.yml +++ /dev/null @@ -1,84 +0,0 @@ -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js -content: - branches: master - sources: - - start_path: fr/teleirc-sig/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/taiga-docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/remix-building/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/quick-docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/project/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/packaging-guidelines/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/neurofedora/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/modularity/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/mindshare/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/mindshare-committee/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/mentored-projects/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/java-packaging-howto/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/iot/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/flatpak/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/fesco/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/fedora/rawhide - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/fedora/f29 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/fedora/f28 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/fedora/f27 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/fedora/f26 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/fedora-silverblue/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/fedora-docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/engineering/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/diversity-inclusion/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/council/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/containers/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/commops/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/ci/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: fr/badges/master - url: https://pagure.io/fedora-docs/translated-sources.git -output: - clean: true - destinations: - - provider: archive - dir: ./public/en-US -runtime: - cache_dir: ./cache - pull: true -site: - start_page: docs::index.adoc - title: Fedora Docs Site - url: https://docs.fedoraproject.org/en-US/ -ui: - bundle: - snapshot: true - url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip - default_layout: with_menu - supplemental_files: ./supplemental-ui diff --git a/site-ja.yml b/site-ja.yml deleted file mode 100644 index 3633ba2..0000000 --- a/site-ja.yml +++ /dev/null @@ -1,80 +0,0 @@ -asciidoc: - extensions: - - ./lib/extensions/package-inline-macro.js -content: - branches: master - sources: - - start_path: ja/teleirc-sig/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/remix-building/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/quick-docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/project/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/packaging-guidelines/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/neurofedora/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/modularity/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/mindshare/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/mindshare-committee/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/mentored-projects/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/java-packaging-howto/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/iot/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/flatpak/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/fesco/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/fedora/rawhide - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/fedora/f29 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/fedora/f28 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/fedora/f27 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/fedora/f26 - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/fedora-silverblue/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/fedora-docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/engineering/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/docs/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/diversity-inclusion/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/council/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/containers/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/commops/master - url: https://pagure.io/fedora-docs/translated-sources.git - - start_path: ja/badges/master - url: https://pagure.io/fedora-docs/translated-sources.git -output: - clean: true - destinations: - - provider: archive - dir: ./public/en-US -runtime: - cache_dir: ./cache - pull: true -site: - start_page: docs::index.adoc - title: Fedora Docs Site - url: https://docs.fedoraproject.org/en-US/ -ui: - bundle: - snapshot: true - url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip - default_layout: with_menu - supplemental_files: ./supplemental-ui diff --git a/supplemental-ui/partials/page-languages.hbs b/supplemental-ui/partials/page-languages.hbs index b65342e..b5858f3 100644 --- a/supplemental-ui/partials/page-languages.hbs +++ b/supplemental-ui/partials/page-languages.hbs @@ -2,8 +2,5 @@
en-US - cs - fr - jp
From 5dda8bce15d30bc6bfb031c0d7269f527e490e1b Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 02 2019 20:18:33 +0000 Subject: [PATCH 16/88] fix antora env variables --- diff --git a/build-scripts/build-translated.py b/build-scripts/build-translated.py index fad81b0..f4e3d54 100755 --- a/build-scripts/build-translated.py +++ b/build-scripts/build-translated.py @@ -136,6 +136,7 @@ def main(): # Timestamp to be included in the footer of the docs timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC') + antora_env = copy.deepcopy(os.environ) antora_env = {"ANTORA_DATE": timestamp} # First, building and copying the en-US site From 02e62f8a732ba5a08bf2a2fea7d7237e031ee353 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 03 2019 05:10:21 +0000 Subject: [PATCH 17/88] fix antora env variables --- diff --git a/build-scripts/build-translated.py b/build-scripts/build-translated.py index f4e3d54..c7acc7e 100755 --- a/build-scripts/build-translated.py +++ b/build-scripts/build-translated.py @@ -137,7 +137,7 @@ def main(): # Timestamp to be included in the footer of the docs timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC') antora_env = copy.deepcopy(os.environ) - antora_env = {"ANTORA_DATE": timestamp} + antora_env["ANTORA_DATE"] = timestamp # First, building and copying the en-US site log("") From f7125311378438dfac42d53ac2de930a823dac86 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 03 2019 07:07:32 +0000 Subject: [PATCH 18/88] show the correct language --- diff --git a/build-scripts/build-translated.py b/build-scripts/build-translated.py index c7acc7e..eb7adc4 100755 --- a/build-scripts/build-translated.py +++ b/build-scripts/build-translated.py @@ -53,7 +53,9 @@ def get_languages(config): def generate_lang_switch_ui(languages): template_start = """
- +
""" template_end = """ @@ -142,6 +144,7 @@ def main(): # First, building and copying the en-US site log("") log("===== Building the en-US site =====") + antora_env["env.ANTORA_LANGUAGE"] = "en-US" result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) if result.returncode != 0: @@ -173,6 +176,7 @@ def main(): log("") log("===== Building the {lang} site =====".format(lang=lang)) filename = "site-{lang}.yml".format(lang=lang) + antora_env["env.ANTORA_LANGUAGE"] = lang result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, filename)], env=antora_env) if result.returncode != 0: From a0f6b138a51be731812ace3d3ae9ca007847b29d Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 03 2019 07:23:05 +0000 Subject: [PATCH 19/88] show the correct language --- diff --git a/build-scripts/build-translated.py b/build-scripts/build-translated.py index eb7adc4..f8678ae 100755 --- a/build-scripts/build-translated.py +++ b/build-scripts/build-translated.py @@ -144,7 +144,7 @@ def main(): # First, building and copying the en-US site log("") log("===== Building the en-US site =====") - antora_env["env.ANTORA_LANGUAGE"] = "en-US" + antora_env["ANTORA_LANGUAGE"] = "en-US" result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) if result.returncode != 0: @@ -176,7 +176,7 @@ def main(): log("") log("===== Building the {lang} site =====".format(lang=lang)) filename = "site-{lang}.yml".format(lang=lang) - antora_env["env.ANTORA_LANGUAGE"] = lang + antora_env["ANTORA_LANGUAGE"] = lang result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, filename)], env=antora_env) if result.returncode != 0: From 3ebf9e4bee0aff30fe3a6d6bf3be105ee4e6a0f0 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Oct 04 2019 17:08:41 +0000 Subject: [PATCH 20/88] Publish PgM docs I'm writing PgM docs. Let's publish them (on stage first to make sure I didn't mess up anything) --- diff --git a/site.yml b/site.yml index 748d738..65b5cc1 100644 --- a/site.yml +++ b/site.yml @@ -49,6 +49,8 @@ content: - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council - url: https://pagure.io/Fedora-Council/council-docs.git + start_path: program_management + - url: https://pagure.io/fedora-pgm/pgm_docs.git start_path: project - url: https://pagure.io/fedora-docs/modularity.git - url: https://github.com/fedora-silverblue/silverblue-docs.git From c8e1044cccda87eb8eab327aa19474a4e2ed154a Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 07 2019 08:36:31 +0000 Subject: [PATCH 21/88] Merge #123 `Publish PgM docs` --- diff --git a/site.yml b/site.yml index 642401e..fdc818e 100644 --- a/site.yml +++ b/site.yml @@ -50,6 +50,8 @@ content: - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council - url: https://pagure.io/Fedora-Council/council-docs.git + start_path: program_management + - url: https://pagure.io/fedora-pgm/pgm_docs.git start_path: project - url: https://pagure.io/Fedora-Council/status_reports.git - url: https://pagure.io/fedora-docs/modularity.git From 0ac8196f20f8c050b70dad8445a5342b1e7607b4 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 07 2019 08:51:14 +0000 Subject: [PATCH 22/88] revert pgm docs --- diff --git a/site.yml b/site.yml index fdc818e..642401e 100644 --- a/site.yml +++ b/site.yml @@ -50,8 +50,6 @@ content: - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council - url: https://pagure.io/Fedora-Council/council-docs.git - start_path: program_management - - url: https://pagure.io/fedora-pgm/pgm_docs.git start_path: project - url: https://pagure.io/Fedora-Council/status_reports.git - url: https://pagure.io/fedora-docs/modularity.git From 0608ced0a360d06c6b61d7a4163869287c8904b4 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Oct 09 2019 14:22:30 +0000 Subject: [PATCH 23/88] A second attempt at adding PgM docs to staging Corrects the mistakes in https://pagure.io/fedora-docs/docs-fp-o/pull-request/123 --- diff --git a/site.yml b/site.yml index 642401e..49d6212 100644 --- a/site.yml +++ b/site.yml @@ -80,6 +80,8 @@ content: - 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-pgm/pgm_docs.git + start_path: program_management ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From f622cb12bc2028478ce784fe5a57a6a9ff725d7f Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 10 2019 15:40:14 +0000 Subject: [PATCH 24/88] fix site.yml --- diff --git a/site.yml b/site.yml index 49d6212..f1aa304 100644 --- a/site.yml +++ b/site.yml @@ -81,7 +81,6 @@ content: - url: https://pagure.io/cpe/docs.git - url: https://pagure.io/fedora-docs/websites.git - url: https://pagure.io/fedora-pgm/pgm_docs.git - start_path: program_management ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 31bf8832695b446243fc1f1b429d93a7f478e1e2 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 16 2019 06:48:41 +0000 Subject: [PATCH 25/88] update gitignore --- diff --git a/.gitignore b/.gitignore index 13d8eda..6abd12e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build public cache +build-scripts/output From a958e830a313b23c59d545ce53589addc8ef9139 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Oct 16 2019 18:29:29 +0000 Subject: [PATCH 26/88] reuse english sources for missing translated ones --- diff --git a/build-scripts/build-translated.py b/build-scripts/build-translated.py index f8678ae..44c912c 100755 --- a/build-scripts/build-translated.py +++ b/build-scripts/build-translated.py @@ -73,33 +73,154 @@ def generate_lang_switch_ui(languages): return "\n".join(template_list) +def prepare_translated_sources(translated_sources, site_yml, languages, config): + with tempfile.TemporaryDirectory() as workdir: + # Location of the translated-sources repo + # (This repo only holds content that has some translations done, + # so it might be incomplete.) + translated_sources_original = os.path.join(workdir, "translated_sources_original") + + # Location of the English sources in the same structure + # as translated-sources, so: + # COMPONENT/VERSION/antora.yml + # COMPONENT/VERSION/modules/MODULE1 + # COMPONENT/VERSION/modules/MODULE2 + # COMPONENT/VERSION/modules/... + en_sources = os.path.join(workdir, "en_sources") + + # Clone the original translated-sources + subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_original]) + + # Get a list of the original English repos + repos = [] + 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"] = "" + + for branch in repo_data["branches"]: + repo = {} + repo["url"] = repo_data["url"] + repo["branch"] = branch + repo["start_path"] = repo_data["start_path"] + + repos.append(repo) + + # Clome the original English sources and put them into the + # desired structure in en_sources (described above) + components = {} + for repo in repos: + with tempfile.TemporaryDirectory() as tmp_repo_root: + log("") + log("Cloning {url} {branch}".format(url=repo["url"], branch=repo["branch"])) + subprocess.run(["git", "clone", "--branch", repo["branch"], repo["url"], tmp_repo_root]) + + repo_dir = os.path.join(tmp_repo_root, repo["start_path"]) + antora_yml_file = os.path.join(repo_dir, "antora.yml") + with open(antora_yml_file, "r") as file: + antora_yml = yaml.safe_load(file) + + component = antora_yml["name"] + version = antora_yml["version"] + + # Saving components and all their versions + if component not in components: + components[component] = set() + components[component].add(version) + + for module in os.listdir(os.path.join(repo_dir, "modules")): + # Now this is looping over modules accross all components, + # so component, module, and version variables are available + + try: + os.makedirs(os.path.join(en_sources, component, version, "modules")) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + 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]) + + 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")]) + log("----- copying antora.yml for {component} {module} {version}".format( + component=component, module=module, version=version)) + else: + log("----- skipping antora.yml for {component} {module} {version}".format( + component=component, module=module, version=version)) + + # Set up the language structure in translated_sources + for language in languages: + lang_dir = os.path.join(translated_sources, language) + try: + os.makedirs(lang_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + # Copy the English sources in the translated_sources + for language in languages: + 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]) + + # 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 + "/"]) + + return components + + +def init_git_repo(path): + try: + os.makedirs(path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + subprocess.run(["git", "init"], cwd=path) + subprocess.run(["git", "config", "--global", "user.name", "Your Name"], cwd=path) + subprocess.run(["git", "config", "--global", "user.email", "you@example.com"], cwd=path) + subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) + def main(): config = GLOBAL_CONFIG - - log("") - log("===== Getting a list of languages =====") - languages = get_languages(config) - log(" Languages: {}".format(" ".join(languages))) - - - log("") - log("===== Generating the language switch UI =====") - lang_switch_ui = generate_lang_switch_ui(["en-US"] + list(languages.keys())) - - log("") - log("===== Getting the site definition =====") with tempfile.TemporaryDirectory() as workdir: + + # Location of the docs-fp-o repo docs_repo = os.path.join(workdir, "docs_repo") + + # Location of the translated sources used for the build + # (That's the translated-sources repo with the missing files added + # from the English sources.) + translated_sources = os.path.join(workdir, "translated_sources") + init_git_repo(translated_sources) + + log("") + log("===== Getting the site definition (site.yml) =====") subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], config["docs_repo_url"], docs_repo]) with open(os.path.join(docs_repo, "site.yml"), "r") as file: original_site_yml = yaml.safe_load(file) + log("") + log("===== Getting a list of languages =====") + languages = get_languages(config) + log(" Languages: {}".format(" ".join(languages))) log("") - log("===== Creating the language switch UI files =====") + log("===== Generating the language switch UI =====") + lang_switch_ui = generate_lang_switch_ui(["en-US"] + list(languages.keys())) + ui_dir = os.path.join(docs_repo, "supplemental-ui", "partials") try: os.makedirs(ui_dir) @@ -111,29 +232,6 @@ def main(): with open(ui_file, "w") as file: file.write(lang_switch_ui) - log("") - log("===== Generating site.lang.yml files =====") - for lang, start_paths in languages.items(): - lang_site_yml = copy.deepcopy(original_site_yml) - - lang_site_yml["output"]["dir"] = "./public/{lang}".format(lang=lang) - - lang_site_yml["content"] = {} - lang_site_yml["content"]["branches"] = "master" - lang_site_yml["content"]["sources"] = [] - - for start_path in start_paths: - source = {} - source["url"] = config["translated_sources_repo_url"] - source["start_path"] = start_path - - lang_site_yml["content"]["sources"].append(source) - - filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) - with open(filename, "w") as file: - file.write(yaml.dump(lang_site_yml)) - - log(" {lang} done".format(lang=lang)) # Timestamp to be included in the footer of the docs @@ -150,7 +248,6 @@ def main(): if result.returncode != 0: log("ERROR building the en-US site") sys.exit(1) - log("") log("===== Copying the en-US site =====") @@ -171,7 +268,41 @@ def main(): shutil.copy(source_index_html, target_index_html) - # Second, building and copying all the translated sites + # Second, preparing the translated sources to contain all the necessary files + log("") + log("===== Preparing the translated sources =====") + components = prepare_translated_sources(translated_sources, original_site_yml, languages, config) + + + log("") + log("===== Generating site.lang.yml files =====") + for lang in languages: + lang_site_yml = copy.deepcopy(original_site_yml) + + lang_site_yml["output"]["dir"] = "./public/{lang}".format(lang=lang) + + lang_site_yml["content"] = {} + # Branches are set to HEAD because the script uses a locally-generated + # content on top of the original translated-sources repo + lang_site_yml["content"]["branches"] = "HEAD" + lang_site_yml["content"]["sources"] = [] + + for component, versions in components.items(): + for version in versions: + source = {} + source["url"] = translated_sources + source["start_path"] = "{lang}/{component}/{version}".format( + lang=lang, component=component, version=version) + + lang_site_yml["content"]["sources"].append(source) + + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) + with open(filename, "w") as file: + file.write(yaml.dump(lang_site_yml)) + + log(" {lang} done".format(lang=lang)) + + # Third, building and copying all the translated sites for lang in languages: log("") log("===== Building the {lang} site =====".format(lang=lang)) @@ -202,3 +333,4 @@ def main(): if __name__ == "__main__": main() + From 9a37accc8c8cbec8ac6bdc5761211c83a64c1e0d Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Nov 04 2019 17:29:43 +0000 Subject: [PATCH 27/88] update builder to f31 --- diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index 0f41de8..6a09f2b 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:31 RUN dnf -y module install nodejs:10/default && \ dnf -y install git python3-yaml && \ From b23f9bfce858631b9e0a59c8ca495b4c1a7a30c3 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Nov 06 2019 06:19:56 +0000 Subject: [PATCH 28/88] fix build script for openshift --- diff --git a/build-scripts/build-translated.py b/build-scripts/build-translated.py index 44c912c..41b6408 100755 --- a/build-scripts/build-translated.py +++ b/build-scripts/build-translated.py @@ -186,8 +186,8 @@ def init_git_repo(path): if e.errno != errno.EEXIST: raise subprocess.run(["git", "init"], cwd=path) - subprocess.run(["git", "config", "--global", "user.name", "Your Name"], cwd=path) - subprocess.run(["git", "config", "--global", "user.email", "you@example.com"], cwd=path) + subprocess.run(["git", "config", "user.name", "Your Name"], cwd=path) + subprocess.run(["git", "config", "user.email", "you@example.com"], cwd=path) subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) From 24cf3526e8d958ba096f18e612a3b2f96fcfbcf0 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Nov 15 2019 11:09:38 +0000 Subject: [PATCH 29/88] add f31 --- diff --git a/site.yml b/site.yml index f1aa304..c41b3da 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f31 - f30 - f29 - f28 @@ -22,6 +23,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f31 - f30 - f29 - f28 @@ -30,6 +32,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f31 - f30 - f29 - f28 @@ -38,6 +41,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f31 - f30 - f29 - f28 From ea89fd8da06ef920f4b500b6b5c7587cab018f38 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: Dec 04 2019 20:34:09 +0000 Subject: [PATCH 30/88] Add localization stats --- diff --git a/site.yml b/site.yml index c41b3da..b823cfc 100644 --- a/site.yml +++ b/site.yml @@ -85,6 +85,7 @@ content: - url: https://pagure.io/cpe/docs.git - url: https://pagure.io/fedora-docs/websites.git - url: https://pagure.io/fedora-pgm/pgm_docs.git + - url: https://pagure.io/fedora-docs/localization.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 8f9d66362f5227067b62fa27f2d6a5066d3aa53b Mon Sep 17 00:00:00 2001 From: Clement Verna Date: Mar 04 2020 08:27:57 +0000 Subject: [PATCH 31/88] Use Fedora 31 instead of 29 which is EOL Signed-off-by: Clement Verna --- diff --git a/Dockerfile b/Dockerfile index 8a10b9c..e51e4bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM fedora:29 +FROM fedora:31 RUN dnf -y module install nodejs:10 && \ dnf clean all From fd56a0aee52217e763a30e50389abd997e7ed9d0 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Mar 10 2020 08:25:21 +0000 Subject: [PATCH 32/88] add Fedora Localization Group --- diff --git a/site.yml b/site.yml index b823cfc..52fb396 100644 --- a/site.yml +++ b/site.yml @@ -86,6 +86,7 @@ content: - url: https://pagure.io/fedora-docs/websites.git - url: https://pagure.io/fedora-pgm/pgm_docs.git - url: https://pagure.io/fedora-docs/localization.git + - url: https://pagure.io/fedora-l10n/docs.git ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From cf9f47ff54bc23a6fb4db0765f008774f3278969 Mon Sep 17 00:00:00 2001 From: Jibec Date: Apr 18 2020 11:55:46 +0000 Subject: [PATCH 33/88] add f32 branch it allows translators to see their work in docs.stg.fpo --- diff --git a/site.yml b/site.yml index 52fb396..91c6948 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f32 - f31 - f30 - f29 @@ -23,6 +24,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f32 - f31 - f30 - f29 @@ -32,6 +34,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f32 - f31 - f30 - f29 @@ -41,6 +44,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f32 - f31 - f30 - f29 From af2aba146ae211ec36c8cdd21bef2f9b55321f3c Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: May 14 2020 09:21:35 +0000 Subject: [PATCH 34/88] separate the english and the translated builds --- diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index 6a09f2b..a20ccc6 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -6,8 +6,8 @@ RUN dnf -y module install nodejs:10/default && \ RUN npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0 -ADD build-translated.py /antora/build-translated.py +ADD rebuild-site.py /antora/rebuild-site.py WORKDIR /antora -CMD /antora/build-translated.py +CMD /antora/rebuild-site.py diff --git a/build-scripts/README.md b/build-scripts/README.md index f1d819c..949cc64 100644 --- a/build-scripts/README.md +++ b/build-scripts/README.md @@ -1,7 +1,46 @@ # Building the docs +This script is used in OpenShift to rebuild the whole site for Fedora. + + +## Local testing + +Test the build locally using podman. + +First, make sure your in the right directory — it's the same one that has this *README.md* file. Then build the container on your system: + +``` +$ podman build --no-cache -t fedora-docs-openshift-rebuild . +``` + +And then run it: + +``` +$ mkdir output +$ podman run --rm -it -e "BUILD_ENV=stg" -v $(pwd)/output:/antora/output fedora-docs-openshift-rebuild +``` + +The output will be saved in `./output/`. + +### Changing configuration + +You can also set different environment variables by setting `-e "VAR_NAME=value"` in the `podman run` command. +See a list of supported variables below. + ``` -docker run --rm -it -e "BUILD_ENV=stg" -v $(pwd)/output:/antora/output antora-openshift-rebuild +# The script requires the following environment variables to be set: +# +# Variable Values Effect +# -----------------|----------------------------------------------------------- +# BUILD_ENV prod Build the production version of the site +# using the "prod" branch. DEFAULT +# stg Build the staging version of the site +# using the "stg" branch. +# -----------------|----------------------------------------------------------- +# BUILD_LANGS english Build the "en-US" version only. DEFAULT +# translated Build only the translated versions. +# all Build the "en-US" and the translated versions. ``` -The output will be in `./output/`. +Please note that rebuilding all the languages locally will take many hours and results in gigabytes of output. + diff --git a/build-scripts/build-translated.py b/build-scripts/build-translated.py deleted file mode 100755 index 41b6408..0000000 --- a/build-scripts/build-translated.py +++ /dev/null @@ -1,336 +0,0 @@ -#!/usr/bin/python3 - -import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys - -GLOBAL_CONFIG = { - "docs_repo_url": "https://pagure.io/fedora-docs/docs-fp-o.git", - "docs_repo_branch": "stg", - "translated_sources_repo_url": "https://pagure.io/fedora-docs/translated-sources.git" -} - - -def log(msg): - print(msg) - - -def get_languages(config): - languages_dict = {} - - with tempfile.TemporaryDirectory() as workdir: - translated_sources_repo = os.path.join(workdir, "translated_sources_repo") - subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_repo]) - - languages = [] - filename_blacklist = [".git"] - for filename in os.listdir(translated_sources_repo): - filepath = os.path.join(translated_sources_repo, filename) - if os.path.isdir(filepath) and filename not in filename_blacklist: - languages.append(filename) - - languages.sort() - - for lang in languages: - languages_dict[lang] = [] - - lang_dir = os.path.join(translated_sources_repo, lang) - for component in os.listdir(lang_dir): - version_dir = os.path.join(lang_dir, component) - for version in os.listdir(version_dir): - start_path = "{lang}/{component}/{version}".format( - lang=lang, component=component, version=version) - - # This is a workaround for cases when a component doesn't have - # the ROOT module that should contain the antora.yml. - # Without the ROOT module the translation scripts won't - # pick up the antora.yml causing the docs build to fail. - # So we're only including directories with the antora.yml file. - if "antora.yml" in os.listdir(os.path.join(version_dir, version)): - languages_dict[lang].append(start_path) - - return languages_dict - - -def generate_lang_switch_ui(languages): - template_start = """ -
- -
- """ - template_end = """ -
-
- """ - - template_list = [] - template_list.append(template_start) - for language in languages: - link = '{language}'.format( - language=language) - template_list.append(link) - template_list.append(template_end) - - return "\n".join(template_list) - -def prepare_translated_sources(translated_sources, site_yml, languages, config): - with tempfile.TemporaryDirectory() as workdir: - # Location of the translated-sources repo - # (This repo only holds content that has some translations done, - # so it might be incomplete.) - translated_sources_original = os.path.join(workdir, "translated_sources_original") - - # Location of the English sources in the same structure - # as translated-sources, so: - # COMPONENT/VERSION/antora.yml - # COMPONENT/VERSION/modules/MODULE1 - # COMPONENT/VERSION/modules/MODULE2 - # COMPONENT/VERSION/modules/... - en_sources = os.path.join(workdir, "en_sources") - - # Clone the original translated-sources - subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_original]) - - # Get a list of the original English repos - repos = [] - 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"] = "" - - for branch in repo_data["branches"]: - repo = {} - repo["url"] = repo_data["url"] - repo["branch"] = branch - repo["start_path"] = repo_data["start_path"] - - repos.append(repo) - - # Clome the original English sources and put them into the - # desired structure in en_sources (described above) - components = {} - for repo in repos: - with tempfile.TemporaryDirectory() as tmp_repo_root: - log("") - log("Cloning {url} {branch}".format(url=repo["url"], branch=repo["branch"])) - subprocess.run(["git", "clone", "--branch", repo["branch"], repo["url"], tmp_repo_root]) - - repo_dir = os.path.join(tmp_repo_root, repo["start_path"]) - antora_yml_file = os.path.join(repo_dir, "antora.yml") - with open(antora_yml_file, "r") as file: - antora_yml = yaml.safe_load(file) - - component = antora_yml["name"] - version = antora_yml["version"] - - # Saving components and all their versions - if component not in components: - components[component] = set() - components[component].add(version) - - for module in os.listdir(os.path.join(repo_dir, "modules")): - # Now this is looping over modules accross all components, - # so component, module, and version variables are available - - try: - os.makedirs(os.path.join(en_sources, component, version, "modules")) - except OSError as e: - if e.errno != errno.EEXIST: - raise - - 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]) - - 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")]) - log("----- copying antora.yml for {component} {module} {version}".format( - component=component, module=module, version=version)) - else: - log("----- skipping antora.yml for {component} {module} {version}".format( - component=component, module=module, version=version)) - - # Set up the language structure in translated_sources - for language in languages: - lang_dir = os.path.join(translated_sources, language) - try: - os.makedirs(lang_dir) - except OSError as e: - if e.errno != errno.EEXIST: - raise - - # Copy the English sources in the translated_sources - for language in languages: - 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]) - - # 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 + "/"]) - - return components - - -def init_git_repo(path): - try: - os.makedirs(path) - except OSError as e: - if e.errno != errno.EEXIST: - raise - subprocess.run(["git", "init"], cwd=path) - subprocess.run(["git", "config", "user.name", "Your Name"], cwd=path) - subprocess.run(["git", "config", "user.email", "you@example.com"], cwd=path) - subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) - - -def main(): - config = GLOBAL_CONFIG - - with tempfile.TemporaryDirectory() as workdir: - - # Location of the docs-fp-o repo - docs_repo = os.path.join(workdir, "docs_repo") - - # Location of the translated sources used for the build - # (That's the translated-sources repo with the missing files added - # from the English sources.) - translated_sources = os.path.join(workdir, "translated_sources") - init_git_repo(translated_sources) - - log("") - log("===== Getting the site definition (site.yml) =====") - subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], config["docs_repo_url"], docs_repo]) - - with open(os.path.join(docs_repo, "site.yml"), "r") as file: - original_site_yml = yaml.safe_load(file) - - log("") - log("===== Getting a list of languages =====") - languages = get_languages(config) - log(" Languages: {}".format(" ".join(languages))) - - log("") - log("===== Generating the language switch UI =====") - lang_switch_ui = generate_lang_switch_ui(["en-US"] + list(languages.keys())) - - ui_dir = os.path.join(docs_repo, "supplemental-ui", "partials") - try: - os.makedirs(ui_dir) - except OSError as e: - if e.errno != errno.EEXIST: - raise - - ui_file = os.path.join(ui_dir, "page-languages.hbs") - with open(ui_file, "w") as file: - file.write(lang_switch_ui) - - - - # Timestamp to be included in the footer of the docs - timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC') - antora_env = copy.deepcopy(os.environ) - antora_env["ANTORA_DATE"] = timestamp - - # First, building and copying the en-US site - log("") - log("===== Building the en-US site =====") - antora_env["ANTORA_LANGUAGE"] = "en-US" - result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) - - if result.returncode != 0: - log("ERROR building the en-US site") - sys.exit(1) - - log("") - log("===== Copying the en-US site =====") - source_dir = os.path.join(docs_repo, "public") - target_dir_copying = "/antora/output/en-US.building" - 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]) - 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("") - log("===== Copying the index.html =====") - source_index_html = os.path.join(docs_repo, "static", "index.html") - target_index_html = "/antora/output/index.html" - shutil.copy(source_index_html, target_index_html) - - - # Second, preparing the translated sources to contain all the necessary files - log("") - log("===== Preparing the translated sources =====") - components = prepare_translated_sources(translated_sources, original_site_yml, languages, config) - - - log("") - log("===== Generating site.lang.yml files =====") - for lang in languages: - lang_site_yml = copy.deepcopy(original_site_yml) - - lang_site_yml["output"]["dir"] = "./public/{lang}".format(lang=lang) - - lang_site_yml["content"] = {} - # Branches are set to HEAD because the script uses a locally-generated - # content on top of the original translated-sources repo - lang_site_yml["content"]["branches"] = "HEAD" - lang_site_yml["content"]["sources"] = [] - - for component, versions in components.items(): - for version in versions: - source = {} - source["url"] = translated_sources - source["start_path"] = "{lang}/{component}/{version}".format( - lang=lang, component=component, version=version) - - lang_site_yml["content"]["sources"].append(source) - - filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) - with open(filename, "w") as file: - file.write(yaml.dump(lang_site_yml)) - - log(" {lang} done".format(lang=lang)) - - # Third, building and copying all the translated sites - for lang in languages: - log("") - log("===== Building the {lang} site =====".format(lang=lang)) - filename = "site-{lang}.yml".format(lang=lang) - antora_env["ANTORA_LANGUAGE"] = lang - result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, filename)], env=antora_env) - - if result.returncode != 0: - log("ERROR building the {lang} site".format(lang=lang)) - sys.exit(1) - - - 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) - - - - -if __name__ == "__main__": - main() - diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py new file mode 100755 index 0000000..7755326 --- /dev/null +++ b/build-scripts/rebuild-site.py @@ -0,0 +1,383 @@ +#!/usr/bin/python3 + + +# The script requires the following environment variables to be set: +# +# Variable Values Effect +# -----------------|----------------------------------------------------------- +# BUILD_ENV prod Build the production version of the site +# using the "prod" branch. DEFAULT +# stg Build the staging version of the site +# using the "stg" branch. +# -----------------|----------------------------------------------------------- +# BUILD_LANGS english Build the "en-US" version only. DEFAULT +# translated Build only the translated versions. +# all Build the "en-US" and the translated versions. +# +# + + +import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys + + +def get_config(): + config = {} + + config["docs_repo_branch"] = os.getenv( + "BUILD_ENV", + "prod") + + config["build_langs"] = os.getenv( + "BUILD_LANGS", + "english") + + config["docs_repo_url"] = os.getenv( + "DOCS_REPO_URL", + "https://pagure.io/fedora-docs/docs-fp-o.git") + + config["translated_sources_repo_url"] = os.getenv( + "TRANSLATED_SOURCES_REPO_URL", + "https://pagure.io/fedora-docs/translated-sources.git" + ) + + return config + + +def log(msg): + print(msg) + + +def get_languages(config): + languages_dict = {} + + with tempfile.TemporaryDirectory() as workdir: + translated_sources_repo = os.path.join(workdir, "translated_sources_repo") + subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_repo]) + + languages = [] + filename_blacklist = [".git"] + for filename in os.listdir(translated_sources_repo): + filepath = os.path.join(translated_sources_repo, filename) + if os.path.isdir(filepath) and filename not in filename_blacklist: + languages.append(filename) + + languages.sort() + + for lang in languages: + languages_dict[lang] = [] + + lang_dir = os.path.join(translated_sources_repo, lang) + for component in os.listdir(lang_dir): + version_dir = os.path.join(lang_dir, component) + for version in os.listdir(version_dir): + start_path = "{lang}/{component}/{version}".format( + lang=lang, component=component, version=version) + + # This is a workaround for cases when a component doesn't have + # the ROOT module that should contain the antora.yml. + # Without the ROOT module the translation scripts won't + # pick up the antora.yml causing the docs build to fail. + # So we're only including directories with the antora.yml file. + if "antora.yml" in os.listdir(os.path.join(version_dir, version)): + languages_dict[lang].append(start_path) + + return languages_dict + + +def generate_lang_switch_ui(languages): + template_start = """ +
+ +
+ """ + template_end = """ +
+
+ """ + + template_list = [] + template_list.append(template_start) + for language in languages: + link = '{language}'.format( + language=language) + template_list.append(link) + template_list.append(template_end) + + return "\n".join(template_list) + +def prepare_translated_sources(translated_sources, site_yml, languages, config): + with tempfile.TemporaryDirectory() as workdir: + # Location of the translated-sources repo + # (This repo only holds content that has some translations done, + # so it might be incomplete.) + translated_sources_original = os.path.join(workdir, "translated_sources_original") + + # Location of the English sources in the same structure + # as translated-sources, so: + # COMPONENT/VERSION/antora.yml + # COMPONENT/VERSION/modules/MODULE1 + # COMPONENT/VERSION/modules/MODULE2 + # COMPONENT/VERSION/modules/... + en_sources = os.path.join(workdir, "en_sources") + + # Clone the original translated-sources + subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_original]) + + # Get a list of the original English repos + repos = [] + 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"] = "" + + for branch in repo_data["branches"]: + repo = {} + repo["url"] = repo_data["url"] + repo["branch"] = branch + repo["start_path"] = repo_data["start_path"] + + repos.append(repo) + + # Clome the original English sources and put them into the + # desired structure in en_sources (described above) + components = {} + for repo in repos: + with tempfile.TemporaryDirectory() as tmp_repo_root: + log("") + log("Cloning {url} {branch}".format(url=repo["url"], branch=repo["branch"])) + subprocess.run(["git", "clone", "--branch", repo["branch"], repo["url"], tmp_repo_root]) + + repo_dir = os.path.join(tmp_repo_root, repo["start_path"]) + antora_yml_file = os.path.join(repo_dir, "antora.yml") + with open(antora_yml_file, "r") as file: + antora_yml = yaml.safe_load(file) + + component = antora_yml["name"] + version = antora_yml["version"] + + # Saving components and all their versions + if component not in components: + components[component] = set() + components[component].add(version) + + for module in os.listdir(os.path.join(repo_dir, "modules")): + # Now this is looping over modules accross all components, + # so component, module, and version variables are available + + try: + os.makedirs(os.path.join(en_sources, component, version, "modules")) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + 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]) + + 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")]) + log("----- copying antora.yml for {component} {module} {version}".format( + component=component, module=module, version=version)) + else: + log("----- skipping antora.yml for {component} {module} {version}".format( + component=component, module=module, version=version)) + + # Set up the language structure in translated_sources + for language in languages: + lang_dir = os.path.join(translated_sources, language) + try: + os.makedirs(lang_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + # Copy the English sources in the translated_sources + for language in languages: + 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]) + + # 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 + "/"]) + + return components + + +def init_git_repo(path): + try: + os.makedirs(path) + except OSError as e: + if e.errno != errno.EEXIST: + raise + subprocess.run(["git", "init"], cwd=path) + subprocess.run(["git", "config", "user.name", "Your Name"], cwd=path) + subprocess.run(["git", "config", "user.email", "you@example.com"], cwd=path) + subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) + + +def main(): + config = get_config() + + with tempfile.TemporaryDirectory() as workdir: + + #####--------------------------------------##### + ##### Preparation ##### + #####--------------------------------------##### + + # Location of the docs-fp-o repo + docs_repo = os.path.join(workdir, "docs_repo") + + # Location of the translated sources used for the build + # (That's the translated-sources repo with the missing files added + # from the English sources.) + translated_sources = os.path.join(workdir, "translated_sources") + init_git_repo(translated_sources) + + log("") + log("===== Getting the site definition (site.yml) =====") + subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], config["docs_repo_url"], docs_repo]) + + with open(os.path.join(docs_repo, "site.yml"), "r") as file: + original_site_yml = yaml.safe_load(file) + + log("") + log("===== Getting a list of languages =====") + languages = get_languages(config) + log(" Languages: {}".format(" ".join(languages))) + + log("") + log("===== Generating the language switch UI =====") + lang_switch_ui = generate_lang_switch_ui(["en-US"] + list(languages.keys())) + + ui_dir = os.path.join(docs_repo, "supplemental-ui", "partials") + try: + os.makedirs(ui_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise + + ui_file = os.path.join(ui_dir, "page-languages.hbs") + with open(ui_file, "w") as file: + file.write(lang_switch_ui) + + # Timestamp to be included in the footer of the docs + timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S UTC') + antora_env = copy.deepcopy(os.environ) + antora_env["ANTORA_DATE"] = timestamp + + + + #####--------------------------------------##### + ##### English site build ##### + #####--------------------------------------##### + + if config["build_langs"] == "english" or config["build_langs"] == "all": + + log("") + log("===== Building the en-US site =====") + antora_env["ANTORA_LANGUAGE"] = "en-US" + result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) + + if result.returncode != 0: + log("ERROR building the en-US site") + sys.exit(1) + + log("") + log("===== Copying the en-US site =====") + source_dir = os.path.join(docs_repo, "public") + target_dir_copying = "/antora/output/en-US.building" + 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]) + 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("") + log("===== Copying the index.html =====") + source_index_html = os.path.join(docs_repo, "static", "index.html") + target_index_html = "/antora/output/index.html" + shutil.copy(source_index_html, target_index_html) + + + + #####--------------------------------------##### + ##### Translated site build ##### + #####--------------------------------------##### + + if config["build_langs"] == "translated" or config["build_langs"] == "all": + + log("") + log("===== Preparing the translated sources =====") + components = prepare_translated_sources(translated_sources, original_site_yml, languages, config) + + log("") + log("===== Generating site.lang.yml files =====") + for lang in languages: + lang_site_yml = copy.deepcopy(original_site_yml) + + lang_site_yml["output"]["dir"] = "./public/{lang}".format(lang=lang) + + lang_site_yml["content"] = {} + # Branches are set to HEAD because the script uses a locally-generated + # content on top of the original translated-sources repo + lang_site_yml["content"]["branches"] = "HEAD" + lang_site_yml["content"]["sources"] = [] + + for component, versions in components.items(): + for version in versions: + source = {} + source["url"] = translated_sources + source["start_path"] = "{lang}/{component}/{version}".format( + lang=lang, component=component, version=version) + + lang_site_yml["content"]["sources"].append(source) + + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) + with open(filename, "w") as file: + file.write(yaml.dump(lang_site_yml)) + + log(" {lang} done".format(lang=lang)) + + # Building all the translated sites + for lang in languages: + log("") + log("===== Building the {lang} site =====".format(lang=lang)) + filename = "site-{lang}.yml".format(lang=lang) + antora_env["ANTORA_LANGUAGE"] = lang + result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, filename)], env=antora_env) + + if result.returncode != 0: + log("ERROR building the {lang} site".format(lang=lang)) + sys.exit(1) + + # Copying all the translated sites + 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) + + + +if __name__ == "__main__": + main() + From 9d5927b1c8a2e8c1b2b487856eb9d7ac1297aefd Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Jul 15 2020 11:09:14 +0000 Subject: [PATCH 35/88] fedora-badges docs moved the folder was just too big ;) --- diff --git a/site.yml b/site.yml index 91c6948..8de555b 100644 --- a/site.yml +++ b/site.yml @@ -72,8 +72,7 @@ content: - url: https://pagure.io/fesco/fesco-docs.git start_path: fesco - url: https://pagure.io/fedora-iot/iot-docs.git - - url: https://pagure.io/fedora-badges.git - start_path: docs + - url: https://pagure.io/fedora-badges/docs.git - url: https://pagure.io/fedora-docs/remix-building.git - url: https://github.com/containers/docs.git - url: https://pagure.io/neuro-sig/documentation.git From 1b01f3659ddfdc1a151caac1fcab2f51621d436a Mon Sep 17 00:00:00 2001 From: Justin W. Flory (he/him) Date: Nov 13 2020 22:39:55 +0000 Subject: [PATCH 36/88] Dev tools: Update build/preview scripts from latest upstream This commit manually copies over the latest version of the `build.sh` and `preview.sh` scripts from fedora-docs/template. Signed-off-by: Justin W. Flory (he/him) --- diff --git a/build.sh b/build.sh index a527e3d..f4ecfe4 100755 --- a/build.sh +++ b/build.sh @@ -3,25 +3,25 @@ image="docker.io/antora/antora" cmd="--html-url-extension-style=indexify site.yml" -if [ "$(uname)" == "Darwin" ]; then +if [ "$(uname)" = "Darwin" ]; then # Running on macOS. # Let's assume that the user has the Docker CE installed # which doesn't require a root password. echo "" echo "This build script is using Docker container runtime to run the build in an isolated environment." echo "" - docker run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora $image $cmd + docker run --rm -it -v "$(pwd):/antora" $image $cmd -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then +elif [ "$(expr substr "$(uname -s)" 1 5)" = "Linux" ]; then # Running on Linux. - # Check whether podman is available, else faill back to docker + # Check whether podman is available, else fall back to docker # which requires root. if [ -f /usr/bin/podman ]; then echo "" echo "This build script is using Podman to run the build in an isolated environment." echo "" - podman run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora:z $image $cmd + podman run --rm -it -v "$(pwd):/antora:z" $image $cmd elif [ -f /usr/bin/docker ]; then echo "" @@ -29,18 +29,18 @@ elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then echo "" if groups | grep -wq "docker"; then - docker run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora:z $image $cmd - else + docker run --rm -it -v "$(pwd):/antora:z" $image $cmd + else echo "" echo "This build script is using $runtime to run the build in an isolated environment. You might be asked for your password." echo "You can avoid this by adding your user to the 'docker' group, but be aware of the security implications. See https://docs.docker.com/install/linux/linux-postinstall/." echo "" - sudo docker run -e "ANTORA_DATE=$(date -u)" --rm -it -v $(pwd):/antora:z $image $cmd - fi + sudo docker run --rm -it -v "$(pwd):/antora:z" $image $cmd + fi else echo "" - echo "Error: Container runtime haven't been found on your system. Fix it by:" - echo "$ sudo dnf install podman" - exit 1 + echo "Error: Container runtime haven't been found on your system. Fix it by:" + echo "$ sudo dnf install podman" + exit 1 fi fi diff --git a/preview.sh b/preview.sh index 9c5d46f..4270107 100755 --- a/preview.sh +++ b/preview.sh @@ -1,13 +1,13 @@ #!/bin/sh -if [ "$(uname)" == "Darwin" ]; then +if [ "$(uname)" = "Darwin" ]; then # Running on macOS. # Let's assume that the user has the Docker CE installed # which doesn't require a root password. echo "The preview will be available at http://localhost:8080/" - docker run --rm -v $(pwd)/public:/usr/share/nginx/html:ro -p 8080:80 nginx + docker run --rm -v "$(pwd):/antora:ro" -v "$(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf:ro" -p 8080:80 nginx -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then +elif [ "$(expr substr "$(uname -s)" 1 5)" = "Linux" ]; then # Running on Linux. # Fedora Workstation has python3 installed as a default, so using that echo "" From d618dc386eaa50f9810d5f84cf943613e226a550 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Nov 30 2020 17:01:07 +0000 Subject: [PATCH 37/88] Move council-docs to main as default branch --- diff --git a/site.yml b/site.yml index 8de555b..bb6e09a 100644 --- a/site.yml +++ b/site.yml @@ -57,6 +57,7 @@ content: start_path: docs - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council + branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project - url: https://pagure.io/Fedora-Council/status_reports.git From 2962f8ca844b29c3762b89867804f85f433ebc51 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Nov 30 2020 17:04:57 +0000 Subject: [PATCH 38/88] Move status dashboard to use main branch --- diff --git a/site.yml b/site.yml index bb6e09a..ba80577 100644 --- a/site.yml +++ b/site.yml @@ -61,6 +61,7 @@ content: - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project - url: https://pagure.io/Fedora-Council/status_reports.git + branches: main - url: https://pagure.io/fedora-docs/modularity.git - url: https://github.com/fedora-silverblue/silverblue-docs.git - url: https://pagure.io/fedora-docs/documentation-contributors-guide.git From 8d56157138fe3772c57f024590b972084fed79a1 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Nov 30 2020 17:14:23 +0000 Subject: [PATCH 39/88] Move FPgM docs to use main branch --- diff --git a/site.yml b/site.yml index ba80577..f89fefc 100644 --- a/site.yml +++ b/site.yml @@ -90,6 +90,9 @@ content: - url: https://pagure.io/cpe/docs.git - url: https://pagure.io/fedora-docs/websites.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 ui: From e7ef20b65eefdc0b6d804776498a878a6a2f1989 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Dec 01 2020 16:37:53 +0000 Subject: [PATCH 40/88] Fix the branch for the /project docs too --- diff --git a/site.yml b/site.yml index f89fefc..08c2967 100644 --- a/site.yml +++ b/site.yml @@ -60,6 +60,7 @@ content: branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project + branches: main - url: https://pagure.io/Fedora-Council/status_reports.git branches: main - url: https://pagure.io/fedora-docs/modularity.git From 6570aa74711c99723302ddd27c904bdbf2f54cff Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Mar 10 2021 14:21:22 +0000 Subject: [PATCH 41/88] Add Fedora Server docs Signed-off-by: Ben Cotton --- diff --git a/site.yml b/site.yml index 08c2967..200bfa6 100644 --- a/site.yml +++ b/site.yml @@ -96,6 +96,9 @@ content: - 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://pagure.io/fedora-server.git + branches: main + start_path: docs ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip From 73e28b05aed04cf57b2849cd7261bdfa506b0c68 Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Apr 10 2021 15:57:34 +0000 Subject: [PATCH 42/88] feat(neuro): switch primary branch to main --- diff --git a/site.yml b/site.yml index 200bfa6..66f9e47 100644 --- a/site.yml +++ b/site.yml @@ -79,6 +79,7 @@ content: - url: https://pagure.io/fedora-docs/remix-building.git - url: https://github.com/containers/docs.git - url: https://pagure.io/neuro-sig/documentation.git + branches: main - url: https://pagure.io/sig-teleirc/infrastructure.git start_path: docs - url: https://pagure.io/fedora-ci/docs.git From 0da28c404c77c58347cdb10fcf98251bbb0c5345 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: May 24 2021 17:10:08 +0000 Subject: [PATCH 43/88] allow single branch and detect default branch --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 7755326..e69e516 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -127,18 +127,23 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): # 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) From 54725f449dfaba11f10855044f5f1b50ca7680d7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: May 24 2021 17:19:40 +0000 Subject: [PATCH 44/88] run hardlink at the end as asked in https://pagure.io/fedora-infrastructure/issue/8964 --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index e69e516..10e0537 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -182,11 +182,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", "-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: @@ -207,13 +207,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", "-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 @@ -304,7 +304,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", "-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) @@ -376,7 +376,7 @@ def main(): 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]) + 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) From 9af6dfc60f2b8fdb4d5a94fc5ee4cf246dac37fa Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: May 24 2021 17:21:31 +0000 Subject: [PATCH 45/88] replace cp -r by cp -a & run hardlink at the end as asked in https://pagure.io/fedora-infrastructure/issue/8964 --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 10e0537..99734aa 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -368,18 +368,48 @@ def main(): 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", "-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) + 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!") From 91dcafcbe4229bd9b1a93fd541b9c1917ce1a8db Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: May 24 2021 17:44:11 +0000 Subject: [PATCH 46/88] add qa docs --- diff --git a/site.yml b/site.yml index 66f9e47..8c7050d 100644 --- a/site.yml +++ b/site.yml @@ -91,6 +91,7 @@ content: - 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 From 437c329d044b3433adbd3c84fe60333f9be8aaff Mon Sep 17 00:00:00 2001 From: Justin W. Flory (he/him) Date: May 24 2021 17:44:11 +0000 Subject: [PATCH 47/88] Remove "Site" from site title I finally figured out where this info is stored. This is been a mild bother for some time. It makes the title shorter, and it doesn't appear in file names or other things if I take screenshots of a docs.fp.o page. Purely cosmetic, using this change as an excuse to make my first change to the production docs.fp.o builder. Signed-off-by: Justin W. Flory (he/him) --- diff --git a/site.yml b/site.yml index 8c7050d..d8a05c8 100644 --- a/site.yml +++ b/site.yml @@ -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: From 36abbd76740e90282e06e8adf81f424a93d36e1e Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: May 24 2021 17:44:11 +0000 Subject: [PATCH 48/88] Add Fedora Gaming docs to Engineering --- diff --git a/site.yml b/site.yml index d8a05c8..c74ec73 100644 --- a/site.yml +++ b/site.yml @@ -98,6 +98,10 @@ content: - 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 + - url: https://pagure.io/gaming/documentation.git - url: https://pagure.io/fedora-server.git branches: main start_path: docs From a5cc276c84805b186141f7160e9b1e2ce7a908fa Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: May 24 2021 17:44:11 +0000 Subject: [PATCH 49/88] Gaming switched default branch to main Signed-off-by: Ben Cotton --- diff --git a/site.yml b/site.yml index c74ec73..4b03c63 100644 --- a/site.yml +++ b/site.yml @@ -102,6 +102,7 @@ content: - url: https://pagure.io/i3-sig/docs.git - url: https://github.com/fedora-infra/fedora-accounts-docs.git - url: https://pagure.io/gaming/documentation.git + branches: main - url: https://pagure.io/fedora-server.git branches: main start_path: docs From a6cc1469d960551a8644a650c1d6661b0070c2b4 Mon Sep 17 00:00:00 2001 From: Timothée Ravier Date: May 24 2021 17:44:11 +0000 Subject: [PATCH 50/88] site.yaml: Add Fedora Kinoite docs --- diff --git a/site.yml b/site.yml index 4b03c63..9ab6ef8 100644 --- a/site.yml +++ b/site.yml @@ -65,6 +65,8 @@ content: 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 From de05d1bf912bc5decde1df5dcaf407e893a91c0a Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: May 24 2021 17:44:11 +0000 Subject: [PATCH 51/88] Change Accounts branch to main --- diff --git a/site.yml b/site.yml index 9ab6ef8..e657c94 100644 --- a/site.yml +++ b/site.yml @@ -103,6 +103,7 @@ content: - 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 From e92a1efd7b165d15148e9a98ac4af8bc3e31f006 Mon Sep 17 00:00:00 2001 From: Petr Bokoc Date: May 24 2021 17:44:11 +0000 Subject: [PATCH 52/88] Publish F34 docs --- diff --git a/site.yml b/site.yml index e657c94..6e2e0a7 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,8 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f34 + - f33 - f32 - f31 - f30 @@ -24,6 +26,8 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f34 + - f33 - f32 - f31 - f30 @@ -34,6 +38,8 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f34 + - f33 - f32 - f31 - f30 @@ -44,6 +50,8 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f34 + - f33 - f32 - f31 - f30 From 825039c0e57bb2346eb7f8e28b7f38d62d94cf19 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: May 24 2021 17:44:11 +0000 Subject: [PATCH 53/88] Switch Fedora CoreOS docs build to main branch --- diff --git a/site.yml b/site.yml index 6e2e0a7..05c2030 100644 --- a/site.yml +++ b/site.yml @@ -98,6 +98,7 @@ content: - 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 From 5d745adb50e9a3ce61a6ef0c3491b4080f6fb065 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: May 25 2021 16:31:35 +0000 Subject: [PATCH 54/88] Bump to F34 & antora 2.3 & node 14 --- diff --git a/Dockerfile b/Dockerfile index e51e4bc..455cdda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM fedora:31 +FROM fedora:34 -RUN dnf -y module install nodejs:10 && \ +RUN dnf -y module install nodejs:14 && \ dnf clean all -RUN npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0 +RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 WORKDIR /antora ENTRYPOINT [ "antora" ] diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index a20ccc6..4fa459f 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,10 +1,10 @@ -FROM fedora:31 +FROM fedora:34 -RUN dnf -y module install nodejs:10/default && \ +RUN dnf -y module install nodejs:14/default && \ dnf -y install git python3-yaml && \ dnf clean all -RUN npm i -g @antora/cli@2.0 @antora/site-generator-default@2.0 +RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 ADD rebuild-site.py /antora/rebuild-site.py From a3052ac10d6b12c764253f0798817176ebdd6724 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Jun 09 2021 19:49:37 +0000 Subject: [PATCH 55/88] Build server docs from the stg branch Fixes #165 --- diff --git a/site.yml b/site.yml index 05c2030..5690115 100644 --- a/site.yml +++ b/site.yml @@ -116,7 +116,7 @@ content: - url: https://pagure.io/gaming/documentation.git branches: main - url: https://pagure.io/fedora-server.git - branches: main + branches: stg start_path: docs ui: bundle: From fc5af5c81b4b729a1e91018d2b1dd0cba181dfe0 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jun 10 2021 08:56:27 +0000 Subject: [PATCH 56/88] disable the edit link for translated pages --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 99734aa..90599ca 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -338,6 +338,8 @@ def main(): # Branches are set to HEAD because the script uses a locally-generated # content on top of the original translated-sources repo lang_site_yml["content"]["branches"] = "HEAD" + # disable the "Edit this Page" + lang_site_yml["content"]["edit_url"] = False lang_site_yml["content"]["sources"] = [] for component, versions in components.items(): From f12af51634e3d6e65f23972aae0b11600b0d3652 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jun 19 2021 22:32:29 +0000 Subject: [PATCH 57/88] containers use main branch --- diff --git a/site.yml b/site.yml index 5690115..9e72764 100644 --- a/site.yml +++ b/site.yml @@ -88,6 +88,7 @@ content: - url: https://pagure.io/fedora-badges/docs.git - url: https://pagure.io/fedora-docs/remix-building.git - url: https://github.com/containers/docs.git + branches: main - url: https://pagure.io/neuro-sig/documentation.git branches: main - url: https://pagure.io/sig-teleirc/infrastructure.git From c6e929ca8b1aefae1d830d0d1472225e6d458fcf Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Jul 06 2021 20:30:11 +0000 Subject: [PATCH 58/88] Start publishing releases docs from the PgM repo as a test --- diff --git a/site.yml b/site.yml index 9e72764..242fb14 100644 --- a/site.yml +++ b/site.yml @@ -106,6 +106,9 @@ content: - url: https://pagure.io/fedora-qa/qa-docs.git - url: https://pagure.io/fedora-pgm/pgm_docs.git branches: main + - url: https://pagure.io/fedora-pgm/pgm_docs.git + branches: main + start_path: releases - 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 From b6199699a717a18f922775dc674dca314ff2dea9 Mon Sep 17 00:00:00 2001 From: Ben Cotton Date: Aug 26 2021 13:55:01 +0000 Subject: [PATCH 59/88] Put the project docs on stg branch to test --- diff --git a/site.yml b/site.yml index 242fb14..7bccdfc 100644 --- a/site.yml +++ b/site.yml @@ -68,7 +68,7 @@ content: branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: project - branches: main + branches: stg - url: https://pagure.io/Fedora-Council/status_reports.git branches: main - url: https://pagure.io/fedora-docs/modularity.git From ef1b007c860eb53f8ed30d70e65ecffbe608df85 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 08 2022 19:50:13 +0000 Subject: [PATCH 60/88] Sync stg with prod Update logo Add Infra docs & EPEL Add Workstation SIG docs Update WS SIG branch Switch EPEL from master to main use the 'main' branch for commops Add package maintainers support an easy way to add an announcement to the top of every page Update UI with new license info F35 docs New repo for Fedora Websites Add Server WG docs --- diff --git a/site.yml b/site.yml index 7bccdfc..df508ff 100644 --- a/site.yml +++ b/site.yml @@ -14,6 +14,7 @@ content: - url: https://pagure.io/fedora-docs/release-docs-home.git branches: - master + - f35 - f34 - f33 - f32 @@ -26,6 +27,7 @@ content: - url: https://pagure.io/fedora-docs/install-guide.git branches: - master + - f35 - f34 - f33 - f32 @@ -38,6 +40,7 @@ content: - url: https://pagure.io/fedora-docs/system-administrators-guide.git branches: - master + - f35 - f34 - f33 - f32 @@ -50,6 +53,7 @@ content: - url: https://pagure.io/fedora-docs/release-notes.git branches: - master + - f35 - f34 - f33 - f32 @@ -63,6 +67,10 @@ content: - url: https://pagure.io/mentored-projects.git - url: https://pagure.io/fedora-commops.git start_path: docs + branches: main + - url: https://pagure.io/fedora-websites.git + start_path: docs + branches: main - url: https://pagure.io/Fedora-Council/council-docs.git start_path: council branches: main @@ -72,6 +80,7 @@ content: - url: https://pagure.io/Fedora-Council/status_reports.git branches: main - url: https://pagure.io/fedora-docs/modularity.git + - url: https://pagure.io/fedora-docs/package-maintainer-docs.git - url: https://github.com/fedora-silverblue/silverblue-docs.git - url: https://pagure.io/fedora-kde/kinoite-docs branches: main @@ -102,7 +111,6 @@ content: 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 @@ -122,6 +130,14 @@ content: - url: https://pagure.io/fedora-server.git branches: stg start_path: docs + - url: https://pagure.io/fedora-server.git + branches: stg + start_path: wg + - url: https://pagure.io/epel.git + branches: main + - url: https://pagure.io/infra-docs-fpo.git + - url: https://pagure.io/fedora-workstation/workstation-docs.git + branches: main ui: bundle: url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip diff --git a/supplemental-ui/img/docs_logo.png b/supplemental-ui/img/docs_logo.png new file mode 100644 index 0000000..ea87697 Binary files /dev/null and b/supplemental-ui/img/docs_logo.png differ diff --git a/supplemental-ui/layouts/homepage.hbs b/supplemental-ui/layouts/homepage.hbs new file mode 100644 index 0000000..bd2c4d7 --- /dev/null +++ b/supplemental-ui/layouts/homepage.hbs @@ -0,0 +1,59 @@ + + + + + + {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} + {{#if page.canonicalUrl}} + + {{/if}} + {{#if page.description}} + + {{/if}} + {{#if page.keywords}} + + {{/if}} + {{#if (or antoraVersion site.antoraVersion)}} + + {{/if}} + +{{> head}} + + +{{> announcement}} +{{> header}} + + + +
+
+ +
+{{#if (eq page.layout '404')}} +
+

The page you're looking for does not exist. It may have been moved.

+
+
+

If you arrived on this page by clicking on a link, please notify the owner of the site that the link is broken. +If you typed the URL of this page manually, please double check that you entered the address correctly.

+
+{{else}} + +{{{page.contents}}} +{{/if}} +
+
+
+ + +{{> footer}} + + diff --git a/supplemental-ui/layouts/with_menu.hbs b/supplemental-ui/layouts/with_menu.hbs new file mode 100644 index 0000000..316c7c6 --- /dev/null +++ b/supplemental-ui/layouts/with_menu.hbs @@ -0,0 +1,28 @@ + + + + + + {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} + {{#if page.canonicalUrl}} + + {{/if}} + {{#if page.description}} + + {{/if}} + {{#if page.keywords}} + + {{/if}} + {{#if (or antoraVersion site.antoraVersion)}} + + {{/if}} + +{{> head}} + + +{{> announcement}} +{{> header}} +{{> main}} +{{> footer}} + + diff --git a/supplemental-ui/layouts/without_menu.hbs b/supplemental-ui/layouts/without_menu.hbs new file mode 100644 index 0000000..910fb6c --- /dev/null +++ b/supplemental-ui/layouts/without_menu.hbs @@ -0,0 +1,35 @@ + + + + + + {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} + {{#if page.canonicalUrl}} + + {{/if}} + {{#if page.description}} + + {{/if}} + {{#if page.keywords}} + + {{/if}} + {{#if (or antoraVersion site.antoraVersion)}} + + {{/if}} + +{{> head}} + + +{{> announcement}} +{{> header}} +
+ +
+{{> toolbar}} +{{> article}} +
+
+ +{{> footer}} + + diff --git a/supplemental-ui/partials/announcement.hbs b/supplemental-ui/partials/announcement.hbs new file mode 100644 index 0000000..0237325 --- /dev/null +++ b/supplemental-ui/partials/announcement.hbs @@ -0,0 +1 @@ + diff --git a/supplemental-ui/partials/footer-content.hbs b/supplemental-ui/partials/footer-content.hbs new file mode 100644 index 0000000..8488b7b --- /dev/null +++ b/supplemental-ui/partials/footer-content.hbs @@ -0,0 +1,4 @@ +
+

All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.

+

Last build: {{{env.ANTORA_DATE}}}

+
From edc81a48bcc1f9764cf758cae167665d10f62149 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 08 2022 19:51:03 +0000 Subject: [PATCH 61/88] Upgrade to Antora 3.0.0 & node 16 --- diff --git a/Dockerfile b/Dockerfile index 455cdda..dbc89f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ FROM fedora:34 -RUN dnf -y module install nodejs:14 && \ +RUN dnf -y module install nodejs:16 && \ dnf clean all -RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 +RUN npm i -g @antora/cli@3.0.0 @antora/site-generator-default@3.0.0 WORKDIR /antora ENTRYPOINT [ "antora" ] diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index 4fa459f..bc1cfea 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,10 +1,10 @@ FROM fedora:34 -RUN dnf -y module install nodejs:14/default && \ +RUN dnf -y module install nodejs:16/default && \ dnf -y install git python3-yaml && \ dnf clean all -RUN npm i -g @antora/cli@2.3 @antora/site-generator-default@2.3 +RUN npm i -g @antora/cli@3.0.0 @antora/site-generator-default@3.0.0 ADD rebuild-site.py /antora/rebuild-site.py diff --git a/site.yml b/site.yml index df508ff..5e23aef 100644 --- a/site.yml +++ b/site.yml @@ -150,7 +150,7 @@ output: destinations: - provider: archive runtime: - pull: true + fetch: true cache_dir: ./cache asciidoc: extensions: From e9e422459c4185c82d1d9f2fce0177ffcaa88ff5 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 25 2022 11:56:11 +0000 Subject: [PATCH 62/88] Use fixed antora version for local build --- diff --git a/build.sh b/build.sh index f4ecfe4..07fbd4a 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -image="docker.io/antora/antora" +image="docker.io/antora/antora:3.0.0" cmd="--html-url-extension-style=indexify site.yml" if [ "$(uname)" = "Darwin" ]; then From dc0f9d764ecc856cc6d7ed55a1ad1de8f413308c Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 25 2022 11:56:52 +0000 Subject: [PATCH 63/88] Update ui-bundle to 1.01 --- diff --git a/site.yml b/site.yml index 5e23aef..beaa39d 100644 --- a/site.yml +++ b/site.yml @@ -140,7 +140,7 @@ content: branches: main ui: bundle: - url: https://asamalik.fedorapeople.org/docs-translations/ui-bundle.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.01.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 22c349e74ee3f4d7499f935f408ea40ef0c48652 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 25 2022 12:22:35 +0000 Subject: [PATCH 64/88] antora 3.0 require site-generator --- diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index bc1cfea..d5458ec 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -4,7 +4,7 @@ RUN dnf -y module install nodejs:16/default && \ dnf -y install git python3-yaml && \ dnf clean all -RUN npm i -g @antora/cli@3.0.0 @antora/site-generator-default@3.0.0 +RUN npm i -g @antora/cli@3.0.0 @antora/site-generator@3.0.0 ADD rebuild-site.py /antora/rebuild-site.py From 636838ed2b115c5d340eddb9d152aa59e72d9a98 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 25 2022 16:40:24 +0000 Subject: [PATCH 65/88] build: optimize temp space --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 90599ca..823c1bd 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -44,7 +44,7 @@ def get_config(): def log(msg): - print(msg) + print(msg, flush=True) def get_languages(config): @@ -369,39 +369,42 @@ def main(): log("ERROR building the {lang} site".format(lang=lang)) 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(" - {}".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)]) + # Copying the translated site + log("") + log(f"=== Copying the {lang} site ===") + + results_dir = os.path.join(docs_repo, "public", lang) + publish_dir = f"/antora/output/{lang}" + copying_dir = f"/antora/output/{lang}.tmp" + + # I have: + # docs_repo/public/xx <- results_dir (local partition) + # /antora/output/xx.tmp <- copying_dir (mounted partition) + # /antora/output/xx <- 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 doesn't exist + shutil.rmtree(copying_dir, ignore_errors=True) + + # Copy results from local partition to a mounted partition + log(f"Copying from {results_dir} to {copying_dir}") + subprocess.run(["cp", "-a", results_dir, copying_dir]) + + # Swap the old tree for the new one for each language + log("Moving language to the final place:") + log(f" - {copying_dir} to {publish_dir}") + shutil.rmtree(publish_dir, ignore_errors=True) + subprocess.run(["mv", copying_dir, publish_dir]) + + # Remove local build + shutil.rmtree(results_dir, ignore_errors=True) + + # End Building all the translated sites # https://pagure.io/fedora-infrastructure/issue/8964 log("Consolidate files with hardlink...") From db8e7e3182d382b3a83d12d0630dc501b7db9197 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Jan 30 2022 14:25:48 +0000 Subject: [PATCH 66/88] add localization support for asciidoc attributes --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 823c1bd..3c34c87 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -17,7 +17,7 @@ # -import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys +import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys, glob def get_config(): @@ -39,6 +39,10 @@ def get_config(): "TRANSLATED_SOURCES_REPO_URL", "https://pagure.io/fedora-docs/translated-sources.git" ) + + config["translated_adockeywords_repo_url"] = os.getenv( + "TRANSLATED_ADOCKEYWORDS_REPO_URL", + "https://pagure.io/fedora-docs-l10n/asciidoc-keywords.git") return config @@ -218,6 +222,30 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): return components +def prepare_localized_admonitions(languages, config): + """ Asciidoc use keywords for admonitions and others items """ + keywords = {} + + with tempfile.TemporaryDirectory() as workdir: + translated_keywords_repo = os.path.join(workdir, "asciidoc-keywords") + subprocess.run(["git", "clone", config["translated_adockeywords_repo_url"], translated_keywords_repo]) + + languages = [] + log(translated_keywords_repo + "/langs/*/asciidoc-attributes.yml") + for filename in glob.glob(translated_keywords_repo + "/langs/*/asciidoc-attributes.yml"): + languages.append(filename.rsplit("/")[::-1][1]) + + for lang in languages: + file = translated_keywords_repo + "/langs/" + lang + "/asciidoc-attributes.yml" + with open(file, 'r') as stream: + try: + keywords[lang] = yaml.load(stream) + except yaml.YAMLError as exc: + print(exc) + + return keywords + + def init_git_repo(path): try: os.makedirs(path) @@ -328,6 +356,10 @@ def main(): components = prepare_translated_sources(translated_sources, original_site_yml, languages, config) log("") + log("===== Preparing the translated ascidoc keywords =====") + keywords = prepare_localized_admonitions(languages, config) + + log("") log("===== Generating site.lang.yml files =====") for lang in languages: lang_site_yml = copy.deepcopy(original_site_yml) @@ -351,6 +383,12 @@ def main(): lang_site_yml["content"]["sources"].append(source) + if lang in keywords: + if "attributes" in lang_site_yml["asciidoc"]: + lang_site_yml["asciidoc"]["attributes"].append(keywords[lang]) + else: + lang_site_yml["asciidoc"]["attributes"] = keywords[lang] + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) with open(filename, "w") as file: file.write(yaml.dump(lang_site_yml)) From 92ee060b8c018fed4cfed0967e0de82a928a54b9 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 30 2022 15:15:56 +0000 Subject: [PATCH 67/88] remove duplicate elements from fedora-docs-ui --- diff --git a/supplemental-ui/img/docs_logo.png b/supplemental-ui/img/docs_logo.png deleted file mode 100644 index ea87697..0000000 Binary files a/supplemental-ui/img/docs_logo.png and /dev/null differ diff --git a/supplemental-ui/layouts/homepage.hbs b/supplemental-ui/layouts/homepage.hbs deleted file mode 100644 index bd2c4d7..0000000 --- a/supplemental-ui/layouts/homepage.hbs +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} - {{#if page.canonicalUrl}} - - {{/if}} - {{#if page.description}} - - {{/if}} - {{#if page.keywords}} - - {{/if}} - {{#if (or antoraVersion site.antoraVersion)}} - - {{/if}} - -{{> head}} - - -{{> announcement}} -{{> header}} - - - -
-
- -
-{{#if (eq page.layout '404')}} -
-

The page you're looking for does not exist. It may have been moved.

-
-
-

If you arrived on this page by clicking on a link, please notify the owner of the site that the link is broken. -If you typed the URL of this page manually, please double check that you entered the address correctly.

-
-{{else}} - -{{{page.contents}}} -{{/if}} -
-
-
- - -{{> footer}} - - diff --git a/supplemental-ui/layouts/with_menu.hbs b/supplemental-ui/layouts/with_menu.hbs deleted file mode 100644 index 316c7c6..0000000 --- a/supplemental-ui/layouts/with_menu.hbs +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} - {{#if page.canonicalUrl}} - - {{/if}} - {{#if page.description}} - - {{/if}} - {{#if page.keywords}} - - {{/if}} - {{#if (or antoraVersion site.antoraVersion)}} - - {{/if}} - -{{> head}} - - -{{> announcement}} -{{> header}} -{{> main}} -{{> footer}} - - diff --git a/supplemental-ui/layouts/without_menu.hbs b/supplemental-ui/layouts/without_menu.hbs deleted file mode 100644 index 910fb6c..0000000 --- a/supplemental-ui/layouts/without_menu.hbs +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - {{{detag (or page.title 'Untitled')}}}{{#if site.title}} :: {{site.title}}{{/if}} - {{#if page.canonicalUrl}} - - {{/if}} - {{#if page.description}} - - {{/if}} - {{#if page.keywords}} - - {{/if}} - {{#if (or antoraVersion site.antoraVersion)}} - - {{/if}} - -{{> head}} - - -{{> announcement}} -{{> header}} -
- -
-{{> toolbar}} -{{> article}} -
-
- -{{> footer}} - - diff --git a/supplemental-ui/partials/footer-content.hbs b/supplemental-ui/partials/footer-content.hbs deleted file mode 100644 index 8488b7b..0000000 --- a/supplemental-ui/partials/footer-content.hbs +++ /dev/null @@ -1,4 +0,0 @@ -
-

All Fedora Documentation content available under CC BY-SA 4.0 or, when specifically noted, under another accepted free and open content license.

-

Last build: {{{env.ANTORA_DATE}}}

-
diff --git a/supplemental-ui/partials/page-languages.hbs b/supplemental-ui/partials/page-languages.hbs deleted file mode 100644 index b5858f3..0000000 --- a/supplemental-ui/partials/page-languages.hbs +++ /dev/null @@ -1,6 +0,0 @@ -
- -
- en-US -
-
From 6d4fbb28654d039a4762b864f507f6e9f31626d2 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Jan 30 2022 16:24:17 +0000 Subject: [PATCH 68/88] update ui-bundle to 1.02 --- diff --git a/site.yml b/site.yml index beaa39d..41b3fa9 100644 --- a/site.yml +++ b/site.yml @@ -140,7 +140,7 @@ content: branches: main ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.01.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.02.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From bf8928f29b5b8ea44ab045b3f299a2302c0fc872 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 03 2022 20:33:10 +0000 Subject: [PATCH 69/88] set latest symbolic version redirect --- diff --git a/site.yml b/site.yml index 41b3fa9..2277745 100644 --- a/site.yml +++ b/site.yml @@ -1,6 +1,6 @@ site: title: Fedora Docs - url: https://docs.fedoraproject.org/en-US/ + url: https://docs.stg.fedoraproject.org/en-US start_page: docs::index.adoc content: branches: master @@ -155,3 +155,8 @@ runtime: asciidoc: extensions: - ./lib/extensions/package-inline-macro.js +urls: + redirect_facility: httpd + latest_version_segment: latest + latest_version_segment_strategy: redirect:to + From 0c81eca661f7156abd1395f616dfa4ed47fb322f Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 03 2022 21:07:08 +0000 Subject: [PATCH 70/88] fix component version if set to null --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 3c34c87..30f51f9 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -167,6 +167,9 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): component = antora_yml["name"] version = antora_yml["version"] + # if component version is null (~), fallback to "master" + if not version: + version = "master" # Saving components and all their versions if component not in components: From 9adbb765ccccf357911e48e20c7d2897d2e80d73 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 03 2022 23:13:53 +0000 Subject: [PATCH 71/88] Revert "set latest symbolic version redirect" This reverts commit bf8928f29b5b8ea44ab045b3f299a2302c0fc872. --- diff --git a/site.yml b/site.yml index 2277745..41b3fa9 100644 --- a/site.yml +++ b/site.yml @@ -1,6 +1,6 @@ site: title: Fedora Docs - url: https://docs.stg.fedoraproject.org/en-US + url: https://docs.fedoraproject.org/en-US/ start_page: docs::index.adoc content: branches: master @@ -155,8 +155,3 @@ runtime: asciidoc: extensions: - ./lib/extensions/package-inline-macro.js -urls: - redirect_facility: httpd - latest_version_segment: latest - latest_version_segment_strategy: redirect:to - From ced7bfcf1564b1a8fedb5931059fb7d5a762101b Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 05 2022 04:36:36 +0000 Subject: [PATCH 72/88] Fix hardlink directory --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 30f51f9..aad83d5 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -449,7 +449,7 @@ def main(): # https://pagure.io/fedora-infrastructure/issue/8964 log("Consolidate files with hardlink...") - subprocess.run(["hardlink", "-v", "{}/".format(publish_dir)]) + subprocess.run(["hardlink", "-v", "/antora/output/"]) # And finally remove the copying dir log("Removing the copying dir...") From c771b632171b704acebdcc0234a46c1c019fda71 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 05 2022 18:15:51 +0000 Subject: [PATCH 73/88] extension to retrieve last-update information from git --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index aad83d5..468dbbb 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -111,6 +111,20 @@ def generate_lang_switch_ui(languages): return "\n".join(template_list) +def prefetch_sources(original_sources, site_yml, config): + if not os.path.isdir(original_sources): + os.mkdir(original_sources) + + for repo_data in site_yml["content"]["sources"]: + gitdir = tempfile.TemporaryDirectory(dir=original_sources) + dirname = gitdir.name + gitdir.cleanup() + log(f"Fetching {repo_data['url']}...") + subprocess.run(["git", "clone", repo_data['url'], dirname]) + repo_data['url'] = dirname + + return site_yml + def prepare_translated_sources(translated_sources, site_yml, languages, config): with tempfile.TemporaryDirectory() as workdir: # Location of the translated-sources repo @@ -320,9 +334,23 @@ def main(): if config["build_langs"] == "english" or config["build_langs"] == "all": log("") + log("===== Prefetching all components =====") + original_sources = os.path.join(workdir, "orginal_sources") + site_local = prefetch_sources(original_sources, original_site_yml, config) + log(original_site_yml["content"]["sources"][0]['url']) + log(site_local["content"]["sources"][0]['url']) + + filename = os.path.join(docs_repo, "site-local.yml") + with open(filename, "w") as file: + file.write(yaml.dump(site_local)) + + + + log("") log("===== Building the en-US site =====") antora_env["ANTORA_LANGUAGE"] = "en-US" - result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) + # result = subprocess.run(["antora", "--html-url-extension-style=indexify", os.path.join(docs_repo, "site.yml")], env=antora_env) + result = subprocess.run(["antora", "--html-url-extension-style=indexify", filename], env=antora_env) if result.returncode != 0: log("ERROR building the en-US site") diff --git a/lib/extensions/page-last-update.js b/lib/extensions/page-last-update.js new file mode 100644 index 0000000..a2bfaf2 --- /dev/null +++ b/lib/extensions/page-last-update.js @@ -0,0 +1,29 @@ + +module.exports.register = function () { + this.on('contentClassified', async ({ contentCatalog }) => { + const logger = this.require('@antora/logger').get('page-last-update') + const git = this.require('@antora/content-aggregator/lib/git') + const path = this.require('path') + const fs = this.require('fs') + // logger.warn(contentCatalog) + + const pages = contentCatalog.findBy({ family: 'page' }) + for (const module of pages) { + const relpath = path.join(module.src.origin.startPath, module.src.path) + logger.warn(relpath) + // logger.warn(module.src) + const contents = module.contents.toString('utf-8') + + // logger.warn(module.contents) + const commits = await git.log({ fs, gitdir: module.src.origin.gitdir, filepath: relpath, ref: "origin/"+module.src.origin.refname, follow: true, depth: 1 }) + const last_update = new Date(commits[0].commit.author.timestamp * 1000).toISOString().split('T')[0] + const last_author = commits[0].commit.author.name + // logger.warn(commits) + // logger.warn({ name: relpath, created_at: created_at, last_update: last_update, by: last_author }) + const patchedContents = ":page-last-updated: " + last_update + "\n" + contents + module.contents = Buffer.from(patchedContents) + + } + this.updateVariables({ contentCatalog }) + }) +} diff --git a/site.yml b/site.yml index 41b3fa9..cec89c0 100644 --- a/site.yml +++ b/site.yml @@ -155,3 +155,9 @@ runtime: asciidoc: extensions: - ./lib/extensions/package-inline-macro.js +antora: + extensions: + - ./lib/extensions/page-last-update.js +urls: + latest_version_segment: latest + From ed2df6d9de9c8be9ab5397b0ffc3e61b96dff1a6 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 05 2022 18:15:51 +0000 Subject: [PATCH 74/88] generate htaccess for redirect --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 468dbbb..445dbde 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -274,6 +274,15 @@ def init_git_repo(path): subprocess.run(["git", "config", "user.email", "you@example.com"], cwd=path) subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) +def gen_redirect(lang, results_dir): + htaccess = os.path.join(results_dir, ".htaccess") + latest = "f35" + htaccess_content = f""" + ErrorDocument 404 /{lang}/404.html + Redirect 302 /{lang}/fedora/{latest} /{lang}/fedora/latest + """ + with open(htaccess, "w") as file: + file.write(htaccess_content) def main(): config = get_config() @@ -362,6 +371,10 @@ def main(): target_dir_copying = "/antora/output/en-US.building" target_dir_copied = "/antora/output/en-US.building/en-US" target_dir_final = "/antora/output/en-US" + + # Generate htaccess for redirect + gen_redirect("en-US", os.path.join(source_dir, "en-US")) + shutil.rmtree(target_dir_copying, ignore_errors=True) subprocess.run(["cp", "-a", source_dir, target_dir_copying]) shutil.rmtree(target_dir_final, ignore_errors=True) @@ -457,6 +470,9 @@ def main(): # 3/ move new within mounted # 4/ remove the copying dir + # Generate htaccess for redirect + gen_redirect(lang, results_dir) + # Make sure copying_dir doesn't exist shutil.rmtree(copying_dir, ignore_errors=True) From 17abff962008dc4c2cf3fdde8c76a8c5b7a7c9e9 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 05 2022 18:15:51 +0000 Subject: [PATCH 75/88] update UI to 1.03 --- diff --git a/site.yml b/site.yml index cec89c0..18702fd 100644 --- a/site.yml +++ b/site.yml @@ -140,7 +140,7 @@ content: branches: main ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.02.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.03.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 16f5f2ba1dbc31d762277527e3fd3c90ed96f817 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 06 2022 15:41:45 +0000 Subject: [PATCH 76/88] catch git error --- diff --git a/lib/extensions/page-last-update.js b/lib/extensions/page-last-update.js index a2bfaf2..e0a1ae5 100644 --- a/lib/extensions/page-last-update.js +++ b/lib/extensions/page-last-update.js @@ -1,29 +1,35 @@ module.exports.register = function () { this.on('contentClassified', async ({ contentCatalog }) => { - const logger = this.require('@antora/logger').get('page-last-update') - const git = this.require('@antora/content-aggregator/lib/git') - const path = this.require('path') - const fs = this.require('fs') - // logger.warn(contentCatalog) + const logger = this.require('@antora/logger').get('page-last-update') + const git = this.require('@antora/content-aggregator/lib/git') + const path = this.require('path') + const fs = this.require('fs') + // logger.warn(contentCatalog) - const pages = contentCatalog.findBy({ family: 'page' }) - for (const module of pages) { - const relpath = path.join(module.src.origin.startPath, module.src.path) - logger.warn(relpath) - // logger.warn(module.src) - const contents = module.contents.toString('utf-8') + const pages = contentCatalog.findBy({ family: 'page' }) + for (const page of pages) { + const relpath = path.join(page.src.origin.startPath, page.src.path) + logger.warn(relpath) + const contents = page.contents.toString('utf-8') - // logger.warn(module.contents) - const commits = await git.log({ fs, gitdir: module.src.origin.gitdir, filepath: relpath, ref: "origin/"+module.src.origin.refname, follow: true, depth: 1 }) - const last_update = new Date(commits[0].commit.author.timestamp * 1000).toISOString().split('T')[0] - const last_author = commits[0].commit.author.name - // logger.warn(commits) - // logger.warn({ name: relpath, created_at: created_at, last_update: last_update, by: last_author }) - const patchedContents = ":page-last-updated: " + last_update + "\n" + contents - module.contents = Buffer.from(patchedContents) + // Get git history + try { + const commits = await git.log({ fs, gitdir: page.src.origin.gitdir, filepath: relpath, ref: "origin/"+page.src.origin.refname, follow: true, depth: 1 }) + // Get last commit date & author + const last_update = new Date(commits[0].commit.author.timestamp * 1000).toISOString().split('T')[0] + const last_author = commits[0].commit.author.name + + // Inject attribute in page content + const patchedContents = ":page-last-updated: " + last_update + "\n" + contents + page.contents = Buffer.from(patchedContents) + } catch (gitErr) { + logger.error("no history found") + continue } - this.updateVariables({ contentCatalog }) - }) + + } + this.updateVariables({ contentCatalog }) + }) } From 07d659046132216af496b6540cf5778057443ad2 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 06 2022 15:41:51 +0000 Subject: [PATCH 77/88] disable page-last-update ext for translated docs --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 445dbde..d3ad055 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -433,6 +433,12 @@ def main(): else: lang_site_yml["asciidoc"]["attributes"] = keywords[lang] + # disable page-last-update extension + if "antora" in lang_site_yml and "extensions" lang_site_yml["antora"]: + for ext in lang_site_yml["antora"]["extensions"]: + if ext['id'] == "page-last-update": + ext['enabled'] = False + filename = os.path.join(docs_repo, "site-{lang}.yml".format(lang=lang)) with open(filename, "w") as file: file.write(yaml.dump(lang_site_yml)) diff --git a/site.yml b/site.yml index 18702fd..7a48355 100644 --- a/site.yml +++ b/site.yml @@ -157,7 +157,9 @@ asciidoc: - ./lib/extensions/package-inline-macro.js antora: extensions: - - ./lib/extensions/page-last-update.js + - id: page-last-update + require: ./lib/extensions/page-last-update.js + enabled: true urls: latest_version_segment: latest From 645dbc617888d618b72d92d1ba45eea175637791 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 06 2022 15:41:51 +0000 Subject: [PATCH 78/88] use shallow clone everywhere we can --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index d3ad055..e130b67 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -56,7 +56,7 @@ def get_languages(config): with tempfile.TemporaryDirectory() as workdir: translated_sources_repo = os.path.join(workdir, "translated_sources_repo") - subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_repo]) + subprocess.run(["git", "clone", "--depth=1", config["translated_sources_repo_url"], translated_sources_repo]) languages = [] filename_blacklist = [".git"] @@ -141,7 +141,7 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): en_sources = os.path.join(workdir, "en_sources") # Clone the original translated-sources - subprocess.run(["git", "clone", config["translated_sources_repo_url"], translated_sources_original]) + subprocess.run(["git", "clone", "--depth=1", config["translated_sources_repo_url"], translated_sources_original]) # Get a list of the original English repos repos = [] @@ -172,7 +172,7 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): with tempfile.TemporaryDirectory() as tmp_repo_root: log("") log("Cloning {url} {branch}".format(url=repo["url"], branch=repo["branch"])) - subprocess.run(["git", "clone", "--branch", repo["branch"], repo["url"], tmp_repo_root]) + subprocess.run(["git", "clone", "--branch", repo["branch"], "--depth=1", repo["url"], tmp_repo_root]) repo_dir = os.path.join(tmp_repo_root, repo["start_path"]) antora_yml_file = os.path.join(repo_dir, "antora.yml") @@ -245,7 +245,7 @@ def prepare_localized_admonitions(languages, config): with tempfile.TemporaryDirectory() as workdir: translated_keywords_repo = os.path.join(workdir, "asciidoc-keywords") - subprocess.run(["git", "clone", config["translated_adockeywords_repo_url"], translated_keywords_repo]) + subprocess.run(["git", "clone", "--depth=1", config["translated_adockeywords_repo_url"], translated_keywords_repo]) languages = [] log(translated_keywords_repo + "/langs/*/asciidoc-attributes.yml") @@ -304,7 +304,7 @@ def main(): log("") log("===== Getting the site definition (site.yml) =====") - subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], config["docs_repo_url"], docs_repo]) + subprocess.run(["git", "clone", "--branch", config["docs_repo_branch"], "--depth=1", config["docs_repo_url"], docs_repo]) with open(os.path.join(docs_repo, "site.yml"), "r") as file: original_site_yml = yaml.safe_load(file) @@ -434,7 +434,7 @@ def main(): lang_site_yml["asciidoc"]["attributes"] = keywords[lang] # disable page-last-update extension - if "antora" in lang_site_yml and "extensions" lang_site_yml["antora"]: + if "antora" in lang_site_yml and "extensions" in lang_site_yml["antora"]: for ext in lang_site_yml["antora"]["extensions"]: if ext['id'] == "page-last-update": ext['enabled'] = False From 4c143f2371ef2ad7ef1587d91076644c8b4e492b Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 06 2022 15:45:24 +0000 Subject: [PATCH 79/88] update UI to 1.04 --- diff --git a/site.yml b/site.yml index 7a48355..2ee9147 100644 --- a/site.yml +++ b/site.yml @@ -140,7 +140,7 @@ content: branches: main ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.03.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.04.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 965ce6e89b05a1dc926c073726bd48bdd58d2460 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 07 2022 21:03:28 +0000 Subject: [PATCH 80/88] hardlink each lang: take 2 --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index e130b67..4212b7b 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -487,10 +487,11 @@ def main(): subprocess.run(["cp", "-a", results_dir, copying_dir]) # Swap the old tree for the new one for each language - log("Moving language to the final place:") - log(f" - {copying_dir} to {publish_dir}") + log(f"Moving language to the final place: {copying_dir} to {publish_dir}") shutil.rmtree(publish_dir, ignore_errors=True) subprocess.run(["mv", copying_dir, publish_dir]) + log("hardlinking files...") + subprocess.run(["hardlink", "-v", publish_dir]) # Remove local build shutil.rmtree(results_dir, ignore_errors=True) @@ -501,10 +502,6 @@ def main(): log("Consolidate files with hardlink...") subprocess.run(["hardlink", "-v", "/antora/output/"]) - # And finally remove the copying dir - log("Removing the copying dir...") - shutil.rmtree(copying_dir, ignore_errors=True) - log("DONE!") From bf53232cea7ee8103a8065a4cc7a213bbe03479e Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 09 2022 06:04:30 +0000 Subject: [PATCH 81/88] try to preserve hardlinks while building --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 4212b7b..2679a1d 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -446,6 +446,7 @@ def main(): log(" {lang} done".format(lang=lang)) # Building all the translated sites + lastlang = list(languages)[-1] for lang in languages: log("") log("===== Building the {lang} site =====".format(lang=lang)) @@ -464,6 +465,7 @@ def main(): results_dir = os.path.join(docs_repo, "public", lang) publish_dir = f"/antora/output/{lang}" copying_dir = f"/antora/output/{lang}.tmp" + lastlang_dir = f"/antora/output/{lastlang}" # I have: # docs_repo/public/xx <- results_dir (local partition) @@ -490,8 +492,12 @@ def main(): log(f"Moving language to the final place: {copying_dir} to {publish_dir}") shutil.rmtree(publish_dir, ignore_errors=True) subprocess.run(["mv", copying_dir, publish_dir]) - log("hardlinking files...") - subprocess.run(["hardlink", "-v", publish_dir]) + + # Recreate hardlinks as we go, in case the rsync job + # start while we are still building + if (lang != lastlang): + log(f"hardlinking files: {publish_dir} - {lastlang_dir}") + subprocess.run(["hardlink", "-cv", publish_dir, lastlang_dir]) # Remove local build shutil.rmtree(results_dir, ignore_errors=True) @@ -500,7 +506,7 @@ def main(): # https://pagure.io/fedora-infrastructure/issue/8964 log("Consolidate files with hardlink...") - subprocess.run(["hardlink", "-v", "/antora/output/"]) + subprocess.run(["hardlink", "-cv", "/antora/output/"]) log("DONE!") diff --git a/site.yml b/site.yml index 2ee9147..c5a7741 100644 --- a/site.yml +++ b/site.yml @@ -152,6 +152,9 @@ output: runtime: fetch: true cache_dir: ./cache + log: + format: pretty + level: fatal asciidoc: extensions: - ./lib/extensions/package-inline-macro.js From 742423ef7f05c11e8f714cd2e106e9678314af43 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 18 2022 17:12:07 +0000 Subject: [PATCH 82/88] Remove Taiga docs --- diff --git a/site.yml b/site.yml index c5a7741..b6050be 100644 --- a/site.yml +++ b/site.yml @@ -104,7 +104,6 @@ content: start_path: docs - url: https://pagure.io/fedora-ci/docs.git - url: https://pagure.io/java-packaging-howto.git - - url: https://pagure.io/fedora-docs/taiga-docs.git - url: https://pagure.io/fedora-magazine.git - url: https://pagure.io/minimization.git - url: https://github.com/coreos/fedora-coreos-docs.git From a2865529bf12952f9db5bf6f6f171be68b73b151 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 20 2022 00:33:34 +0000 Subject: [PATCH 83/88] detect latest fedora version and build redirect from it --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index 2679a1d..a55ba97 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -17,7 +17,17 @@ # -import tempfile, yaml, os, errno, subprocess, copy, datetime, shutil, sys, glob +import tempfile +import yaml +import os +import errno +import subprocess +import copy +import datetime +import shutil +import sys +import glob +import re def get_config(): @@ -274,15 +284,28 @@ def init_git_repo(path): subprocess.run(["git", "config", "user.email", "you@example.com"], cwd=path) subprocess.run(["git", "commit", "--allow-empty", "-m", "init"], cwd=path) +def get_version_from_file(index_file): + latest = None + if os.path.isfile(index_file): + with open(index_file, 'r') as f: + for l in f: + m = re.search(r'data-version="(f\d+)"', l) + if m: + latest = m[1] + break + return latest + + def gen_redirect(lang, results_dir): htaccess = os.path.join(results_dir, ".htaccess") - latest = "f35" - htaccess_content = f""" - ErrorDocument 404 /{lang}/404.html - Redirect 302 /{lang}/fedora/{latest} /{lang}/fedora/latest - """ - with open(htaccess, "w") as file: - file.write(htaccess_content) + latest = get_version_from_file(f"{results_dir}/fedora/latest/index.html") + if latest: + htaccess_content = f""" + ErrorDocument 404 /{lang}/404.html + Redirect 302 /{lang}/fedora/{latest} /{lang}/fedora/latest + """ + with open(htaccess, "w") as file: + file.write(htaccess_content) def main(): config = get_config() From 5d8e12730ca5780ba792633ee5924dade43d2956 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 20 2022 12:09:57 +0000 Subject: [PATCH 84/88] Fix profile name for nodejs dnf module --- diff --git a/build-scripts/Dockerfile b/build-scripts/Dockerfile index d5458ec..acbf5e7 100644 --- a/build-scripts/Dockerfile +++ b/build-scripts/Dockerfile @@ -1,6 +1,6 @@ FROM fedora:34 -RUN dnf -y module install nodejs:16/default && \ +RUN dnf -y module install nodejs:16 && \ dnf -y install git python3-yaml && \ dnf clean all From 0d872e339967dd6eda50f643a3973d2e2394c7e7 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Feb 26 2022 19:25:39 +0000 Subject: [PATCH 85/88] use pregenerated metadata from git in last-update extension --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index a55ba97..df1ebc0 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -121,10 +121,24 @@ def generate_lang_switch_ui(languages): return "\n".join(template_list) +def get_metadata_from_branch(branch, repodir): + cmd = f""" + for file in $(git ls-tree -r --name-only origin/{branch}|grep -E "adoc$"); do + git log -1 --format="'$file':%n refs: %S%n hash: %h%n date: %as" origin/{branch} -- $file; + done""" + s = subprocess.run(cmd, shell=True, cwd=repodir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + return yaml.safe_load(s.stdout) + def prefetch_sources(original_sources, site_yml, config): if not os.path.isdir(original_sources): os.mkdir(original_sources) + default_branch = site_yml["content"].get("branches", ["master"]) + if type(default_branch) is str: + default_branch = [default_branch] + + metadata = {} + for repo_data in site_yml["content"]["sources"]: gitdir = tempfile.TemporaryDirectory(dir=original_sources) dirname = gitdir.name @@ -133,6 +147,21 @@ def prefetch_sources(original_sources, site_yml, config): subprocess.run(["git", "clone", repo_data['url'], dirname]) repo_data['url'] = dirname + branches = repo_data.get("branches", default_branch) + if type(branches) is str: + branches = [branches] + + for branch in branches: + y = get_metadata_from_branch(branch, repo_data['url']) + if dirname in metadata: + metadata[dirname][branch] = y + else: + metadata[dirname] = { branch: y } + + if metadata: + with open("/tmp/metadata.yml", "w") as f: + yaml.dump(metadata, f) + return site_yml def prepare_translated_sources(translated_sources, site_yml, languages, config): diff --git a/lib/extensions/page-last-update.js b/lib/extensions/page-last-update.js index e0a1ae5..c60629f 100644 --- a/lib/extensions/page-last-update.js +++ b/lib/extensions/page-last-update.js @@ -2,33 +2,36 @@ module.exports.register = function () { this.on('contentClassified', async ({ contentCatalog }) => { const logger = this.require('@antora/logger').get('page-last-update') - const git = this.require('@antora/content-aggregator/lib/git') + const yaml = this.require('js-yaml') const path = this.require('path') const fs = this.require('fs') - // logger.warn(contentCatalog) - const pages = contentCatalog.findBy({ family: 'page' }) - for (const page of pages) { - const relpath = path.join(page.src.origin.startPath, page.src.path) - logger.warn(relpath) - const contents = page.contents.toString('utf-8') - - // Get git history - try { - const commits = await git.log({ fs, gitdir: page.src.origin.gitdir, filepath: relpath, ref: "origin/"+page.src.origin.refname, follow: true, depth: 1 }) - - // Get last commit date & author - const last_update = new Date(commits[0].commit.author.timestamp * 1000).toISOString().split('T')[0] - const last_author = commits[0].commit.author.name + const pageRx = new RegExp('modules/[^/]+/pages/(?:.+/)*[^.].*\.adoc$') - // Inject attribute in page content - const patchedContents = ":page-last-updated: " + last_update + "\n" + contents - page.contents = Buffer.from(patchedContents) - } catch (gitErr) { - logger.error("no history found") - continue + if (fs.existsSync("/tmp/metadata.yml")) { + let data = fs.readFileSync("/tmp/metadata.yml", "utf-8") + let y = yaml.loadAll(data) + + for (const page of pages) { + if (page.src.origin.type == "git" && pageRx.test(page.src.path)) { + const relpath = path.join(page.src.origin.startPath, page.src.path) + const abspath = page.src.origin.gitdir.replace(/\/\.git$/, "") + // logger.warn(abspath) + const contents = page.contents.toString('utf-8') + const branch = page.src.origin.branch + if (abspath in y[0] && branch in y[0][abspath] && relpath in y[0][abspath][branch]) { + let last_update = y[0][abspath][branch][relpath]["date"].toISOString().split('T')[0] + logger.warn({name: relpath, rev: branch, update: last_update}) + + // Inject attribute in page content + const patchedContents = ":page-last-updated: " + last_update + "\n" + contents + page.contents = Buffer.from(patchedContents) + } + } } + } else { + logger.warn("no git metadata found, skipping...") } this.updateVariables({ contentCatalog }) }) From 35d6170431c3077764a6c8ba8a88bf04325821f3 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Mar 12 2022 12:38:34 +0000 Subject: [PATCH 86/88] use stg branch for Localization docs --- diff --git a/site.yml b/site.yml index b6050be..29c41e6 100644 --- a/site.yml +++ b/site.yml @@ -120,6 +120,7 @@ content: - 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 + branches: stg - 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 From 8e1c31ad977f8f7146e5b3275d8f037f25b1cbf2 Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Mar 27 2022 18:03:00 +0000 Subject: [PATCH 87/88] update UI to 1.05 --- diff --git a/site.yml b/site.yml index 29c41e6..a0bbec8 100644 --- a/site.yml +++ b/site.yml @@ -140,7 +140,7 @@ content: branches: main ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.04.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.05.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui From 160f33758b24bb07ae47c73164d975d63ef11b9f Mon Sep 17 00:00:00 2001 From: Francois Andrieu Date: Mar 28 2022 11:49:36 +0000 Subject: [PATCH 88/88] update UI to 1.06 --- diff --git a/site.yml b/site.yml index a0bbec8..cf62d95 100644 --- a/site.yml +++ b/site.yml @@ -140,7 +140,7 @@ content: branches: main ui: bundle: - url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.05.zip + url: https://releases.pagure.org/fedora-docs/fedora-docs-ui/ui-bundle-1.06.zip snapshot: true default_layout: with_menu supplemental_files: ./supplemental-ui