redhat: fix rpmbuild command line option defaults 96/12596/4
authorMichael Meffie <mmeffie@sinenomine.net>
Mon, 10 Apr 2017 18:23:12 +0000 (14:23 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 19 Jul 2017 14:58:56 +0000 (10:58 -0400)
Fix the handling of default values for the various rpmbuild options
which can be given. These have been broken as code was shuffled around
over the years.

Remove obsolete comments about detecting what to build based on the
architecture.

Provide the '--without authlibs' option to disable the openafs-authlibs
package.

Change-Id: I6c8db1f3163ee241f9a4d1282345a0ddeabd284c
Reviewed-on: https://gerrit.openafs.org/12596
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

src/packaging/RedHat/openafs.spec.in

index 90b530a..5bf446d 100644 (file)
@@ -8,13 +8,43 @@
 
 %{!?build_dkmspkg: %define build_dkmspkg 1}
 
-# Determine presence of rpmbuild command line --define arguments used for
-# option specification
+#
+# Determine presence of rpmbuild command line --define arguments and set
+# defaults if not present.
+#
 %define kernvers_on_cmdline %{?kernvers:1}%{!?kernvers:0}
 %define build_userspace_on_cmdline %{?build_userspace:1}%{!?build_userspace:0}
 %define build_modules_on_cmdline %{?build_modules:1}%{!?build_modules:0}
-%define build_authlibs_on_cmdline %{?build_authlibs:1}%{!?build_authlibs:0}
+%define debugspec_on_cmdline %{?debugspec:1}%{!?debugspec:0}
+
+%if !%{kernvers_on_cmdline}
+%define kernvers %(uname -r)
+%endif
+%if !%{build_userspace_on_cmdline}
+%define build_userspace 1
+%endif
+%if !%{build_modules_on_cmdline}
+%define build_modules 1
+%endif
+%if !%{debugspec_on_cmdline}
+%define debugspec 0
+%endif
 
+# Specify '--without authlibs' if you do not want to build the openafs-authlibs
+# package.
+%define build_authlibs %{?_without_authlibs:0}%{!?_without_authlibs:1}
+
+# Specify '--without krb5' if you do not want to build the openafs-krb5 package
+# to distribute aklog, asetkey, and akeyconvert.
+%define krb5support %{?_without_krb5:0}%{!?_without_krb5:1}
+
+# Specify '--with bootkernel' if you want to build the
+# kernel module for Red Hat BOOT Kernels on x86.
+%define bootkernelsupport %{?_with_bootkernel:1}%{!?_with_bootkernel:0}
+
+#
+# Definitions
+#
 %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7
 %define depmod /usr/sbin/depmod
 %else
 
 %define dkms_version %{pkgvers}-%{pkgrel}%{?dist}
 
-# Set 'debugspec' to 1 if you want to debug the spec file.  This will
-# not remove the installed tree as part of the %clean operation
-%if %{?debugspec:0}%{!?debugspec:1}
-%define debugspec 0
-%endif
-
-# Set 'krb5support' to 1 if you want to build the openafs-krb5 package
-# to distribute aklog and asetkey
-%define krb5support %{?_without_krb5:0}%{!?_without_krb5:1}
-
-# Set 'bootkernelsupport' to 1 if you want to build the
-# kernel module for Red Hat BOOT Kernels on x86.
-%define bootkernelsupport %{?_with_bootkernel:1}%{!?_with_bootkernel:0}
-
 # Define the location of your init.d directory
 %define initdir /etc/rc.d/init.d
 
 # Define the location of the PAM security module directory
 %define pamdir /%{_lib}/security
 
-#######################################################################
-# You probably don't need to change anything beyond this line
-# NOTE: If you do, please email me!!!
-
-# Determine which elements of OpenAFS to build.  For non-x86 arches
-# (subject to the ExclusiveArch setting, below), we build both userspace
-# and modules.  For most x86 arches, we build just the kernel modules.  For
-# i386, we build just the userspace.  If you're running an i386 kernel,
-# you'll need to tweak that last bit.
-%if !%{build_userspace_on_cmdline} && !%{build_modules_on_cmdline}
-
-%define build_userspace 1
-%define build_modules 1
-%ifarch %{ix86} x86_64 ia64
-%define build_authlibs 1
-%else
-%define build_authlibs 0
-%endif
-
-%else
-%if !%{build_userspace_on_cmdline}
-%define build_userspace 0
-%endif
-%if !%{build_modules_on_cmdline}
-%define build_modules 0
-%endif
-%endif
-
-%if !%{build_authlibs_on_cmdline}
-%if %{build_userspace_on_cmdline}
-%define build_authlibs 1
-%else
-%define build_authlibs 0
-%endif
-%endif
-
-# Make sure RPM doesn't complain about installed but non-packaged files.
-#define __check_files  %{nil}
-
 Summary: OpenAFS distributed filesystem
 Name: openafs
 Version: %{pkgvers}
@@ -164,16 +141,13 @@ what gets built:
                                   The build will define ksrvdir as
                                   %%{kbase}<kernvers>%%{kend}
 
+ --without authlibs               Disable authlibs package (default: with authlibs)
  --without krb5                   Disable krb5 support (default: with krb5)
  --with bitmap-later              Enable "bitmap later" support
  --with bos-restricted            Enable "bos restricted" mode
  --with supergroups               Enable "supergroups"
 
  --target=i386                    The target architecture to build for.
-                                  When building for a non-default target
-                                  the build may choose whether to build
-                                  userspace or kernel modules automatically.
-                                  The defaults are probably what you want.
 
  --define "build_userspace 1"     Request building of userspace tools
  --define "build_modules 1"       Request building of kernel modules