launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04358
[Merge] lp:~bac/launchpad/bug-788685 into lp:launchpad
Brad Crittenden has proposed merging lp:~bac/launchpad/bug-788685 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #788685 in Launchpad itself: "Enable translating selected Ubuntu universe packages in Launchpad"
https://bugs.launchpad.net/launchpad/+bug/788685
For more details, see:
https://code.launchpad.net/~bac/launchpad/bug-788685/+merge/69082
= Summary =
Allow translation packages for distroseries of Oneiric or later to be targeted to components other than 'main' and 'restricted.'
== Proposed fix ==
Bypass the component name test for distoseries >= 11.10.
== Pre-implementation notes ==
Chats with Danilo.
== Implementation details ==
As above.
== Tests ==
Simply extended existing doctest. :(
bin/test -vvt distroseriesqueue-translations.txt
== Demo and Q/A ==
Hmm.
= Launchpad lint =
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/soyuz/model/queue.py
lib/lp/soyuz/doc/distroseriesqueue-translations.txt
--
https://code.launchpad.net/~bac/launchpad/bug-788685/+merge/69082
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bac/launchpad/bug-788685 into lp:launchpad.
=== modified file 'lib/lp/soyuz/doc/distroseriesqueue-translations.txt'
--- lib/lp/soyuz/doc/distroseriesqueue-translations.txt 2011-06-16 10:33:38 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue-translations.txt 2011-07-25 13:21:30 +0000
@@ -11,7 +11,10 @@
>>> from lp.soyuz.model.publishing import (
... SourcePackagePublishingHistory)
>>> from lp.registry.interfaces.distribution import IDistributionSet
- >>> from lp.registry.interfaces.distroseries import IDistroSeriesSet
+ >>> from lp.registry.interfaces.distroseries import (
+ ... IDistroSeries,
+ ... IDistroSeriesSet,
+ ... )
>>> from lp.registry.interfaces.pocket import PackagePublishingPocket
>>> from lp.soyuz.interfaces.component import IComponentSet
>>> from lp.soyuz.enums import (
@@ -363,10 +366,16 @@
... def __init__(self, purpose):
... self.purpose = purpose
+ >>> class MockDistroSeries:
+ ... implements(IDistroSeries)
+ ... def __init__(self, version):
+ ... self.version = version
+
>>> class MockSourcePackageRelease:
... implements(ISourcePackageRelease)
- ... def __init__(self, component, creator):
+ ... def __init__(self, component, creator, upload_distroseries):
... self.component = getUtility(IComponentSet)[component]
+ ... self.upload_distroseries = upload_distroseries
... self.creator = creator
... self.packageupload = 1
...
@@ -405,7 +414,9 @@
>>> release_pocket = PackagePublishingPocket.RELEASE
>>> archive = MockArchive(ArchivePurpose.PRIMARY)
- >>> katie_sourcepackagerelease = MockSourcePackageRelease('main', katie)
+ >>> distro_series = MockDistroSeries(u'9.04')
+ >>> katie_sourcepackagerelease = MockSourcePackageRelease(
+ ... 'main', katie, distro_series)
>>> sync_package_upload = MockPackageUpload(
... release_pocket, True, katie_sourcepackagerelease, archive)
>>> sync_package_upload.isAutoSyncUpload()
@@ -429,7 +440,8 @@
>>> person_set = getUtility(IPersonSet)
>>> carlos = person_set.getByName('carlos')
- >>> carlos_sourcepackagerelease = MockSourcePackageRelease('main', carlos)
+ >>> carlos_sourcepackagerelease = MockSourcePackageRelease(
+ ... 'main', carlos, distro_series)
>>> carlos_package_upload = MockPackageUpload(
... release_pocket, False, carlos_sourcepackagerelease, archive)
>>> carlos_package_upload.isAutoSyncUpload()
@@ -438,6 +450,42 @@
>>> translations_upload.publishRosettaTranslations()
Imported by: carlos
+Uploads for distroseries before Oneiric or later may not be targeted
+to any component but 'main' and 'restricted'. The upload attempt is ignored.
+
+ >>> katie_sourcepackagerelease = MockSourcePackageRelease(
+ ... 'universe', katie, distro_series)
+ >>> sync_package_upload = MockPackageUpload(
+ ... release_pocket, True, katie_sourcepackagerelease, archive)
+ >>> translations_upload = MockPackageUploadCustom()
+ >>> translations_upload.packageupload = sync_package_upload
+ >>> translations_upload.publishRosettaTranslations()
+
+For Oneiric the import succeeds for 'universe'.
+
+ >>> distro_series = MockDistroSeries(u'11.10')
+ >>> katie_sourcepackagerelease = MockSourcePackageRelease(
+ ... 'universe', katie, distro_series)
+ >>> sync_package_upload = MockPackageUpload(
+ ... release_pocket, True, katie_sourcepackagerelease, archive)
+ >>> translations_upload = MockPackageUploadCustom()
+ >>> translations_upload.packageupload = sync_package_upload
+ >>> translations_upload.publishRosettaTranslations()
+ Imported by: katie
+
+And for the 12.04 release the import succeeds for 'universe'.
+
+ >>> distro_series = MockDistroSeries(u'12.04')
+ >>> katie_sourcepackagerelease = MockSourcePackageRelease(
+ ... 'universe', katie, distro_series)
+ >>> sync_package_upload = MockPackageUpload(
+ ... release_pocket, True, katie_sourcepackagerelease, archive)
+ >>> translations_upload = MockPackageUploadCustom()
+ >>> translations_upload.packageupload = sync_package_upload
+ >>> translations_upload.publishRosettaTranslations()
+ Imported by: katie
+
+
Translations tarball
~~~~~~~~~~~~~~~~~~~~
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2011-07-18 02:44:34 +0000
+++ lib/lp/soyuz/model/queue.py 2011-07-25 13:21:30 +0000
@@ -60,6 +60,7 @@
# that it needs a bit of redesigning here around the publication stuff.
from lp.archivepublisher.config import getPubConfig
from lp.archivepublisher.customupload import CustomUploadError
+from lp.archivepublisher.debversion import Version
from lp.archiveuploader.tagfiles import parse_tagfile_content
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.registry.model.sourcepackagename import SourcePackageName
@@ -1298,12 +1299,18 @@
"in MAIN_ARCHIVE_PURPOSES.")
return
+ # If the distroseries is 11.10 (oneiric) or later, the valid names
+ # check is not required. (See bug 788685.)
+ distroseries = sourcepackagerelease.upload_distroseries
+ do_names_check = Version(distroseries.version) < Version('11.10')
+
valid_pockets = (
PackagePublishingPocket.RELEASE, PackagePublishingPocket.SECURITY,
PackagePublishingPocket.UPDATES, PackagePublishingPocket.PROPOSED)
- valid_component_names = ('main', 'restricted')
+ valid_comp_names = ('main', 'restricted')
if (self.packageupload.pocket not in valid_pockets or
- sourcepackagerelease.component.name not in valid_component_names):
+ (do_names_check and
+ sourcepackagerelease.component.name not in valid_comp_names)):
# XXX: CarlosPerelloMarin 2006-02-16 bug=31665:
# This should be implemented using a more general rule to accept
# different policies depending on the distribution.