Diff for "Packaging/SourceBuilds/GettingStarted"

Not logged in - Log In / Register

Differences between revisions 1 and 21 (spanning 20 versions)
Revision 1 as of 2010-07-07 18:52:43
Size: 6446
Editor: CPE001e6b233d5b-CM001e6b233d5a
Comment:
Revision 21 as of 2019-05-29 09:28:48
Size: 8696
Editor: cjwatson
Comment: LP no longer has a recipe build quota, but people should still test
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<Include(DailyBuilds/Header)>> ~-[[FrontPage|Launchpad Help]] > [[Packaging]] > [[Packaging/SourceBuilds|Daily builds]] > Getting started -~

<<Include(Packaging/SourceBuilds/Header)>>

Line 6: Line 10:
Here's the quick run-down of what you need to do, to set up your daily builds. To create your own source package recipes, you need:
Line 8: Line 12:
 * Have source code in launchpad (either use code.launchpad.net or have source import)
 * Select branch used for daily build
 * Write recipe
 * Test build locally
 * Set up daily build on Launchpad
 * (Optional) Do a test build on Launchpad
 * sourcecode in Launchpad (either hosted directly on Launchpad or imported from elsewhere)
 * a branch with buildable code
 * a recipe.
Line 15: Line 16:
= Prerequisites =
== Code in Launchpad ==
Launchpad's Daily Builds only works on [[https://help.launchpad.net/Code|code that exists in Launchpad]]. Either you [[https://help.launchpad.net/Code/UploadingABranch|make use of Launchpad Code]] yourself (easier), or you set up Launchpad to [[https://help.launchpad.net/Code/Imports|import code from somewhere else]].
You should also have confirmed that you build will work by testing it locally.
Line 19: Line 18:
== Packaging ==
Somebody needs to have packaged your software before. If your software for example is in Ubuntu or Debian, you are sorted out. If there's another branch in Launchpad, that contains packaging for your software, you are sorted out. With the "recipe" (more on the topic below), you can sort-of-merge the packaging into your daily branch.
Let's take a quick look at these in turn and then we can look at them in more detail later on.
Line 22: Line 20:
If nobody ever attempted to package your software for Debian or Ubuntu, you might want to have a look at [[PackagingGuide/PackagingOverview]] to get your initial packaging set up. == Watch the screencast ==
Line 24: Line 22:
Make sure that the build process in your packaging can deal with what's in your branch. For example, if you work on a C project with autotools, you might have to run `autoreconf -i` at some stage during the build to make sure that all the auto-generated files (which are not in version control) are present. If you prefer, you can [[http://youtu.be/_bG-SXNX9Ww|watch our screencast]], which will take you through each of the steps you need to get a source package recipe up and running.
Line 26: Line 24:
= Recipe =
"recipes" are descriptions of the steps needed to construct a package from the various bzr branches. It relies on a certain format that specifies
 * where to use the code from (trunk branch, beta branch, etc.), where to get the packaging from (separate branch? ubuntu branch?)
 * the correct package version (so users will still be able to upgrade to the stable version of the distro once it gets released)
 * what to modify to make the source build properly
= Code in Launchpad =
Line 32: Line 26:
In this first step, just write it in a text editor. Later on, you'll test it locally, then enable it in Launchpad. The code that you want to use for your source package recipe must be in Launchpad, either as a [[Code/UploadingABranch|Bazaar]] or [[Code/Git|Git]] branch that you have uploaded to Launchpad (easier) or as [[Code/Imports|an import from elsewhere]].

You can import code that is hosted anywhere on the internet, so long as Launchpad can reach it and it is available without needing a username and password. Launchpad can import code hosted in the following formats:

 * Bazaar
 * git
 * Subversion
 * CVS.

= Packaging =

It's likely that someone has already packaged the software you want to build. If that's the case, Launchpad can borrow that packaging information and you're pretty much sorted.

Similarly, if there's a branch in Launchpad that contains packaging information for your software, you can use that.

