← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/bug-611217 into lp:launchpad

 

The proposal to merge lp:~jtv/launchpad/bug-611217 into lp:launchpad has been updated.

Description changed to:

= Bug 611217 =

Not for the first time, the translations import queue gardener broke down recently because of name clashes.

The problem is this: a queue entry contains a translation file for a given productseries or source package (in this case it happened to be git in Ubuntu 10.10).  The gardener's auto-approval code tries to match this to an existing POFile, based on a path match in that productseries or source package.  POFileSet.getPOFilesByPathAndOrigin implements the match.

That combination of path and productseries/package should normally be unique, and so TranslationImportQueueEntry._guessed_pofile_from_path returns getPOFilesByPathAndOrigin(…).one().  But it is occasionally possible for a POFile belonging to an obsolete POTemplate to have the same path as another POFile belonging a current POTemplate in the same context.  KABOOM.  The one() unexpectedly finds two records, and blows up.

Actually we have no particular interest in auto-approving translations for obsolete templates anyway.  So in this branch I make _guessed_pofile_from_path ignore POFiles for obsolete templates.  That avoids the clashes as a side effect.

In addition to this, I cleaned up some browser code that unnecessarily duplicated the logic of figuring out filename extensions (which is also done by the importer).  I also found that it clashed with our coding standards and could generally be simpler, so that turned into a bit of a local rewrite.  The only practical effect is that the notions of "template file" and "translation file" are no longer directly coupled to gettext ".po" and ".pot" files, respectively.

I ran various tests, but this should just about cover it:
{{{
./bin/test -vvc lp.translations -t queue -t approv -t test_pofile
}}}

The sign that this works will be that we no longer get these crises where Ubuntu and manual translation uploads stop being approved.  For active Q/A, we'll want to make sure that manual uploads are still approved automatically in each of 3 scenarios:
 * There is a POFile with a matching path.
 * There is a POFile for the language, but with a different path.
 * There is no POFile for the language.

No lint,

Jeroen



For more details, see:
https://code.launchpad.net/~jtv/launchpad/bug-611217/+merge/45883
-- 
https://code.launchpad.net/~jtv/launchpad/bug-611217/+merge/45883
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/bug-611217 into lp:launchpad.



References