launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #04405
[Merge] lp:~rvb/launchpad/dsd-creation-multiple-parents-bug-815775 into lp:launchpad
Raphaël Victor Badin has proposed merging lp:~rvb/launchpad/dsd-creation-multiple-parents-bug-815775 into lp:launchpad with lp:~rvb/launchpad/bug-815751 as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~rvb/launchpad/dsd-creation-multiple-parents-bug-815775/+merge/69407
This branch is the first of a series of branches to fix bug 815775 (fix DistroSeriesDifference [DSD] support of multiple parents).
This branch removes the XXX bug=758906 that were left when we made the transition from one parent to multiple parent inside the DSD code. The strategy here was to make parent_series (because with multiple parents we need to specify which parent we are talking about when describing a DSD) mandatory. The two main methods ('createForPackagePublication' and 'massCreateForSeries') that are called from outside the module don't take a parent_series parameter because they will create DSDs for all the parents of the given derived_series.
= Tests =
(modified tests)
./bin/test -vvc initialize_distroseries
./bin/test -vvc test_distroseriesdifference
./bin/test -vvc test_distroseriesdifferencejob
= Q/A =
This is mostly a cleanup and is thus qa-untestable.
--
https://code.launchpad.net/~rvb/launchpad/dsd-creation-multiple-parents-bug-815775/+merge/69407
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/launchpad/dsd-creation-multiple-parents-bug-815775 into lp:launchpad.
=== modified file 'lib/lp/registry/errors.py'
--- lib/lp/registry/errors.py 2011-06-16 20:12:00 +0000
+++ lib/lp/registry/errors.py 2011-07-28 09:08:52 +0000
@@ -5,7 +5,6 @@
__all__ = [
'DistroSeriesDifferenceError',
'NotADerivedSeriesError',
- 'MultipleParentsForDerivedSeriesError',
'CannotTransitionToCountryMirror',
'CountryMirrorAlreadySet',
'DeleteSubscriptionError',
@@ -124,14 +123,6 @@
non-derived series - that is, a distroseries with a null Parent."""
-class MultipleParentsForDerivedSeriesError(Exception):
- """A distro series difference must have one parent series set.
-
- This is raised when a DistroSeriesDifference is created, and we can't
- determine the parent series to use, since there is more than one. The
- parent series needs to be specified in this case."""
-
-
@error_status(httplib.BAD_REQUEST)
class TeamMembershipTransitionError(ValueError):
"""Indicates something has gone wrong with the transtiion.
=== modified file 'lib/lp/registry/interfaces/distroseriesdifference.py'
--- lib/lp/registry/interfaces/distroseriesdifference.py 2011-07-08 09:06:24 +0000
+++ lib/lp/registry/interfaces/distroseriesdifference.py 2011-07-28 09:08:52 +0000
@@ -272,7 +272,7 @@
class IDistroSeriesDifferenceSource(Interface):
"""A utility of this interface can be used to create differences."""
- def new(derived_series, source_package_name, parent_series=None):
+ def new(derived_series, source_package_name, parent_series):
"""Create an `IDistroSeriesDifference`.
:param derived_series: The distribution series which was derived
@@ -283,8 +283,7 @@
package with a difference.
:type source_package_name: `ISourcePackageName`.
:param parent_series: The distribution series which has the derived
- series as a child. If there is only one parent, it does not need
- to be specified.
+ series as a child.
:type parent_series: `IDistroSeries`.
:raises NotADerivedSeriesError: When the passed distro series
is not a derived series.
=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py 2011-07-27 08:27:09 +0000
+++ lib/lp/registry/model/distroseriesdifference.py 2011-07-28 09:08:52 +0000
@@ -20,7 +20,6 @@
)
from lazr.enum import DBItem
from sqlobject import StringCol
-from storm.exceptions import NotOneError
from storm.expr import (
And,
Column,
@@ -55,7 +54,6 @@
)
from lp.registry.errors import (
DistroSeriesDifferenceError,
- MultipleParentsForDerivedSeriesError,
NotADerivedSeriesError,
)
from lp.registry.interfaces.distroseriesdifference import (
@@ -407,22 +405,13 @@
base_version = StringCol(dbName='base_version', notNull=False)
@staticmethod
- def new(derived_series, source_package_name, parent_series=None):
+ def new(derived_series, source_package_name, parent_series):
"""See `IDistroSeriesDifferenceSource`."""
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
- if parent_series is None:
- try:
- dsps = getUtility(IDistroSeriesParentSet)
- dsp = dsps.getByDerivedSeries(
- derived_series).one()
- except NotOneError:
- raise MultipleParentsForDerivedSeriesError()
- else:
- if dsp is None:
- raise NotADerivedSeriesError()
- else:
- parent_series = dsp.parent_series
+ dsps = getUtility(IDistroSeriesParentSet)
+ dsp = dsps.getByDerivedAndParentSeries(
+ derived_series, parent_series)
+ if dsp is None:
+ raise NotADerivedSeriesError()
store = IMasterStore(DistroSeriesDifference)
diff = DistroSeriesDifference()
=== modified file 'lib/lp/registry/tests/test_distroseriesdifference.py'
--- lib/lp/registry/tests/test_distroseriesdifference.py 2011-07-26 13:58:36 +0000
+++ lib/lp/registry/tests/test_distroseriesdifference.py 2011-07-28 09:08:52 +0000
@@ -74,7 +74,8 @@
self.assertRaises(
NotADerivedSeriesError, distroseriesdifference_factory.new,
- distro_series, source_package_name)
+ distro_series, source_package_name,
+ self.factory.makeDistroSeries())
def test_source_pub(self):
# The related source pub is returned for the derived series.
@@ -836,7 +837,7 @@
# factory.makeDistroSeriesDifference() will always create
# publications to be helpful. We don't need the help in this case.
dsd = getUtility(IDistroSeriesDifferenceSource).new(
- dsp.derived_series, spn)
+ dsp.derived_series, spn, dsp.parent_series)
self.assertEqual(pd, dsd.package_diff)
def _initDiffWithMultiplePendingPublications(self, versions, parent):
=== modified file 'lib/lp/soyuz/interfaces/distributionjob.py'
--- lib/lp/soyuz/interfaces/distributionjob.py 2011-07-22 11:17:04 +0000
+++ lib/lp/soyuz/interfaces/distributionjob.py 2011-07-28 09:08:52 +0000
@@ -121,8 +121,7 @@
class IDistroSeriesDifferenceJobSource(IJobSource):
"""An `IJob` for creating `DistroSeriesDifference`s."""
- def createForPackagePublication(derivedseries, sourcepackagename, pocket,
- parent_series=None):
+ def createForPackagePublication(derivedseries, sourcepackagename, pocket):
"""Create jobs as appropriate for a given status publication.
:param derived_series: A `DistroSeries` that is assumed to be
@@ -130,22 +129,15 @@
:param sourcepackagename: A `SourcePackageName` that is being
published in `derived_series` or `parent_series`.
:param pocket: The `PackagePublishingPocket` for the publication.
- :param parent_series: The parent `DistroSeries` whose version of
- `sourcepackagename` is to be compared with that in
- `derived_series`.
:return: An iterable of `DistroSeriesDifferenceJob`.
"""
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
- def massCreateForSeries(derived_series, parent_series):
+ def massCreateForSeries(derived_series):
"""Create jobs for all the publications inside the given distroseries
with reference to the given parent series.
:param derived_series: A `DistroSeries` that is assumed to be
derived from `parent_series`.
- :param parent_series: The parent `DistroSeries`.
-
:return: An iterable of `DistroSeriesDifferenceJob` ids. We don't
return the Job themselves for performance reason.
"""
=== modified file 'lib/lp/soyuz/model/distroseriesdifferencejob.py'
--- lib/lp/soyuz/model/distroseriesdifferencejob.py 2011-07-22 11:12:23 +0000
+++ lib/lp/soyuz/model/distroseriesdifferencejob.py 2011-07-28 09:08:52 +0000
@@ -48,21 +48,15 @@
FEATURE_FLAG_ENABLE_MODULE = u"soyuz.derived_series_jobs.enabled"
-def make_metadata(sourcepackagename, parent_series=None):
+def make_metadata(sourcepackagename, parent_series):
"""Return JSON metadata for a job on `sourcepackagename`."""
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
- if parent_series is None:
- parent_id = None
- else:
- parent_id = parent_series.id
return {
'sourcepackagename': sourcepackagename.id,
- 'parent_series': parent_id,
+ 'parent_series': parent_series.id,
}
-def create_job(derived_series, sourcepackagename, parent_series=None):
+def create_job(derived_series, sourcepackagename, parent_series):
"""Create a `DistroSeriesDifferenceJob` for a given source package.
:param derived_series: A `DistroSeries` that is assumed to be derived
@@ -73,8 +67,6 @@
`derived_series`. The difference is between the versions of
`sourcepackagename` in `parent_series` and `derived_series`.
"""
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
job = DistributionJob(
distribution=derived_series.distribution, distroseries=derived_series,
job_type=DistributionJobType.DISTROSERIESDIFFERENCE,
@@ -85,13 +77,12 @@
def create_multiple_jobs(derived_series, parent_series):
"""Create a `DistroSeriesDifferenceJob` for all the source packages in
- archive (optionally limited to the sourcepackagenames passed).
+ archive.
:param derived_series: A `DistroSeries` that is assumed to be derived
from another one.
:param parent_series: A `DistroSeries` that is a parent of
`derived_series`.
- :param archive: A `IArchive` where to find the source packages.
"""
store = IStore(SourcePackageRelease)
source_package_releases = store.find(
@@ -134,7 +125,7 @@
return [job_id for job_id, in result]
-def find_waiting_jobs(derived_series, sourcepackagename, parent_series=None):
+def find_waiting_jobs(derived_series, sourcepackagename, parent_series):
"""Look for pending `DistroSeriesDifference` jobs on a package."""
# Look for identical pending jobs. This compares directly on
# the metadata string. It's fragile, but this is only an
@@ -155,18 +146,13 @@
DistributionJob._json_data == json_metadata,
DistributionJob.job_id.is_in(Job.ready_jobs))
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
- if parent_series is None:
- return list(candidates)
-
return [
job
for job in candidates
if job.metadata["parent_series"] == parent_series.id]
-def may_require_job(derived_series, sourcepackagename, parent_series=None):
+def may_require_job(derived_series, sourcepackagename, parent_series):
"""Might publishing this package require a new job?
Use this to determine whether to create a new
@@ -175,8 +161,6 @@
runner some unnecessary work, but we don't expect a bit of
unnecessary work to be a big problem.
"""
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
if derived_series is None:
return False
dsp = getUtility(IDistroSeriesParentSet).getByDerivedSeries(
@@ -208,10 +192,8 @@
@classmethod
def createForPackagePublication(cls, derived_series, sourcepackagename,
- pocket, parent_series=None):
+ pocket):
"""See `IDistroSeriesDifferenceJobSource`."""
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
if not getFeatureFlag(FEATURE_FLAG_ENABLE_MODULE):
return
# -backports and -proposed are not really part of a standard
@@ -223,19 +205,30 @@
PackagePublishingPocket.PROPOSED):
return
jobs = []
- children = list(derived_series.getDerivedSeries())
- for relative in children + [derived_series]:
- if may_require_job(relative, sourcepackagename, parent_series):
- jobs.append(create_job(
- relative, sourcepackagename, parent_series))
+ parent_series = derived_series.getParentSeries()
+ # Create jobs for DSDs between the derived_series and its
+ # parents.
+ for parent in parent_series:
+ if may_require_job(
+ derived_series, sourcepackagename, parent):
+ jobs.append(create_job(
+ derived_series, sourcepackagename, parent))
+ # Create jobs for DSDs between the derived_series and its
+ # children.
+ for child in derived_series.getDerivedSeries():
+ if may_require_job(
+ child, sourcepackagename, derived_series):
+ jobs.append(create_job(
+ child, sourcepackagename, derived_series))
return jobs
@classmethod
- def massCreateForSeries(cls, derived_series, parent_series):
+ def massCreateForSeries(cls, derived_series):
"""See `IDistroSeriesDifferenceJobSource`."""
if not getFeatureFlag(FEATURE_FLAG_ENABLE_MODULE):
return
- create_multiple_jobs(derived_series, parent_series)
+ for parent_series in derived_series.getParentSeries():
+ create_multiple_jobs(derived_series, parent_series)
@classmethod
def getPendingJobsForDifferences(cls, derived_series,
@@ -248,13 +241,15 @@
Job._status.is_in(Job.PENDING_STATUSES),
DistributionJob.distroseries == derived_series)
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Check for parent
- # series once it becomes available.
+ parent_series_ids = set(
+ dsd.parent_series.id for dsd in distroseriesdifferences)
keyed_dsds = dict(
(dsd.source_package_name.id, dsd)
for dsd in distroseriesdifferences)
jobs_by_dsd = {}
for job in jobs:
+ if job.metadata["parent_series"] not in parent_series_ids:
+ continue
dsd = keyed_dsds.get(job.metadata["sourcepackagename"])
if dsd is not None:
jobs_by_dsd.setdefault(dsd, []).append(cls(job))
@@ -271,10 +266,6 @@
@property
def parent_series(self):
parent_id = self.metadata['parent_series']
- if not parent_id:
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
- return None
return IStore(DistroSeries).get(DistroSeries, parent_id)
def passesPackagesetFilter(self):
@@ -286,12 +277,6 @@
"""
derived_series = self.derived_series
parent_series = self.parent_series
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
- if parent_series is None:
- dsp = getUtility(IDistroSeriesParentSet).getByDerivedSeries(
- derived_series)
- parent_series = dsp[0].parent_series
sourcepackagename = self.sourcepackagename
if has_package(derived_series, sourcepackagename):
@@ -316,18 +301,11 @@
spn_id = self.metadata["sourcepackagename"]
parent_id = self.metadata["parent_series"]
store = IMasterStore(DistroSeriesDifference)
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Make parent_series
- # mandatory as part of multi-parent support.
- if parent_id is None:
- match_parent = True
- else:
- match_parent = (
- DistroSeriesDifference.parent_series_id == parent_id)
search = store.find(
DistroSeriesDifference,
DistroSeriesDifference.derived_series == self.derived_series,
- DistroSeriesDifference.source_package_name_id == spn_id,
- match_parent)
+ DistroSeriesDifference.parent_series_id == parent_id,
+ DistroSeriesDifference.source_package_name_id == spn_id)
return search.one()
def run(self):
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py 2011-07-27 23:06:20 +0000
+++ lib/lp/soyuz/model/publishing.py 2011-07-28 09:08:52 +0000
@@ -1500,9 +1500,8 @@
pocket)
return pub
- def getBuildsForSourceIds(
- self, source_publication_ids, archive=None, build_states=None,
- need_build_farm_job=False):
+ def getBuildsForSourceIds(self, source_publication_ids, archive=None,
+ build_states=None, need_build_farm_job=False):
"""See `IPublishingSet`."""
# Import Build and DistroArchSeries locally to avoid circular
# imports, since that Build uses SourcePackagePublishingHistory
=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py 2011-07-25 15:53:38 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py 2011-07-28 09:08:52 +0000
@@ -293,8 +293,7 @@
def _create_dsd_jobs(self):
job_source = getUtility(IDistroSeriesDifferenceJobSource)
- for parent in self.parents:
- job_source.massCreateForSeries(self.distroseries, parent)
+ job_source.massCreateForSeries(self.distroseries)
def _copy_configuration(self):
self.distroseries.backports_not_automatic = any(
=== modified file 'lib/lp/soyuz/tests/test_distroseriesdifferencejob.py'
--- lib/lp/soyuz/tests/test_distroseriesdifferencejob.py 2011-07-22 21:06:30 +0000
+++ lib/lp/soyuz/tests/test_distroseriesdifferencejob.py 2011-07-28 09:08:52 +0000
@@ -109,11 +109,6 @@
package = self.factory.makeSourcePackageName()
self.assertFalse(may_require_job(None, package, parent_series))
- def test_may_require_job_accepts_none_parent_series(self):
- derived_series = self.makeDerivedDistroSeries()
- package = self.factory.makeSourcePackageName()
- self.assertTrue(may_require_job(derived_series, package, None))
-
def test_may_require_job_allows_new_jobs(self):
dsp = self.factory.makeDistroSeriesParent()
package = self.factory.makeSourcePackageName()
@@ -262,42 +257,54 @@
[],
find_waiting_jobs(dsp.derived_series, package, dsp.parent_series))
- def test_createForPackagedPublication_creates_jobs_for_its_child(self):
- dsp = self.factory.makeDistroSeriesParent()
- parent_dsp = self.factory.makeDistroSeriesParent(
- derived_series=dsp.parent_series)
- package = self.factory.makeSourcePackageName()
- # Create a job for the derived_series parent, which should create
- # two jobs. One for derived_series, and the other for its child.
- self.getJobSource().createForPackagePublication(
- parent_dsp.derived_series, package,
- PackagePublishingPocket.RELEASE, parent_dsp.parent_series)
- jobs = sum([
- find_waiting_jobs(dsp.derived_series, package, dsp.parent_series)
- for dsp in [parent_dsp, parent_dsp]],
- [])
+ def assertJobsSeriesAndMetadata(self, job, series, metadata):
+ self.assertEqual(job.distroseries, series)
self.assertEqual(
- [package.id, package.id],
- [job.metadata["sourcepackagename"] for job in jobs])
+ (metadata[0], metadata[1]),
+ (job.metadata["sourcepackagename"],
+ job.metadata["parent_series"]))
def test_createForPackagePublication_creates_job_for_derived_series(self):
+ # A call to createForPackagePublication for the derived_series
+ # creates a job for the derived series.
dsp = self.factory.makeDistroSeriesParent()
+ parent_dsp = self.factory.makeDistroSeriesParent(
+ derived_series=dsp.parent_series)
package = self.factory.makeSourcePackageName()
self.getJobSource().createForPackagePublication(
- dsp.derived_series, package, PackagePublishingPocket.RELEASE,
- dsp.parent_series)
+ parent_dsp.derived_series, package,
+ PackagePublishingPocket.RELEASE)
jobs = find_waiting_jobs(
dsp.derived_series, package, dsp.parent_series)
- self.assertEqual(
- [package.id], [job.metadata["sourcepackagename"] for job in jobs])
+
+ self.assertEquals(len(jobs), 1)
+ self.assertJobsSeriesAndMetadata(
+ jobs[0], dsp.derived_series, [package.id, dsp.parent_series.id])
+
+ def test_createForPackagePublication_creates_job_for_parent_series(self):
+ # A call to createForPackagePublication for the derived_series
+ # creates a job for the parent series.
+ dsp = self.factory.makeDistroSeriesParent()
+ parent_dsp = self.factory.makeDistroSeriesParent(
+ derived_series=dsp.parent_series)
+ package = self.factory.makeSourcePackageName()
+ self.getJobSource().createForPackagePublication(
+ parent_dsp.derived_series, package,
+ PackagePublishingPocket.RELEASE)
+ parent_jobs = find_waiting_jobs(
+ parent_dsp.derived_series, package, parent_dsp.parent_series)
+
+ self.assertEquals(len(parent_jobs), 1)
+ self.assertJobsSeriesAndMetadata(
+ parent_jobs[0], dsp.parent_series,
+ [package.id, parent_dsp.parent_series.id])
def test_createForPackagePublication_obeys_feature_flag(self):
dsp = self.factory.makeDistroSeriesParent()
package = self.factory.makeSourcePackageName()
self.useFixture(FeatureFixture({FEATURE_FLAG_ENABLE_MODULE: ''}))
self.getJobSource().createForPackagePublication(
- dsp.derived_series, package, PackagePublishingPocket.RELEASE,
- dsp.parent_series)
+ dsp.derived_series, package, PackagePublishingPocket.RELEASE)
self.assertContentEqual(
[],
find_waiting_jobs(dsp.derived_series, package, dsp.parent_series))
@@ -306,21 +313,18 @@
dsp = self.factory.makeDistroSeriesParent()
package = self.factory.makeSourcePackageName()
self.getJobSource().createForPackagePublication(
- dsp.derived_series, package, PackagePublishingPocket.BACKPORTS,
- dsp.parent_series)
+ dsp.derived_series, package, PackagePublishingPocket.BACKPORTS)
self.getJobSource().createForPackagePublication(
- dsp.derived_series, package, PackagePublishingPocket.PROPOSED,
- dsp.parent_series)
+ dsp.derived_series, package, PackagePublishingPocket.PROPOSED)
self.assertContentEqual(
[],
find_waiting_jobs(dsp.derived_series, package, dsp.parent_series))
def test_massCreateForSeries_obeys_feature_flag(self):
+ self.useFixture(FeatureFixture({FEATURE_FLAG_ENABLE_MODULE: ''}))
dsp = self.factory.makeDistroSeriesParent()
spph = self.createSPPHs(dsp.derived_series, 1)[0]
- self.useFixture(FeatureFixture({FEATURE_FLAG_ENABLE_MODULE: ''}))
- self.getJobSource().massCreateForSeries(
- dsp.derived_series, dsp.parent_series)
+ self.getJobSource().massCreateForSeries(dsp.derived_series)
self.assertContentEqual(
[],
@@ -331,7 +335,8 @@
def test_getPendingJobsForDifferences_finds_job(self):
dsd = self.factory.makeDistroSeriesDifference()
- job = create_job(dsd.derived_series, dsd.source_package_name)
+ job = create_job(
+ dsd.derived_series, dsd.source_package_name, dsd.parent_series)
self.assertEqual(
{dsd: [job]},
self.getJobSource().getPendingJobsForDifferences(
@@ -339,7 +344,9 @@
def test_getPendingJobsForDifferences_ignores_other_package(self):
dsd = self.factory.makeDistroSeriesDifference()
- create_job(dsd.derived_series, self.factory.makeSourcePackageName())
+ create_job(
+ dsd.derived_series, self.factory.makeSourcePackageName(),
+ dsd.parent_series)
self.assertEqual(
{},
self.getJobSource().getPendingJobsForDifferences(
@@ -347,21 +354,29 @@
def test_getPendingJobsForDifferences_ignores_other_derived_series(self):
dsd = self.factory.makeDistroSeriesDifference()
- create_job(self.makeDerivedDistroSeries(), dsd.source_package_name)
+ create_job(
+ self.makeDerivedDistroSeries(), dsd.source_package_name,
+ dsd.parent_series)
self.assertEqual(
{},
self.getJobSource().getPendingJobsForDifferences(
dsd.derived_series, [dsd]))
def test_getPendingJobsForDifferences_ignores_other_parent_series(self):
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Can't test this
- # until we can specify the right parent series when creating a
- # job.
- return
+ dsd = self.factory.makeDistroSeriesDifference()
+ other_parent = self.factory.makeDistroSeriesParent(
+ dsd.derived_series).parent_series
+ create_job(
+ dsd.derived_series, dsd.source_package_name, other_parent)
+ self.assertEqual(
+ {},
+ self.getJobSource().getPendingJobsForDifferences(
+ dsd.derived_series, [dsd]))
def test_getPendingJobsForDifferences_ignores_non_pending_jobs(self):
dsd = self.factory.makeDistroSeriesDifference()
- job = create_job(dsd.derived_series, dsd.source_package_name)
+ job = create_job(
+ dsd.derived_series, dsd.source_package_name, dsd.parent_series)
removeSecurityProxy(job).job._status = JobStatus.COMPLETED
self.assertEqual(
{},
@@ -369,15 +384,14 @@
dsd.derived_series, [dsd]))
def test_getPendingJobsForDifferences_ignores_other_job_types(self):
- # XXX JeroenVermeulen 2011-05-26 bug=758906: Once parent_series
- # is incorporated into the job type, set it to dsd.parent_series
- # on the fake job, or this test will become silently meaningless.
dsd = self.factory.makeDistroSeriesDifference()
DistributionJob(
distribution=dsd.derived_series.distribution,
distroseries=dsd.derived_series,
job_type=DistributionJobType.INITIALIZE_SERIES,
- metadata={"sourcepackagename": dsd.source_package_name.id})
+ metadata={
+ "sourcepackagename": dsd.source_package_name.id,
+ "parent_series": dsd.parent_series.id})
self.assertEqual(
{},
self.getJobSource().getPendingJobsForDifferences(
@@ -387,8 +401,7 @@
dsp = self.factory.makeDistroSeriesParent()
package = self.factory.makeSourcePackageName()
self.getJobSource().createForPackagePublication(
- dsp.derived_series, package, PackagePublishingPocket.RELEASE,
- dsp.parent_series)
+ dsp.derived_series, package, PackagePublishingPocket.RELEASE)
# Make changes visible to the process we'll be spawning.
transaction.commit()
return_code, stdout, stderr = run_script(
@@ -407,8 +420,7 @@
dsp = self.factory.makeDistroSeriesParent()
package = self.factory.makeSourcePackageName()
job = self.getJobSource().createForPackagePublication(
- dsp.derived_series, package, PackagePublishingPocket.RELEASE,
- dsp.parent_series)
+ dsp.derived_series, package, PackagePublishingPocket.RELEASE)
job[0].start()
job[0].run()
# Complete the job so we can create another.
@@ -417,8 +429,7 @@
self.assertEqual(1, find_dsd_for(dsp, package).count())
# If we run the job again, it will not create another DSD.
job = self.getJobSource().createForPackagePublication(
- dsp.derived_series, package, PackagePublishingPocket.RELEASE,
- dsp.parent_series)
+ dsp.derived_series, package, PackagePublishingPocket.RELEASE)
job[0].start()
job[0].run()
self.assertEqual(1, find_dsd_for(dsp, package).count())
@@ -561,7 +572,8 @@
# Creating the SPPHs has created jobs for us, so grab them off
# the queue.
- jobs = find_waiting_jobs(dsp.derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ dsp.derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
ds_diff = find_dsd_for(dsp, source_package_name)
self.assertEqual(1, ds_diff.count())
@@ -572,7 +584,8 @@
self.createPublication(
source_package_name, ['1.0-2', '1.0-1'],
dsp.parent_series)
- jobs = find_waiting_jobs(dsp.derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ dsp.derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
# And the DSD we have a hold of will have updated.
self.assertEqual('1.0-2', ds_diff[0].parent_source_version)
@@ -588,7 +601,8 @@
source_package_name, ['1.0-1'], dsp.derived_series)
self.createPublication(
source_package_name, ['1.0-1'], dsp.parent_series)
- jobs = find_waiting_jobs(dsp.derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ dsp.derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
ds_diff = find_dsd_for(dsp, source_package_name)
self.assertEqual(
@@ -596,7 +610,8 @@
self.createPublication(
source_package_name, ['2.0-0derived1', '1.0-1'],
dsp.derived_series)
- jobs = find_waiting_jobs(dsp.derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ dsp.derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
self.assertEqual(
DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT,
@@ -607,7 +622,8 @@
self.createPublication(
source_package_name, ['2.0-0derived2', '1.0-1'],
dsp.derived_series)
- jobs = find_waiting_jobs(dsp.derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ dsp.derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
self.assertEqual(
DistroSeriesDifferenceStatus.BLACKLISTED_CURRENT,
@@ -623,13 +639,15 @@
source_package_name, ['1.0-1derived1', '1.0-1'], derived_series)
self.createPublication(
source_package_name, ['1.0-2', '1.0-1'], dsp.parent_series)
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
ds_diff = self.findDSD(derived_series, source_package_name)
self.assertEqual('1.0-1', ds_diff[0].base_version)
self.createPublication(
source_package_name, ['1.0-2', '1.0-1'], derived_series)
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
self.assertEqual(
DistroSeriesDifferenceStatus.RESOLVED, ds_diff[0].status)
@@ -642,7 +660,8 @@
source_package_name = self.factory.makeSourcePackageName()
self.createPublication(
source_package_name, ['1.0-0derived1'], derived_series)
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
ds_diff = self.findDSD(derived_series, source_package_name)
self.assertEqual(
@@ -657,7 +676,8 @@
source_package_name = self.factory.makeSourcePackageName()
self.createPublication(
source_package_name, ['1.0-1'], dsp.parent_series)
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
ds_diff = self.findDSD(derived_series, source_package_name)
self.assertEqual(
@@ -674,13 +694,15 @@
source_package_name, ['1.0-1'], derived_series)
spph = self.createPublication(
source_package_name, ['1.0-1'], dsp.parent_series)
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
ds_diff = self.findDSD(derived_series, source_package_name)
self.assertEqual(
DistroSeriesDifferenceStatus.RESOLVED, ds_diff[0].status)
spph.requestDeletion(self.factory.makePerson())
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
self.assertEqual(
DistroSeriesDifferenceType.UNIQUE_TO_DERIVED_SERIES,
@@ -696,13 +718,15 @@
source_package_name, ['1.0-1'], derived_series)
self.createPublication(
source_package_name, ['1.0-1'], dsp.parent_series)
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
ds_diff = self.findDSD(derived_series, source_package_name)
self.assertEqual(
DistroSeriesDifferenceStatus.RESOLVED, ds_diff[0].status)
spph.requestDeletion(self.factory.makePerson())
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
self.assertEqual(
DistroSeriesDifferenceType.MISSING_FROM_DERIVED_SERIES,
@@ -716,7 +740,9 @@
self.createPublication(
source_package_name, ['1.0-1'], dsp.derived_series, ppa)
self.assertContentEqual(
- [], find_waiting_jobs(dsp.derived_series, source_package_name))
+ [],
+ find_waiting_jobs(
+ dsp.derived_series, source_package_name, dsp.parent_series))
def test_no_job_for_PPA_with_deleted_source(self):
# If a source package is deleted from a PPA, no job is created.
@@ -728,7 +754,9 @@
source_package_name, ['1.0-1'], derived_series, ppa)
spph.requestDeletion(ppa.owner)
self.assertContentEqual(
- [], find_waiting_jobs(derived_series, source_package_name))
+ [],
+ find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series))
def test_update_deletes_diffs(self):
# When a DSD is updated, the diffs are invalidated.
@@ -746,7 +774,8 @@
archive=dsp.parent_series.main_archive,
distroseries=dsp.parent_series,
status=PackagePublishingStatus.SUPERSEDED)
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
ds_diff = self.findDSD(derived_series, source_package_name)
ds_diff[0].requestPackageDiffs(self.factory.makePerson())
@@ -755,7 +784,8 @@
self.createPublication(
source_package_name, ['1.0-3', '1.0-2', '1.0-1'],
dsp.parent_series)
- jobs = find_waiting_jobs(derived_series, source_package_name)
+ jobs = find_waiting_jobs(
+ derived_series, source_package_name, dsp.parent_series)
self.runJob(jobs[0])
# Since the diff showing the changes from 1.0-1 to 1.0-1derived1 is
# still valid, it isn't reset, but the parent diff is.