Merge lp://staging/~michael.nelson/launchpad/536700-present-packagebuilds-in-ppa-context into lp://staging/launchpad/db-devel

Proposed by Michael Nelson
Status: Merged
Merged at revision: 9485
Proposed branch: lp://staging/~michael.nelson/launchpad/536700-present-packagebuilds-in-ppa-context
Merge into: lp://staging/launchpad/db-devel
Diff against target: 1137 lines (+424/-145) (has conflicts)
28 files modified
lib/canonical/buildd/apply-ogre-model (+0/-39)
lib/canonical/buildd/binarypackage.py (+7/-17)
lib/canonical/buildd/debian.py (+1/-40)
lib/canonical/buildd/debian/changelog (+7/-0)
lib/canonical/buildd/debian/rules (+2/-2)
lib/canonical/buildd/debian/upgrade-config (+11/-0)
lib/canonical/buildd/template-buildd-slave.conf (+0/-1)
lib/canonical/buildd/tests/buildd-slave-test.conf (+0/-1)
lib/canonical/launchpad/templates/launchpad-form.pt (+6/-3)
lib/canonical/widgets/product.py (+3/-1)
lib/lp/buildmaster/configure.zcml (+6/-0)
lib/lp/buildmaster/interfaces/packagebuild.py (+26/-1)
lib/lp/buildmaster/model/packagebuild.py (+45/-2)
lib/lp/buildmaster/tests/test_packagebuild.py (+49/-6)
lib/lp/code/browser/sourcepackagerecipe.py (+12/-3)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+56/-7)
lib/lp/code/model/sourcepackagerecipedata.py (+2/-0)
lib/lp/registry/doc/product-widgets.txt (+45/-2)
lib/lp/registry/model/sourcepackage.py (+5/-3)
lib/lp/soyuz/configure.zcml (+5/-0)
lib/lp/soyuz/interfaces/archive.py (+6/-0)
lib/lp/soyuz/interfaces/buildrecords.py (+11/-6)
lib/lp/soyuz/model/archive.py (+14/-4)
lib/lp/soyuz/model/binarypackagebuild.py (+21/-0)
lib/lp/soyuz/tests/test_archive.py (+1/-1)
lib/lp/soyuz/tests/test_binarypackagebuild.py (+37/-0)
lib/lp/soyuz/tests/test_hasbuildrecords.py (+31/-0)
lib/lp/testing/factory.py (+15/-6)
Text conflict in lib/lp/code/browser/tests/test_sourcepackagerecipe.py
To merge this branch: bzr merge lp://staging/~michael.nelson/launchpad/536700-present-packagebuilds-in-ppa-context
Reviewer Review Type Date Requested Status
Henning Eggers (community) code Approve
Review via email: mp+27477@code.staging.launchpad.net

Description of the change

Please review my branch:

   bzr+ssh://bazaar.launchpad.net/~michael.nelson/launchpad/536700-present-packagebuilds-in-ppa-context

revision 11006.

Test command: bin/test -vv -m test_packagebuild -m test_binarypackagebuild -m
test_hasbuildrecords

This branch does some initial work to enable PPA's to present general
IPackageBuilds rather than IBinaryPackageBuilds (bug 536700).

It adds and tests an IPackageBuildSet.getBuildsForArchive(). It adds an
optional param to the getBuildRecords() method - binary_only - which defaults
to true (current behaivour). It then updates IArchive.getBuildRecords() to
support binary_only=False.

Additionally, it adds an adapter for IBuildFarmJob->IBinaryPackageBuild in
preparation for the UI (so each build can present its title correctly).

To post a comment you must log in.
Revision history for this message
Henning Eggers (henninge) wrote :
Download full text (19.4 KiB)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Michael,
thank you for your fix and sorry for the delay...

Am 14.06.2010 10:35, schrieb Michael Nelson:
> Test command: bin/test -vv -m test_packagebuild -m test_binarypackagebuild -m
> test_hasbuildrecords

Yup, they pass. Thanks.

> This branch does some initial work to enable PPA's to present general
> IPackageBuilds rather than IBinaryPackageBuilds (bug 536700).

So, I assume that is the reason that no bug is attached to this branch?

>
> It adds and tests an IPackageBuildSet.getBuildsForArchive(). It adds an
> optional param to the getBuildRecords() method - binary_only - which defaults
> to true (current behaivour). It then updates IArchive.getBuildRecords() to
> support binary_only=False.
>
> Additionally, it adds an adapter for IBuildFarmJob->IBinaryPackageBuild in
> preparation for the UI (so each build can present its title correctly).
>

Very clever. ;-)

Here are my comments:

> === modified file 'lib/lp/buildmaster/configure.zcml'

OK.

> === modified file 'lib/lp/buildmaster/interfaces/packagebuild.py'

OK.

