File cluster-fs.spec of Package cluster-fs.7555

#
# spec file for package cluster-fs
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# needssslcertforbuild

%ifarch x86_64
%define buildrt 0
%endif

Url:            http://oss.oracle.com/projects/ocfs2/

Name:           cluster-fs
BuildRequires:  kernel-source
BuildRequires:  kernel-syms
BuildRequires:  module-init-tools
%if 0%{?buildrt} == 1
BuildRequires:  kernel-source-rt
BuildRequires:  kernel-syms-rt
%endif
Summary:        Cluster Filesystems providing DLM, OCFS2 and GFS2
License:        GPL-2.0
Group:          System/Kernel
Version:        1.0
Release:        0
Source1:        Module.supported
Source3:        Makefile
Source4:        Makefile.ocfs2
Source5:        Makefile.ocfs2_cluster
Source6:        Makefile.ocfs2_dlm
Source7:        Makefile.ocfs2_dlmfs
Source8:        preamble
Source9:        Makefile.dlm
Source10:       Makefile.gfs2
Source11:       dlm-files
Source12:       gfs2-files
Source13:       ocfs2-files
Source14:       fs_preamble

Patch1:         0001-Add-clustername-to-cluster-connection.patch
Patch2:         0002-Add-DLM-recovery-callbacks.patch
Patch3:         0003-Shift-allocation-ocfs2_live_connection-to-user_conne.patch
Patch4:         0004-Pass-ocfs2_cluster_connection-to-ocfs2_this_node.patch
Patch5:         0005-Framework-for-version-LVB.patch
Patch6:         0006-Use-the-new-DLM-operation-callbacks-while-requesting.patch
Patch7:         gfs2-use-put_page-instead-of-alloc_pages.patch
Patch8:         ocfs2-check-if-cluster-name-exists-before-deref.patch
Patch9:         0001-ocfs2-NFS-hangs-in-__ocfs2_cluster_lock-due-to-race-.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%kernel_module_package -p %_sourcedir/preamble -f %_sourcedir/dlm-files -n dlm -v 4.0.2 
%kernel_module_package -p %_sourcedir/fs_preamble -f %_sourcedir/ocfs2-files -n ocfs2 -v 1.8.2 
%kernel_module_package -p %_sourcedir/fs_preamble -f %_sourcedir/gfs2-files -n gfs2 -v 3.1.6 

BuildRequires:  kernel-syms
BuildRequires:  module-init-tools

%description
This package contains the OCFS2, GFS2 and DLM kernel modules.

DLM stands for Distributed Lock Manager, a means to synchronize access to
shared resources over the cluster.

OCFS2 is the Oracle Cluster Filesystem, a filesystem for shared devices
accessible simultaneously from multiple nodes of a cluster.

GFS2 is Global Filesystem, a shared device filesystem.


%prep
%setup -cTn %{name}-%{version}

#
# standard kernel and -rt kernels have seperate source roots, copy
# from each one seperately.
#
kern_src=/usr/src/linux
src_root=cluster-fs/fs/

mkdir -p $src_root
cp -a $kern_src/fs/ocfs2/ $src_root
cp $RPM_SOURCE_DIR/Makefile.ocfs2 $src_root/ocfs2/Makefile
cp $RPM_SOURCE_DIR/Makefile.ocfs2_cluster $src_root/ocfs2/cluster/Makefile
cp $RPM_SOURCE_DIR/Makefile.ocfs2_dlm $src_root/ocfs2/dlm/Makefile
cp $RPM_SOURCE_DIR/Makefile.ocfs2_dlmfs $src_root/ocfs2/dlmfs/Makefile

cp -a $kern_src/fs/dlm/ $src_root
cp $RPM_SOURCE_DIR/Makefile.dlm $src_root/dlm/Makefile

cp -a $kern_src/fs/gfs2/ $src_root
cp $RPM_SOURCE_DIR/Makefile.gfs2 $src_root/gfs2/Makefile

%if 0%{?buildrt} == 1
rt_kern_src=/usr/src/linux-rt
rt_src_root=cluster-fs-rt/fs

mkdir -p $rt_src_root
cp -a $rt_kern_src/fs/ocfs2/ $rt_src_root
cp $RPM_SOURCE_DIR/Makefile.ocfs2 $rt_src_root/ocfs2/Makefile
cp $RPM_SOURCE_DIR/Makefile.ocfs2_cluster $rt_src_root/ocfs2/cluster/Makefile
cp $RPM_SOURCE_DIR/Makefile.ocfs2_dlm $rt_src_root/ocfs2/dlm/Makefile
cp $RPM_SOURCE_DIR/Makefile.ocfs2_dlmfs $rt_src_root/ocfs2/dlmfs/Makefile

cp -a $rt_kern_src/fs/dlm/ $rt_src_root
cp $RPM_SOURCE_DIR/Makefile.dlm $rt_src_root/dlm/Makefile

cp -a $rt_kern_src/fs/gfs2/ $rt_src_root
cp $RPM_SOURCE_DIR/Makefile.gfs2 $rt_src_root/gfs2/Makefile
%endif

#
# Likewise, we have to apply patches seperately to each copied source
# tree. The majority of patches should come through git anyway. This
# is here mostly to make debug patches easier to test.
#

cd cluster-fs
# Place %%patchN directives on the lines immediately following this comment.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
cd ..

%if 0%{?buildrt} == 1
cd cluster-fs-rt
# Place %%patchN directives for -rt kernel on the lines immediately following this comment.
cd ..
%endif

%build
for flavor in %flavors_to_build; do
    mkdir -p $flavor

    src=cluster-fs
    rt=`echo $flavor | cut -b -2`
    if [ $rt != "rt" ] ; then
	src=cluster-fs;
    else
	src=cluster-fs-rt;
    fi

    cp -a $src/fs/ocfs2/ $flavor/
    cp -a $src/fs/dlm/ $flavor/
    cp -a $src/fs/gfs2/ $flavor/
    cp -a $RPM_SOURCE_DIR/Module.supported $RPM_SOURCE_DIR/Makefile $flavor/
    make -C %{kernel_source $flavor} modules M=$PWD/$flavor
done

%install
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
export INSTALL_MOD_DIR=updates/fs
for flavor in %flavors_to_build; do
    make -C %{kernel_source $flavor} modules_install \
	 M=$PWD/$flavor
done

%changelog
openSUSE Build Service is sponsored by