1 | | [[PageOutline]] |
2 | | |
3 | | = Building Debian Packages = |
4 | | |
5 | | |
6 | | == Bcfg2 Packaging == |
7 | | |
8 | | The Bcfg2 project provides a `debian` subdirectory with the project's source that enables users to create their own Debian/Ubuntu compatible packages (`.deb` files). The steps to do this, assuming that you are running on a Debian/Ubuntu system, are as follows: |
9 | | |
10 | | === Build deps === |
11 | | |
12 | | If the distribution you are building on already has packaged bcfg2 (even an older version), the following command will likely install the necessary packages to enable it to be built: |
13 | | |
14 | | {{{ |
15 | | apt-get build-dep bcfg2 bcfg2-server |
16 | | }}} |
17 | | |
18 | | === Install source code === |
19 | | |
20 | | Depending on which version of bcfg2 you want build, you can obtain the source code from [wiki:Download] or from the project's git |
21 | | repository. To create a local anonymous working copy of the latest version of the bcfg2 source code, use a command like the following: |
22 | | |
23 | | {{{ |
24 | | git clone git://git.mcs.anl.gov/bcfg2.git |
25 | | }}} |
26 | | |
27 | | === Update the changelog === |
28 | | |
29 | | The next step is to update the Debian `changelog` file with an appropriate package version string. Debian packages contain a version |
30 | | that is extracted from the latest entry in the `changelog` file. An appropriate version will help you distinguish your locally built |
31 | | package from one provided by your distribution. It also helps the packaging system know when a newer version of the package is available to install. |
32 | | |
33 | | It is possible to skip this step, but the packages you build will have the same version as the source distribution and will be easy to |
34 | | confuse with other similarly named (but maybe not equivalent) packages. |
35 | | |
36 | | The basic format of the package version string to use is this: |
37 | | |
38 | | {{{<UPSTREAM VER>~<UPSTREAM PRE-VER>+<GIT-ID>-0.1+<LOCAL VER>}}} |
39 | | |
40 | | '''NOTE: The '+', and '-' characters have significance in determining when one package is newer than another. The following format is believed to do the right thing in all common situations.''' |
41 | | |
42 | | The components of the package version string are explained below: |
43 | | |
44 | | `<UPSTREAM VER>`:: |
45 | | This is the version of the Bcfg source code you are working from. It will likely be something like `0.9.6` or `1.0`. |
46 | | `<UPSTREAM PRE-VER>`:: |
47 | | If you are using a published pre-release of Bcfg2, it will have a name like `pre1` or `rc1`. Use that string here, otherwise drop this component from the package version string. |
48 | | `+<GIT-ID>`:: |
49 | | If you are building from a local working copy of the git repository, it is useful to include the revision in the package version. If you are building from a downloaded copy of the source, drop this component (including the preceding plus-sign (`+`) from the package version string. |
50 | | `+<LOCAL VER>`:: |
51 | | This is a locally relevant name like your last name or your domain name, plus the digit `1`. For example, if your family name is ''Smith'', you could use `smith1`. If you work for ''Example Inc'', you could use `example1`. |
52 | | |
53 | | Here are some examples: |
54 | | |
55 | | * If you are building packages for revision 6c681bd from git, and the latest published version is 1.2.0rc1, the version string should be `1.2.0rc1+6c681bd-0.1+example1`. |
56 | | * If you are building packages for the published 1.0 rc1 version, the version string should be `1.0rc1-0.1+example1`. |
57 | | * If you are building packages for the published 1.0 version, the version string should be `1.0-0.1+example1`. |
58 | | |
59 | | If you are working on a git working copy of 1.0 pre5 and have the `devscripts` package installed, the following command is a convenient way to create a well formatted changelog entry: |
60 | | |
61 | | {{{ |
62 | | REV=$(git log --oneline | head -n 1 | cut -d' ' -f1) |
63 | | debchange --force-bad-version --preserve --newversion "1.0~pre5+${REV}-0.1+example1" git revision $REV |
64 | | }}} |
65 | | |
66 | | === Building the package === |
67 | | |
68 | | With the preliminaries out of the way, building the package is simple. |
69 | | |
70 | | {{{ |
71 | | cd .. # Change into the top level of the source directory |
72 | | fakeroot dpkg-buildpackage -uc -us |
73 | | }}} |
74 | | |
75 | | The freshly built packages will be deposited in the parent of the current directory (`..`). Examine the output of `dpkg-buildpackage` for details. |
76 | | |
77 | | == External build systems == |
78 | | |
79 | | This section describes how to build bcfg2 and deps via external build system. Currently only a PPA. Some other possibilities are: |
80 | | * #651 Look into project-builder to make more native-system bcfg2 packages available |
81 | | * http://en.opensuse.org/Build_Service/Deb_builds |
82 | | |
83 | | === Launchpad PPA === |
84 | | |
85 | | * https://launchpad.net/~bcfg2 |
86 | | |
87 | | To upload to the PPA you need to be on the active member list of [https://launchpad.net/~bcfg2 Bcfg2 in Launchpad]. |
88 | | |
89 | | Note that '''after each successful upload''', you should wait until the PPA is built, and then '''install it locally''' using "sudo aptitude update; sudo aptitude install (packagename)" so the next build doesn't fail on your local machine. If you don't want to wait for a PPA binary build to complete, you can "apt-get source (packagename)" and do a local build before the PPA build is done. |
90 | | |
91 | | ==== setup gpg-agent ==== |
92 | | |
93 | | So you won't be prompted for your passphrase a whole bunch of times... |
94 | | {{{ |
95 | | sudo aptitude install gnupg-agent pinentry-gtk2 pinentry-curses |
96 | | # replace 0xAA95C349 with your GPG Key ID |
97 | | export GPGKEY=0xAA95C349 |
98 | | killall -q gpg-agent |
99 | | eval $(gpg-agent --daemon) |
100 | | }}} |
101 | | |
102 | | ==== setup debuild ==== |
103 | | |
104 | | Tell dpkg-buildpackage who you are, for example: |
105 | | {{{ |
106 | | export DEBEMAIL="[email protected]" |
107 | | export DEBFULLNAME="Daniel Joseph Barnhart Clark" |
108 | | }}} |
109 | | |
110 | | ==== bcfg2 ==== |
111 | | |
112 | | ===== upload bcfg2 to ppa ===== |
113 | | |
114 | | A `dists` file contains a space-separated list of all distributions you want to build PPA packages for. |
115 | | |
116 | | {{{ |
117 | | #!/bin/sh |
118 | | |
119 | | . ./dists |
120 | | |
121 | | # Replace 0xAA95C349 with your GnuPG Key ID |
122 | | export GPGKEY=0xAA95C349 |
123 | | |
124 | | sudo apt-get build-dep bcfg2 bcfg2-server |
125 | | sudo aptitude install git |
126 | | |
127 | | VERSION=1.3.2-1 |
128 | | if [ ! -d testing ]; then |
129 | | mkdir testing |
130 | | fi |
131 | | DATE=$(date +%F-%H%M) |
132 | | ppa="testing" # "testing" or "ppa" (for stable) |
133 | | |
134 | | # download source |
135 | | cd testing |
136 | | git clone git://git.mcs.anl.gov/bcfg2 |
137 | | cd bcfg2 |
138 | | GITID=$(git log --oneline | head -n 1 | cut -d' ' -f1) |
139 | | cp debian/changelog ../changelog.orig |
140 | | |
141 | | for dist in $DISTS |
142 | | do |
143 | | cp ../changelog.orig debian/changelog |
144 | | (cd debian && dch --distribution ${dist} \ |
145 | | --force-bad-version \ |
146 | | --preserve \ |
147 | | --force-distribution \ |
148 | | --newversion "${VERSION}~${ppa}~${dist}${DATE}+${GITID}" \ |
149 | | "bcfg2 backport for ${dist} release ${VERSION} git commit ${GITID}") |
150 | | debuild --no-tgz-check -rfakeroot -I -S -k${GPGKEY} |
151 | | done |
152 | | |
153 | | for dist in $DISTS |
154 | | do |
155 | | dput ppa:bcfg2/${dist}testing ../bcfg2_${VERSION}~${ppa}~${dist}${DATE}+${GITID}_source.changes |
156 | | done |
157 | | }}} |
| 1 | This page has moved to http://docs.bcfg2.org/installation/building-packages.html#building-debian-packages. |