aboutsummaryrefslogtreecommitdiff
path: root/docs/chapters/building.sgml
blob: 00257444690eb2738849771f0376c85f3d07ffd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<chapter id="gbp.building">
    <title>Building packages from the &git; repository</title>
    <para>
    In order to build a &debian; package from the &git; repository you use:
    &git-buildpackage;. This builds the upstream tarball as will be described below and
    invokes &debuild; to build the package. To use another build command you
    can use the <option>--git-builder</option> option as described later in the manual
    but &debuild; is nice since it can invoke <productname>linda</productname>
    und <productname>lintian</productname>.
    During the development phase (when you're either not on the
    <emphasis>debian-branch</emphasis> or when you have uncommitted changes in
    your repository) you'll usually use:
<screen>
&git-buildpackage; <option>--git-ignore-new</option>
</screen>
    <para>If &git-buildpackage; doesn't find a valid upstream tarball it will create
    one by looking at the tag matching the upstream version, if no tag can be
    found it uses the tip of the current <option>upstream-branch</option>. Any
    other treeish objecto to create the upstream tarball from can be given with
    the <option>--upstream-branch</option> option.</para>
    <para>Once you're satisfied with the build and want to do a release you commit all
    your changes and issue:</para>
<screen>
&git-buildpackage; <option>--git-tag</option>
</screen>
    <para>This will again build the debian package and tag the final result after
    extracting the current version from the changelog. If you want &gpg; signed
    tags you can use the <option>--git-sign</option> and
    <option>--git-keyid</option> options. To safe typing these option can be
    specified via the configuration files. You can futhermore change the tag
    format used when creating tags with the <option>debian-tag</option>
    option, the default is <replaceable>debian/&lt;version&gt;</replaceable>.</para>
    <sect1 id="gbp.building.export">
    <title>Using a separate build dir</title>
    <para>Tools like &svn-buildpackage; use a separate build-area. To achieve a similar behaviour
    with &git-buildpackage; use the <option>--git-export-dir</option> option:</para>
<screen>
&git-buildpackage; <option>--git-export-dir</option>=<replaceable>../build-area/</replaceable>
</screen>
    <para>This will export the current branch head to
    <replaceable>../build-area/package-version</replaceable>, check out the corresponding
    upstream tree to build the .orig.tar.gz  if necessary and build the
    package. If you don't want to export the current branch head you can use
    <option>--git-export</option> to export any treeish object, here are some
    examples:</para>
<screen>
&git-buildpackage; <option>--git-export-dir</option>=<replaceable>../build-area</replaceable> <option>--git-export</option>=<replaceable>debian/0.4.3</replaceable>
&git-buildpackage; <option>--git-export-dir</option>=<replaceable>../build-area</replaceable> <option>--git-export</option>=<replaceable>etch</replaceable>
&git-buildpackage; <option>--git-export-dir</option>=<replaceable>../build-area</replaceable> <option>--git-export</option>=<replaceable>8caed309653d69b7ab440e3d35abc090eb4c6697</replaceable>
</screen>
    <para>If you want to default to build in a separate build area you can
    specify the directory to use in the gbp.conf.
<programlisting>
[git-buildpackage]
# use a build area relative to the git repository
export-dir=../build-area
# to use the same build area for all packages use an absolute path:
#export-dir=/home/debian-packages/build-area
</programlisting>
    </para>
    </sect1>
    <sect1 id="gbp.building.push">
    <title>Pushing into a remote repository</title>
	<para>If you want to push your changes automatically after a succesful build and tag
	you can use &git-buildpackage;'s posttag hook:
<programlisting>
<command>git-buildpackage</command> <option>--git-tag</option> <option>--git-posttag</option>=<replaceable>"git push && git push --tags"</replaceable>
</programlisting>
	This assumes you have set up a remote repository to push to in either
	<filename>.git/config</filename> or
	<filename>.git/remotes/</filename>. Setting up the posttag hook in
	<filename>.gbp.conf</filename> looks like:
<programlisting>
<option>posttag</option>=<replaceable>"git push git.debian.org && git push --tags git.debian.org"</replaceable>
</programlisting>
    </para>
    </sect1>
</chapter>