1. 19 Mar, 2020 2 commits
    • Cyril Brulebois's avatar
      lint_po: set XDG_CACHE_HOME independently (refs: #17359). · 542bdf10
      Cyril Brulebois authored
      Let's clean things up a little: The previous commit was an incremental
      evolution, creating individual cache directories below the previously
      global temporary directory. Even if that works fine, that's a little
      convoluted, and there's no reason for this indirection: each i18nspector
      call can get its own temporary directory anywhere, so simplify how the
      temporary directories are created.
      542bdf10
    • Cyril Brulebois's avatar
      lint_po: make each i18nspector work with a specific rply cache dir (Closes: #17359). · d7ca5acd
      Cyril Brulebois authored
      Treating the first PO file as special was a nice try but some files
      don't trigger the creation of a parser, i.e. don't result in the
      creation of a rply cache directory and/or cache file.
      
      That's the case if the first file is wiki/src/getting_started.fr.po for
      example, which results in various failure modes, depending on who wins
      the race:
       - mkdir on the just-created rply directory;
       - trying to read from the just-created and still-empty cache file,
         which is not valid JSON-wise;
       - trying to read from a being-written cache file, leading to
         inconsistent data, meaning another JSON validity problem.
      
      Therefore, consider the XDG_CACHE_HOME environment variable set at the
      top-level to be the top-level directory, below which a specific
      subdirectory will be created for each i18nspector call. This should
      ensure nobody steps on someone else's toes.
      
      This is just an attempt at a minimal bug fix, follow-up commits will
      simplify that code drastically.
      d7ca5acd
  2. 02 Jan, 2020 1 commit
    • intrigeri's avatar
      lint_po: succeed if --cached was passed but no PO files were staged · af71169b
      intrigeri authored
      When having "lint_po --cached" in one's pre-commit hook, any attempt
      to create a commit that does not modify any PO file fails with:
      
        Traceback (most recent call last):
          File "/home/intrigeri/.home/prv-user/.combined/cyber/amnesia/live/git/submodules/jenkins-tools/slaves/lint_po", line 347, in <module>
            main(logging.getLogger())
          File "/home/intrigeri/.home/prv-user/.combined/cyber/amnesia/live/git/submodules/jenkins-tools/slaves/lint_po", line 327, in main
            chain = [(_check_po_file(next(iterator)),),
        StopIteration
      
        The po files you're trying to commit contain errors. Please fix them and try again.
      
      This is a regression introduced by c957b5b8,
      which b37a38ce fixed already, but only for the
      case when --cached is *not* passed.
      
      Note that in --cached mode, we don't display a warning: for details,
      see 0da94c64.
      af71169b
  3. 20 Dec, 2019 3 commits
    • Sandro Knauß's avatar
      Stops the scripts explicitly. · b37a38ce
      Sandro Knauß authored
      When there are no files to process on, we should stop the script
      directly. So other parts of the script can expect that there are files
      to operate on. With the last commit, this is needed, as we execute
      next(iterator), that fails if there is no element in the iterator.
      b37a38ce
    • Sandro Knauß's avatar
      Fix race condition of $XDG_CACHE_HOME/rply creation. · c957b5b8
      Sandro Knauß authored
      As we run check_po for ten files in parallel, we end up in a race
      condition about the creation of $XDG_CACHE_HOME/rply. That's why we
      check the first file before checking the rest (#17359#note-14).
      c957b5b8
    • Sandro Knauß's avatar
      cleanup lint_po. · 95d279af
      Sandro Knauß authored
      95d279af
  4. 18 Dec, 2019 1 commit
  5. 12 Sep, 2019 5 commits
  6. 26 Jun, 2019 3 commits
    • intrigeri's avatar
      Support <LANG>_<SCRIPT>.po format. · defc52db
      intrigeri authored
      i18nspector's --language option takes "a 2- or 3-letter ISO 639 language code,
      possibly followed by underscore and a 2-letter ISO 3166 territory code"
      so we need to strip any "_<SCRIPT>" suffix when passing it the language
      we've detected from the PO file name. Otherwise, we get:
      
         i18nspector: error: invalid language
      defc52db
    • intrigeri's avatar
      Clarify return value. · 27eafcb2
      intrigeri authored
      lang() can return e.g.:
      
       - fr: language = French, no territory nor script specified
       - fr_CA: language = French, territory = Canada
       - sr_Latn: language = Serbian, script = Latin
      27eafcb2
    • intrigeri's avatar
      ab5f9164
  7. 25 Jun, 2019 3 commits