Fix more typos
[openafs-wiki.git] / devel / HowToBuildOpenAfsRpmPackages.mdwn
1 # Building RPM packages for OpenAFS
2
3 This pages describes how to build OpenAFS client and server packages for RHEL
4 and CentOS using the contributed RPM spec file available in the OpenAFS source
5 tree.  Packages may be built from the OpenAFS release tar files or from a clone
6 of the OpenAFS git repository.
7
8 ## How to build release packages from an OpenAFS source distribution
9
10 The OpenAFS project provides releases as [source code distributions][3]. A
11 source RPM (src.rpm) file can easily be built from a source distribution
12 release, which can then be used to build rpm packages.
13
14 Step 1. Download the source distribution files.
15
16 Four files are provided in a release; source tarball, documentation tarball,
17 release notes, and a change log.
18
19     $ wget https://www.openafs.org/dl/openafs/1.8.5/openafs-1.8.5-src.tar.bz2
20     $ wget https://www.openafs.org/dl/openafs/1.8.5/openafs-1.8.5-doc.tar.bz2
21     $ wget https://www.openafs.org/dl/openafs/1.8.5/RELNOTES-1.8.5
22     $ wget https://www.openafs.org/dl/openafs/1.8.5/ChangeLog
23
24 Step 2. Extract the packaging files.
25
26 Extract packaging files contained in the source tarball.
27
28     $ tar xf openafs-1.8.5-src.tar.bz2 openafs-1.8.5/src/packaging/RedHat
29
30 Step 3. Run build the source rpm.
31
32 Run the provided `makesrpm.pl` script to build the source rpm files from the
33 source distribution.
34
35     $ ./openafs-1.8.5/src/packaging/RedHat/makesrpm.pl \
36       openafs-1.8.5-src.tar.bz2 \
37       openafs-1.8.5-doc.tar.bz2 \
38       RELNOTES-1.8.5 \
39       ChangeLog
40     ...
41     SRPM is openafs-1.8.5-1.src.rpm
42
43 Step 4: Build the rpm packages.
44
45     $ rpmbuild --rebuild -bb --define "_topdir $(pwd)/rpmbuild" openafs-1.8.5-1.src.rpm
46
47
48 ## How to build release packages from git
49
50 The following commands show how to build RPM packages from a git checkout of a
51 released version of OpenAFS.  The following commands build RPM packages from a
52 release tag.
53
54     $ git clone git://git.openafs.org/openafs.git
55     $ cd openafs
56     $ git checkout <openafs-release-tag>  # e.g., openafs-stable-1_8_5
57
58     $ ./regen.sh
59     $ ./configure  # configure options are not required here.
60     $ make dist    # creates the source distribution in ./packages
61     $ make srpm    # get the source rpm name from the output
62
63     $ rpmbuild --rebuild -ba --define "_topdir $(pwd)/packages/rpmbuild" packages/<name>.src.rpm
64
65 The RPM packages will be created in the `packages/rpmbuild/RPMS` directory.  See
66 the RPM spec file in src/packaging/RedHat for `--define` options for optional
67 features and packages.
68
69 Note: One downside to this method is the RELNOTES and ChangeLog from the
70 OpenAFS release download page are not included in the built packages.
71
72 ## How to build release packages with afsutil
73
74 The contributed `afsutil`[1] script can be used to build packages from a git
75 checkout. This tool is a front-end with various options to support building
76 client and server packages from release tags as well as non-release commits.
77 `afsutil` is available on [PyPI][2] and [github][1]
78
79
80     $ pip install afsutil
81
82     $ git clone git://git.openafs.org/openafs.git
83     $ cd openafs
84     $ git checkout <tag>  # e.g., openafs-stable-1_8_5
85
86     $ afsutil package [options]
87
88 The RPM packages will be created in the `packages/rpmbuild/RPMS` directory.
89
90 Some commonly used `afsutil package` options are:
91
92     --version=<custom-version> # for testing or building custom versions
93     --csdb=<path-to-custom-CellServDB-file>
94     --spec=<path-to-custom-openafs-spec-file>
95     --build=<what to build, one of: all, sources, srpm, userspace, kmods>
96     --kernel-version=<kernel-version> # may be given more than once
97
98 See `afsutil package --help` for a complete list of options.
99
100
101 ## A note about version strings
102
103 RPM packages require a valid version string and package release number.  If you
104 are building packages for a non-release version (or not a pre-release), you
105 will need to set a customized version string in the spec file.
106
107 For example, perhaps you want to make changes and build packages for testing,
108 or perhaps you wish to deploy packages with custom changes or fixes. In these
109 cases you will need to provide a customized version string.
110
111 Specify your customer version string in the `.version` file to generate a
112 `openafs.spec` file with your desired version.  If you are using the `afsutil
113 package` contributed script, use the `--version` option to specify your custom
114 version.
115
116
117 [1]: https://github.com/openafs-contrib/afsutil
118 [2]: https://pypi.org/project/afsutil/
119 [3]: https://www.openafs.org/release/