[OpenAFS-devel] openafs.spec patch

Jack Neely jjneely@pams.ncsu.edu
Mon, 1 Jun 2009 12:52:59 -0400


--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Folks,

I've taught the .spec file used to build the OpenAFS packages to be able
to build packages using the FSH based paths rather than the transarc
style paths.  I'm not asking for the provided RPMs to be built
differently than they currently are, but this just adds a

   --without transarc-paths

option that can be used when building the packages.

If you'd like to apply this you are welcome to it.

Thanks,
Jack Neely
-- 
Jack Neely <jjneely@ncsu.edu>
Linux Czar, OIT Campus Linux Services
Office of Information Technology, NC State University
GPG Fingerprint: 1917 5AC1 E828 9337 7AA4  EA6B 213B 765F 3B6A 5B89

--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="openafs.spec.patch"

--- openafs.spec.orig	2009-06-01 11:21:53.000000000 -0400
+++ openafs.spec	2009-06-01 11:19:07.000000000 -0400
@@ -8,7 +8,7 @@
 # for beta/rc releases make pkgrel 0.X.<tag>
 # for real releases make pkgrel 1 (or more for extra releases)
 #%define pkgrel 0.1.rc1
-%define pkgrel 1.2
+%define pkgrel 1.3
 
 %if %{?osvers:0}%{!?osvers:1}
 %define osvers 1
@@ -98,6 +98,9 @@
 %define debugspec 0
 %endif
 
+# Do we use the transarc paths (--without transarc-paths)
+%define _transarc %{?_without_transarc_paths:0}%{!?_without_transarc_paths:1}
+
 # 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}
@@ -249,7 +252,7 @@
 Summary: OpenAFS distributed filesystem
 Name: openafs
 Version: %{pkgvers}
-Release: %{osvers}.%{pkgrel}
+Release: %{osvers}.%{pkgrel}%{?dist}
 License: IBM Public License
 URL: http://www.openafs.org
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
@@ -302,6 +305,7 @@
                                   %%{kbase}<kernvers>%%{kend}
 
  --without krb5                   Disable krb5 support (default: with krb5)
+ --without transarc-paths         Disable use of the Transarc paths
  --with bitmap-later              Enable "bitmap later" support
  --with bos-restricted            Enable "bos restricted" mode
  --with fast-restart              Enable "fast restart" mode
@@ -468,10 +472,6 @@
 %package kernel-source
 Summary: OpenAFS Kernel Module source tree
 Group: Networking/Filesystems
-Provides: openafs-kernel = %{PACKAGE_VERSION}
-%if %{fedorakmod}
-Provides: %{name}-kmod = %{PACKAGE_VERSION}
-%endif
 
 %description kernel-source
 The AFS distributed filesystem.  AFS is a distributed filesystem
@@ -482,6 +482,7 @@
 This package provides the source code to build your own AFS kernel
 module.
 
+%if %{_transarc}
 %package compat
 Summary: OpenAFS client compatibility symlinks
 Requires: openafs = %{PACKAGE_VERSION}, openafs-client = %{PACKAGE_VERSION}
@@ -498,6 +499,7 @@
 completely optional, and is only necessary to support legacy
 applications and scripts that hard-code the location of AFS client
 programs.
+%endif
 
 %package kpasswd
 Summary: OpenAFS KA kpasswd support
@@ -839,7 +841,7 @@
 	%{?_with_fast_restart:--enable-fast-restart} \
 	%{?_with_largefiles:--enable-largefile-fileserver} \
 	%{?_with_supergroups:--enable-supergroups} \
-	--enable-transarc-paths"
+	%{!?_without_transarc_paths:--enable-transarc-paths}"
 
 # Configure AFS
 
@@ -865,7 +867,7 @@
 
 CFLAGS="$RPM_OPT_FLAGS"; export CFLAGS
 
-./configure --with-afs-sysname=${sysname} \
+%configure --with-afs-sysname=${sysname} \
        --prefix=%{_prefix} \
        --libdir=%{_libdir} \
        --bindir=%{_bindir} \
@@ -896,7 +898,7 @@
 
     cp -R libafs_tree _kmod_build_${kvariant}
     pushd _kmod_build_${kvariant}
-    ./configure --with-afs-sysname=${sysname} \
+    %configure --with-afs-sysname=${sysname} \
   	--prefix=%{_prefix} \
 	--libdir=%{_libdir} \
 	--bindir=%{_bindir} \
@@ -1008,19 +1010,39 @@
 mkdir -p $RPM_BUILD_ROOT%{initdir}
 mkdir -p $RPM_BUILD_ROOT/etc/openafs
 mkdir -p $RPM_BUILD_ROOT%{pamdir}
+%if %{_transarc}
 mkdir -p $RPM_BUILD_ROOT%{_prefix}/afs/etc
 mkdir -p $RPM_BUILD_ROOT%{_prefix}/afs/logs
 mkdir -p $RPM_BUILD_ROOT%{_prefix}/vice/etc
 mkdir -p $RPM_BUILD_ROOT%{_prefix}/vice/cache
 chmod 700 $RPM_BUILD_ROOT%{_prefix}/vice/cache
+%else
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/libexec/openafs
+mkdir -p $RPM_BUILD_ROOT/var/cache/openafs
+chmod 700 $RPM_BUILD_ROOT/var/cache/openafs
+%endif
 mkdir -p $RPM_BUILD_ROOT%{_mandir}
 
 # Copy files from dest to the appropriate places in BuildRoot
 tar cf - -C ${sysname}/dest bin include | tar xf - -C $RPM_BUILD_ROOT%{_prefix}
 tar cf - -C ${sysname}/dest/lib . | tar xf - -C $RPM_BUILD_ROOT%{_libdir}
 tar cf - -C ${sysname}/dest/etc . | tar xf - -C $RPM_BUILD_ROOT%{_sbindir}
+%if %{_transarc}
 tar cf - -C ${sysname}/dest/root.server%{_prefix}/afs bin | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/afs
 tar cf - -C ${sysname}/dest/root.client%{_prefix}/vice/etc afsd C | tar xf - -C $RPM_BUILD_ROOT%{_prefix}/vice/etc