If there's no existing packaging, either for Debian or Ubuntu, you'll need to create your own. You should [[http://packaging.ubuntu.com/html/|read the Ubuntu community's guide to packaging]] to get started.

'''Note:''' you need to make sure that the build process specified by your packaging and deal with what's in your branch. For example, if you work on a C project with autotools, you might have to run `autoreconf -i` at some stage during the build to make sure that all the auto-generated files (which are not in version control) are present.

== The recipe ==

The recipe is a simple description of what steps are needed to construct a package from your various Bazaar or Git branches. It specifies:

 * which branch to use: such as the project's trunk branch or an experimental branch
 * where to find the packaging information: e.g. an Ubuntu source package branch or some other Bazaar or Git branch
 * which version to give the package: this is important to allow users to upgrade to the stable version once it is released in their distro
 * what to modify to make the source build properly.
 
= Trying it out =

The best way to learn how to create a source package recipe is to try out a simple example. All you need is a text editor and the ''bzr-builder'' plugin for Bazaar, or the ''git-build-recipe'' program for Git.

== Getting bzr-builder ==

On recent Ubuntu releases you can [[http://apt.ubuntu.com/p/bzr-builder|install the bzr-builder package]] to run tests locally.

Read more about [[Packaging/SourceBuilds/BzrBuilder|bzr-builder]].

== Getting git-build-recipe ==

As of Ubuntu 16.04, you can [[http://apt.ubuntu.com/p/git-build-recipe|install the git-build-recipe package]] to run tests locally.

On previous releases of Ubuntu, you can get the version running on Launchpad's builders from the [[https://launchpad.net/~canonical-is-sa/+archive/ubuntu/buildd|buildd PPA]].
Line 35: Line 71:
With daily build recipes you have a number of options to get the source in place so it can be built.
Line 37: Line 72:
 * ''build from trunk as is'', if you need to have the `debian/` directory with the packaging in trunk
 * ''use trunk and merge another branch'', if you don't have the packaging in trunk but in another branch that can be merged in
 * ''use trunk and nest another branch'', if you want to use a separate branch and put it into trunk in a specific location
There are different ways to write a recipe but, for this example, we're going to use the simplest: you use the project's trunk, which contains no packaging, and nest another branch that contains only packaging information.
Line 41: Line 74:
The third alternative is one that is going to work in the most cases, which is why we'll highlight it here. For other recipe types, see the [[Packaging/SourceBuilds/Recipes|recipe guide]].
Line 43: Line 76:
'''If you need anything more sophisticated or extensive documentation on all your options, please review our [[DailyBuilds/Recipes|recipe documentation]].''' For this example, we'll use the [[https://launchpad.net/wikkid|Wikkid wiki]] project.
Line 45: Line 78:
=== Simple Example === === The anatomy of a recipe ===
Line 47: Line 80:
In this example we will use trunk which does not contain any packaging and nest a separate branch that contains JUST the packaging (`./debian/` directory). Open your text editor and enter:
Line 50: Line 83:
# bzr-builder format 0.2 deb-version 1.0+{time}
lp:foo
nest foopackaging lp:~hacker/+junk/packaging debian}}}
# bzr-builder format 0.3 deb-version {debupstream}+{revno}+{revno:packaging}
lp:wikkid
merge packaging lp:~thumper/wikkid/debian}}}
Line 54: Line 87:
Now save the file as ''wikkid.recipe''.
Line 55: Line 89:
== Testing locally == '''Important:''' if for whatever reason either the Wikkid trunk or Thumper's packaging branch become unbuildable you may need to try this out with another project.

This recipe is pretty straightforward to read, but let's look at each line in turn.

The first line tells Launchpad which recipe version we're using (in this case it's 0.3), along with how we want to name the resultant package.

The next line specifies the code branch, using Launchpad's short name system.

Finally, we specify where to find the packaging branch and say that we want to nest it into the code branch.

