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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<chapter id="gbp.rpm.development">
<title>Development flow</title>
<sect1 id="gbp.rpm.setup.models">
<title>Development models</title>
<para>The &git-buildpackage-rpm; toolset basically supports three different
models of package maintenance.</para>
<sect2>
<title>Native package</title>
<para>This means that you are the upstream, there is no separate
upstream with which you have to sync. Basically, only <option>packaging-branch</>
is used - it contains both the source code and packaging files. No
patches should be present as all changes can be directly committed to
upstream (which is you). When building, &git-buildpackage-rpm; will create
the source tarball and copy it and the packaging to the build directory.
</para>
</sect2>
<sect2>
<title>Upstream package, alternative 1: packaging and sources in the same branch</title>
<para>This represents somewhat Debian-style package maintenance.
All changes (packaging and source code) are done to the same branch,
i.e., the <option>packaging-branch</>, based on the <option>upstream-branch</>.
When package is built,
&git-buildpackage-rpm; can automatically generate patches from
upstream version to packaging branch head (one patch per commit).
and modify the spec file accordingly.
</para>
</sect2>
<sect2>
<title>Upstream package, alternative 2: packaging and sources in separate branches</title>
<para>In this model packaging files (spec and patches) are held in
<option>packaging-branch</> and upstream sources in <option>upstream-branch</>.
Your code development is done on the <option>patch-queue-branch</>,
based on the <option>upstream-branch</>, which only contains source
code but no packaging files. When building the package, &gbp-pq-rpm;
tool is used to export patches from the patch queue branch to the
packaging branch and edit the spec file accordingly.
Finally, &git-buildpackage-rpm; will create the upstream source
tarball and export it and the packaging files to the build directory,
and, build the RPM package.
</para>
</sect2>
</sect1>
<sect1 id="gbp.rpm.setup.scratch">
<title>Starting from scratch with a non-native package</title>
<para>In this case, you most probably want to package software not yet
found in your distro. First, create an empty repository:
<screen>
<command>mkdir</> mypackage
<command>cd</> mypackage
<command>git init</>
</screen>
Then, import the upstream sources, create the packaging/development
branch and add the rpm packaging files. You have two choices:
<orderedlist>
<listitem><para>packaging files and development sources in the same branch
<screen>
<command>git-import-orig-rpm</> ../mypackage.tar.gz
# Optionally (recommended): add gbp.conf
<command>vim</> .gbp.conf && <command>git add</> .gbp.conf && <command>git commit</> -m"Add gbp.conf"
# Add packaging files to source tree under subdir 'packaging'
<command>mkdir</> packaging && <command>cd</> packaging
<command>vim</> mypackage.spec
<command>git add</> .
<command>git commit</> -m"Add packaging files"
</screen></para>
</listitem>
<listitem><para>development sources and packaging files in separate branches
<screen>
<command>git-import-orig-rpm</> --no-merge ../mypackage.tar.gz
# Optionally (recommended): add gbp.conf
<command>vim</> .gbp.conf && <command>git add</> .gbp.conf && <command>git commit</> -m"Add gbp.conf"
# Add packaging files (to root of master branch)
<command>vim</> mypackage.spec
<command>git add </> .
<command>git commit</> -m"Add packaging files"
</screen></para>
</listitem>
</orderedlist>
</para>
</sect1>
<sect1 id="gbp.rpm.setup.convert">
<title>Converting an existing git repository of a non-native package</title>
<para>In this case, you already have a git repository containing the
upstream source, but it was created neither with &gbp-clone; nor &git-import-srpm;.
You need to have a separate branch for upstream sources.
If you already have that, you can simply rename that branch to the default upstream-branch:
<screen>
<command>$ git branch</> -m my-old-upstream-branch upstream
</screen>
OR just add the name of your upstream branch to gbp.conf.
Then, you just create a packaging/development branch(es) with git and
add packaging files to the packaging branch.
</para>
</sect1>
</chapter>
|