forked from christopherdion/scst
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scst.spec.in
222 lines (205 loc) · 7.78 KB
/
scst.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
%define kmod_name scst
# kversion: Kernel version as it appears under /lib/modules.
# The algorithm for setting the variable kversion is as follows:
# - If the variable kversion has been set, use its value.
# - If the variable kdir has been set, derive the kernel version from kdir.
# - Otherwise use the version number of the running kernel.
%{!?kversion:
%{?kdir:%define kversion %{expand:%%(
make -sC "%{kdir}" kernelversion | grep -v ^make)}}
%{!?kdir:
%define kversion %{expand:%%(uname -r)}}}
%{echo:kdir=%{kdir} kversion=%{kversion}
}
# kernel_rpm: Name of the kernel RPM if the kernel is available as an RPM.
# krpmver: Version of the kernel RPM. Not necessarily identical to kversion.
%if %{expand:%%(rpm --quiet -qf /lib/modules/%{kversion}/kernel/arch 2>/dev/null;
echo $((1-$?)))}
%define kernel_rpm %{expand:%%(
rpm -q --qf '%%%%{name}\\n' -f \\
/lib/modules/%%{kversion}/kernel/arch | uniq
)}
%define krpmver %{expand:%%(
rpm -q --qf '%%%%{version}-%%%%{release}\\n' -f \\
/lib/modules/%%{kversion}/kernel/arch | uniq
)}
%else
%if %{expand:%%(rpm --quiet -q kernel-headers; echo $((1-$?)))}
%define kernel_rpm kernel
%define krpmver %{expand:%%(
rpm -q --qf '%%%%{BUILDTIME} %%%%{version}-%%%%{release}\\n' \\
kernel-headers | sort | tail -n1 | { read a b; echo $b; }
)}
%endif
%endif
%{?kernel_rpm:
%{echo:kernel_rpm=%{kernel_rpm}
}
%{echo:krpmver=%{krpmver}
}}
# kernel_devel_rpm: Name of the kernel development RPM.
%if 0%{?kernel_rpm:1}
%if %([ %{kernel_rpm} = kernel-plus-core ]; echo $((1-$?)))
# CentOSPlus
%define kernel_devel_rpm kernel-plus-devel
%else
%if %([ %{kernel_rpm} = kernel-ml-core ]; echo $((1-$?)))
# RHEL/CentOS elrepo mainline
%define kernel_devel_rpm kernel-ml-devel
%else
%if %([ %{kernel_rpm} = kernel-core ]; echo $((1-$?)))
# Fedora
%define kernel_devel_rpm kernel-devel
%else
# Other Linux distros
%define kernel_devel_rpm %{kernel_rpm}-devel
%endif
%endif
%endif
%{echo:kernel_devel_rpm=%{kernel_devel_rpm}
}
%endif
# Version of the RPM that is being built.
%define rpm_version @rpm_version@
# Make command with or without flags.
%define make %{expand:%%(echo ${MAKE:-make})}
%define pkgrel 1
Name: %{kmod_name}-%{kversion}
Version: %{rpm_version}
Release: %{pkgrel}%{?dist}
Summary: SCST mid-layer kernel drivers
Group: System/Kernel
License: GPLv2
Vendor: http://scst.sourceforge.net/
URL: http://scst.sourceforge.net/
# Unfortunately the Red Hat / CentOS kernel-debug-devel RPM provides
# kernel-devel so a workaround is needed to match the kernel-devel RPM.
BuildRequires: %{?kernel_rpm:%{kernel_rpm} = %{krpmver} %{kernel_devel_rpm} = %{krpmver}} gcc make
Source: %{kmod_name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
AutoReqProv: no
Requires: %{?kernel_rpm:%{kernel_rpm} = %{krpmver}} @depmod@ %{expand:%%(for c in find rm; do echo -n "$(PATH=/usr/sbin:/usr/bin:/sbin:/bin which $c) "; done)}
Provides: scst
%description
A generic SCSI target subsystem for Linux that allows to convert any Linux
server into a sophisticated storage server. The three layers in SCST are the
target driver layer; the SCSI target core and the device handler layer. SCST
target drivers realize communication with an initiator and implement a storage
protocol like iSCSI, FC or SRP. SCST device handlers implement a SCSI
interface on top of local storage. Examples of such local storage are SCSI
RAID controller (dev_disk handler), block device (vdisk_blockio handler), file
(vdisk_fileio handler) or custom block device behavior implemented in user
space (scst_user).
Authors:
--------
Vladislav Bolkhovitin, Bart Van Assche and others
%package devel
Summary: SCST mid-layer kernel driver development package
Group: Development/Kernel
BuildArch: noarch
%description devel
A generic SCSI target subsystem for Linux (SCST) that allows to convert
any Linux server into a sophisticated storage server. SCST target drivers
implement protocols like iSCSI, FC or SRP. SCST device handlers either
provide access to a local SCSI RAID controller (dev_disk), block device
(vdisk_blockio), file (vdisk_fileio) or custom block device behavior
implemented in user space (scst_user).
Authors:
--------
Vladislav Bolkhovitin, Bart Van Assche and others
%prep
%setup -q -n %{kmod_name}-%{version}
%build
%{?kdir:export KDIR=%{kdir}}
%{!?kdir:%{?kversion:export KVER=%{kversion}}}
export PREFIX=%{_prefix}
export BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y
make 2release
for d in scst fcst iscsi-scst qla2x00t/qla2x00-target scst_local srpt; do
%{make} -C $d
done
%install
%{?kdir:export KDIR=%{kdir}}
%{!?kdir:%{?kversion:export KVER=%{kversion}}}
export PREFIX=%{_prefix} MANDIR=%{_mandir} DEPMOD=true
export BUILD_2X_MODULE=y CONFIG_SCSI_QLA_FC=y CONFIG_SCSI_QLA2XXX_TARGET=y
for d in scst; do
DESTDIR=%{buildroot} %{make} -C $d install
done
for d in fcst iscsi-scst qla2x00t/qla2x00-target scst_local srpt; do
DESTDIR=%{buildroot} INSTALL_MOD_PATH=%{buildroot} %{make} -C $d install
done
# Set the executable bit such that /usr/lib/rpm/find-debuginfo.sh can find the
# SCST kernel modules.
find %{buildroot}/lib/modules -name '*.ko' -print0 | xargs -0 chmod u+x
rm -f %{buildroot}/lib/modules/%{kversion}/[Mm]odule*
%clean
rm -rf %{buildroot}
%pre
# Remove any existing ib_srpt.ko kernel modules
find /lib/modules/%{kversion} -name ib_srpt.ko -exec rm {} \;
# Remove files installed by "make install"
rm -f /usr/local/man/man5/iscsi-scstd.conf.5
rm -f /usr/local/man/man8/iscsi-scst-adm.8
rm -f /usr/local/man/man8/iscsi-scstd.8
rm -f /usr/local/sbin/iscsi-scst-adm
rm -f /usr/local/sbin/iscsi-scstd
rm -rf /usr/local/include/scst
%post
@depmod@ -a %{kversion}
%files
%defattr(0644,root,root,0755)
/lib/modules/%{kversion}/extra/fcst.ko
/lib/modules/%{kversion}/extra/ib_srpt.ko
/lib/modules/%{kversion}/extra/iscsi-scst.ko
/lib/modules/%{kversion}/extra/isert-scst.ko
/lib/modules/%{kversion}/extra/qla2x00tgt.ko
/lib/modules/%{kversion}/extra/qla2xxx_scst.ko
/lib/modules/%{kversion}/extra/scst.ko
/lib/modules/%{kversion}/extra/scst_local.ko
%dir /lib/modules/%{kversion}/extra/dev_handlers
/lib/modules/%{kversion}/extra/dev_handlers/scst_cdrom.ko
/lib/modules/%{kversion}/extra/dev_handlers/scst_changer.ko
/lib/modules/%{kversion}/extra/dev_handlers/scst_disk.ko
/lib/modules/%{kversion}/extra/dev_handlers/scst_modisk.ko
/lib/modules/%{kversion}/extra/dev_handlers/scst_processor.ko
/lib/modules/%{kversion}/extra/dev_handlers/scst_raid.ko
/lib/modules/%{kversion}/extra/dev_handlers/scst_tape.ko
/lib/modules/%{kversion}/extra/dev_handlers/scst_user.ko
/lib/modules/%{kversion}/extra/dev_handlers/scst_vdisk.ko
%defattr(-,root,root,0755)
%{_mandir}/man5/iscsi-scstd.conf.5.gz
%{_mandir}/man8/iscsi-scst-adm.8.gz
%{_mandir}/man8/iscsi-scstd.8.gz
%{_sbindir}/iscsi-scst-adm
%{_sbindir}/iscsi-scstd
%dir /var/lib/scst/dif_tags
%dir /var/lib/scst/pr
%dir /var/lib/scst/vdev_mode_pages
%files devel
%defattr(-,root,root,0755)
%dir /usr/include/scst
/usr/include/scst/Module.symvers
/usr/include/scst/backport.h
/usr/include/scst/build_mode.h
/usr/include/scst/scst.h
/usr/include/scst/scst_const.h
/usr/include/scst/scst_debug.h
/usr/include/scst/scst_itf_ver.h
/usr/include/scst/scst_sgv.h
/usr/include/scst/scst_user.h
%changelog
* Sun Mar 8 2020 Bart Van Assche <[email protected]>
- Added support for the CentOSPlus kernel.
* Tue Oct 8 2019 Bart Van Assche <[email protected]>
- Make this spec file compatible with rpmbuild v4.14.
* Wed May 6 2015 Bart Van Assche <[email protected]>
- Build in release mode instead of debug mode.
* Mon May 4 2015 Bart Van Assche <[email protected]>
- Added iSER target driver.
* Mon Feb 23 2015 Bart Van Assche <[email protected]>
- Split spec file into a non-DKMS and a DKMS spec file.
* Fri Jan 16 2015 Bart Van Assche <[email protected]>
- Added DKMS support.
* Fri Nov 22 2013 Bart Van Assche <[email protected]>
- Initial spec file.