From 241b2e3fee6aa53d57e60c21d5ca552cd2e7d9a6 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
Date: Aug 15 2021 13:29:03 +0000
Subject: [PATCH 1/4] hop


---

diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+<component name="InspectionProjectProfileManager">
+  <settings>
+    <option name="USE_PROJECT_PROFILE" value="false" />
+    <version value="1.0" />
+  </settings>
+</component>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d1e22ec
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8" project-jdk-type="Python SDK" />
+</project>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..ce6e8d0
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/translations-scripts.iml" filepath="$PROJECT_DIR$/.idea/translations-scripts.iml" />
+    </modules>
+  </component>
+</project>
\ No newline at end of file
diff --git a/.idea/translations-scripts.iml b/.idea/translations-scripts.iml
new file mode 100644
index 0000000..d0876a7
--- /dev/null
+++ b/.idea/translations-scripts.iml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="PYTHON_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..131c3f6
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/sources/pagure.iofedora-docs/install-guide" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/sources/pagure.iofedora-docs/pages" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/sources/pagure.iofedora-docs/release-docs-home" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/sources/pagure.iofedora-docs/release-notes" vcs="Git" />
+    <mapping directory="$PROJECT_DIR$/sources/pagure.iofedora-docs/system-administrators-guide" vcs="Git" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/build.py b/build.py
index 9005ccd..a1530e3 100755
--- a/build.py
+++ b/build.py
@@ -17,7 +17,7 @@ import yaml
 SELECTED_COMPONENT = None
 SELECTED_MODULE = None
 SELECTED_VERSION = None
-
+os.environ['PYTHONUNBUFFERED'] = '1'
 
 def main():
     """Handle params"""
diff --git a/po4a-diff.sh b/po4a-diff.sh
index 2cd97b8..e5616b9 100755
--- a/po4a-diff.sh
+++ b/po4a-diff.sh
@@ -1,8 +1,21 @@
 #!/bin/bash
+this files allow to validate a new version of PO4A to use in our build process
 
+process to validate a new version of po4a:
+confirm the following list of combination brings no bug:
+1. the homepage: docs/ROOT/master
+   https://docs.fedoraproject.org/en-US/docs/
+2. the fedora project presentation page: project/ROOT/master
+   https://docs.fedoraproject.org/en-US/project/
+3. the alias usage: diversity-inclusion/roles/master
+   https://docs.fedoraproject.org/en-US/diversity-inclusion/roles/council-advisor/
+4. big pages manuals: fedora/install-guide/f33
+   https://docs.fedoraproject.org/en-US/fedora/f33/
+5. outdated pages: quick-docs/ROOT/master
+   https://docs.fedoraproject.org/en-US/quick-docs/
 
-po4a_old="v0.57"
-po4a_new="v0.60"
+po4a_old="v0.60"
+po4a_new="v0.62"
 l10n_dir="l10n"
 tsrc_dir="translated-sources"
 
@@ -16,13 +29,13 @@ else
     target_repo_name="$component-$module"
 fi
 
-rm -rf "$l10n_dir"
+rm -rf "./$l10n_dir"
 rm -rf ./po4a
-rm -rf "$tsrc_dir"
+rm -rf "./$tsrc_dir"
 
 echo "Running with po4a $po4a_old"
 ./build.py \
-    --clone_sources false --commit_l10n false --commit_tsources false \
+    --clone_sources false --commit_l10n --commit_tsources --nopush \
     --component "$component" --module "$module" --version "$version" \
     --clone-po4a --clone-po4a-version "$po4a_old"
 
@@ -41,7 +54,7 @@ rm -rf ./po4a
 echo "Running with po4a $po4a_new"
 
 ./build.py \
-    --clone_sources false --commit_l10n false --commit_tsources false \
+    --clone_sources false --commit_l10n --commit_tsources --nopush \
     --component "$component" --module "$module" --version "$version" \
     --clone-po4a --clone-po4a-version "$po4a_new"
 
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..4818cc5
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+pyyaml
\ No newline at end of file

From 7009ae4bbf023c232f6a640a37dd413ebc672490 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
Date: Aug 15 2021 13:29:03 +0000
Subject: [PATCH 2/4] hop


---

diff --git a/po4a-diff.sh b/po4a-diff.sh
index e5616b9..bff9621 100755
--- a/po4a-diff.sh
+++ b/po4a-diff.sh
@@ -1,18 +1,18 @@
 #!/bin/bash
-this files allow to validate a new version of PO4A to use in our build process
+# this files allow to validate a new version of PO4A to use in our build process
 