> === modified file 'lib/lp/buildmaster/model/packagebuild.py'
> --- lib/lp/buildmaster/model/packagebuild.py 2010-06-07 10:43:01 +0000
> +++ lib/lp/buildmaster/model/packagebuild.py 2010-06-14 08:35:42 +0000
> @@ -11,6 +11,7 @@
> from lazr.delegates import delegates
>
> from storm.locals import Int, Reference, Storm, Unicode
> +from storm.expr import Desc
>
> from zope.component import getUtility
> from zope.interface import classProvides, implements
> @@ -19,13 +20,16 @@
> from canonical.launchpad.browser.librarian import (
> ProxiedLibraryFileAlias)
> from canonical.launchpad.interfaces.lpstorm import IMasterStore
> +from canonical.launchpad.webapp.interfaces import (
> + IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR)
>
> from lp.buildmaster.interfaces.buildbase import BuildStatus
> from lp.buildmaster.interfaces.buildfarmjob import IBuildFarmJobSource
> from lp.buildmaster.interfaces.packagebuild import (
> - IPackageBuild, IPackageBuildSource)
> + IPackageBuild, IPackageBuildSet, IPackageBuildSource)
> from lp.buildmaster.model.buildbase import handle_status_for_build, BuildBase
> -from lp.buildmaster.model.buildfarmjob import BuildFarmJobDerived
> +from lp.buildmaster.model.buildfarmjob import (
> + BuildFarmJob, BuildFarmJobDerived)
> from lp.registry.interfaces.pocket import PackagePublishingPocket
> from lp.soyuz.adapters.archivedependencies import (
> default_component_dependency_name)
> @@ -214,3 +218,40 @@
> def _handleStatus_GIVENBACK(self, librarian, slave_status, logger):
> return BuildBase._handleStatus_GIVENBACK(
> self, librarian, slave_status, logger)
> +
> +
> +class PackageBuildSet:
> + implements(IPackageBuildSet)
> +
> + def getBuildsForArchive(self, archive, status=None, pocket=None):
> + """See `IPackageBuildSet`."""
> +
> + extra_exprs = []
> +
> + # Add query clause that filters on build status if the latter is
> + # provided.

I had been told that comments are not there to reiterate what the code is
doing - the code should speak for itself. Thi...

review: Needs Fixing (code)
Revision history for this message
Michael Nelson (michael.nelson) wrote :
Download full text (19.3 KiB)

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Michael,
> thank you for your fix and sorry for the delay...

No problem... it was worth all the improvements below :)

>
> Am 14.06.2010 10:35, schrieb Michael Nelson:
> > Test command: bin/test -vv -m test_packagebuild -m test_binarypackagebuild
> -m
> > test_hasbuildrecords
>
> Yup, they pass. Thanks.
>
> > This branch does some initial work to enable PPA's to present general
> > IPackageBuilds rather than IBinaryPackageBuilds (bug 536700).
>
> So, I assume that is the reason that no bug is attached to this branch?

There are two now :P

>
> >
> > It adds and tests an IPackageBuildSet.getBuildsForArchive(). It adds an
> > optional param to the getBuildRecords() method - binary_only - which
> defaults
> > to true (current behaivour). It then updates IArchive.getBuildRecords() to
> > support binary_only=False.
> >
> > Additionally, it adds an adapter for IBuildFarmJob->IBinaryPackageBuild in
> > preparation for the UI (so each build can present its title correctly).
> >
>
> Very clever. ;-)
>
> Here are my comments:
>
...
> > === modified file 'lib/lp/buildmaster/model/packagebuild.py'
> > --- lib/lp/buildmaster/model/packagebuild.py 2010-06-07 10:43:01 +0000
> > +++ lib/lp/buildmaster/model/packagebuild.py 2010-06-14 08:35:42 +0000
> > @@ -214,3 +218,40 @@
> > def _handleStatus_GIVENBACK(self, librarian, slave_status, logger):
> > return BuildBase._handleStatus_GIVENBACK(
> > self, librarian, slave_status, logger)
> > +
> > +
> > +class PackageBuildSet:
> > + implements(IPackageBuildSet)
> > +
> > + def getBuildsForArchive(self, archive, status=None, pocket=None):
> > + """See `IPackageBuildSet`."""
> > +
> > + extra_exprs = []
> > +
> > + # Add query clause that filters on build status if the latter is
> > + # provided.
>
> I had been told that comments are not there to reiterate what the code is
> doing - the code should speak for itself. This looks like such a case, does it
> not?

/me must stop doing that. Removed.

>
> > + if status is not None:
> > + extra_exprs.append(BuildFarmJob.status == status)
> > +
> > + # Add query clause that filters on pocket if the latter is
> provided.
>
> Same here. The comment is just chatter. Maybe its pseudo code that you forgot
> in here?

Ditto.

>
> > + if pocket:
> > + extra_exprs.append(PackageBuild.pocket == pocket)
> > +
> > + store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
> > + result_set = store.find(PackageBuild,
> > + PackageBuild.archive == archive,
> > + PackageBuild.build_farm_job == BuildFarmJob.id,
> > + *extra_exprs)
> > +
> > + # Ordering according status
> > + # * SUPERSEDED & All by -datecreated
>
> What does "& All" refer to"?

I updated this to: When we have a set of builds that may include pending or superseded builds, we order by -date_created (as we won't always have a date_finished), otherwise we can order by -date_finished.

>
> > + # * FULLYBUILT & FAILURES by -datebuilt
> I would put this near the "else" to expla...

Revision history for this message
Henning Eggers (henninge) wrote :

As discussed on mumble:

- Please make sure the indention is less confusing by using an intermediate variable for the states, e.g. "unfinished_states".

+ if status is None or status in [
+ BuildStatus.NEEDSBUILD,
+ BuildStatus.BUILDING,
+ BuildStatus.SUPERSEDED]:
             result_set.order_by(
                 Desc(BuildFarmJob.date_created), BuildFarmJob.id)

- AFAICT PackageBuildSet is missing from __all__ (not TestPackageBuildSet, sorry). Pleaes check that.

Thanks for you good work and patience with me. ;-)

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: