Diff for "Packaging/DailyBuilds/GettingStarted/Draft"

Not logged in - Log In / Register

Differences between revisions 2 and 3
Revision 2 as of 2011-03-22 14:04:02
Size: 7801
Editor: host217-44-165-42
Comment:
Revision 3 as of 2020-07-27 10:47:03
Size: 0
Comment: Obsolete draft of what became https://help.launchpad.net/Packaging/SourceBuilds/GettingStarted
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
~-[[FrontPage|Launchpad Help]] > [[Packaging]] > [[Packaging/DailyBuilds|Daily builds]] > Getting started -~

||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;"><<TableOfContents>>||

= Overview =

To create your own daily builds, 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.

= Code in Launchpad =

The code that you want to use for your daily build must be in Launchpad, either as a [[Code/UploadingABranch|Bazaar 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 use in a daily 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://wiki.ubuntu.com/PackagingGuide/PackagingOverview|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 branch. 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 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 daily build is to try out a simple example. All you need is a text editor and the ''bzr-builder'' plugin for Bazaar.

== Getting bzr-builder ==

You can install the bzr-builder plugin from this PPA:

 * https://launchpad.net/~dailydebs-team/+archive/bzr-builder
 
Read more about [[Packaging/SourceBuilds/BzrBuilder|bzr-builder]].

== 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 [[Packaging/DailyBuilds/Recipes|recipe guide]].

For this example, we'll use the [[Getting Things Gnome|https://launchpad.net/gtg]] project.

=== The anatomy of a recipe ===

Open your text editor and enter:

{{{
# bzr-builder format 0.2 deb-version {debupstream}+{revno}+{revno:packaging}
lp:gtg
nest packaging lp:~gtg/gtg/debian debian}}}

Now save the file as ''gtg.recipe''.

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.2), 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. Launchpad limits each user to five builds per distroseries, per recipe, per day, so failed builds will waste your allocation.

=== 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 [[http://wiki.ubuntu.com/UsingDevelopmentReleases|Ubuntu guide]].

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

Let's try it out in your terminal:

{{{
$ bzr dailydeb gtg.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.

=== 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''.

||<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'''||

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 "build 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/DailyBuilds/Recipes|writing recipes]].

||<tablestyle="width: 100%;"> ~-[[Packaging/DailyBuilds|< Daily builds overview]] -~ ||<style="text-align: right;"> ~- [[Packaging/DailyBuilds/Recipes|Recipes in detail >]] -~ ||