← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~cjwatson/launchpad/snap-build-channels into lp:launchpad

 


Diff comments:

> === modified file 'lib/lp/snappy/interfaces/snap.py'
> --- lib/lp/snappy/interfaces/snap.py	2017-08-22 11:36:30 +0000
> +++ lib/lp/snappy/interfaces/snap.py	2018-02-08 13:37:58 +0000
> @@ -281,17 +282,23 @@
>      @operation_parameters(
>          archive=Reference(schema=IArchive),
>          distro_arch_series=Reference(schema=IDistroArchSeries),
> -        pocket=Choice(vocabulary=PackagePublishingPocket))
> +        pocket=Choice(vocabulary=PackagePublishingPocket),
> +        channels=Dict(
> +            title=_("Source channels to use for this build."),

Sadly circular imports make this inordinately painful.  The best I could do for the moment was to sync up the declarations properly.

> +            key_type=TextLine(), required=False))
>      # Really ISnapBuild, patched in lp.snappy.interfaces.webservice.
>      @export_factory_operation(Interface, [])
>      @operation_for_version("devel")
> -    def requestBuild(requester, archive, distro_arch_series, pocket):
> +    def requestBuild(requester, archive, distro_arch_series, pocket,
> +                     channels=None):
>          """Request that the snap package be built.
>  
>          :param requester: The person requesting the build.
>          :param archive: The IArchive to associate the build with.
>          :param distro_arch_series: The architecture to build for.
>          :param pocket: The pocket that should be targeted.
> +        :param channels: A dictionary mapping snap names to channels to use
> +            for this build.
>          :return: `ISnapBuild`.
>          """
>  
> 
> === modified file 'lib/lp/snappy/model/snap.py'
> --- lib/lp/snappy/model/snap.py	2017-11-10 11:23:27 +0000
> +++ lib/lp/snappy/model/snap.py	2018-02-08 13:37:58 +0000
> @@ -917,6 +926,15 @@
>                      SnapBuild.snap_id == Snap.id,
>                      SnapBuild.archive_id == Snap.auto_build_archive_id,
>                      SnapBuild.pocket == Snap.auto_build_pocket,
> +                    # These columns are nullable so require some care, since
> +                    # a straightforward equality check will compile to
> +                    # "SnapBuild.channels = Snap.auto_build_channels" which
> +                    # is false if both are NULL.
> +                    Or(
> +                        And(
> +                            SnapBuild.channels == None,
> +                            Snap.auto_build_channels == None),
> +                        SnapBuild.channels == Snap.auto_build_channels),

Ah, much better, thanks!

>                      # We only want Snaps that haven't had an automatic
>                      # SnapBuild dispatched for them recently.
>                      SnapBuild.date_created >= threshold_date)),


-- 
https://code.launchpad.net/~cjwatson/launchpad/snap-build-channels/+merge/337360
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.


References