1 |
commit: 0d44f61a3dcb6e943edb307c7196cd0f7044af79 |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 26 20:13:37 2019 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 26 20:30:41 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d44f61a |
7 |
|
8 |
sys-fs/zfs: unkeyworded revbump of 0.7.13, udev timeout patch |
9 |
|
10 |
Bug: https://bugs.gentoo.org/627320 |
11 |
Package-Manager: Portage-2.3.79, Repoman-2.3.18 |
12 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
13 |
|
14 |
.../0.7.13-ZPOOL_IMPORT_UDEV_TIMEOUT_MS.patch | 70 +++++++ |
15 |
sys-fs/zfs/zfs-0.7.13-r2.ebuild | 220 +++++++++++++++++++++ |
16 |
2 files changed, 290 insertions(+) |
17 |
|
18 |
diff --git a/sys-fs/zfs/files/0.7.13-ZPOOL_IMPORT_UDEV_TIMEOUT_MS.patch b/sys-fs/zfs/files/0.7.13-ZPOOL_IMPORT_UDEV_TIMEOUT_MS.patch |
19 |
new file mode 100644 |
20 |
index 00000000000..922e5951bdf |
21 |
--- /dev/null |
22 |
+++ b/sys-fs/zfs/files/0.7.13-ZPOOL_IMPORT_UDEV_TIMEOUT_MS.patch |
23 |
@@ -0,0 +1,70 @@ |
24 |
+From a0767672aac01f41516550e3808ff72da893102f Mon Sep 17 00:00:00 2001 |
25 |
+From: Georgy Yakovlev <gyakovlev@g.o> |
26 |
+Date: Tue, 26 Nov 2019 12:07:36 -0800 |
27 |
+Subject: [PATCH] backport udev timeout patch |
28 |
+ |
29 |
+https://github.com/zfsonlinux/zfs/commit/803884217f9b9b5fb235d7c5e78a809d271f6387 |
30 |
+--- |
31 |
+ lib/libzfs/libzfs_import.c | 11 ++++++++++- |
32 |
+ man/man8/zpool.8 | 6 ++++++ |
33 |
+ 2 files changed, 16 insertions(+), 1 deletion(-) |
34 |
+ |
35 |
+diff --git a/lib/libzfs/libzfs_import.c b/lib/libzfs/libzfs_import.c |
36 |
+index 9dbf207..cd08806 100644 |
37 |
+--- a/lib/libzfs/libzfs_import.c |
38 |
++++ b/lib/libzfs/libzfs_import.c |
39 |
+@@ -53,6 +53,7 @@ |
40 |
+ #endif |
41 |
+ #include <stddef.h> |
42 |
+ #include <stdlib.h> |
43 |
++#include <stdio.h> |
44 |
+ #include <string.h> |
45 |
+ #include <sys/stat.h> |
46 |
+ #include <unistd.h> |
47 |
+@@ -1594,17 +1595,25 @@ zpool_open_func(void *arg) |
48 |
+ if (rn->rn_labelpaths) { |
49 |
+ char *path = NULL; |
50 |
+ char *devid = NULL; |
51 |
++ char *env = NULL; |
52 |
+ rdsk_node_t *slice; |
53 |
+ avl_index_t where; |
54 |
++ int timeout; |
55 |
+ int error; |
56 |
+ |
57 |
+ if (label_paths(rn->rn_hdl, rn->rn_config, &path, &devid)) |
58 |
+ return; |
59 |
+ |
60 |
++ env = getenv("ZPOOL_IMPORT_UDEV_TIMEOUT_MS"); |
61 |
++ if ((env == NULL) || sscanf(env, "%d", &timeout) != 1 || |
62 |
++ timeout < 0) { |
63 |
++ timeout = DISK_LABEL_WAIT; |
64 |
++ } |
65 |
++ |
66 |
+ /* |
67 |
+ * Allow devlinks to stabilize so all paths are available. |
68 |
+ */ |
69 |
+- zpool_label_disk_wait(rn->rn_name, DISK_LABEL_WAIT); |
70 |
++ zpool_label_disk_wait(rn->rn_name, timeout); |
71 |
+ |
72 |
+ if (path != NULL) { |
73 |
+ slice = zfs_alloc(hdl, sizeof (rdsk_node_t)); |
74 |
+diff --git a/man/man8/zpool.8 b/man/man8/zpool.8 |
75 |
+index 46e531e..10a19b5 100644 |
76 |
+--- a/man/man8/zpool.8 |
77 |
++++ b/man/man8/zpool.8 |
78 |
+@@ -2291,6 +2291,12 @@ Similar to the |
79 |
+ option in |
80 |
+ .Nm zpool import . |
81 |
+ .El |
82 |
++.Bl -tag -width "ZPOOL_IMPORT_UDEV_TIMEOUT_MS" |
83 |
++.It Ev ZPOOL_IMPORT_UDEV_TIMEOUT_MS |
84 |
++The maximum time in milliseconds that |
85 |
++.Nm zpool import |
86 |
++will wait for an expected device to be available. |
87 |
++.El |
88 |
+ .Bl -tag -width "ZPOOL_VDEV_NAME_GUID" |
89 |
+ .It Ev ZPOOL_VDEV_NAME_GUID |
90 |
+ Cause |
91 |
+-- |
92 |
+2.24.0 |
93 |
+ |
94 |
|
95 |
diff --git a/sys-fs/zfs/zfs-0.7.13-r2.ebuild b/sys-fs/zfs/zfs-0.7.13-r2.ebuild |
96 |
new file mode 100644 |
97 |
index 00000000000..928b6e1c532 |
98 |
--- /dev/null |
99 |
+++ b/sys-fs/zfs/zfs-0.7.13-r2.ebuild |
100 |
@@ -0,0 +1,220 @@ |
101 |
+# Copyright 1999-2019 Gentoo Authors |
102 |
+# Distributed under the terms of the GNU General Public License v2 |
103 |
+ |
104 |
+EAPI="5" |
105 |
+PYTHON_COMPAT=( python{2_7,3_5,3_6} ) |
106 |
+ |
107 |
+if [ ${PV} == "9999" ] ; then |
108 |
+ inherit git-r3 linux-mod |
109 |
+ AUTOTOOLS_AUTORECONF="1" |
110 |
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git" |
111 |
+else |
112 |
+ SRC_URI="https://github.com/zfsonlinux/${PN}/releases/download/${P}/${P}.tar.gz" |
113 |
+ KEYWORDS="" |
114 |
+fi |
115 |
+ |
116 |
+inherit autotools-utils bash-completion-r1 flag-o-matic linux-info python-single-r1 systemd toolchain-funcs udev usr-ldscript |
117 |
+ |
118 |
+DESCRIPTION="Userland utilities for ZFS Linux kernel module" |
119 |
+HOMEPAGE="https://zfsonlinux.org/" |
120 |
+ |
121 |
+LICENSE="BSD-2 CDDL MIT" |
122 |
+SLOT="0" |
123 |
+IUSE="custom-cflags debug kernel-builtin +rootfs systemd test-suite static-libs" |
124 |
+RESTRICT="test" |
125 |
+ |
126 |
+COMMON_DEPEND=" |
127 |
+ net-libs/libtirpc |
128 |
+ sys-apps/util-linux[static-libs?] |
129 |
+ sys-libs/zlib[static-libs(+)?] |
130 |
+ virtual/awk |
131 |
+" |
132 |
+DEPEND="${COMMON_DEPEND} |
133 |
+ virtual/pkgconfig |
134 |
+" |
135 |
+ |
136 |
+RDEPEND="${COMMON_DEPEND} |
137 |
+ ${PYTHON_DEPS} |
138 |
+ !=sys-apps/grep-2.13* |
139 |
+ !kernel-builtin? ( =sys-fs/zfs-kmod-${PV}* ) |
140 |
+ !sys-fs/zfs-fuse |
141 |
+ !prefix? ( virtual/udev ) |
142 |
+ test-suite? ( |
143 |
+ sys-apps/util-linux |
144 |
+ sys-devel/bc |
145 |
+ sys-block/parted |
146 |
+ sys-fs/lsscsi |
147 |
+ sys-fs/mdadm |
148 |
+ sys-process/procps |
149 |
+ virtual/modutils |
150 |
+ ) |
151 |
+ rootfs? ( |
152 |
+ app-arch/cpio |
153 |
+ app-misc/pax-utils |
154 |
+ !<sys-boot/grub-2.00-r2:2 |
155 |
+ !<sys-kernel/genkernel-3.5.1.1 |
156 |
+ !<sys-kernel/genkernel-next-67 |
157 |
+ !<sys-kernel/bliss-initramfs-7.1.0 |
158 |
+ !<sys-kernel/dracut-044-r1 |
159 |
+ ) |
160 |
+ sys-fs/udev-init-scripts |
161 |
+" |
162 |
+ |
163 |
+REQUIRED_USE="${PYTHON_REQUIRED_USE}" |
164 |
+ |
165 |
+AT_M4DIR="config" |
166 |
+AUTOTOOLS_IN_SOURCE_BUILD="1" |
167 |
+ |
168 |
+PATCHES=( "${FILESDIR}/0.7.13-ZPOOL_IMPORT_UDEV_TIMEOUT_MS.patch" ) |
169 |
+ |
170 |
+pkg_setup() { |
171 |
+ python-single-r1_pkg_setup |
172 |
+ if use kernel_linux && use test-suite; then |
173 |
+ linux-info_pkg_setup |
174 |
+ if ! linux_config_exists; then |
175 |
+ ewarn "Cannot check the linux kernel configuration." |
176 |
+ else |
177 |
+ # recheck that we don't have usblp to collide with libusb |
178 |
+ if use test-suite; then |
179 |
+ if linux_chkconfig_present BLK_DEV_LOOP; then |
180 |
+ eerror "The ZFS test suite requires loop device support enabled." |
181 |
+ eerror "Please enable it:" |
182 |
+ eerror " CONFIG_BLK_DEV_LOOP=y" |
183 |
+ eerror "in /usr/src/linux/.config or" |
184 |
+ eerror " Device Drivers --->" |
185 |
+ eerror " Block devices --->" |
186 |
+ eerror " [ ] Loopback device support" |
187 |
+ fi |
188 |
+ fi |
189 |
+ fi |
190 |
+ fi |
191 |
+} |
192 |
+ |
193 |
+src_prepare() { |
194 |
+ # Update paths |
195 |
+ sed -e "s|/sbin/lsmod|/bin/lsmod|" \ |
196 |
+ -e "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" \ |
197 |
+ -e "s|/sbin/parted|/usr/sbin/parted|" \ |
198 |
+ -i scripts/common.sh.in || die |
199 |
+ |
200 |
+ autotools-utils_src_prepare |
201 |
+} |
202 |
+ |
203 |
+src_configure() { |
204 |
+ use custom-cflags || strip-flags |
205 |
+ local myeconfargs=( |
206 |
+ --bindir="${EPREFIX}/bin" |
207 |
+ --sbindir="${EPREFIX}/sbin" |
208 |
+ --with-config=user |
209 |
+ --with-dracutdir="${EPREFIX}/usr/lib/dracut" |
210 |
+ --with-linux="${KV_DIR}" |
211 |
+ --with-linux-obj="${KV_OUT_DIR}" |
212 |
+ --with-udevdir="$(get_udevdir)" |
213 |
+ --with-systemdunitdir="$(systemd_get_systemunitdir)" |
214 |
+ --with-systemdpresetdir="${EPREFIX}/lib/systemd/system-preset" |
215 |
+ $(use_enable debug) |
216 |
+ $(use_enable systemd) |
217 |
+ ) |
218 |
+ autotools-utils_src_configure |
219 |
+ |
220 |
+ # prepare systemd unit and helper script |
221 |
+ cat "${FILESDIR}/zfs.service.in" | \ |
222 |
+ sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \ |
223 |
+ -e "s:@sysconfdir@:${EPREFIX}/etc:g" \ |
224 |
+ > "${T}/zfs.service" || die |
225 |
+ cat "${FILESDIR}/zfs-init.sh.in" | \ |
226 |
+ sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \ |
227 |
+ -e "s:@sysconfdir@:${EPREFIX}/etc:g" \ |
228 |
+ > "${T}/zfs-init.sh" || die |
229 |
+} |
230 |
+ |
231 |
+src_install() { |
232 |
+ autotools-utils_src_install |
233 |
+ gen_usr_ldscript -a uutil nvpair zpool zfs zfs_core |
234 |
+ use test-suite || rm -rf "${ED}usr/share/zfs" |
235 |
+ |
236 |
+ newbashcomp "${FILESDIR}/bash-completion-r1" zfs |
237 |
+ bashcomp_alias zfs zpool |
238 |
+ |
239 |
+ exeinto /usr/libexec |
240 |
+ doexe "${T}/zfs-init.sh" |
241 |
+ systemd_dounit "${T}/zfs.service" |
242 |
+ |
243 |
+ # enforce selected python implementation |
244 |
+ python_fix_shebang "${ED}/bin" |
245 |
+} |
246 |
+ |
247 |
+pkg_postinst() { |
248 |
+ if ! use kernel-builtin && [ ${PV} = "9999" ] |
249 |
+ then |
250 |
+ einfo "Adding ${P} to the module database to ensure that the" |
251 |
+ einfo "kernel modules and userland utilities stay in sync." |
252 |
+ update_moduledb |
253 |
+ fi |
254 |
+ |
255 |
+ if [ -e "${EROOT}etc/runlevels/boot/zfs" ] |
256 |
+ then |
257 |
+ einfo 'The zfs boot script has been split into the zfs-import,' |
258 |
+ einfo 'zfs-mount and zfs-share scripts.' |
259 |
+ einfo |
260 |
+ einfo 'You had the zfs script in your boot runlevel. For your' |
261 |
+ einfo 'convenience, it has been automatically removed and the three' |
262 |
+ einfo 'scripts that replace it have been configured to start.' |
263 |
+ einfo 'The zfs-import and zfs-mount scripts have been added to the boot' |
264 |
+ einfo 'runlevel while the zfs-share script is in the default runlevel.' |
265 |
+ |
266 |
+ rm "${EROOT}etc/runlevels/boot/zfs" |
267 |
+ ln -snf "${EROOT}etc/init.d/zfs-import" \ |
268 |
+ "${EROOT}etc/runlevels/boot/zfs-import" |
269 |
+ ln -snf "${EROOT}etc/init.d/zfs-mount" \ |
270 |
+ "${EROOT}etc/runlevels/boot/zfs-mount" |
271 |
+ ln -snf "${EROOT}etc/init.d/zfs-share" \ |
272 |
+ "${EROOT}etc/runlevels/default/zfs-share" |
273 |
+ else |
274 |
+ [ -e "${EROOT}etc/runlevels/boot/zfs-import" ] || \ |
275 |
+ einfo "You should add zfs-import to the boot runlevel." |
276 |
+ [ -e "${EROOT}etc/runlevels/boot/zfs-mount" ] || \ |
277 |
+ einfo "You should add zfs-mount to the boot runlevel." |
278 |
+ [ -e "${EROOT}etc/runlevels/default/zfs-share" ] || \ |
279 |
+ einfo "You should add zfs-share to the default runlevel." |
280 |
+ fi |
281 |
+ |
282 |
+ if [ -e "${EROOT}etc/runlevels/default/zed" ] |
283 |
+ then |
284 |
+ einfo 'The downstream OpenRC zed script has replaced by the upstream' |
285 |
+ einfo 'OpenRC zfs-zed script.' |
286 |
+ einfo |
287 |
+ einfo 'You had the zed script in your default runlevel. For your' |
288 |
+ einfo 'convenience, it has been automatically removed and the zfs-zed' |
289 |
+ einfo 'script that replaced it has been configured to start.' |
290 |
+ |
291 |
+ rm "${EROOT}etc/runlevels/boot/zed" |
292 |
+ ln -snf "${EROOT}etc/init.d/zfs-sed" \ |
293 |
+ "${EROOT}etc/runlevels/default/zfs-zed" |
294 |
+ else |
295 |
+ [ -e "${EROOT}etc/runlevels/default/zfs-zed" ] || \ |
296 |
+ einfo "You should add zfs-zed to the default runlevel." |
297 |
+ fi |
298 |
+ |
299 |
+ if [ -e "${EROOT}etc/runlevels/shutdown/zfs-shutdown" ] |
300 |
+ then |
301 |
+ einfo "The zfs-shutdown script is obsolete. Removing it from runlevel." |
302 |
+ rm "${EROOT}etc/runlevels/shutdown/zfs-shutdown" |
303 |
+ fi |
304 |
+ |
305 |
+ systemd_reenable zfs-zed.service |
306 |
+ systemd_reenable zfs-import-cache.service |
307 |
+ systemd_reenable zfs-import-scan.service |
308 |
+ systemd_reenable zfs-mount.service |
309 |
+ systemd_reenable zfs-share.service |
310 |
+ systemd_reenable zfs-import.target |
311 |
+ systemd_reenable zfs.target |
312 |
+ systemd_reenable zfs.service |
313 |
+} |
314 |
+ |
315 |
+pkg_postrm() { |
316 |
+ if ! use kernel-builtin && [ ${PV} = "9999" ] |
317 |
+ then |
318 |
+ remove_moduledb |
319 |
+ fi |
320 |
+} |