1 # Building RPM packages for OpenAFS
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.
8 The general process is:
10 * Set up the RPM build directories
11 * Download or extract the RPM sources
14 - Source code tar file
15 - Documentation tar file
16 * Extract the openafs.spec file from the openafs code tree
17 - Set the OpenAFS version and package release versions
18 * Run rpmbuild -bs to create a source RPM
19 * Run rpmbuild with options to create RPM package files
21 Available resources for building RPM packages:
23 * The OpenAFS makefile has targets to build the source RPM
24 * The OpenAFS src/packaging/RedHat/makesrpm.pl script may be used to build the source RPM (This script is used by the makefile)
25 * The OpenAFS-contrib [afsutil package][1] script will build RPMs in a local git repo, and has options to support building packages with `mock`.
28 ## How to build release packages from an OpenAFS source distribution
30 The OpenAFS project provides a source code distributions of [releases][3]. A
31 source RPM (src.rpm) file can be built from a source distribution release,
32 which can then be used to build rpm packages.
34 Step 1. Download the source distribution files.
36 Four files are provided; source tarball, documentation tarball, release notes,
39 $ wget https://www.openafs.org/dl/openafs/1.8.5/openafs-1.8.5-src.tar.bz2
40 $ wget https://www.openafs.org/dl/openafs/1.8.5/openafs-1.8.5-doc.tar.bz2
41 $ wget https://www.openafs.org/dl/openafs/1.8.5/RELNOTES-1.8.5
42 $ wget https://www.openafs.org/dl/openafs/1.8.5/ChangeLog
44 Step 2. Extract the packaging files.
46 Extract packaging files contained in the source tarball.
48 $ tar xf openafs-1.8.5-src.tar.bz2 openafs-1.8.5/src/packaging/RedHat
50 Step 3. Run the `makesrpm.pl` script to build the source rpm.
52 $ ./openafs-1.8.5/src/packaging/RedHat/makesrpm.pl \
53 openafs-1.8.5-src.tar.bz2 \
54 openafs-1.8.5-doc.tar.bz2 \
58 SRPM is openafs-1.8.5-1.src.rpm
60 Step 4: Build the rpm packages.
62 $ rpmbuild --rebuild -bb --define "_topdir $(pwd)/rpmbuild" openafs-1.8.5-1.src.rpm
65 ## How to build release packages from git
67 The following commands show how to build RPM packages from a git checkout of a
68 released version of OpenAFS. The following commands build RPM packages from a
71 $ git clone git://git.openafs.org/openafs.git
73 $ git checkout <openafs-release-tag> # e.g., openafs-stable-1_8_5
76 $ ./configure # configure options are not required here.
77 $ make dist # creates the source distribution in ./packages
78 $ make srpm # get the source rpm name from the output
80 $ rpmbuild --rebuild -ba --define "_topdir $(pwd)/packages/rpmbuild" packages/<name>.src.rpm
82 The RPM packages will be created in the `packages/rpmbuild/RPMS` directory. See
83 the RPM spec file in src/packaging/RedHat for `--define` options for optional
84 features and packages.
86 Note: One downside to this method is the RELNOTES and ChangeLog from the
87 OpenAFS release download page are not included in the build packages.
89 ## How to build release packages with afsutil
91 The contributed `afsutil`[1] script can be used to build packages from a git
92 checkout. This tool is a front-end with various options to support building
93 client and server packages from release tags as well as non-release commits.
94 `afsutil` is available on [PyPI][2] and [github][1]
99 $ git clone git://git.openafs.org/openafs.git
101 $ git checkout <tag> # e.g., openafs-stable-1_8_5
103 $ afsutil package [options]
105 The RPM packages will be created in the `packages/rpmbuild/RPMS` directory.
107 Some commonly used `afsutil package` options are:
109 --version=<custom-version> # for testing or building custom versions
110 --csdb=<path-to-custom-CellServDB-file>
111 --spec=<path-to-custom-openafs-spec-file>
112 --build=<what to build, one of: all, sources, srpm, userspace, kmods>
113 --kernel-version=<kernel-version> # may be given more than once
115 See `afsutil package --help` for a complete list of options.
118 ## A note about version strings
120 RPM packages require a valid version string and package release number. If you
121 are building packages for a non-release version (or not a pre-release), you
122 will need to set a customized version string in the spec file.
124 For example, perhaps you want to make changes and build packages for testing,
125 or perhaps you wish to deploy packages with custom changes or fixes. In these
126 cases you will need to provide a customized version string.
128 Specify your customer version string in the `.version` file to generate a
129 `openafs.spec` file with your desired version. If you are using the `afsutil
130 package` contributed script, use the `--version` option to specify your custom
134 [1]: https://github.com/openafs-contrib/afsutil
135 [2]: https://pypi.org/project/afsutil/
136 [3]: https://www.openafs.org/release/