launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07212
[Merge] lp:~cjwatson/launchpad/remove-initialize-from-parent-script into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/remove-initialize-from-parent-script into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/remove-initialize-from-parent-script/+merge/103186
We used to use initialize-from-parent.py to initialise new Ubuntu distroseries. However, since https://wiki.ubuntu.com/NewReleaseCycleProcess?action=diff&rev1=85&rev2=86, we use DistroSeries:+initseries in the web UI instead, so there's no need to keep the separate script around.
I felt there was no need to write a job-based replacement for the test_script test case I removed, since lib/lp/soyuz/tests/test_initializedistroseriesjob.py already does plenty of testing of InitializeDistroSeriesJob.
--
https://code.launchpad.net/~cjwatson/launchpad/remove-initialize-from-parent-script/+merge/103186
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/remove-initialize-from-parent-script into lp:launchpad.
=== modified file 'lib/lp/registry/doc/distroseries.txt'
--- lib/lp/registry/doc/distroseries.txt 2012-04-10 14:01:17 +0000
+++ lib/lp/registry/doc/distroseries.txt 2012-04-23 22:25:26 +0000
@@ -344,7 +344,7 @@
a SPR according to the distroseries in question (practically according
what is published in this distrorelease)
-Since the initialize-from-parent procedure copies the latest
+Since the InitializeDistroSeries procedure copies the latest
publications from the parent IDRSPR.builds should be empty, reflecting
that there are no builds for this SPR in this DistroSeries.
IDRSPR.builds will be non-empty after a developer submits a new SPR
=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2012-04-23 00:43:10 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py 2012-04-23 22:25:26 +0000
@@ -900,39 +900,6 @@
self.assertEqual(
das[0].architecturetag, self.parent_das.architecturetag)
- def test_script(self):
- # Do an end-to-end test using the command-line tool.
- self.parent, self.parent_das = self.setupParent()
- uploader = self.factory.makePerson()
- test1 = getUtility(IPackagesetSet).new(
- u'test1', u'test 1 packageset', self.parent.owner,
- distroseries=self.parent)
- test1.addSources('udev')
- getUtility(IArchivePermissionSet).newPackagesetUploader(
- self.parent.main_archive, uploader, test1)
- child = self.factory.makeDistroSeries(previous_series=self.parent)
- # Create an initialized series in the distribution.
- other_series = self.factory.makeDistroSeries(
- distribution=child.parent)
- self.factory.makeSourcePackagePublishingHistory(
- distroseries=other_series)
- transaction.commit()
- ifp = os.path.join(
- config.root, 'scripts', 'ftpmaster-tools',
- 'initialize-from-parent.py')
- process = subprocess.Popen(
- [sys.executable, ifp, "-vv", "-d", child.parent.name,
- child.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- stdout, stderr = process.communicate()
- self.addDetail("stdout", Content(UTF8_TEXT, lambda: stdout))
- self.addDetail("stderr", Content(UTF8_TEXT, lambda: stderr))
- self.assertEqual(process.returncode, 0)
- self.assertTrue(
- "DEBUG Committing transaction." in stderr.split('\n'))
- transaction.commit()
- self.assertDistroSeriesInitializedCorrectly(
- child, self.parent, self.parent_das)
-
def test_is_initialized(self):
# At the end of the initialization, the distroseriesparent is marked
# as 'initialized'.
=== removed symlink 'scripts/ftpmaster-tools/initialise-from-parent.py'
=== target was u'initialize-from-parent.py'
=== removed file 'scripts/ftpmaster-tools/initialize-from-parent.py'
--- scripts/ftpmaster-tools/initialize-from-parent.py 2012-01-06 11:08:30 +0000
+++ scripts/ftpmaster-tools/initialize-from-parent.py 1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
-#!/usr/bin/python -S
-#
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Initialize a new distroseries from its parent series."""
-
-import _pythonpath
-
-import transaction
-from zope.component import getUtility
-
-from lp.app.errors import NotFoundError
-from lp.registry.interfaces.distribution import IDistributionSet
-from lp.services.config import config
-from lp.services.scripts.base import (
- LaunchpadScript,
- LaunchpadScriptFailure,
- )
-from lp.soyuz.scripts.initialize_distroseries import (
- InitializationError,
- InitializeDistroSeries,
- )
-
-
-class InitializeFromParentScript(LaunchpadScript):
-
- usage = "Usage: %prog [options] <SERIES>"
-
- def add_my_options(self):
- self.parser.add_option(
- "-N", "--dry-run", action="store_true",
- dest="dryrun", metavar="DRY_RUN", default=False,
- help="Whether to treat this as a dry-run or not.")
- self.parser.add_option(
- "-d", "--distro", dest="distribution",
- metavar="DISTRO", default="ubuntu", help="Distribution name")
- self.parser.add_option(
- "-a", "--arches", dest="arches",
- help="A comma-separated list of arches to limit the child "
- "distroseries to inheriting")
-
- def main(self):
- if len(self.args) != 1:
- self.parser.error("SERIES is required")
-
- distroseries_name = self.args[0]
-
- try:
- # 'ubuntu' is the default option.distribution value
- distribution = getUtility(IDistributionSet)[
- self.options.distribution]
- distroseries = distribution[distroseries_name]
- except NotFoundError, info:
- raise LaunchpadScriptFailure('%s not found' % info)
-
- try:
- arches = ()
- if self.options.arches is not None:
- arches = tuple(self.options.arches.split(','))
- ids = InitializeDistroSeries(distroseries, arches=arches)
- self.logger.debug("Checking preconditions")
- ids.check()
- self.logger.debug(
- "Initializing from parent(s), copying publishing records.")
- ids.initialize()
- except InitializationError, e:
- transaction.abort()
- raise LaunchpadScriptFailure(e)
-
- if self.options.dryrun:
- self.logger.debug('Dry-Run mode, transaction aborted.')
- transaction.abort()
- else:
- self.logger.debug('Committing transaction.')
- transaction.commit()
-
-
-if __name__ == '__main__':
- script = InitializeFromParentScript(
- 'initialize-from-parent', config.initializedistroseries.dbuser)
- script.lock_and_run()
Follow ups