Merge lp:~laney/launchpad/proposed-notautomatic into lp:launchpad

Proposed by Iain Lane
Status: Work in progress
Proposed branch: lp:~laney/launchpad/proposed-notautomatic
Merge into: lp:launchpad
Diff against target: 196 lines (+55/-25)
7 files modified
lib/lp/archivepublisher/publishing.py (+4/-2)
lib/lp/archivepublisher/tests/test_publisher.py (+32/-16)
lib/lp/registry/configure.zcml (+1/-0)
lib/lp/registry/interfaces/distroseries.py (+12/-0)
lib/lp/registry/model/distroseries.py (+1/-0)
lib/lp/soyuz/scripts/initialize_distroseries.py (+3/-0)
lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py (+2/-7)
To merge this branch: bzr merge lp:~laney/launchpad/proposed-notautomatic
Reviewer Review Type Date Requested Status
Richard Harding (community) Needs Information
Review via email: mp+113921@code.launchpad.net

Commit message

Add flag proposed_not_automatic to cause Release files for -proposed to be set NotAutomatic and ButAutomaticUpgrades so that users are not offered upgrades to packages in the proposed pocket, but are within it.

Description of the change

Summary
=======

Users are offered upgrades to packages in -proposed, which is often used as a staging/test area. It would be better if they were able to opt in on a per-package basis.

Proposed Fix
============

Add a flag which causes the -proposed Eelease files for a series to contain the NotAutomatic and ButAutomaticUpgrade flags, so that users are not offered updates by apt to packages in -propoed, but are offered upgrades within it.

Test
====

bin/test -cvv test_publisher

QA/demo Plans
==============

Upload (or copy) a package into quantal-proposed with proposed_not_automatic = False. Confirm that the Release file for quantal-proposed does not contain NotAutomatic or ButAutomaticUpgrades. Set the flag to True and upload another package (to cause the Release files to be re-written) and check that the Release file contains NotAutomatic: yes and ButAutomaticUpgrades: yes.

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

One thing I don't know is whether the way that I modified the tests is the best way to go about this. In particular I'm not sure about the "set_flag" functions.

Perhaps both tests should just be combined?

Revision history for this message
Richard Harding (rharding) wrote :

Thank Iain. I think having the split tests is ok. I might have passed in the string for the property 'proposed_not_automatic' for instance, and used getattr/setattr to test and check the value myself, but it works.

I don't see any LoC qualification in the MP. Do you have a credit currently?

I want to make sure the removed imports in #164 are unused imports then?

Other than that, I don't see anything. Marking needs information for the moment.

review: Needs Information

Unmerged revisions

15424. By Iain Lane

Fix missing copy of proposed_not_automatic when initialising new series

15423. By Iain Lane

Lint and including remove some unused imports.

15422. By Iain Lane

Add DistroSeries.proposed_not_automatic to set NotAutomatic ButAutomaticUpgrades

