Merge lp:~jtv/launchpad/redo-uploads into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jeroen T. Vermeulen on 2009-09-30 | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | not available | ||||
Proposed branch: | lp:~jtv/launchpad/redo-uploads | ||||
Merge into: | lp:launchpad | ||||
Diff against target: |
449 lines 6 files modified
lib/lp/registry/interfaces/sourcepackage.py (+7/-0) lib/lp/registry/model/sourcepackage.py (+33/-0) lib/lp/soyuz/doc/distroseriesqueue-translations.txt (+43/-0) lib/lp/translations/scripts/reupload_translations.py (+110/-0) lib/lp/translations/scripts/tests/test_reupload_translations.py (+168/-0) scripts/rosetta/reupload-translations.py (+19/-0) |
||||
To merge this branch: | bzr merge lp:~jtv/launchpad/redo-uploads | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Abstain on 2009-09-30 | ||
Edwin Grubbs (community) | code | 2009-09-30 | Approve on 2009-09-30 |
Review via email:
|
Jeroen T. Vermeulen (jtv) wrote : | # |
Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi Jeroen,
This looks good. I just have a few formatting comments.
merge-conditional
-Edwin
>=== added file 'lib/lp/
>--- lib/lp/
>+++ lib/lp/
>@@ -0,0 +1,105 @@
>+__metaclass__ = type
Missing copyright notice.
>+
>+__all__ = [
>+ 'ReuploadPackag
>+ ]
Indentation should be spaces.
>+
>+from zope.component import getUtility
>+
>+from lp.services.
>+
>+from canonical.
>+from lp.registry.
>+from lp.translations
>+ ITranslationImp
>+
>+
>+class ReuploadPackage
>+ """Re-upload latest translations for given distribution packages."""
>+ description = "Re-upload latest translations uploads for package(s)."
>+
>+ def add_my_
>+ """See `LaunchpadScrip
>+ self.parser.
>+ help="Distribution to upload for.", default='ubuntu')
>+ self.parser.
>+ help="Distribution release series to upload for.")
>+ self.parser.
>+ dest='packages', default=[],
>+ help="Name(s) of source package(s) to re-upload.")
>+ self.parser.
>+ action=
>+ help="Pretend to upload, but make no actual changes.")
>+
Trailing white space.
>+ def main(self):
>+ """See `LaunchpadScrip
>+ self.uploadless
>+ self._setDistro
>+
>+ if len(self.
>+ raise LaunchpadScript
>+
>+ if self.options.
>+ self.logger.
>+
>+ for package_name in self.options.
>+ self._processPa
>+ self._commit()
>+
>+ self.logger.
>+
>+ def _commit(self):
>+ """Commit transaction (or abort if dry run)."""
>+ if self.txn:
>+ if self.options.
>+ self.txn.abort()
>+ else:
>+ self.txn.commit()
>+
>+ def _setDistroDetai
>+ """Figure out the `Distribution`
>+ # Avoid circular imports.
>+ from lp.registry.
>+
>+ distroset = getUtility(
>+ self.distro = distroset.
>+
>+ if not self.options.
>+ raise LaunchpadScript
>+ "Specify a distribution release series.")
>+
>+ self.distroseries = self.distro.
Jeroen T. Vermeulen (jtv) wrote : | # |
> Hi Jeroen,
>
> This looks good. I just have a few formatting comments.
Thanks. Whitespace problems all fixed.
"I have no idea how that tab got into my code, officer."
= Bug 439346 =
A stupid missing parameter in 3.0 caused the translations auto-approver
to approve uploads for the right packages but the wrong Ubuntu releases.
Due to some other bugs that we've fixed already, we don't know exactly
which translations will or won't be affected. So we ended up with a
fairly long list of packages that _may_ have had the wrong files
imported to them.
This branch provides a script that finds the latest Soyuz-generated
translations upload for a given package (a tarball containing, roughly
speaking, the upstream templates and translations) and re-uploads it.
Finding the latest translations upload for a package turns out to be...
in Julian's words, "easy." I'd probably pick another word myself.
After conferring with Celso (who helped me get it actually working) I
isolated that piece of work in SourcePackage.
You may wonder why the script keeps track of uploadless_ packages. That
is there just to facilitate testing.
There is no single end-to-end test. It's just too hard to set up and
maintain a realistic testing situation for this. Test coverage consists
of several stretches that touch more than overlap:
* A full script run, but without any uploads being found. ations in the
This exercises everything except retrieving and uploading a tarball
from the Librarian, and the tail end of getLatestTransl
success case.
* A before-and-after demonstration of getLatestTransl ationsUploads in
the doctest. This does exercise the tail end in the success case.
It also shows that a gzipped tarball containing the right files has
gone into the Librarian.
* A unit test for _findPackage, to cover up for the fact that other
unit tests patch that method for mocking purposes.
* A successful run of the LaunchpadScript object, but with nslationsUpload s mocked up to return a gzipped tarball
getLatestTra
that was stuffed straight into the Librarian by the test. This also
tests the retrieval and uploading of that tarball.
The tar-file handling in the tests is terrible. I can't really help it;
blame the tarfile module's horrible API. Makes it hard to create
tarballs in-memory using StringIOs.
== Tests == ue-translations .txt translations
{{{
./bin/test -vv -t distroseriesque
./bin/test -vv -t reupload_
}}}
== Demo and Q/A ==
Pick a source package in "main" for some Ubuntu release, one with
translations but not too much in its import queue—there has to be at
least one translation that doesn't have a Needs Review or Approved entry
in the queue. You can create a new translation by translating a string
into a dead language such as Sumerian (sux).
Run the script, passing it the name of the Ubuntu release (e.g. karmic)
and the name of the source package (e.g. tomboy). Try the --dry-run
option first; nothing will actually happen to the package's import
queue. Try the same run again without the --dry-run option, and now a
full set of upstream translations will appear on the queue in Needs
Review state.
Or if you wait too long, Approved or even Imported. The approval and
import scripts do run on staging.
No lint.
Jeroen