launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29989
[Merge] ~cjwatson/launchpad:fix-translations-opening-unapprove into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-translations-opening-unapprove into launchpad:master.
Commit message:
fix-translations-opening: Unapprove existing imports
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/442642
`scripts/fix-translations-opening.py` is run manually in the case where opening translations for a new series is interrupted (usually due to long transactions making it difficult to continue) and leaves translations in an incomplete state.
The last time we did this, in September 2016, we found that we additionally had to set the associated translation import queue entries back from Approved to Needs Review so that `cronscripts/rosetta-approve-imports.py` could process them again (see https://pastebin.canonical.com/164459/). Rather than keeping this solely in folk memory, let's make the `fix-translations-opening` script do that as well.
I'm afraid I don't have a good way to test this short of the real-world run that we're going to need to perform shortly.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-translations-opening-unapprove into launchpad:master.
diff --git a/scripts/fix-translations-opening.py b/scripts/fix-translations-opening.py
index ad30977..7118a4d 100755
--- a/scripts/fix-translations-opening.py
+++ b/scripts/fix-translations-opening.py
@@ -1,6 +1,6 @@
#!/usr/bin/python3 -S
#
-# Copyright 2012-2013 Canonical Ltd. This software is licensed under the
+# Copyright 2012-2023 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
import _pythonpath # noqa: F401
@@ -87,6 +87,20 @@ DELETE FROM POTemplate
LIMIT ?)
"""
+# Reset status from RosettaImportStatus.APPROVED (1) to
+# RosettaImportStatus.NEEDSREVIEW (5); we've just unset the target, so these
+# entries will have to be gardened again.
+unapprove_translationimportqueueentry = """\
+UPDATE TranslationImportQueueEntry
+ SET status = 5
+ WHERE TranslationImportQueueEntry.id IN (
+ SELECT TranslationImportQueueEntry.id
+ FROM TranslationImportQueueEntry
+ WHERE TranslationImportQueueEntry.status = 1
+ AND TranslationImportQueueEntry.distroseries = ?
+ LIMIT ?)
+"""
+
statements = [
delete_pofiletranslator,
null_translationimportqueueentry_pofile,
@@ -95,6 +109,7 @@ statements = [
delete_packagingjob,
null_translationimportqueueentry_potemplate,
delete_potemplate,
+ unapprove_translationimportqueueentry,
]