launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03093
[Merge] lp:~wgrant/launchpad/backports-not-automatic into lp:launchpad/db-devel
William Grant has proposed merging lp:~wgrant/launchpad/backports-not-automatic into lp:launchpad/db-devel.
Requested reviews:
Stuart Bishop (stub): db
Robert Collins (lifeless): db
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #721591 in Launchpad itself: "backports release files in natty and above don't have new apt metadata"
https://bugs.launchpad.net/launchpad/+bug/721591
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/backports-not-automatic/+merge/55279
This branch implements the archive side of https://blueprints.launchpad.net/ubuntu/+spec/other-foundations-n-backports-notautomatic, bug #721591. We need to set "NotAutomatic: yes" and "ButAutomaticUpgrades: yes" in the -backports Release file for series >= Natty.
To do this I've added a new DistroSeries flag, backports_not_automatic. This is propagated by initialise_distroseries, and when generating -backports Release files. We'll need to manually set this to True for Natty once Ubuntu confirms it's OK.
--
https://code.launchpad.net/~wgrant/launchpad/backports-not-automatic/+merge/55279
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/backports-not-automatic into lp:launchpad/db-devel.
=== added file 'database/schema/patch-2208-99-0.sql'
--- database/schema/patch-2208-99-0.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2208-99-0.sql 2011-03-29 05:26:44 +0000
@@ -0,0 +1,6 @@
+SET client_min_messages=ERROR;
+
+ALTER TABLE distroseries
+ ADD COLUMN backports_not_automatic BOOLEAN NOT NULL DEFAULT FALSE;
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2208, 99, 0);
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py 2011-03-04 15:42:09 +0000
+++ lib/lp/archivepublisher/publishing.py 2011-03-29 05:26:44 +0000
@@ -501,6 +501,10 @@
release_file["Components"] = " ".join(
reorder_components(all_components))
release_file["Description"] = drsummary
+ if (pocket == PackagePublishingPocket.BACKPORTS and
+ distroseries.backports_not_automatic):
+ release_file["NotAutomatic"] = "yes"
+ release_file["ButAutomaticUpgrades"] = "yes"
for filename in sorted(list(all_files), key=os.path.dirname):
entry = self._readIndexFileContents(suite, filename)
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2011-02-17 22:22:45 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2011-03-29 05:26:44 +0000
@@ -35,7 +35,10 @@
)
from lp.registry.interfaces.distribution import IDistributionSet
from lp.registry.interfaces.person import IPersonSet
-from lp.registry.interfaces.pocket import PackagePublishingPocket
+from lp.registry.interfaces.pocket import (
+ PackagePublishingPocket,
+ pocketsuffix,
+ )
from lp.registry.interfaces.series import SeriesStatus
from lp.soyuz.enums import (
ArchivePurpose,
@@ -49,6 +52,10 @@
from lp.soyuz.tests.test_publishing import TestNativePublishingBase
+RELEASE = PackagePublishingPocket.RELEASE
+BACKPORTS = PackagePublishingPocket.BACKPORTS
+
+
class TestPublisherBase(TestNativePublishingBase):
"""Basic setUp for `TestPublisher` classes.
@@ -1033,6 +1040,38 @@
# The Label: field should be set to the archive displayname
self.assertEqual(release_contents[1], 'Label: Partner archive')
+ def testReleaseFileForNotAutomaticBackports(self):
+ # Test Release file writing for series with NotAutomatic backports.
+ publisher = Publisher(
+ self.logger, self.config, self.disk_pool,
+ self.ubuntutest.main_archive)
+ self.getPubSource(filecontent='Hello world', pocket=RELEASE)
+ self.getPubSource(filecontent='Hello world', pocket=BACKPORTS)
+
+ publisher.A_publish(True)
+ publisher.C_writeIndexes(False)
+
+ def get_release(pocket):
+ release_file = os.path.join(
+ publisher._config.distsroot,
+ 'breezy-autotest%s' % pocketsuffix[pocket], 'Release')
+ return open(release_file).read().splitlines()
+
+ # When backports_not_automatic is unset, no Release files have
+ # NotAutomatic: yes.
+ self.assertEqual(False, self.breezy_autotest.backports_not_automatic)
+ publisher.D_writeReleaseFiles(False)
+ self.assertNotIn("NotAutomatic: yes", get_release(RELEASE))
+ self.assertNotIn("NotAutomatic: yes", get_release(BACKPORTS))
+
+ # But with the flag set, -backports Release files gain
+ # NotAutomatic: yes and ButAutomaticUpgrades: yes.
+ self.breezy_autotest.backports_not_automatic = True
+ publisher.D_writeReleaseFiles(False)
+ self.assertNotIn("NotAutomatic: yes", get_release(RELEASE))
+ self.assertIn("NotAutomatic: yes", get_release(BACKPORTS))
+ self.assertIn("ButAutomaticUpgrades: yes", get_release(BACKPORTS))
+
def testHtaccessForPrivatePPA(self):
# A htaccess file is created for new private PPA's.
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2011-03-25 03:26:29 +0000
+++ lib/lp/registry/configure.zcml 2011-03-29 05:26:44 +0000
@@ -207,7 +207,8 @@
<require
permission="launchpad.Edit"
- set_attributes="displayname title summary description driver"/>
+ set_attributes="displayname title summary description driver
+ backports_not_automatic"/>
<!-- NB: check with SABDFL before modifying these, there is potential to
make a huge mess if these get changed and Soyuz has to republish
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2011-03-29 01:28:52 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2011-03-29 05:26:44 +0000
@@ -344,6 +344,14 @@
language_packs = Attribute(
"All language packs associated with this distribution series.")
+ backports_not_automatic = Bool(
+ title=_("Don't upgrade to backports automatically"), required=True,
+ description=_("""
+ Set NotAutomatic: yes and ButAutomaticUpgrades: yes in Release
+ files generated for the backports pocket. This tells apt to
+ automatically upgrade within backports, but not into it.
+ """))
+
# other properties
previous_series = Attribute("Previous series from the same "
"distribution.")
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2011-03-29 01:28:52 +0000
+++ lib/lp/registry/model/distroseries.py 2011-03-29 05:26:44 +0000
@@ -252,6 +252,7 @@
foreignKey="LanguagePack", dbName="language_pack_proposed",
notNull=False, default=None)
language_pack_full_export_requested = BoolCol(notNull=True, default=False)
+ backports_not_automatic = BoolCol(notNull=True, default=False)
language_packs = SQLMultipleJoin(
'LanguagePack', joinColumn='distroseries', orderBy='-date_exported')
=== modified file 'lib/lp/soyuz/scripts/initialise_distroseries.py'
--- lib/lp/soyuz/scripts/initialise_distroseries.py 2011-01-15 06:32:40 +0000
+++ lib/lp/soyuz/scripts/initialise_distroseries.py 2011-03-29 05:26:44 +0000
@@ -127,10 +127,15 @@
raise InitialisationError(error)
def initialise(self):
+ self._copy_configuration()
self._copy_architectures()
self._copy_packages()
self._copy_packagesets()
+ def _copy_configuration(self):
+ self.distroseries.backports_not_automatic = \
+ self.parent.backports_not_automatic
+
def _copy_architectures(self):
include = ''
if self.arches:
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py 2010-10-14 12:56:31 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialise_distroseries.py 2011-03-29 05:26:44 +0000
@@ -53,6 +53,7 @@
self.parent.nominatedarchindep = self.parent_das
getUtility(ISourcePackageFormatSelectionSet).add(
self.parent, SourcePackageFormat.FORMAT_1_0)
+ self.parent.backports_not_automatic = True
self._populate_parent()
def _populate_parent(self):
@@ -153,10 +154,12 @@
self.parent[self.parent_das.architecturetag],
self.parent.main_archive)
self.assertEqual(parent_udev.id, child_udev.id)
- # We also inherient the permitted source formats from our parent
+ # We also inherit the permitted source formats from our parent
self.assertTrue(
child.isSourcePackageFormatPermitted(
SourcePackageFormat.FORMAT_1_0))
+ # Other configuration bits are copied too.
+ self.assertTrue(child.backports_not_automatic)
def _full_initialise(self, arches=(), packagesets=(), rebuild=False):
child = self.factory.makeDistroSeries(parent_series=self.parent)
@@ -334,4 +337,5 @@
self.assertEqual(process.returncode, 0)
self.assertTrue(
"DEBUG Committing transaction." in stderr.split('\n'))
+ transaction.commit()
self.assertDistroSeriesInitialisedCorrectly(child)
Follow ups