= Build from branch into archive =
''Short description of feature''
'''Contact:''' ''JelmerVernooij'', ''MartinPool'' <
>
'''[[LEP]]:''' https://dev.launchpad.net/LEP/BuildFromBranchIntoArchive <
>
'''On Launchpad:''' [[https://bugs.launchpad.net/launchpad/+bugs?field.tag=bfbia|bfbia bugs]]
'''As a developer'''<
>
'''I want Launchpad to build source and binary packages from branches''' <
>
'''so that I don't have to build and dput source packages to PPAs manually'''<
>
== Rationale ==
At the moment building a source package from a revision in a branch on Launchpad requires creating a recipe. It would be
useful to have a way to request a one-off build of a specific revision into a PPA.
This is also a milestone towards [[https://dev.launchpad.net/LEP/BuildFromBranchIntoPrimary|BuildFromBranchIntoPrimary]].
== Risks ==
The security implications are similar to those of recipes, which can also only be targeted at PPAs. Building from a branch into the primary archive is more complex but [[https://dev.launchpad.net/LEP/BuildFromBranchIntoPrimary|beyond the scope of this LEP]].
Making it easier to request builds will also make it a lot easier to flood the build farm.
== Stakeholders ==
* ???
=== Must ===
* Provide a way to build from a branch into a PPA without having to create a recipe
* Expose this mechanism on the web UI
* Expose this mechanism via the web service
=== Nice to have ===
* lp-build-branch command in lptools that calls out to the web API. ("lp-build-branch lp:~debian-bazaar/bzr/unstable ppa:bzr/ppa")
=== Must not ===
=== Out of scope ===
* Building into anything other than PPA's; see [[https://dev.launchpad.net/LEP/BuildFromBranchIntoPrimary|BuildFromBranchIntoPrimary]]
== Workflows ==
=== Publish a change into a PPA ===
1. User makes a local branch from the source package branch.
1. Make changes
1. Commit
1. Push back to a branch
1. Request publication (through web UI or an API request)
== Success ==
=== How will we know when we are done? ===
* You can build from a branch directly into a PPA
=== How will we measure how well we have done? ===
* Number of packages built this way. (entries in the SourcePackageBranchBuildJob table?)
== Thoughts ? ==
* Where should the API request live ? IBranch.requestBuild ?
* Should we restrict the number of builds a user can request this way to prevent resource abuse? Perhaps limiting it to one active build per branch?
=== Changes needed ===
Most of these changes will be similar to what already exists for recipes. We probably want to factor out some bits to be shared between them.
* SourcePackageBranchBuild class
* New type of schedule-able job (SourcePackageBranchBuildJob) to request a source package be built from a branch. There is already a db enum for it, but we need to add a new build farm job type.
* UI bits for showing branch build jobs
* API request for requesting a build
* extension in buildmaster to support running a SourcePackageBranchBuild
* some lines in the archive uploader for handling branch builds
* UI button on branch web pages for requesting a build (allowing you to specify a target PPA and a revision)
* renaming of 'buildrecipe' script to 'buildsourcepackage' and extension or a new 'buildbranch' script
* on the builder, support for building a new kind of job, with a revision_id and a branch as custom parameters
=== Implementation questions ===
* Should we do this on top of recipes?
* For the bzr-builder side of this, it's not necessary (bzr-builder can now directly build branches, without a recipe)
* Using recipes as they currently exist may make the linkage between source package branch and built source package much looser.
* It seems like locking the source package branch to the branch makes it easier to find the right source for a package, and easier to get the right access control.
* We can generate manifests on demand from a SourcePackageBranchBuild if users need them, there's no need to store them in the database
* SourcePackageRelease currently has a link to the SourcePackageRecipeBuild ("source_package_recipe_build") that built it. Should we just add a (non-required) "source_package_branch_build" field as well, or something more advanced that can point at either a SourcePackageRecipeBuild or a SourcePackageBranchBuild?
* Should an option be available to create a zip archive? -- Xaav
* No. This is about building a branch into a Debian/Ubuntu package archive, not into a zip-like archive. Providing an option in the Launchpad UI and API to get a zip would be useful, but it's totally separate. -- mbp