launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03492
[Merge] lp:~rvb/launchpad/sync-to-updates into lp:launchpad
Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/sync-to-updates into lp:launchpad with lp:~rvb/launchpad/change-perm-sync as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #775529 in Launchpad itself: "Synching to a released series should put packages in -updates."
https://bugs.launchpad.net/launchpad/+bug/775529
For more details, see:
https://code.launchpad.net/~rvb/launchpad/sync-to-updates/+merge/59653
This branch fixes the destination pocket used when syncing packages to a released series. Synching packages to a released series should put these packages in "-updates".
(dribe-by fix: fixed __all__ in lib/lp/registry/browser/distroseries.py)
= Test =
./bin/test -cvv test_distroseries test_sync_in_released_series_in_updates
= QA =
On DF:
- mark a derived series as CURRENT (release a series).
- sync some packages.
- make sure these packages end up in the -updates pocket.
--
https://code.launchpad.net/~rvb/launchpad/sync-to-updates/+merge/59653
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/sync-to-updates into lp:launchpad.
=== modified file 'lib/lp/registry/browser/distroseries.py'
--- lib/lp/registry/browser/distroseries.py 2011-05-02 12:31:14 +0000
+++ lib/lp/registry/browser/distroseries.py 2011-05-02 12:31:22 +0000
@@ -12,10 +12,12 @@
'DistroSeriesEditView',
'DistroSeriesFacets',
'DistroSeriesInitializeView',
- 'DistroSeriesLocalDifferences',
+ 'DistroSeriesLocalDifferencesView',
+ 'DistroSeriesMissingPackagesView',
'DistroSeriesNavigation',
'DistroSeriesPackageSearchView',
'DistroSeriesPackagesView',
+ 'DistroSeriesUniquePackagesView',
'DistroSeriesView',
]
@@ -772,11 +774,18 @@
# setting up on-page notifications.
series_url = canonical_url(self.context)
series_title = self.context.displayname
+
+ # If the series is released, sync packages in the "updates" pocket.
+ if self.context.datereleased is None:
+ destination_pocket = PackagePublishingPocket.RELEASE
+ else:
+ destination_pocket = PackagePublishingPocket.UPDATES
+
if self.do_copy(
'selected_differences', sources, self.context.main_archive,
- self.context, PackagePublishingPocket.RELEASE,
- include_binaries=False, dest_url=series_url,
- dest_display_name=series_title, person=self.user):
+ self.context, destination_pocket, include_binaries=False,
+ dest_url=series_url, dest_display_name=series_title,
+ person=self.user):
# The copy worked so we can redirect back to the page to
# show the results.
self.next_url = self.request.URL
@@ -795,7 +804,8 @@
This method is used as a condition for the above sync action, as
well as directly in the template.
"""
- return self.user is not None and self.cached_differences.batch.total() > 0
+ return (self.user is not None and
+ self.cached_differences.batch.total() > 0)
@property
def specified_name_filter(self):
=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
--- lib/lp/registry/browser/tests/test_distroseries.py 2011-05-02 12:31:14 +0000
+++ lib/lp/registry/browser/tests/test_distroseries.py 2011-05-02 12:31:22 +0000
@@ -27,6 +27,7 @@
from zope.security.proxy import removeSecurityProxy
from canonical.config import config
+from canonical.database.constants import UTC_NOW
from canonical.database.sqlbase import flush_database_caches
from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.testing.pages import find_tag_by_id
@@ -47,6 +48,8 @@
DistroSeriesDifferenceStatus,
DistroSeriesDifferenceType,
)
+from lp.registry.interfaces.pocket import PackagePublishingPocket
+from lp.registry.interfaces.series import SeriesStatus
from lp.services.features import (
get_relevant_feature_controller,
getFeatureFlag,
@@ -1195,6 +1198,37 @@
'derilucid</li>\n</ul>',
notifications[0].message)
+ def test_sync_in_released_series_in_updates(self):
+ # If the destination series is released, the sync packages end
+ # up in the updates pocket.
+ versions = {
+ 'parent': '1.0-1',
+ }
+ derived_series, parent_series, sourcepackagename = self._setUpDSD(
+ 'my-src-name', versions=versions)
+
+ # Update destination series status to current and update
+ # daterelease.
+ with celebrity_logged_in('admin'):
+ derived_series.status = SeriesStatus.CURRENT
+ derived_series.datereleased = UTC_NOW
+
+ person = self.factory.makePerson()
+ removeSecurityProxy(derived_series.main_archive).newPackageUploader(
+ person, sourcepackagename)
+ self._syncAndGetView(
+ derived_series, person, ['my-src-name'])
+
+ parent_pub = parent_series.main_archive.getPublishedSources(
+ name='my-src-name', version=versions['parent'],
+ distroseries=parent_series).one()
+ pub = derived_series.main_archive.getPublishedSources(
+ name='my-src-name', version=versions['parent'],
+ distroseries=derived_series).one()
+
+ self.assertEqual(self.factory.getAnyPocket(), parent_pub.pocket)
+ self.assertEqual(PackagePublishingPocket.UPDATES, pub.pocket)
+
class TestDistroSeriesNeedsPackagesView(TestCaseWithFactory):
"""Test the distroseries +needs-packaging view."""