Fix spelling error
[openafs-wiki.git] / devel / HowToBuildOpenAfsRpmPackages.mdwn
index 2369310..752dce2 100644 (file)
@@ -2,29 +2,44 @@
 
 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 build from the OpenAFS release tar files or from a clone
-of the OpenAFS git repository.  It is recommended to use Fedora `mock` to build
-packages, especially if you are building packages for multiple kernel versions.
-This page describes how to build packages with and without `mock`.
+tree.  Packages may be built from the OpenAFS release tar files or from a clone
+of the OpenAFS git repository.
 
-The general process is:
+## How to build release packages from an OpenAFS source distribution
 
-* Set up the RPM build directories
-* Download or extract the RPM sources
-   - Release Notes
-   - CellServDB file
-   - Source code tar file
-   - Documentation tar file
-* Extract the openafs.spec file from the openafs code tree
-   - Set the OpenAFS version and package release versions
-* Run rpmbuild -bs to create a source RPM
-* Run rpmbuild with options to create RPM package files
+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.
 
-Available resources for building RPM packages:
+Step 1. Download the source distribution files.
 
-* The OpenAFS makefile has targets to build the source RPM
-* The OpenAFS src/packaging/RedHat/makesrpm.pl script may be used to build the source RPM (This script is used by the makefile)
-* The OpenAFS-contrib [afsutil package][1] script will build RPMs in a local git repo, and has options to support building packages with `mock`.
+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
@@ -49,7 +64,7 @@ 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 build packages.
+OpenAFS release download page are not included in the built packages.
 
 ## How to build release packages with afsutil
 
@@ -79,111 +94,18 @@ Some commonly used `afsutil package` options are:
 
 See `afsutil package --help` for a complete list of options.
 
-## How to build release packages from OpenAFS source distributions
-
-The OpenAFS project provides [source code distributions of releases][3]. These
-files are, of course, available via AFS3 at
-`/afs/grand.central.org/software/openafs` The source RPM file can be built from
-the source distribution releases without external tools.
-
-Step 1. Download the source distibution 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.
-
-The packaging files are contained in the source tarball.
-
-    $ tar -x -j -f openafs-1.8.5-src.tar.bz2 openafs-1.8.5/src/packaging/RedHat
-
-
-Step 3. Set the version strings.
-
-The version being built must be set in the spec file. Replace the following
-three version placeholders to create a spec file.
-
-    $ sed \
-      -e s/@PACKAGE_VERSION@/1.8.5/ \
-      -e s/@LINUX_PKGVER@/1.8.5/ \
-      -e s/@LINUX_PKGREL@/1/  \
-      openafs-1.8.5/packaging/RedHat/openafs.spec.in > openafs.spec
-
-
-Step 4: Download the CellServDB file.
-
-The CellServDB file is maintained at grand.central.org. Download the expected
-version specified in the spec file.  The path is set in the spec file as
-`Source20` in existing spec files. This could change in the future.
-
-     $ grep '^Source20' openafs.spec
-     Source20: https://www.central.org/dl/cellservdb/CellServDB.2018-05-14
-
-     $ wget https://www.central.org/dl/cellservdb/CellServDB.2018-05-14
-
-
-Step 4. Populate the build directories.
-
-    $ mkdir -p rpmbuild/{SOURCES,SPECS,SRPMS}
-
-    $ cp openafs.spec rpmbuild/SPECS/
-
-    $ cp openafs-1.8.5-src.tar.bz2 rpmbuild/SOURCES/
-    $ cp openafs-1.8.5-doc.tar.bz2 rpmbuild/SOURCES/
-    $ cp RELNOTES-1.8.5 rpmbuild/SOURCES/
-    $ cp ChangeLog rpmbuild/SOURCES/
-
-    $ cp CellServDB.2018-05-14 rpmbuild/SOURCES/
-
-    $ cp openafs-1.8.5/src/packaging/RedHat/openafs-kvers-is.sh rpmbuild/SOURCES/
-    $ cp openafs-1.8.5/src/packaging/RedHat/openafs-buildfedora.pl rpmbuild/SOURCES/
-    $ cp openafs-1.8.5/src/packaging/RedHat/openafs-buildall.sh rpmbuild/SOURCES/
-    $ cp openafs-1.8.5/src/packaging/RedHat/openafs-kmodtool rpmbuild/SOURCES/
-
-At this point your rpmbuild tree should look like:
-
-    rpmbuild
-    ├── SOURCES
-    │   ├── CellServDB.2018-05-14
-    │   ├── ChangeLog
-    │   ├── openafs-1.8.5-doc.tar.bz2
-    │   ├── openafs-1.8.5-src.tar.bz2
-    │   ├── openafs-buildall.sh
-    │   ├── openafs-buildfedora.pl
-    │   ├── openafs-kmodtool
-    │   ├── openafs-kvers-is.sh
-    │   └── RELNOTES-1.8.5
-    ├── SPECS
-    │   └── openafs.spec
-    └── SRPMS
-
-
-Step 6: Build the source rpm:
-
-    $ rpmbuild -bs --define "_topdir $(pwd)/rpmbuild" rpmbuild/SPECS/openafs.spec
-    ...
-    Wrote: /tmp/bs2/rpmbuild/SRPMS/openafs-1.8.5-1.src.rpm
-
-Step 7: Build the rpm packages
-
-    $ rpmbuild -ba --define "_topdir $(pwd)/rpmbuild" rpmbuild/SRPMS/openafs-1.8.5-1.src.rpm
 
+## A note about version strings
 
-## 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.
 
-A note about version strings. RPM packages require a valid version string and
-package release number.  If you are building packages for version which is not
-a release (or pre-release), for example perhaps you want to make changes and
-build packages for testing, perhaps you wish to deploy packages with custom
-changes or fixes, 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.
 
-In the following examples, set the version string the `.version` to generate a
+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.