Search code examples
kernelpatchrpmrpmbuildsctp

Patching lksctp RPM in linux


I am using a homegrown customized Linux that is a derivative of Oracle Linux 6 but I need to pickup all the patches from the lksctp-tools-1.0.17-2.el7.src.rpm and patch in my lksctp-tools-1.0.11-1 rpm package.

I found there are two new patches in 1.0.17-2.el7 version:

lksctp-tools-1.0.17-sctp_status-fix-hostname-resolution.patch
lksctp-tools-1.0.6-libdir.patch

I copied the above patches in the patches directory where I built a build environment and during building the new RPM I face hunk failed for the last patch:

Patch #5 (lksctp-tools-1.0.17-sctp_status-fix-hostname-resolution.patch):
+ /bin/cat /workdirs/BuildUser/build/RPM/SOURCES/lksctp-tools-1.0.17-sctp_status-fix-hostname-resolution.patch
+ /usr/bin/patch -p1 --fuzz=0
patching file src/apps/sctp_status.c
+ echo 'Patch #6 (lksctp-tools-1.0.6-libdir.patch):'
Patch #6 (lksctp-tools-1.0.6-libdir.patch):
+ /bin/cat /workdirs/BuildUser/build/RPM/SOURCES/lksctp-tools-1.0.6-libdir.patch
+ /usr/bin/patch -p1 --fuzz=0
patching file src/withsctp/withsctp.in
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED -- saving rejects to file src/withsctp/withsctp.in.rej
error: Bad exit status from /workdirs/BuildUser/tmp/rpm-tmp.nJHnek (%prep)

I have mentioned the patches in my specfile:

Name: lksctp-tools
Version: %{pack_version}
Release: ~RELEASE~
License: LGPL
Group: System Environment/Libraries
URL: http://lksctp.sourceforge.net
Source0: %{name}-%{file_version}.tar.gz
Patch0: lksctp-tools-linux-3.4.38-sctp.patch
Patch1: lksctp-tools-sctp-per-association-stats.patch
Patch2: lksctp-tools-fix-deprecated-SO_RCVBUF-SO_SNDBUF-testcase.patch
Patch3: lksctp-tools-Avoid-using-file-descriptor-0-to-get-ENOTSOCK.patch
Patch4: lksctp-tools-test_fragments-increase-message-size-since-it-succeeds.patch
Patch5: lksctp-tools-1.0.17-sctp_status-fix-hostname-resolution.patch
Patch6: lksctp-tools-1.0.6-libdir.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
BuildRequires: gcc
BuildRequires: libtool, automake, autoconf
%prep
%setup -q -n %{name}-%{file_version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1

Solution

  • The patch failed because the source doesn't match. Before automating with rpm, make sure you can apply the patches yourself manually, in the order given in the specfile. Another possible issue - did the newer source RPM replace an older patch with one of these new ones?