1 Star 0 Fork 6

twtlpl/kmod-drbd90

forked from src-openEuler/kmod-drbd90 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
kmod-drbd90.spec 7.93 KB
一键复制 编辑 原始数据 按行查看 历史
# Define the kmod package name here.
%define kmod_name drbd90
%define real_name drbd
%global kernel_devel_version %(rpm -qa kernel-devel | awk -F 'kernel-devel-' '{print $2}')
%{!?kmod_kernel_version: %define kmod_kernel_version %(rpm -qa kernel-devel | awk -F 'kernel-devel-|.x86|.aarch' '{print $2}')}
Name: kmod-%{kmod_name}
Version: 9.2.10
Release: 5
Summary: %{kmod_name} kernel module(s)
Group: System Environment/Kernel
License: GPL-2.0-or-later
URL: http://www.drbd.org/
Source0: https://pkg.linbit.com//downloads/drbd/9/drbd-9.2.10.tar.gz
Source1: GPL-v2.0.txt
Patch0: backport-drbd-pretty-print-cluster-wide-state-change.patch
Patch1: backport-drbd-print-node-IDs-when-starting-threads.patch
Patch2: backport-drbd-abort-twopc-directly-from-timer-function.patch
Patch3: backport-drbd-send-nested-twopc-reply-from-system-work-queue.patch
Patch4: backport-drbd-hold-RCU-lock-while-dereferencing-in-calc_data_.patch
Patch5: backport-drbd-hold-a-reference-on-ldev-for-calling-drbd_recon.patch
Patch6: 0014-drbd-clear_peer_slot-give-up-if-drbd_md_get_buffer-r.patch
Patch7: 0016-build-spatch-result-depends-on-gen_patch_names.c.patch
%define __spec_install_post /usr/lib/rpm/check-buildroot \
/usr/lib/rpm/brp-ldconfig \
/usr/lib/rpm/brp-compress \
/usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump \
/usr/lib/rpm/brp-strip-static-archive /usr/bin/strip \
/usr/lib/rpm/brp-python-bytecompile "" 1 \
/usr/lib/rpm/brp-python-hardlink \
PYTHON3="/usr/libexec/platform-python"
%define findpat %( echo "%""P" )
%define __find_requires /usr/lib/rpm/openEuler/find-requires.ksyms
%define dup_state_dir %{_localstatedir}/lib/rpm-state/kmod-dups
%define kver_state_dir %{dup_state_dir}/kver
%define kver_state_file %{kver_state_dir}/%{kmod_kernel_version}.%{_arch}
%define dup_module_list %{dup_state_dir}/rpm-kmod-%{kmod_name}-modules
%define debug_package %{nil}
%global _use_internal_dependency_generator 1
%global kernel_source() %{_usrsrc}/kernels/%{kmod_kernel_version}.%{_arch}
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
ExclusiveArch: x86_64 aarch64
BuildRequires: elfutils-libelf-devel
BuildRequires: kernel-devel >= 4.19.0
BuildRequires: kernel-rpm-macros
BuildRequires: openEuler-rpm-config
Provides: kernel-modules >= %{kmod_kernel_version}.%{_arch}
Provides: kmod-%{kmod_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires(post): %{_sbindir}/weak-modules
Requires(postun): %{_sbindir}/weak-modules
Requires: kernel >= 4.19.0
%description
DRBD is a distributed replicated block device. It mirrors a
block device over the network to another machine. Think of it
as networked raid 1. It is a building block for setting up
high availability (HA) clusters.
This package provides the %{kmod_name} kernel module(s).
It is built to depend upon the specific ABI provided by a range of releases
of the same variant of the Linux kernel and not on any one specific build.
%prep
%setup -n %{real_name}-%{version}
%autopatch -p1
echo "override drbd * weak-updates/%{kmod_name}" > kmod-%{kmod_name}.conf
echo "override drbd_transport_tcp * weak-updates/%{kmod_name}" >> kmod-%{kmod_name}.conf
%build
%{__make} %{?_smp_mflags} module KDIR=%{kernel_source} KVER=%{kversion}
whitelist="/lib/modules/kabi-current/kabi_whitelist_%{_target_cpu}"
for modules in $( find . -name "*.ko" -type f -printf "%{findpat}\n" | sed 's|\.ko$||' | sort -u ) ; do
# update greylist
nm -u ./$modules.ko | sed 's/.*U //' | sed 's/^\.//' | sort -u | while read -r symbol; do
grep -q "^\s*$symbol\$" $whitelist || echo "$symbol" >> ./greylist
done
done
sort -u greylist | uniq > greylist.txt
%install
%{__install} -d %{buildroot}/lib/modules/%{kmod_kernel_version}.%{_arch}/extra/%{kmod_name}/
%{__install} drbd/build-current/*.ko %{buildroot}/lib/modules/%{kmod_kernel_version}.%{_arch}/extra/%{kmod_name}/
%{__install} -d %{buildroot}%{_sysconfdir}/depmod.d/
%{__install} -m 0644 kmod-%{kmod_name}.conf %{buildroot}%{_sysconfdir}/depmod.d/
%{__install} -d %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/
%{__install} -m 0644 %{SOURCE1} %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/
%{__install} -m 0644 greylist.txt %{buildroot}%{_defaultdocdir}/kmod-%{kmod_name}-%{version}/
# strip the modules(s)
find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \;
# Sign the modules(s)
%if %{?_with_modsign:1}%{!?_with_modsign:0}
# If the module signing keys are not defined, define them here.
%{!?privkey: %define privkey %{_sysconfdir}/pki/SECURE-BOOT-KEY.priv}
%{!?pubkey: %define pubkey %{_sysconfdir}/pki/SECURE-BOOT-KEY.der}
for module in $(find %{buildroot} -type f -name \*.ko);
do %{_usrsrc}/kernels/%{kmod_kernel_version}.%{_arch}/scripts/sign-file \
sha256 %{privkey} %{pubkey} $module;
done
%endif
%clean
%{__rm} -rf %{buildroot}
%post
modules=( $(find /lib/modules/%{kmod_kernel_version}.%{_arch}/extra/%{kmod_name} | grep '\.ko$') )
printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --add-modules --no-initramfs
mkdir -p "%{kver_state_dir}"
touch "%{kver_state_file}"
exit 0
%posttrans
# We have to re-implement part of weak-modules here because it doesn't allow
# calling initramfs regeneration separately
if [ -f "%{kver_state_file}" ]; then
kver_base="%{kmod_kernel_version}"
kvers=$(ls -d "/lib/modules/${kver_base%%.*}"*)
for k_dir in $kvers; do
k="${k_dir#/lib/modules/}"
tmp_initramfs="/boot/initramfs-$k.tmp"
dst_initramfs="/boot/initramfs-$k.img"
# The same check as in weak-modules: we assume that the kernel present
# if the symvers file exists.
if [ -e "/$k_dir/symvers.gz" ]; then
/usr/bin/dracut -f "$tmp_initramfs" "$k" || exit 1
cmp -s "$tmp_initramfs" "$dst_initramfs"
if [ "$?" = 1 ]; then
mv "$tmp_initramfs" "$dst_initramfs"
else
rm -f "$tmp_initramfs"
fi
fi
done
rm -f "%{kver_state_file}"
rmdir "%{kver_state_dir}" 2> /dev/null
fi
rmdir "%{dup_state_dir}" 2> /dev/null
exit 0
%preun
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
mkdir -p "%{kver_state_dir}"
touch "%{kver_state_file}"
fi
mkdir -p "%{dup_state_dir}"
rpm -ql kmod-%{kmod_name}-%{version}-%{release}.%{_arch} | grep '\.ko$' > "%{dup_module_list}"
%postun
if rpm -q --filetriggers kmod 2> /dev/null| grep -q "Trigger for weak-modules call on kmod removal"; then
initramfs_opt="--no-initramfs"
else
initramfs_opt=""
fi
modules=( $(cat "%{dup_module_list}") )
rm -f "%{dup_module_list}"
printf '%s\n' "${modules[@]}" | %{_sbindir}/weak-modules --remove-modules $initramfs_opt
rmdir "%{dup_state_dir}" 2> /dev/null
exit 0
%files
%defattr(644,root,root,755)
/lib/modules/%{kmod_kernel_version}.%{_arch}/
%config /etc/depmod.d/kmod-%{kmod_name}.conf
%doc /usr/share/doc/kmod-%{kmod_name}-%{version}/
%changelog
* Tue Nov 26 liupei <liupei@kylinos.cn> - 9.2.10-5
* Sun Nov 24 2024 liupei <liupei@kylinos.cn> - 9.2.10-4
- drbd: hold RCU lock while dereferencing in calc_data_accessible()
- drbd: hold a reference on ldev for calling drbd_reconsider_queue_parameters()
* Fri Nov 22 2024 liupei <liupei@kylinos.cn> - 9.2.10-3
- drbd: abort twopc directly from timer function
- drbd: send nested twopc reply from system work queue
* Wed Nov 20 2024 liupei <liupei@kylinos.cn> - 9.2.10-2
- drbd: pretty-print cluster-wide state change
- drbd: print node IDs when starting threads
* Thu Nov 14 2024 liupei <liupei@kylinos.cn> - 9.2.10-1
- update to 9.2.10
* Tue Nov 5 2024 liupei <liupei@kylinos.cn> - 9.2.9-1
- update to 9.2.9
* Thu Aug 15 2024 baiming <bai_ming@topsec.com.cn> - 9.1.21-1
- update to 9.1.21
* Tue Nov 28 2023 liupei <liupei@kylinos.cn> - 9.1.13-1
- update to 9.1.13
* Fri Aug 26 2022 jiangxinyu <jiangxinyu@kylinos.cn> - 9.0.29-2
- Fix install error
* Fri Mar 18 2022 jiangxinyu <jiangxinyu@kylinos.cn> - 9.0.29-1
- Init project
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/twtlpl/kmod-drbd90.git
git@gitee.com:twtlpl/kmod-drbd90.git
twtlpl
kmod-drbd90
kmod-drbd90
master

搜索帮助