Diff for "Packaging/SourceBuilds/Recipes"

Not logged in - Log In / Register

Differences between revisions 3 and 4
Revision 3 as of 2010-07-20 17:55:46
Size: 5053
Editor: CPE001e6b233d5b-CM001e6b233d5a
Comment:
Revision 4 as of 2010-09-23 18:48:24
Size: 5438
Editor: CPE001e6b233d5b-CM001e6b233d5a
Comment: Use revno in examples to recommend its use.
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
# bzr-builder format 0.2 deb-version 1.0+{time} # bzr-builder format 0.2 deb-version 1.0+{revno}
Line 18: Line 18:
`deb-version 1.0+{time}` specifies the version to use for the generated package. `{time}` here is a substitution variable; more information on those will be given later. `deb-version 1.0+{revno}` specifies the version to use for the generated package. `{revno}` here is a substitution variable; more information on those will be given later.
Line 50: Line 50:
# bzr-builder format 0.2 deb-version 1.0+{time} # bzr-builder format 0.2 deb-version 1.0+{revno}+{revno:fix-build}+{revno:pyfoo}+{revno:branding}+{revno:packaging}
Line 70: Line 70:
=== Version numbers === === Version numbers and Substitution Variables ===
Line 72: Line 72:
The `deb-version` specifier allow you to specify a version number for the resulting package, but it's not very useful if it is only ever a single version number, as you need it to increase. The `deb-version` specifier allow you to specify a version number for the resulting package, but the version number needs to increase each time the package is built, so debversion supports several substitution variables.
Line 74: Line 74:
The example above (`1.0+{time}`), use a substitution variable. This will be replaced when the version number is needed with the current date and time (UTC). This will ensure that later packages get higher version numbers. The examples above use `{revno}`. This will be replaced with the revision number of the revision that was used from the primary branch. You can use the revision number of any branch by using `{revno:<branch id>}`. In the examples above, the revnos of all branches are specified. This has the nice property that a new version is generated when any of the branches changes, but not if no branches change. However, it can become unwieldy if many branches are involved.
Line 76: Line 76:
There is a second variable that you can use as well: `{revno}`. This will be replaced with the revision number of the revision that was used from the primary branch. You can use the revision number of any branch by using `{revno:<branch id>}`. You can also use {time} as a substitution variable. This will be replaced when the version number is needed with the current date and time (UTC). This will ensure that later packages get higher version numbers, whether or not their contents have changed.
Line 90: Line 90:
 * `{revno:<branch name>}` will be substituted with the revno for the branch named <branch name> in the recipe.  * `{revno:<branch id>}` will be substituted with the revno for the branch named <branch name> in the recipe.

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

Home

Getting Started

Knowledge Base

List of Daily Builds

General information

A bzr-builder "recipe" is a description of the steps needed to construct a package from the various bzr branches. Its format 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

Writing a recipe

The start of the file always looks similar to

# bzr-builder format 0.2 deb-version 1.0+{revno}

The # bzr-builder format 0.2 is the same for each, and just specifies the version of the format in use. The current format is 0.2, and is increased as the format changes.

deb-version 1.0+{revno} specifies the version to use for the generated package. {revno} here is a substitution variable; more information on those will be given later.

The next line specifies the branch to base the package on:

lp:bzr

This says that we will use the trunk of the bzr project.

Then there is any number of other lines to specify other branches to include. The usual way to do this is to use the merge keyword to specify a simple merge of the branch.

merge fix-build lp:~bzr/bzr/fix-build

fix-build is the id of the branch within this file, it doesn't have to be the same as any part of the branch URL, but it has to be unique within the file. lp:~bzr/bzr/fix-build is again the location of the branch. What we are doing here is merging in a branch that we know we need in order to fix the build, but that hasn't landed in lp:bzr yet.

The other way to include code is to use the nest keyword.

nest pyfoo lp:pyfoo foo

The nest keyword will put the contents of one branch into a specific location in another branch, instead of merging it. In this case we are nesting lp:pyfoo in to lp:bzr. We are using pyfoo to refer to it in the file, and we want it nested in the foo directory, so we specify that last.

It is possible to act on the nested branch in the same way as with the main branch. Any lines that are indented by two spaces under a nest line will act on the nested branch, e.g.

  merge branding lp:~bob/pyfoo/ubuntu-branding

would merge the ubuntu-branding branch in to foo.

The resulting branch needs to already have the debian directory in place with the packaging in it, as it can't be auto-generated. Therefore you will often need to merge (or nest) one or more packaging branches:

merge packaging lp:~bzr/bzr/packaging

In total this recipe would look like

# bzr-builder format 0.2 deb-version 1.0+{revno}+{revno:fix-build}+{revno:pyfoo}+{revno:branding}+{revno:packaging}
lp:bzr
merge fix-build lp:~bzr/bzr/fix-build
nest pyfoo lp:pyfoo foo
  merge branding lp:~bob/pyfoo/ubuntu-branding
merge packaging lp:~bzr/bzr/packaging

Specifying revisions

Sometimes you want to specify a specific revision of a branch to use, rather than the tip. You can do this by including a revision specifier at the end of any branch line, e.g.

merge packaging lp:~bzr/bzr/packaging revno:2355

or, for the first branch line

lp:bzr tag:1.0

would mean that every time the recipe was used it would use the "1.0" tag from that branch.

Version numbers and Substitution Variables

The deb-version specifier allow you to specify a version number for the resulting package, but the version number needs to increase each time the package is built, so debversion supports several substitution variables.

The examples above use {revno}. This will be replaced with the revision number of the revision that was used from the primary branch. You can use the revision number of any branch by using {revno:<branch id>}. In the examples above, the revnos of all branches are specified. This has the nice property that a new version is generated when any of the branches changes, but not if no branches change. However, it can become unwieldy if many branches are involved.

You can also use {time} as a substitution variable. This will be replaced when the version number is needed with the current date and time (UTC). This will ensure that later packages get higher version numbers, whether or not their contents have changed.

You can use as many substitution variables as you like, e.g.

  deb-version 1.0+{revno}-0ubuntu0+{revno:packaging}+{time}

Please note that the packaging in revno:packaging refers to a branch id.

Which would expand to something like

  deb-version 1.0+4264-0ubuntu0+2145+200907201627
  • {time} will be substituted with the current date and time, such as 200908191512.

  • {revno} will be the revno of the base branch (the first specified).

  • {revno:<branch id>} will be substituted with the revno for the branch named <branch name> in the recipe.

  • {debupstream} will be replaced by the upstream portion of the versionnumber taken from debian/changelog in the final tree. If when the tree is built the top of debian/changelog has a version number of "1.0-1" then this would evaluate to "1.0".

Packaging/SourceBuilds/Recipes (last edited 2021-06-07 13:41:17 by cjwatson)