+%else
+install -m 755 ${sysname}/dest/root.server%{_prefix}/afs/bin/* $RPM_BUILD_ROOT%{_sbindir}
+install -m 755 ${sysname}/dest/root.client%{_prefix}/vice/etc/afsd $RPM_BUILD_ROOT%{_sbindir}
+for x in `ls -1 $RPM_BUILD_ROOT%{_bindir}` ; do
+    # We don't need duplicate files
+    y=`basename $x`
+    [ -x $RPM_BUILD_ROOT%{_sbindir}/$y ] && rm -f $RPM_BUILD_ROOT%{_sbindir}/$y
+done
+# move these to /usr/libexec/openafs
+mv -f $RPM_BUILD_ROOT%{_sbindir}/*server $RPM_BUILD_ROOT%{_sbindir}/upclient \
+    $RPM_BUILD_ROOT%{_sbindir}/salvager \
+    $RPM_BUILD_ROOT%{_prefix}/libexec/openafs/
+%endif
 
 # Link kpasswd to kapasswd
 ln -f $RPM_BUILD_ROOT%{_bindir}/kpasswd $RPM_BUILD_ROOT%{_bindir}/kapasswd
@@ -1030,6 +1052,12 @@
 install -m 755 src/packaging/RedHat/openafs-client.init $RPM_BUILD_ROOT%{initdir}/openafs-client
 install -m 755 src/packaging/RedHat/openafs-server.init $RPM_BUILD_ROOT%{initdir}/openafs-server
 
+%if ! %{_transarc}
+# Some path munging
+sed -i -e 's|/usr/vice/etc/afsd|/usr/sbin/afsd|' -e 's|/usr/vice/etc/|/etc/openafs/|g' $RPM_BUILD_ROOT%{initdir}/openafs-client
+sed -i 's|/usr/afs/bin/|/usr/libexec/openafs/|' $RPM_BUILD_ROOT%{initdir}/openafs-server
+%endif
+
 # Copy PAM modules
 install -m 755 ${sysname}/dest/lib/pam* $RPM_BUILD_ROOT%{pamdir}
 
@@ -1038,14 +1066,22 @@
 ln -sf pam_afs.krb.so.1 $RPM_BUILD_ROOT%{pamdir}/pam_afs.krb.so
 
 # Populate /usr/vice/etc
+%if %{_transarc}
 uve=$RPM_BUILD_ROOT%{_prefix}/vice/etc
+%else
+uve=$RPM_BUILD_ROOT/etc/openafs
+%endif
 install -p -m 644 src/packaging/RedHat/openafs-ThisCell $uve/ThisCell
 install -p -m 644 %{SOURCE20} $uve/CellServDB.dist
 install -p -m 644 src/packaging/RedHat/openafs-cacheinfo $uve/cacheinfo
+%if ! %{_transarc}
+sed -i 's|/usr/vice/cache|/var/cache/openafs|' $uve/cacheinfo
+%endif
 
 #
 # install dkms source
 #
+%if %{build_dkmspkg}
 install -d -m 755 $RPM_BUILD_ROOT%{_prefix}/src
 cp -a libafs_tree $RPM_BUILD_ROOT%{_prefix}/src/%{name}-%{dkms_version}
 
@@ -1064,6 +1100,7 @@
 AUTOINSTALL=yes
 
 EOF
+%endif
 
 #
 # install kernel-source
@@ -1098,7 +1135,9 @@
 
 # Copy the uninstalled krb5 files (or delete the unused krb5 files)
 %if %{krb5support}
+%if %{_transarc}
 mv $RPM_BUILD_ROOT%{_prefix}/afs/bin/asetkey $RPM_BUILD_ROOT%{_sbindir}/asetkey
+%endif
 %else
 rm -f $RPM_BUILD_ROOT%{_mandir}/man8/asetkey.*
 %endif
@@ -1178,6 +1217,7 @@
 #
 # Install compatiblity links
 #
+%if %{_transarc}
 for d in bin:bin etc:sbin; do
   olddir=`echo $d | sed 's/:.*$//'`
   newdir=`echo $d | sed 's/^.*://'`
@@ -1189,6 +1229,7 @@
     fi
   done
 done
+%endif
 
 #
 # Remove files we're not installing
@@ -1297,10 +1338,12 @@
 ##############################################################################
 %if %{build_userspace}
 
+%if %{_transarc}
 %pre compat
 if [ -e %{_prefix}/afsws ]; then
         /bin/rm -fr %{_prefix}/afsws
 fi
+%endif
 
 %post client
 chkconfig --add openafs-client
@@ -1311,17 +1354,22 @@
 fi
 
 # Create the CellServDB
-[ -f /usr/vice/etc/CellServDB.local ] || touch /usr/vice/etc/CellServDB.local
+%if %{_transarc}
+uve=/usr/vice/etc
+%else
+uve=/etc/openafs
+%endif
+[ -f $uve/CellServDB.local ] || touch $uve/CellServDB.local
 
-( cd /usr/vice/etc ; \
+( cd $uve ; \
   cat CellServDB.local CellServDB.dist > CellServDB ; \
   chmod 644 CellServDB )
 
 echo
 echo The AFS cache is configured for 100 MB. Edit the
-echo /usr/vice/etc/cacheinfo file to change this before
+echo $uve/cacheinfo file to change this before
 echo running AFS for the first time. You should also
-echo set your home cell in /usr/vice/etc/ThisCell.
+echo set your home cell in $uve/ThisCell.
 echo
 echo Also, you may want to edit /etc/pam.d/login and
 echo possibly others there to get an AFS token on login.
@@ -1435,6 +1483,7 @@
 
 %files client
 %defattr(-,root,root)
+%if %{_transarc}
 %dir %{_prefix}/vice
 %dir %{_prefix}/vice/cache
 %dir %{_prefix}/vice/etc
@@ -1442,10 +1491,15 @@
 %{_prefix}/vice/etc/CellServDB.dist
 %config %{_prefix}/vice/etc/ThisCell
 %config %{_prefix}/vice/etc/cacheinfo
-%{_bindir}/cmdebug
-%{_bindir}/up
 %{_prefix}/vice/etc/afsd
 %{_prefix}/vice/etc/C/afszcm.cat
+%else
+%dir /var/cache/openafs
+%config /etc/openafs/*
+%{_sbindir}/afsd
+%endif
+%{_bindir}/cmdebug
+%{_bindir}/up
 %{pamdir}/pam_afs.krb.so.1
 %{pamdir}/pam_afs.krb.so
 %{pamdir}/pam_afs.so.1
@@ -1461,6 +1515,7 @@
 
 %files server
 %defattr(-,root,root)
+%if %{_transarc}
 %dir %{_prefix}/afs
 %dir %{_prefix}/afs/bin
 %dir %{_prefix}/afs/etc
@@ -1480,6 +1535,13 @@
 %{_prefix}/afs/bin/vlserver
 %{_prefix}/afs/bin/volinfo
 %{_prefix}/afs/bin/volserver
+%else
+%{_prefix}/libexec/openafs/*
+%{_sbindir}/bos_util
+%{_sbindir}/ka-forwarder
+%{_sbindir}/pt_util
+%{_sbindir}/volinfo
+%endif
 %{_sbindir}/kadb_check
 %{_sbindir}/prdb_check
 %{_sbindir}/vldb_check
@@ -1583,9 +1645,11 @@
 %{_prefix}/src/openafs-kernel-%{afsvers}/README
 %{_prefix}/src/openafs-kernel-%{afsvers}/src
 
+%if %{_transarc}
 %files compat
 %defattr(-,root,root)
 %{_prefix}/afsws
+%endif
 
 %files kpasswd
 %defattr(-,root,root)
@@ -1608,6 +1672,7 @@
 
 %if !%{fedorakmod}
 %if %{up_package}
+
 %files kernel
 %defattr(-,root,root)
 %{kxmoddir}/fs/openafs/openafs.*
@@ -1646,6 +1711,11 @@
 ###
 ##############################################################################
 %changelog
+* Fri May 22 2009  Jack Neely <jjneely@ncsu.edu> 1.4.10
+- Add --without transarc-paths to enable building this package
+  with FSH style pathing.
+- kmod packaging style corrections to the openafs-kernel-source package
+
 * Wed Dec 12 2007  Simon Wilkinson <simon@sxw.org.uk> 1.4.5
 - Make the RPM mockable
 

--dDRMvlgZJXvWKvBx--