File scsi_ep_front.spec of Package scsi_ep_front

# needssslcertforbuild
Name: scsi_ep_front
Summary: Huawei SCSI driver for virtual cinder block storage on OTC BMS (SD100)
Version: 1.0.2
Release: 0
#Source:  %{name}.zip
Source:  %{name}.tar.bz2
Source1: preamble
Source2: open_source_software_Copyright_notice.html.gz
Patch1: fix-411.diff
Patch2: Makefile-kbuild.diff
Patch3: Mod-Supp-Ext.diff
Patch4: fix-412.diff
Vendor: Huawei Technologies Co., Ltd.
License: GPL-2.0
ExclusiveOS: linux
Group: System Environment/Kernel
BuildRequires: unzip binutils
#Provides: %{name}
ExclusiveArch: x86_64 %ix86

BuildRoot: %{_tmppath}/%{name}-%{version}-root
# do not generate debugging packages by default - newer versions of rpmbuild
# may instead need:
#%define debug_package %{nil}
%debug_package %{nil}

Requires: kernel, fileutils, findutils, gawk, bash
BuildRequires: %kernel_module_package_buildreqs
%if 0%{?centos_version} >= 700 || 0%{?rhel_version} >= 700
#BuildRequires: kabi-whitelists
#ExclusiveArch: %{ix86} x86_64

%if 0%{?suse_version} > 0
#Recommends: scsi_ep_front-kmp-default
%kernel_module_package -p %_sourcedir/preamble -x ec2 -x vmi -x xen
#Recommends: kmod-scsi_ep_front = %{version}
Requires: kmod-scsi_ep_front = %{version}
%kernel_module_package -p %_sourcedir/preamble default

This SCSI device driver exposes the SCSI (metadata.hw:passthrough=true) cinder
volumes on Bare Metal (Ironic) servers in Open Telekom Cloud.  The device
driver supports specific Huawei SDI add-in cards (SD100EP - 19e5:1610).

#%setup -n %{name}
%setup -n SD100_Card_Driver
cp -p %{S:2} .
#mv open\ source\ software\ Copyright\ notice.docx open_source_software_Copyright_notice.docx
chmod 0644 open_source_software_Copyright_notice.*
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
#chmod -x README ixgbevf.7
set -- %{name}/*
mkdir source
mv "$@" source/
mkdir obj

#make -C src clean
#make -C src
echo Build kernel modules for kernel flavors %flavors_to_build ...
for flavor in %flavors_to_build; do
    rm -rf obj/$flavor
    cp -r source obj/$flavor
    export CFLAGS_MODULE
    make -C %{kernel_source $flavor} modules %{?_smp_mflags} M=$MOD KSRC=%{kernel_source $flavor} #CFLAGS_MODULE="$CFLAGS_MODULE"

# Following line works for SUSE 11+ and RHEL 6.1+ only, must set INSTALL_MOD_DIR manually for other targets
%if 0%{?suse_version} > 0
export INSTALL_MOD_DIR=%{kernel_module_package_moddir %{name}}
%if 0%{?centos_version} > 600 || 0%{?rhel_version} > 600
export INSTALL_MOD_DIR=%{kernel_module_package_moddir %{name}}/%{name}
export INSTALL_MOD_DIR=extra/%{name}
for flavor in %flavors_to_build; do
    make -C %{kernel_source $flavor} modules_install M=$PWD/obj/$flavor
%if 0%{?suse_version} == 0
rm -f $RPM_BUILD_ROOT/lib/modules/*/modules.*
#%if 0%{?centos_version} >= 700 || 0%{?rhel_version} >= 700
#mkdir -p $RPM_BUILD_ROOT/etc/depmod.d/
#cp -p %{S:2} $RPM_BUILD_ROOT/etc/depmod.d/

rm -rf %{buildroot}

%doc LICENSE open_source_software_Copyright_notice.html.gz
#%if 0%{?centos_version} >= 700 || 0%{?rhel_version} >= 700
#%config /etc/depmod.d/kmod-ixgbevf.conf

uname -r | grep BOOT || /sbin/depmod -a > /dev/null 2>&1 || true

uname -r | grep BOOT || /sbin/depmod -a > /dev/null 2>&1 || true