Use makesrpm to build the source rpm
[openafs-wiki.git] / devel / HowToBuildOpenAfsRpmPackages.mdwn
index fd7d0af..9f5e498 100644 (file)
@@ -81,10 +81,9 @@ 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.
+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 the be used to build rpm packages.
 
 Step 1. Download the source distribution files.
 
@@ -98,80 +97,24 @@ and a change log.
 
 Step 2. Extract the packaging files.
 
-The packaging files are contained in the source tarball.
+Extract packaging files contained in the source tarball.
 
-    $ tar -x -j -f openafs-1.8.5-src.tar.bz2 openafs-1.8.5/src/packaging/RedHat
+    $ 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.
 
-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 5. 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
+    $ ./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
+    ...
     ...
-    Wrote: /tmp/bs2/rpmbuild/SRPMS/openafs-1.8.5-1.src.rpm
+    SRPM is openafs-1.8.5-1.src.rpm
 
-Step 7: Build the rpm packages
+Step 4: Build the rpm packages.
 
-    $ rpmbuild -ba --define "_topdir $(pwd)/rpmbuild" rpmbuild/SRPMS/openafs-1.8.5-1.src.rpm
+    $ rpmbuild --rebuild -bb --define "_topdir $(pwd)/rpmbuild" openafs-1.8.5-1.src.rpm
 
 
 ## Version Strings