-process to validate a new version of po4a:
-confirm the following list of combination brings no bug:
-1. the homepage: docs/ROOT/master
-   https://docs.fedoraproject.org/en-US/docs/
-2. the fedora project presentation page: project/ROOT/master
-   https://docs.fedoraproject.org/en-US/project/
-3. the alias usage: diversity-inclusion/roles/master
-   https://docs.fedoraproject.org/en-US/diversity-inclusion/roles/council-advisor/
-4. big pages manuals: fedora/install-guide/f33
-   https://docs.fedoraproject.org/en-US/fedora/f33/
-5. outdated pages: quick-docs/ROOT/master
-   https://docs.fedoraproject.org/en-US/quick-docs/
+# process to validate a new version of po4a:
+# confirm the following list of combination brings no bug:
+# 1. the homepage: docs/ROOT/master
+#    https://docs.fedoraproject.org/en-US/docs/
+# 2. the fedora project presentation page: project/ROOT/master
+#    https://docs.fedoraproject.org/en-US/project/
+# 3. the alias usage: diversity-inclusion/roles/master
+#    https://docs.fedoraproject.org/en-US/diversity-inclusion/roles/council-advisor/
+# 4. big pages manuals: fedora/install-guide/f33
+#    https://docs.fedoraproject.org/en-US/fedora/f33/
+# 5. outdated pages: quick-docs/ROOT/master
+#    https://docs.fedoraproject.org/en-US/quick-docs/
 
 po4a_old="v0.60"
 po4a_new="v0.62"

From d374617b3fc7ba4cd7d07ba400ea027b557df57d Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
Date: Aug 15 2021 13:29:03 +0000
Subject: [PATCH 3/4] commit with po4a_old=v0.60


---

diff --git a/po4a-diff.sh b/po4a-diff.sh
index bff9621..11e3a3d 100755
--- a/po4a-diff.sh
+++ b/po4a-diff.sh
@@ -19,8 +19,8 @@ po4a_new="v0.62"
 l10n_dir="l10n"
 tsrc_dir="translated-sources"
 
-component="docs"
-module="ROOT"
+component="diversity-inclusion"
+module="roles"
 version="master"
 
 if [ "$module" == "ROOT" ] ; then
@@ -35,18 +35,18 @@ rm -rf "./$tsrc_dir"
 
 echo "Running with po4a $po4a_old"
 ./build.py \
-    --clone_sources false --commit_l10n --commit_tsources --nopush \
+    --clone_sources --commit_l10n --commit_tsources --nopush \
     --component "$component" --module "$module" --version "$version" \
     --clone-po4a --clone-po4a-version "$po4a_old"
 
 pushd "$l10n_dir/$target_repo_name"
 git add .
-git commit -m "hop"
+git commit -m "commit with po4a_old=$po4a_old"
 popd
 
 pushd "$tsrc_dir"
 git add .
-git commit -m "hop"
+git commit -m "commit with po4a_old=$po4a_old"
 popd
 
 rm -rf ./po4a
@@ -54,7 +54,7 @@ rm -rf ./po4a
 echo "Running with po4a $po4a_new"
 
 ./build.py \
-    --clone_sources false --commit_l10n --commit_tsources --nopush \
+    --clone_sources --commit_l10n --commit_tsources --nopush \
     --component "$component" --module "$module" --version "$version" \
     --clone-po4a --clone-po4a-version "$po4a_new"
 

From e82725e4b228fd7c9537df3a8fbeadacbc6a3316 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Holcroft <jean-baptiste@holcroft.fr>
Date: Aug 15 2021 13:29:03 +0000
Subject: [PATCH 4/4] fix #21, check if folder exists


---

diff --git a/stats/compute.sh b/stats/compute.sh
index 06a1554..3f35e9f 100755
--- a/stats/compute.sh
+++ b/stats/compute.sh
@@ -2,20 +2,29 @@
 echo "**********************************"
 echo "* Refresh fedora-docs/localization"
 
-# make sure we are in the folder of the current cript
-pushd $(dirname $0) > /dev/null || exit
+# we expect a l10n folder containing all po/pot files in the parent folder
+RELATIVE_PATH="../"
+FOLDER_TO_SCAN="l10n"
 
-echo "* Runnning po Count"
-pushd "../" > /dev/null || exit
+# make sure we are in the folder of the current script
+pushd "$(dirname "$0")" > /dev/null || exit
+
+if [[ ! -d "$RELATIVE_PATH$FOLDER_TO_SCAN" ]]; then
+  echo "The folder $FOLDER_TO_SCAN do not exist, exiting..."
+  exit 1
+fi
+
+echo "* Running po Count"
+pushd "$RELATIVE_PATH" > /dev/null || exit
 # pocount requires the installation of translate-toolkit
-pocount --csv $(find l10n -name '*.po') >> stats/results.csv 2>> stats/error.log
-pocount --csv $(find l10n -name '*.pot') | tail -n+2 >> stats/results.csv 2>> stats/error.log
+pocount --csv "$(find "$FOLDER_TO_SCAN" -name '*.po')" >> stats/results.csv 2>> stats/error.log
+pocount --csv "$(find "$FOLDER_TO_SCAN" -name '*.pot')" | tail -n+2 >> stats/results.csv 2>> stats/error.log
 popd > /dev/null || exit
 
 echo "* Cloning"
 git clone https://pagure.io/fedora-docs/localization.git --quiet
 
-echo "* Installing Python depedencies with pip"
+echo "* Installing Python dependencies with pip"
 python3 -m venv  venv
 source venv/bin/activate
 pip install pandas
@@ -29,7 +38,7 @@ pushd "localization" > /dev/null || exit
 git remote set-url --push origin ssh://git@pagure.io/fedora-docs/localization.git
 git add .
 git status --porcelain
-git commit -m "Automated update"  --quiet
+git commit -m "𝄠 Automated update 𝄟"  --quiet
 git push  --quiet
 popd > /dev/null || exit
 

