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

#
# 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

ExcludeArch:    i586 s390
%ifarch x86_64
%define buildrt 1
%endif

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

Name:           cluster-fs
BuildRequires:  kernel-obs-build
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
Source15:       md-files
Source16:       Makefile.md

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 
%kernel_module_package -p %_sourcedir/fs_preamble -f %_sourcedir/md-files -n cluster-md -v 0.0.1 

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.
#
for kern_src in /usr/src/linux \
%if 0%{?buildrt}
	/usr/src/linux-rt
%else
	;
%endif
		do
	src=$(readlink "$kern_src")
	src=${src##*/}

	mkdir $src
	cp -a $RPM_SOURCE_DIR/Makefile $RPM_SOURCE_DIR/Module.supported $src

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

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

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

	mkdir $src/drivers
	cp -a $kern_src/drivers/md $src/drivers
	cp -a $kern_src/include/uapi/linux/raid $src/drivers/md
	cp $RPM_SOURCE_DIR/Makefile.md $src/drivers/md/Makefile

	#
	# 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.
	#
	pushd $src
	# 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
	popd
done

%build
for flavor in %flavors_to_build; do
	# use the patched source directory created in %%prep
	src=$(readlink /lib/modules/$(make -sC %{kernel_source $flavor} kernelrelease)/source)
	src=${src##*/}
	cp -a $src/ $flavor
	make %{?_smp_mflags} -C %{kernel_source $flavor} modules M=$PWD/$flavor
done

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

%changelog
openSUSE Build Service is sponsored by