#22 prevent all stats to be erased in case of failure
Closed 2 years ago by jibecfed. Opened 2 years ago by jibecfed.

file added
+3
@@ -0,0 +1,3 @@ 

+ # Default ignored files

+ /shelf/

+ /workspace.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

file added
+4
@@ -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

file added
+8
@@ -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

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

file added
+11
@@ -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

file modified
+1 -1
@@ -17,7 +17,7 @@ 

  SELECTED_COMPONENT = None

  SELECTED_MODULE = None

  SELECTED_VERSION = None

- 

+ os.environ['PYTHONUNBUFFERED'] = '1'

  

  def main():

      """Handle params"""

file modified
+23 -10
@@ -1,13 +1,26 @@ 

  #!/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"

  

- component="docs"

- module="ROOT"

+ component="diversity-inclusion"

+ module="roles"

  version="master"

  

  if [ "$module" == "ROOT" ] ; then
@@ -16,24 +29,24 @@ 

      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 --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
@@ -41,7 +54,7 @@ 

  echo "Running with po4a $po4a_new"

  

  ./build.py \

-     --clone_sources false --commit_l10n false --commit_tsources false \

+     --clone_sources --commit_l10n --commit_tsources --nopush \

      --component "$component" --module "$module" --version "$version" \

      --clone-po4a --clone-po4a-version "$po4a_new"

  

file added
+1
@@ -0,0 +1,1 @@ 

+ pyyaml 

\ No newline at end of file

file modified
+17 -8
@@ -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 @@ 

  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

  

the stats scripts is run after the global l10n pot update, but if it completely fails, there is no l10n folder to take translations from

the motivation to link both script is to reuses the "l10n" directory containing all po files, saving time & bandwith, and making sure stats match the reality

Metadata Update from @jibecfed:
- Request assigned

2 years ago

rebased onto 241b2e3

2 years ago

Pull-Request has been closed by jibecfed

2 years ago