# Building RPM packages for OpenAFS This pages describes how to build OpenAFS client and server packages for RHEL and CentOS using the contributed RPM spec file available in the OpenAFS source tree. Packages may be built from the OpenAFS release tar files or from a clone of the OpenAFS git repository. ## How to build release packages from an OpenAFS source distribution The OpenAFS project provides a source code distributions of [releases][3]. A source RPM (src.rpm) file can be built from a source distribution release, which can then be used to build rpm packages. Step 1. Download the source distribution files. Four files are provided; source tarball, documentation tarball, release notes, and a change log. $ wget https://www.openafs.org/dl/openafs/1.8.5/openafs-1.8.5-src.tar.bz2 $ wget https://www.openafs.org/dl/openafs/1.8.5/openafs-1.8.5-doc.tar.bz2 $ wget https://www.openafs.org/dl/openafs/1.8.5/RELNOTES-1.8.5 $ wget https://www.openafs.org/dl/openafs/1.8.5/ChangeLog Step 2. Extract the packaging files. Extract packaging files contained in the source tarball. $ tar xf openafs-1.8.5-src.tar.bz2 openafs-1.8.5/src/packaging/RedHat Step 3. Run the `makesrpm.pl` script to build the source rpm. $ ./openafs-1.8.5/src/packaging/RedHat/makesrpm.pl \ openafs-1.8.5-src.tar.bz2 \ openafs-1.8.5-doc.tar.bz2 \ RELNOTES-1.8.5 \ ChangeLog ... SRPM is openafs-1.8.5-1.src.rpm Step 4: Build the rpm packages. $ rpmbuild --rebuild -bb --define "_topdir $(pwd)/rpmbuild" openafs-1.8.5-1.src.rpm ## How to build release packages from git The following commands show how to build RPM packages from a git checkout of a released version of OpenAFS. The following commands build RPM packages from a release tag. $ git clone git://git.openafs.org/openafs.git $ cd openafs $ git checkout # e.g., openafs-stable-1_8_5 $ ./regen.sh $ ./configure # configure options are not required here. $ make dist # creates the source distribution in ./packages $ make srpm # get the source rpm name from the output $ rpmbuild --rebuild -ba --define "_topdir $(pwd)/packages/rpmbuild" packages/.src.rpm The RPM packages will be created in the `packages/rpmbuild/RPMS` directory. See the RPM spec file in src/packaging/RedHat for `--define` options for optional features and packages. Note: One downside to this method is the RELNOTES and ChangeLog from the OpenAFS release download page are not included in the built packages. ## How to build release packages with afsutil The contributed `afsutil`[1] script can be used to build packages from a git checkout. This tool is a front-end with various options to support building client and server packages from release tags as well as non-release commits. `afsutil` is available on [PyPI][2] and [github][1] $ pip install afsutil $ git clone git://git.openafs.org/openafs.git $ cd openafs $ git checkout # e.g., openafs-stable-1_8_5 $ afsutil package [options] The RPM packages will be created in the `packages/rpmbuild/RPMS` directory. Some commonly used `afsutil package` options are: --version= # for testing or building custom versions --csdb= --spec= --build= --kernel-version= # may be given more than once See `afsutil package --help` for a complete list of options. ## A note about version strings RPM packages require a valid version string and package release number. If you are building packages for a non-release version (or not a pre-release), you will need to set a customized version string in the spec file. For example, perhaps you want to make changes and build packages for testing, or perhaps you wish to deploy packages with custom changes or fixes. In these cases you will need to provide a customized version string. Specify your customer version string in the `.version` file to generate a `openafs.spec` file with your desired version. If you are using the `afsutil package` contributed script, use the `--version` option to specify your custom version. [1]: https://github.com/openafs-contrib/afsutil [2]: https://pypi.org/project/afsutil/ [3]: https://www.openafs.org/release/