This means that users will not be offered upgrades to packages in -proposed for
series with this flag enabled, but will be offered upgrade within it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py 2012-06-29 08:40:05 +0000
+++ lib/lp/archivepublisher/publishing.py 2012-07-09 08:16:26 +0000
@@ -569,8 +569,10 @@
569 release_file["Components"] = " ".join(569 release_file["Components"] = " ".join(
570 reorder_components(all_components))570 reorder_components(all_components))
571 release_file["Description"] = drsummary571 release_file["Description"] = drsummary
572 if (pocket == PackagePublishingPocket.BACKPORTS and572 if ((pocket == PackagePublishingPocket.BACKPORTS and
573 distroseries.backports_not_automatic):573 distroseries.backports_not_automatic) or
574 (pocket == PackagePublishingPocket.PROPOSED and
575 distroseries.proposed_not_automatic)):
574 release_file["NotAutomatic"] = "yes"576 release_file["NotAutomatic"] = "yes"
575 release_file["ButAutomaticUpgrades"] = "yes"577 release_file["ButAutomaticUpgrades"] = "yes"
576578
577579
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2012-01-03 01:02:12 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2012-07-09 08:16:26 +0000
@@ -64,6 +64,7 @@
6464
65RELEASE = PackagePublishingPocket.RELEASE65RELEASE = PackagePublishingPocket.RELEASE
66BACKPORTS = PackagePublishingPocket.BACKPORTS66BACKPORTS = PackagePublishingPocket.BACKPORTS
67PROPOSED = PackagePublishingPocket.PROPOSED
6768
6869
69class TestPublisherBase(TestNativePublishingBase):70class TestPublisherBase(TestNativePublishingBase):
@@ -1021,13 +1022,14 @@
1021 # The Label: field should be set to the archive displayname1022 # The Label: field should be set to the archive displayname
1022 self.assertEqual('Partner archive', release['label'])1023 self.assertEqual('Partner archive', release['label'])
10231024
1024 def testReleaseFileForNotAutomaticBackports(self):1025 def releaseFileNotAutomatic(self, pocket, flag_value, set_flag):
1025 # Test Release file writing for series with NotAutomatic backports.1026 # Set up Release file writing for series/pocket with NotAutomatic
1027 # ButAutomaticUpgrades.
1026 publisher = Publisher(1028 publisher = Publisher(
1027 self.logger, self.config, self.disk_pool,1029 self.logger, self.config, self.disk_pool,
1028 self.ubuntutest.main_archive)1030 self.ubuntutest.main_archive)
1029 self.getPubSource(filecontent='Hello world', pocket=RELEASE)1031 self.getPubSource(filecontent='Hello world', pocket=RELEASE)
1030 self.getPubSource(filecontent='Hello world', pocket=BACKPORTS)1032 self.getPubSource(filecontent='Hello world', pocket=pocket)
10311033
1032 publisher.A_publish(True)1034 publisher.A_publish(True)
1033 publisher.C_writeIndexes(False)1035 publisher.C_writeIndexes(False)
@@ -1039,20 +1041,34 @@
1039 with open(release_path) as release_file:1041 with open(release_path) as release_file:
1040 return release_file.read().splitlines()1042 return release_file.read().splitlines()
10411043
1042 # When backports_not_automatic is unset, no Release files have1044 # When flag is unset, no Release files have
1043 # NotAutomatic: yes.1045 # NotAutomatic: yes.
1044 self.assertEqual(False, self.breezy_autotest.backports_not_automatic)1046 self.assertEqual(False, flag_value)
1045 publisher.D_writeReleaseFiles(False)1047 publisher.D_writeReleaseFiles(False)
1046 self.assertNotIn("NotAutomatic: yes", get_release(RELEASE))1048 self.assertNotIn("NotAutomatic: yes", get_release(RELEASE))
1047 self.assertNotIn("NotAutomatic: yes", get_release(BACKPORTS))1049 self.assertNotIn("NotAutomatic: yes", get_release(pocket))
10481050
1049 # But with the flag set, -backports Release files gain1051 # But with the flag set, the pocket's Release files gain NotAutomatic:
1050 # NotAutomatic: yes and ButAutomaticUpgrades: yes.1052 # yes and ButAutomaticUpgrades: yes.
1051 self.breezy_autotest.backports_not_automatic = True1053 set_flag(True)
1052 publisher.D_writeReleaseFiles(False)1054 publisher.D_writeReleaseFiles(False)
1053 self.assertNotIn("NotAutomatic: yes", get_release(RELEASE))1055 self.assertNotIn("NotAutomatic: yes", get_release(RELEASE))
1054 self.assertIn("NotAutomatic: yes", get_release(BACKPORTS))1056 self.assertIn("NotAutomatic: yes", get_release(pocket))
1055 self.assertIn("ButAutomaticUpgrades: yes", get_release(BACKPORTS))1057 self.assertIn("ButAutomaticUpgrades: yes", get_release(pocket))
1058
1059 def testReleaseFileForNotAutomaticBackports(self):
1060 def set_flag(value):
1061 self.breezy_autotest.backports_not_automatic = value
1062 self.releaseFileNotAutomatic(BACKPORTS,
1063 self.breezy_autotest.backports_not_automatic,
1064 set_flag)
1065
1066 def testReleaseFileForNotAutomaticProposed(self):
1067 def set_flag(value):
1068 self.breezy_autotest.proposed_not_automatic = value
1069 self.releaseFileNotAutomatic(PROPOSED,
1070 self.breezy_autotest.proposed_not_automatic,
1071 set_flag)
10561072
1057 def testReleaseFileForI18n(self):1073 def testReleaseFileForI18n(self):
1058 """Test Release file writing for translated package descriptions."""1074 """Test Release file writing for translated package descriptions."""
10591075
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2012-06-29 02:15:05 +0000
+++ lib/lp/registry/configure.zcml 2012-07-09 08:16:26 +0000
@@ -263,6 +263,7 @@
263 permission="launchpad.Edit"263 permission="launchpad.Edit"
264 set_attributes="displayname title summary description driver264 set_attributes="displayname title summary description driver
265 backports_not_automatic265 backports_not_automatic
266 proposed_not_automatic
266 include_long_descriptions"/>267 include_long_descriptions"/>
267268
268 <!-- NB: check with SABDFL before modifying these, there is potential to269 <!-- NB: check with SABDFL before modifying these, there is potential to
269270
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2012-07-03 08:04:35 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2012-07-09 08:16:26 +0000
@@ -365,6 +365,18 @@
365 automatically upgrade within backports, but not into it.365 automatically upgrade within backports, but not into it.
366 """))366 """))
367367
368 proposed_not_automatic = Bool(
369 title=_("Don't upgrade to packages in proposed automatically"),
370 required=True,
371 description=_("""
372 Set NotAutomatic: yes and ButAutomaticUpgrades: yes in Release
373 files generated for the proposed pocket pre-release. This tells apt
374 to automatically upgrade within proposed, but not into it.
375 Pre-release, this pocket is used as a package staging area for
376 archive consistency purposes. Post-release, users would like to be
377 able to opt-in to testing proposed updates on a per-package basis.
378 """))
379
368 include_long_descriptions = exported(380 include_long_descriptions = exported(
369 Bool(381 Bool(
370 title=_(382 title=_(
371383
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2012-07-05 09:43:58 +0000
+++ lib/lp/registry/model/distroseries.py 2012-07-09 08:16:26 +0000
@@ -244,6 +244,7 @@
244 notNull=False, default=None)244 notNull=False, default=None)
245 language_pack_full_export_requested = BoolCol(notNull=True, default=False)245 language_pack_full_export_requested = BoolCol(notNull=True, default=False)
246 backports_not_automatic = BoolCol(notNull=True, default=False)246 backports_not_automatic = BoolCol(notNull=True, default=False)
247 proposed_not_automatic = BoolCol(notNull=True, default=False)
247 include_long_descriptions = BoolCol(notNull=True, default=True)248 include_long_descriptions = BoolCol(notNull=True, default=True)
248249
249 language_packs = SQLMultipleJoin(250 language_packs = SQLMultipleJoin(
250251
=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py 2012-07-05 09:43:58 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py 2012-07-09 08:16:26 +0000
@@ -367,6 +367,9 @@
367 self.distroseries.backports_not_automatic = any(367 self.distroseries.backports_not_automatic = any(
368 parent.backports_not_automatic368 parent.backports_not_automatic
369 for parent in self.derivation_parents)369 for parent in self.derivation_parents)
370 self.distroseries.proposed_not_automatic = any(
371 parent.proposed_not_automatic
372 for parent in self.derivation_parents)
370 self.distroseries.include_long_descriptions = any(373 self.distroseries.include_long_descriptions = any(
371 parent.include_long_descriptions374 parent.include_long_descriptions
372 for parent in self.derivation_parents)375 for parent in self.derivation_parents)
373376
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2012-04-23 22:18:46 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2012-07-09 08:16:26 +0000
@@ -5,12 +5,6 @@
55
6__metaclass__ = type6__metaclass__ = type
77
8import os
9import subprocess
10import sys
11
12from testtools.content import Content
13from testtools.content_type import UTF8_TEXT
14import transaction8import transaction
15from zope.component import getUtility9from zope.component import getUtility
1610
@@ -21,7 +15,6 @@
21 )15 )
22from lp.registry.interfaces.distroseriesparent import IDistroSeriesParentSet16from lp.registry.interfaces.distroseriesparent import IDistroSeriesParentSet
23from lp.registry.interfaces.pocket import PackagePublishingPocket17from lp.registry.interfaces.pocket import PackagePublishingPocket
24from lp.services.config import config
25from lp.services.database.lpstorm import IStore18from lp.services.database.lpstorm import IStore
26from lp.services.features.testing import FeatureFixture19from lp.services.features.testing import FeatureFixture
27from lp.soyuz.enums import (20from lp.soyuz.enums import (
@@ -89,6 +82,7 @@
89 if existing_format_selection is None:82 if existing_format_selection is None:
90 spfss_utility.add(parent, format_selection)83 spfss_utility.add(parent, format_selection)
91 parent.backports_not_automatic = True84 parent.backports_not_automatic = True
85 parent.proposed_not_automatic = True
92 parent.include_long_descriptions = False86 parent.include_long_descriptions = False
93 self._populate_parent(parent, parent_das, packages, pocket)87 self._populate_parent(parent, parent_das, packages, pocket)
94 return parent, parent_das88 return parent, parent_das
@@ -593,6 +587,7 @@
593 SourcePackageFormat.FORMAT_1_0))587 SourcePackageFormat.FORMAT_1_0))
594 # Other configuration bits are copied too.588 # Other configuration bits are copied too.
595 self.assertTrue(child.backports_not_automatic)589 self.assertTrue(child.backports_not_automatic)
590 self.assertTrue(child.proposed_not_automatic)
596 self.assertFalse(child.include_long_descriptions)591 self.assertFalse(child.include_long_descriptions)
597592
598 def test_initialize(self):593 def test_initialize(self):