== Testing your recipe and build ==

You should always test your recipe locally before sending it to Launchpad.
Line 58: Line 105:
'''It's very important to test your recipe locally, else your build might fail in Launchpad over and over again without you noticing. Also might the package versioning be broken. Make sure you test locally first!''' Let's start by testing the recipe itself. For now, we'll assume you're running the Ubuntu version that you want to test against.
Line 60: Line 107:
Save your recipe file to `<project>.recipe`. '''Note:''' if you want to test a specific version, see the [[http://wiki.ubuntu.com/UsingDevelopmentReleases|Ubuntu guide]].
Line 62: Line 109:
 * If you run Windows or Mac, check out how to [[https://help.ubuntu.com/community/VirtualBox|run Ubuntu in a virtual]] machine for the test.
 * If you want to test on a specific version, check out [[UbuntuDevelopment/UsingDevelopmentReleases|this documentation]] for how to do that in a safe and sane manner.
The bzr-builder plugin adds a ''dailydeb'' command to Bazaar.
Line 65: Line 111:
Once you're happy with the specific Ubuntu version you want to test this in, please install
 * `bzr-builder` from the archive if available or
 * from https://launchpad.net/~dailydebs-team/+archive/bzr-builder
Let's try it out in your terminal:
Line 69: Line 113:

In order to build the recipe you need to use the `bzr dailydeb` command. {{{
$ bzr dailydeb package.recipe working-dir
{{{
$ bzr dailydeb --allow-fallback-to-native wikkid.recipe working-dir
Line 74: Line 117:
This will perform the steps specified in `<project>.recipe`. It will create `working-dir` and put the resulting source tree and the source package there. This processes your recipe and creates a directory called ```working-dir```, into which it places the resulting source tree and source package.

Things are similar for git, but use `git-build-recipe` instead of `bzr dailydeb`.
Line 77: Line 122:
Now we have a source package. Now let's test the build process.
Line 79: Line 123:
First we set up `pbuilder`, a tool that sets up a clean, minimal environment for the build, so we can be sure it builds everywhere. If bzr-builder processed the recipe without any problems, you'll now have a source package. Let's make sure it builds.
Line 81: Line 125:
 1. `sudo apt-get install pbuilder`
 1. edit `~/.pbuilderrc` and add {{{
First, you need to set up ''pbuilder'', a tool that creates a clean, minimal environment for the build. This ensures that the build will work everywhere and that it's not dependent on something unusual in your own environment.

'''Step 1:''' Install pbuilder with ```sudo apt-get install pbuilder```

'''Step 2:''' Edit `~/.pbuilderrc` and add:

{{{
Line 84: Line 133:
 1. sudo pbuilder create
Line 86: Line 134:
To kick off the test-build, run {{{ '''Step 3:''' ```sudo pbuilder create```

Now, kick off the test build with:

{{{
Line 90: Line 142:
If the build succeeds, you can test-install the resulting package from `/var/cache/pbuilder/result/`.
If the build succeeds, you can test-install the resulting package from ```/var/cache/pbuilder/result/```.
Line 94: Line 145:
Now that you confirmed the recipe to work, the rest is very simple.
Line 96: Line 146:
{{attachment:create-recipe.png}} Now that you've confirmed that both the recipe and build work, the rest is very simple.
Line 98: Line 148:
Browse to the branch you want to build in Launchpad. Click on "(+) Create packaging recipe". Browse to the branch you want to build in Launchpad and click ''(+) Create packaging recipe''.

||<tablestyle="font-size: 0.8em; width:30%; background:#F1F1ED; margin: 1em 1em 1em 0;" style="padding:0.5em;">{{attachment:create-recipe.png}}||
||<style="text-align: center;">'''Create the build in Launchpad'''||
Line 102: Line 155:
 * ''Name:'' simple name of the recipe. Remember: you might want more than one.
 * ''Description:'' please make it clear what users of this build sign up for.
 * ''Name:'' a short name for the recipe. Remember: you might want more than one.
 * ''Description:'' make your intention clear and tell potential users of the build what they're signing up for.
Line 105: Line 158:
 * ''Build daily:'' enables building the recipe daily, instead of only on-demand.
 * ''Daily build archive:'' the archive to upload the resulting source package into.  (Only PPAs are currently supported.)
 * ''Build daily:'' enables automatic daily builds, rather than building on-demand only.
 * ''Daily build archive:'' the PPA where you want to publish the package.
Line 111: Line 164:
If you have checked "build daily", Launchpad will automatically schedule a build of your recipe once every day, if any of the branch tips have changed since the last build. However, it's a good idea to try building it yourself first, to make sure that everything is working correctly. You can use the "Request build(s)" link for this:
Line 113: Line 165:
{{attachment:request-build.png}} If you have checked "built daily", Launchpad will automatically schedule a build of your recipe once every day, if any of the branches specified have changed since the last build. However, it's a good idea to try building it yourself first, to make sure that everything is working correctly. You can use the "Request build(s)" link for this:

||<tablestyle="font-size: 0.8em; width:30%; background:#F1F1ED; margin: 1em 1em 1em 0;" style="padding:0.5em;">{{attachment:request-build.png}}||
||<style="text-align: center;">'''Manually request a build'''||

= Next steps =

Now that you've tried a simple example, let's take a more detailed look at [[Packaging/SourceBuilds/Recipes|writing recipes]].

||<tablestyle="width: 100%;" style="width: 50%;"> ~-[[Packaging/SourceBuilds|< Source package recipes overview]] -~ ||<style="text-align: right; width: 50%;"> ~- [[Packaging/SourceBuilds/Recipes|Recipes in detail >]] -~ ||

Launchpad Help > Packaging > Daily builds > Getting started

lp-diamond-16.png Source package recipes in Launchpad

Home

Getting Started

Knowledge Base

List of Daily Builds

Overview

To create your own source package recipes, you need:

  • sourcecode in Launchpad (either hosted directly on Launchpad or imported from elsewhere)
  • a branch with buildable code
  • a recipe.

You should also have confirmed that you build will work by testing it locally.

Let's take a quick look at these in turn and then we can look at them in more detail later on.

Watch the screencast

If you prefer, you can watch our screencast, which will take you through each of the steps you need to get a source package recipe up and running.

Code in Launchpad

The code that you want to use for your source package recipe must be in Launchpad, either as a Bazaar or Git branch that you have uploaded to Launchpad (easier) or as an import from elsewhere.

You can import code that is hosted anywhere on the internet, so long as Launchpad can reach it and it is available without needing a username and password. Launchpad can import code hosted in the following formats:

  • Bazaar
  • git
  • Subversion
  • CVS.

Packaging

It's likely that someone has already packaged the software you want to build. If that's the case, Launchpad can borrow that packaging information and you're pretty much sorted.

Similarly, if there's a branch in Launchpad that contains packaging information for your software, you can use that.

If there's no existing packaging, either for Debian or Ubuntu, you'll need to create your own. You should read the Ubuntu community's guide to packaging to get started.

Note: you need to make sure that the build process specified by your packaging and deal with what's in your branch. For example, if you work on a C project with autotools, you might have to run autoreconf -i at some stage during the build to make sure that all the auto-generated files (which are not in version control) are present.

The recipe

The recipe is a simple description of what steps are needed to construct a package from your various Bazaar or Git branches. It specifies:

  • which branch to use: such as the project's trunk branch or an experimental branch
  • where to find the packaging information: e.g. an Ubuntu source package branch or some other Bazaar or Git branch
  • which version to give the package: this is important to allow users to upgrade to the stable version once it is released in their distro
  • what to modify to make the source build properly.

Trying it out

The best way to learn how to create a source package recipe is to try out a simple example. All you need is a text editor and the bzr-builder plugin for Bazaar, or the git-build-recipe program for Git.

Getting bzr-builder

On recent Ubuntu releases you can install the bzr-builder package to run tests locally.

Read more about bzr-builder.

Getting git-build-recipe

As of Ubuntu 16.04, you can install the git-build-recipe package to run tests locally.

On previous releases of Ubuntu, you can get the version running on Launchpad's builders from the buildd PPA.

Writing a basic recipe

There are different ways to write a recipe but, for this example, we're going to use the simplest: you use the project's trunk, which contains no packaging, and nest another branch that contains only packaging information.

For other recipe types, see the recipe guide.

For this example, we'll use the Wikkid wiki project.

The anatomy of a recipe

Open your text editor and enter:

# bzr-builder format 0.3 deb-version {debupstream}+{revno}+{revno:packaging}
lp:wikkid
merge packaging lp:~thumper/wikkid/debian

Now save the file as wikkid.recipe.

Important: if for whatever reason either the Wikkid trunk or Thumper's packaging branch become unbuildable you may need to try this out with another project.

This recipe is pretty straightforward to read, but let's look at each line in turn.

The first line tells Launchpad which recipe version we're using (in this case it's 0.3), along with how we want to name the resultant package.

The next line specifies the code branch, using Launchpad's short name system.

Finally, we specify where to find the packaging branch and say that we want to nest it into the code branch.

Testing your recipe and build

You should always test your recipe locally before sending it to Launchpad.

Testing the recipe

Let's start by testing the recipe itself. For now, we'll assume you're running the Ubuntu version that you want to test against.

Note: if you want to test a specific version, see the Ubuntu guide.

The bzr-builder plugin adds a dailydeb command to Bazaar.

Let's try it out in your terminal:

$ bzr dailydeb --allow-fallback-to-native wikkid.recipe working-dir

This processes your recipe and creates a directory called working-dir, into which it places the resulting source tree and source package.

Things are similar for git, but use git-build-recipe instead of bzr dailydeb.

Testing the build

If bzr-builder processed the recipe without any problems, you'll now have a source package. Let's make sure it builds.

First, you need to set up pbuilder, a tool that creates a clean, minimal environment for the build. This ensures that the build will work everywhere and that it's not dependent on something unusual in your own environment.

Step 1: Install pbuilder with sudo apt-get install pbuilder

Step 2: Edit ~/.pbuilderrc and add:

COMPONENTS="main universe multiverse restricted"

Step 3: sudo pbuilder create

Now, kick off the test build with:

sudo pbuilder build <working-dir>/<project>_<version>.dsc

If the build succeeds, you can test-install the resulting package from /var/cache/pbuilder/result/.

Setting up the recipe in Launchpad

Now that you've confirmed that both the recipe and build work, the rest is very simple.

Browse to the branch you want to build in Launchpad and click (+) Create packaging recipe.

create-recipe.png

Create the build in Launchpad

Now fill in all the necessary details:

  • Name: a short name for the recipe. Remember: you might want more than one.

  • Description: make your intention clear and tell potential users of the build what they're signing up for.

  • Owner: select who drives these builds.

  • Build daily: enables automatic daily builds, rather than building on-demand only.

  • Daily build archive: the PPA where you want to publish the package.

  • Default Distribution Series: select all the Ubuntu releases you want to build the package for. Make sure all these builds work before you sign up for them!

  • Recipe text: paste your recipe in here.

Building

If you have checked "built daily", Launchpad will automatically schedule a build of your recipe once every day, if any of the branches specified have changed since the last build. However, it's a good idea to try building it yourself first, to make sure that everything is working correctly. You can use the "Request build(s)" link for this:

request-build.png

Manually request a build

Next steps

Now that you've tried a simple example, let's take a more detailed look at writing recipes.

< Source package recipes overview

Recipes in detail >

Packaging/SourceBuilds/GettingStarted (last edited 2022-10-13 08:16:57 by jugmac00)