Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-fs/nfs-utils/files/, net-fs/nfs-utils/
Date: Sat, 09 Oct 2021 05:19:55
Message-Id: 1633756758.212922697015df2aac781bfe7f34bad7603385a0.sam@gentoo
1 commit: 212922697015df2aac781bfe7f34bad7603385a0
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 9 05:19:18 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 9 05:19:18 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21292269
7
8 net-fs/nfs-utils: add upstream patch for older kernels (<5.3)
9
10 Bug: https://bugs.gentoo.org/808183
11 Signed-off-by: Sam James <sam <AT> gentoo.org>
12
13 .../files/nfs-utils-2.5.4-kernel-5.3-nfsv4.patch | 32 +++
14 net-fs/nfs-utils/nfs-utils-2.5.4-r2.ebuild | 219 +++++++++++++++++++++
15 2 files changed, 251 insertions(+)
16
17 diff --git a/net-fs/nfs-utils/files/nfs-utils-2.5.4-kernel-5.3-nfsv4.patch b/net-fs/nfs-utils/files/nfs-utils-2.5.4-kernel-5.3-nfsv4.patch
18 new file mode 100644
19 index 00000000000..c9a543191b5
20 --- /dev/null
21 +++ b/net-fs/nfs-utils/files/nfs-utils-2.5.4-kernel-5.3-nfsv4.patch
22 @@ -0,0 +1,32 @@
23 +https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commitdiff;h=feb3dfc7127cf1337530ccb06ed90e818b026a07#patch1
24 +https://bugzilla.redhat.com/show_bug.cgi?id=1979816
25 +https://bugs.gentoo.org/808183
26 +
27 +Slightly rebased by sam@ to account for version.h moving around.
28 +
29 +From feb3dfc7127cf1337530ccb06ed90e818b026a07 Mon Sep 17 00:00:00 2001
30 +From: Steve Dickson <steved@××××××.com>
31 +Date: Wed, 22 Sep 2021 11:31:56 -0400
32 +Subject: [PATCH] mountd: only do NFSv4 logging on supported kernels.
33 +
34 +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1979816
35 +Signed-off-by: Steve Dickson <steved@××××××.com>
36 +--- a/support/export/v4clients.c
37 ++++ b/support/export/v4clients.c
38 +@@ -10,6 +10,7 @@
39 + #include <sys/inotify.h>
40 + #include <errno.h>
41 + #include "export.h"
42 ++#include "../../utils/mount/version.h"
43 +
44 + /* search.h declares 'struct entry' and nfs_prot.h
45 + * does too. Easiest fix is to trick search.h into
46 +@@ -23,6 +24,8 @@ static int clients_fd = -1;
47 +
48 + void v4clients_init(void)
49 + {
50 ++ if (linux_version_code() < MAKE_VERSION(5, 3, 0))
51 ++ return;
52 + if (clients_fd >= 0)
53 + return;
54 + clients_fd = inotify_init1(IN_NONBLOCK);
55
56 diff --git a/net-fs/nfs-utils/nfs-utils-2.5.4-r2.ebuild b/net-fs/nfs-utils/nfs-utils-2.5.4-r2.ebuild
57 new file mode 100644
58 index 00000000000..1b938e11441
59 --- /dev/null
60 +++ b/net-fs/nfs-utils/nfs-utils-2.5.4-r2.ebuild
61 @@ -0,0 +1,219 @@
62 +# Copyright 1999-2021 Gentoo Authors
63 +# Distributed under the terms of the GNU General Public License v2
64 +
65 +EAPI=7
66 +
67 +inherit autotools linux-info systemd
68 +
69 +DESCRIPTION="NFS client and server daemons"
70 +HOMEPAGE="http://linux-nfs.org/"
71 +
72 +if [[ "${PV}" = *_rc* ]] ; then
73 + MY_PV="$(ver_rs 1- -)"
74 + SRC_URI="http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=snapshot;h=refs/tags/${PN}-${MY_PV};sf=tgz -> ${P}.tar.gz"
75 + S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
76 +else
77 + SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
78 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
79 +fi
80 +
81 +LICENSE="GPL-2"
82 +SLOT="0"
83 +IUSE="caps ipv6 junction kerberos ldap +libmount nfsdcld +nfsidmap +nfsv4 nfsv41 sasl selinux tcpd +uuid"
84 +REQUIRED_USE="kerberos? ( nfsv4 )"
85 +RESTRICT="test" #315573
86 +
87 +# kth-krb doesn't provide the right include
88 +# files, and nfs-utils doesn't build against heimdal either,
89 +# so don't depend on virtual/krb.
90 +# (04 Feb 2005 agriffis)
91 +DEPEND="
92 + dev-db/sqlite:3
93 + dev-libs/libxml2
94 + net-libs/libtirpc:=
95 + >=net-nds/rpcbind-0.2.4
96 + sys-fs/e2fsprogs
97 + caps? ( sys-libs/libcap )
98 + ldap? (
99 + net-nds/openldap
100 + sasl? (
101 + app-crypt/mit-krb5
102 + dev-libs/cyrus-sasl:2
103 + )
104 + )
105 + libmount? ( sys-apps/util-linux )
106 + nfsv4? (
107 + dev-libs/libevent:=
108 + >=sys-apps/keyutils-1.5.9:=
109 + kerberos? (
110 + >=net-libs/libtirpc-0.2.4-r1[kerberos]
111 + app-crypt/mit-krb5
112 + )
113 + )
114 + nfsv41? (
115 + sys-fs/lvm2
116 + )
117 + tcpd? ( sys-apps/tcp-wrappers )
118 + uuid? ( sys-apps/util-linux )"
119 +RDEPEND="${DEPEND}
120 + !net-libs/libnfsidmap
121 + !net-nds/portmap
122 + !<sys-apps/openrc-0.13.9
123 + selinux? (
124 + sec-policy/selinux-rpc
125 + sec-policy/selinux-rpcbind
126 + )
127 +"
128 +BDEPEND="
129 + net-libs/rpcsvc-proto
130 + virtual/pkgconfig
131 +"
132 +
133 +PATCHES=(
134 + "${FILESDIR}"/${PN}-2.5.2-no-werror.patch
135 + # Upstream, see bug #808183
136 + "${FILESDIR}"/${P}-kernel-5.3-nfsv4.patch
137 +)
138 +
139 +pkg_setup() {
140 + linux-info_pkg_setup
141 + if use nfsv4 && ! use nfsdcld && linux_config_exists && ! linux_chkconfig_present CRYPTO_MD5 ; then
142 + ewarn "Your NFS server will be unable to track clients across server restarts!"
143 + ewarn "Please enable the \"${HILITE}nfsdcld${NORMAL}\" USE flag to install the nfsdcltrack usermode"
144 + ewarn "helper upcall program, or enable ${HILITE}CONFIG_CRYPTO_MD5${NORMAL} in your kernel to"
145 + ewarn "support the legacy, in-kernel client tracker."
146 + fi
147 +}
148 +
149 +src_prepare() {
150 + default
151 +
152 + sed \
153 + -e "/^sbindir/s:= := \"${EPREFIX}\":g" \
154 + -i utils/*/Makefile.am || die
155 +
156 + eautoreconf
157 +}
158 +
159 +src_configure() {
160 + export libsqlite3_cv_is_recent=yes # Our DEPEND forces this.
161 + export ac_cv_header_keyutils_h=$(usex nfsidmap)
162 +
163 + # SASL is consumed in a purely automagic way
164 + export ac_cv_header_sasl_h=no
165 + export ac_cv_header_sasl_sasl_h=$(usex sasl)
166 +
167 + local myeconfargs=(
168 + --disable-static
169 + --with-statedir="${EPREFIX}"/var/lib/nfs
170 + --enable-tirpc
171 + --with-tirpcinclude="${ESYSROOT}"/usr/include/tirpc/
172 + --with-pluginpath="${EPREFIX}"/usr/$(get_libdir)/libnfsidmap
173 + --with-rpcgen
174 + --with-systemd="$(systemd_get_systemunitdir)"
175 + --without-gssglue
176 + $(use_enable caps)
177 + $(use_enable ipv6)
178 + $(use_enable junction)
179 + $(use_enable kerberos gss)
180 + $(use_enable kerberos svcgss)
181 + $(use_enable ldap)
182 + $(use_enable libmount libmount-mount)
183 + $(use_enable nfsdcld nfsdcltrack)
184 + $(use_enable nfsv4)
185 + $(use_enable nfsv41)
186 + $(use_enable uuid)
187 + $(use_with tcpd tcp-wrappers)
188 + )
189 + econf "${myeconfargs[@]}"
190 +}
191 +
192 +src_compile() {
193 + # remove compiled files bundled in the tarball
194 + emake clean
195 + default
196 +}
197 +
198 +src_install() {
199 + default
200 + rm linux-nfs/Makefile* || die
201 + dodoc -r linux-nfs README
202 +
203 + # Don't overwrite existing xtab/etab, install the original
204 + # versions somewhere safe... more info in pkg_postinst
205 + keepdir /var/lib/nfs/{,sm,sm.bak}
206 + mv "${ED}"/var/lib/nfs "${ED}"/usr/$(get_libdir)/ || die
207 +
208 + # Install some client-side binaries in /sbin
209 + dodir /sbin
210 + mv "${ED}"/usr/sbin/rpc.statd "${ED}"/sbin/ || die
211 +
212 + if use nfsv4 && use nfsidmap ; then
213 + insinto /etc
214 + doins support/nfsidmap/idmapd.conf
215 +
216 + # Install a config file for idmappers in newer kernels. #415625
217 + insinto /etc/request-key.d
218 + echo 'create id_resolver * * /usr/sbin/nfsidmap -t 600 %k %d' > id_resolver.conf
219 + doins id_resolver.conf
220 + fi
221 +
222 + insinto /etc
223 + doins "${FILESDIR}"/exports
224 + keepdir /etc/exports.d
225 +
226 + local f list=() opt_need=""
227 + if use nfsv4 ; then
228 + opt_need="rpc.idmapd"
229 + list+=( rpc.idmapd rpc.pipefs )
230 + use kerberos && list+=( rpc.gssd rpc.svcgssd )
231 + fi
232 + for f in nfs nfsclient rpc.statd "${list[@]}" ; do
233 + newinitd "${FILESDIR}"/${f}.initd ${f}
234 + done
235 + newinitd "${FILESDIR}"/nfsmount.initd-1.3.1 nfsmount # Nuke after 2015/08/01
236 + for f in nfs nfsclient ; do
237 + newconfd "${FILESDIR}"/${f}.confd ${f}
238 + done
239 + sed -i \
240 + -e "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" \
241 + "${ED}"/etc/conf.d/nfs || die #234132
242 +
243 + local systemd_systemunitdir="$(systemd_get_systemunitdir)"
244 + sed -i \
245 + -e 's:/usr/sbin/rpc.statd:/sbin/rpc.statd:' \
246 + "${ED}${systemd_systemunitdir}"/* || die
247 +
248 + keepdir /var/lib/nfs #368505
249 + keepdir /var/lib/nfs/v4recovery #603628
250 +
251 + # no static archives
252 + find "${ED}" -name '*.la' -delete || die
253 +}
254 +
255 +pkg_postinst() {
256 + # Install default xtab and friends if there's none existing. In
257 + # src_install we put them in /usr/lib/nfs for safe-keeping, but
258 + # the daemons actually use the files in /var/lib/nfs. #30486
259 + local f
260 + for f in "${EROOT}"/usr/$(get_libdir)/nfs/*; do
261 + [[ -e ${EROOT}/var/lib/nfs/${f##*/} ]] && continue
262 + einfo "Copying default ${f##*/} from ${EPREFIX}/usr/$(get_libdir)/nfs to ${EPREFIX}/var/lib/nfs"
263 + cp -pPR "${f}" "${EROOT}"/var/lib/nfs/
264 + done
265 +
266 + if systemd_is_booted; then
267 + for v in ${REPLACING_VERSIONS}; do
268 + if ver_test "${v}" -lt 1.3.0; then
269 + ewarn "We have switched to upstream systemd unit files. Since"
270 + ewarn "they got renamed, you should probably enable the new ones."
271 + ewarn "You can run 'equery files nfs-utils | grep systemd'"
272 + ewarn "to know what services you need to enable now."
273 + fi
274 + done
275 + else
276 + ewarn "If you use OpenRC, the nfsmount service has been replaced with nfsclient."
277 + ewarn "If you were using nfsmount, please add nfsclient and netmount to the"
278 + ewarn "same runlevel as nfsmount."
279 + fi
280 +}