Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs/, sys-fs/zfs/files/
Date: Thu, 23 Dec 2021 22:28:09
Message-Id: 1640298432.94a129e0e7930ec5537be5f4fc5c84cb0e7a48bd.gyakovlev@gentoo
1 commit: 94a129e0e7930ec5537be5f4fc5c84cb0e7a48bd
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 23 22:08:39 2021 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 23 22:27:12 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94a129e0
7
8 sys-fs/zfs: add 2.0.7
9
10 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
11
12 sys-fs/zfs/Manifest | 2 +
13 sys-fs/zfs/files/2.0.7-scrub-timers.patch | 99 ++++++++++
14 sys-fs/zfs/zfs-2.0.7.ebuild | 303 ++++++++++++++++++++++++++++++
15 3 files changed, 404 insertions(+)
16
17 diff --git a/sys-fs/zfs/Manifest b/sys-fs/zfs/Manifest
18 index 1d9cb77a48f7..8c426ab5ccc7 100644
19 --- a/sys-fs/zfs/Manifest
20 +++ b/sys-fs/zfs/Manifest
21 @@ -1,5 +1,7 @@
22 DIST zfs-0.8.6.tar.gz 9295260 BLAKE2B 45424d710aaf75a05f766ae523ae157a24b5cbdcefe72a59e4cede81e42f7a92ae7f01150388437b78cd49f3d28b9664599f2a624516e6b3f1073497194a99f2 SHA512 626b172554f39a5c70f6ea5c599a92fae52534590d1b0273de2bbfc3676d29dff0eade8ca17e5f179a59870c12bc758fb53b7900f8a1fdbdef3a9161b93f9cce
23 DIST zfs-2.0.6.tar.gz 13192941 BLAKE2B 3a83303b016ec4259c286af8a9ceb281829d26508d411df91dd94193bca8c3155ef0ba63604e95f6add5f0c6cf6d100b0f567efc33b6c484c9ff811924da6ccd SHA512 52a5576eed21868b2a3d63d05d3d8c35b5e59ee88c7ddab1dc070644539f9acd56bde43ba5e965ad951a6d50a014fb429a7977d2ab1a2bfcadd92ea78dd57bf8
24 DIST zfs-2.0.6.tar.gz.asc 836 BLAKE2B 065eba3361ef4234acc67df0236ab9a6737ba9fe5a706be98b55dd64d10360160ca787d8873f27451a2107225ae657dc4cab20a7c2a268cd2de64c8d82d0327a SHA512 123569ecfcee22ac462160acf61b120144c774bc5c0d46a50d2b7312f7565da1a9d780e1a6207dba5834917c66d5b852763e4a3162378d5c9bb90b0dfde35c5c
25 +DIST zfs-2.0.7.tar.gz 14550055 BLAKE2B 80f7297f04a21cd8f3f2043d895b0325512ba0cea3bb9223561237754495c8233d29af5a9418a3c06a87510100240a45ef3d59c7ce776fffb5aafdcd18167c21 SHA512 1135abf74bf74685439018f7cd65fc52088f179d113bdd2e6481689bb0f4a016716a07d859107b74501fda00689e80b2488c7c2c53d5f058d6b659909ed85f6f
26 +DIST zfs-2.0.7.tar.gz.asc 836 BLAKE2B 65e7df58c33ccadc4e0ca9dbc1e8c006abbec8442e2da50872a1ab0cbb841fc45152298e8d3b93ee4320ddae6416e3a856caf80d8efb21b19db53dfedbf00e38 SHA512 b901d8e92faa6cfe6010bd54de88c7d18057f434cb07f8a89672d6c446a0a97b23209ee8f02cfd3b2a8f431c68ec977e7dc9f95fe5d385dba0bb6d37338ba682
27 DIST zfs-2.1.2.tar.gz 34829045 BLAKE2B ab4e2d85200438373c7eeeaa5256a712dbfb2862b85de1fb7554ad0cc2b9f8e1255ab4564bca62f65a81a823adb8c112957e6e8771b8e5e6944c3731bc894584 SHA512 3e3932259da2a27f1c4cca8da62b909edc43bf51ab0229d2d5d0234d9a7eaa7b63b67c06a98cbe2d29ba1eb5cbcaab16e5062c2a2bc8e84cab770be10ebf2102
28 DIST zfs-2.1.2.tar.gz.asc 836 BLAKE2B 8f5666f5c3d7016a4d79191f42d0a220fe8c654a0d64e3da3b575644fe52c83dcb9f9ef49ba0553771a127bba44e2802f1d366a7a38f670e73612deef76755c3 SHA512 da6bfccd19a249a6891f5e1de6c4b332e98ce4f125f638c046b9cedac3fd79c56a99dd9a620105a40741e5f04b382f5d5996b56cbe576fb268b31e57e0fed6eb
29
30 diff --git a/sys-fs/zfs/files/2.0.7-scrub-timers.patch b/sys-fs/zfs/files/2.0.7-scrub-timers.patch
31 new file mode 100644
32 index 000000000000..7c7bd1b874ea
33 --- /dev/null
34 +++ b/sys-fs/zfs/files/2.0.7-scrub-timers.patch
35 @@ -0,0 +1,99 @@
36 +From 2c9844d159024d4c742d24639a218213fb53d537 Mon Sep 17 00:00:00 2001
37 +From: Georgy Yakovlev <gyakovlev@g.o>
38 +Date: Sat, 22 May 2021 22:27:39 -0700
39 +Subject: [PATCH 1/2] systemd: add weekly and monthly scrub timers
40 +
41 +timers can be enabled as follows:
42 +
43 +systemctl enable zfs-scrub-weekly@×××××.timer --now
44 +systemctl enable zfs-scrub-monthly@××××××××.timer --now
45 +
46 +Each timer will pull in zfs-scrub@${poolname}.service, which is not
47 +schedule-specific.
48 +
49 +Signed-off-by: Georgy Yakovlev <gyakovlev@g.o>
50 +---
51 + etc/systemd/system/.gitignore | 1 +
52 + etc/systemd/system/Makefile.am | 5 ++++-
53 + etc/systemd/system/zfs-scrub-monthly@××××××.in | 12 ++++++++++++
54 + etc/systemd/system/zfs-scrub-weekly@××××××.in | 12 ++++++++++++
55 + etc/systemd/system/zfs-scrub@××××××××.in | 14 ++++++++++++++
56 + 5 files changed, 43 insertions(+), 1 deletion(-)
57 + create mode 100644 etc/systemd/system/zfs-scrub-monthly@××××××.in
58 + create mode 100644 etc/systemd/system/zfs-scrub-weekly@××××××.in
59 + create mode 100644 etc/systemd/system/zfs-scrub@××××××××.in
60 +
61 +diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am
62 +index c374a52ac..5e65e1db4 100644
63 +--- a/etc/systemd/system/Makefile.am
64 ++++ b/etc/systemd/system/Makefile.am
65 +@@ -12,7 +12,10 @@ systemdunit_DATA = \
66 + zfs-volume-wait.service \
67 + zfs-import.target \
68 + zfs-volumes.target \
69 +- zfs.target
70 ++ zfs.target \
71 ++ zfs-scrub-monthly@.timer \
72 ++ zfs-scrub-weekly@.timer \
73 ++ zfs-scrub@.service
74 +
75 + SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA)
76 +
77 +diff --git a/etc/systemd/system/zfs-scrub-monthly@××××××.in b/etc/systemd/system/zfs-scrub-monthly@××××××.in
78 +new file mode 100644
79 +index 000000000..903068468
80 +--- /dev/null
81 ++++ b/etc/systemd/system/zfs-scrub-monthly@××××××.in
82 +@@ -0,0 +1,12 @@
83 ++[Unit]
84 ++Description=Monthly zpool scrub timer for %i
85 ++Documentation=man:zpool-scrub(8)
86 ++
87 ++[Timer]
88 ++OnCalendar=monthly
89 ++Persistent=true
90 ++RandomizedDelaySec=1h
91 ++Unit=zfs-scrub@%i.service
92 ++
93 ++[Install]
94 ++WantedBy=timers.target
95 +diff --git a/etc/systemd/system/zfs-scrub-weekly@××××××.in b/etc/systemd/system/zfs-scrub-weekly@××××××.in
96 +new file mode 100644
97 +index 000000000..ede699500
98 +--- /dev/null
99 ++++ b/etc/systemd/system/zfs-scrub-weekly@××××××.in
100 +@@ -0,0 +1,12 @@
101 ++[Unit]
102 ++Description=Weekly zpool scrub timer for %i
103 ++Documentation=man:zpool-scrub(8)
104 ++
105 ++[Timer]
106 ++OnCalendar=weekly
107 ++Persistent=true
108 ++RandomizedDelaySec=1h
109 ++Unit=zfs-scrub@%i.service
110 ++
111 ++[Install]
112 ++WantedBy=timers.target
113 +diff --git a/etc/systemd/system/zfs-scrub@××××××××.in b/etc/systemd/system/zfs-scrub@××××××××.in
114 +new file mode 100644
115 +index 000000000..c04ac292a
116 +--- /dev/null
117 ++++ b/etc/systemd/system/zfs-scrub@××××××××.in
118 +@@ -0,0 +1,14 @@
119 ++[Unit]
120 ++Description=zpool scrub on %i
121 ++Documentation=man:zpool-scrub(8)
122 ++Requires=zfs.target
123 ++After=zfs.target
124 ++ConditionACPower=true
125 ++ConditionPathIsDirectory=/sys/module/zfs
126 ++
127 ++[Service]
128 ++ExecStart=/bin/sh -c '\
129 ++if @sbindir@/zpool status %i | grep "scrub in progress"; then\
130 ++exec @sbindir@/zpool wait -t scrub %i;\
131 ++else exec @sbindir@/zpool scrub -w %i; fi'
132 ++ExecStop=-/bin/sh -c '@sbindir@/zpool scrub -p %i 2>/dev/null || true'
133 +--
134 +2.34.1
135
136 diff --git a/sys-fs/zfs/zfs-2.0.7.ebuild b/sys-fs/zfs/zfs-2.0.7.ebuild
137 new file mode 100644
138 index 000000000000..52e731767cc5
139 --- /dev/null
140 +++ b/sys-fs/zfs/zfs-2.0.7.ebuild
141 @@ -0,0 +1,303 @@
142 +# Copyright 1999-2021 Gentoo Authors
143 +# Distributed under the terms of the GNU General Public License v2
144 +
145 +EAPI=7
146 +
147 +DISTUTILS_OPTIONAL=1
148 +DISTUTILS_USE_SETUPTOOLS=manual
149 +PYTHON_COMPAT=( python3_{8..10} )
150 +
151 +inherit autotools bash-completion-r1 dist-kernel-utils distutils-r1 flag-o-matic linux-info pam systemd udev usr-ldscript
152 +
153 +DESCRIPTION="Userland utilities for ZFS Linux kernel module"
154 +HOMEPAGE="https://github.com/openzfs/zfs"
155 +
156 +if [[ ${PV} == "9999" ]]; then
157 + inherit git-r3 linux-mod
158 + EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
159 +else
160 + VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
161 + inherit verify-sig
162 +
163 + MY_P="${P/_rc/-rc}"
164 + SRC_URI="https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz"
165 + SRC_URI+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )"
166 + S="${WORKDIR}/${P%_rc?}"
167 +
168 + if [[ ${PV} != *_rc* ]]; then
169 + KEYWORDS="~amd64 ~arm64 ~ppc64"
170 + fi
171 +fi
172 +
173 +LICENSE="BSD-2 CDDL MIT"
174 +# just libzfs soname major for now.
175 +# possible candidates: libuutil, libzpool, libnvpair. Those do not provide stable abi, but are considered.
176 +# see libsoversion_check() below as well
177 +SLOT="0/4"
178 +IUSE="custom-cflags debug dist-kernel kernel-builtin minimal nls pam python +rootfs test-suite"
179 +
180 +DEPEND="
181 + net-libs/libtirpc:=
182 + sys-apps/util-linux
183 + sys-libs/zlib
184 + virtual/libudev:=
185 + dev-libs/openssl:0=
186 + !minimal? ( ${PYTHON_DEPS} )
187 + pam? ( sys-libs/pam )
188 + python? (
189 + virtual/python-cffi[${PYTHON_USEDEP}]
190 + )
191 +"
192 +
193 +BDEPEND="virtual/awk
194 + virtual/pkgconfig
195 + nls? ( sys-devel/gettext )
196 + python? (
197 + dev-python/setuptools[${PYTHON_USEDEP}]
198 + || (
199 + dev-python/packaging[${PYTHON_USEDEP}]
200 + dev-python/distlib[${PYTHON_USEDEP}]
201 + )
202 + )
203 +"
204 +
205 +if [[ ${PV} != "9999" ]] ; then
206 + BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
207 +fi
208 +
209 +# awk is used for some scripts, completions, and the Dracut module
210 +RDEPEND="${DEPEND}
211 + !kernel-builtin? ( ~sys-fs/zfs-kmod-${PV}:= )
212 + !prefix? ( virtual/udev )
213 + sys-fs/udev-init-scripts
214 + virtual/awk
215 + dist-kernel? ( virtual/dist-kernel:= )
216 + rootfs? (
217 + app-arch/cpio
218 + app-misc/pax-utils
219 + !<sys-kernel/genkernel-3.5.1.1
220 + )
221 + test-suite? (
222 + app-shells/ksh
223 + sys-apps/kmod[tools]
224 + sys-apps/util-linux
225 + sys-devel/bc
226 + sys-block/parted
227 + sys-fs/lsscsi
228 + sys-fs/mdadm
229 + sys-process/procps
230 + )
231 +"
232 +
233 +# PDEPEND in this form is needed to trick portage suggest
234 +# enabling dist-kernel if only 1 package have it set, without suggesting to disable
235 +PDEPEND="dist-kernel? ( ~sys-fs/zfs-kmod-${PV}[dist-kernel] )"
236 +
237 +REQUIRED_USE="
238 + !minimal? ( ${PYTHON_REQUIRED_USE} )
239 + python? ( !minimal )
240 + test-suite? ( !minimal )
241 +"
242 +
243 +RESTRICT="test"
244 +
245 +PATCHES=(
246 + "${FILESDIR}/bash-completion-sudo.patch"
247 + "${FILESDIR}/2.0.7-scrub-timers.patch"
248 + "${FILESDIR}/2.1.2-openrc-vendor.patch"
249 + "${FILESDIR}/2.1.2-musl-tests.patch"
250 +)
251 +
252 +pkg_pretend() {
253 + use rootfs || return 0
254 +
255 + if has_version virtual/dist-kernel && ! use dist-kernel; then
256 + ewarn "You have virtual/dist-kernel installed, but"
257 + ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
258 + ewarn "It's recommended to globally enable dist-kernel USE flag"
259 + ewarn "to auto-trigger initrd rebuilds with kernel updates"
260 + fi
261 +}
262 +
263 +pkg_setup() {
264 + if use kernel_linux; then
265 + linux-info_pkg_setup
266 +
267 + if ! linux_config_exists; then
268 + ewarn "Cannot check the linux kernel configuration."
269 + else
270 + if use test-suite; then
271 + if linux_chkconfig_present BLK_DEV_LOOP; then
272 + eerror "The ZFS test suite requires loop device support enabled."
273 + eerror "Please enable it:"
274 + eerror " CONFIG_BLK_DEV_LOOP=y"
275 + eerror "in /usr/src/linux/.config or"
276 + eerror " Device Drivers --->"
277 + eerror " Block devices --->"
278 + eerror " [X] Loopback device support"
279 + fi
280 + fi
281 + fi
282 + fi
283 +}
284 +
285 +libsoversion_check() {
286 +
287 + local bugurl libzfs_sover
288 + bugurl="https://bugs.gentoo.org/enter_bug.cgi?form_name=enter_bug&product=Gentoo+Linux&component=Current+packages"
289 +
290 + libzfs_sover="$(grep 'libzfs_la_LDFLAGS += -version-info' lib/libzfs/Makefile.am \
291 + | grep -Eo '[0-9]+:[0-9]+:[0-9]+')"
292 + libzfs_sover="${libzfs_sover%%:*}"
293 +
294 + if [[ ${libzfs_sover} -ne $(ver_cut 2 ${SLOT}) ]]; then
295 + echo
296 + eerror "BUG BUG BUG BUG BUG BUG BUG BUG"
297 + eerror "ebuild subslot does not match libzfs soversion!"
298 + eerror "libzfs soversion: ${libzfs_sover}"
299 + eerror "ebuild value: $(ver_cut 2 ${SLOT})"
300 + eerror "This is a bug in the ebuild, please use the following URL to report it"
301 + eerror "${bugurl}&short_desc=${CATEGORY}%2F${P}+update+subslot"
302 + echo
303 + # we want to abort for releases, but just print a warning for live ebuild
304 + # to keep package installable
305 + [[ ${PV} == "9999" ]] || die
306 + fi
307 +}
308 +
309 +src_prepare() {
310 + default
311 + libsoversion_check
312 +
313 + # Run unconditionally (bug #792627)
314 + eautoreconf
315 +
316 + if [[ ${PV} != "9999" ]]; then
317 + # Set revision number
318 + sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
319 + fi
320 +
321 + if use python; then
322 + pushd contrib/pyzfs >/dev/null || die
323 + distutils-r1_src_prepare
324 + popd >/dev/null || die
325 + fi
326 +
327 + # prevent errors showing up on zfs-mount stop, #647688
328 + # openrc will unmount all filesystems anyway.
329 + sed -i "/^ZFS_UNMOUNT=/ s/yes/no/" "etc/default/zfs.in" || die
330 +}
331 +
332 +src_configure() {
333 + use custom-cflags || strip-flags
334 + use minimal || python_setup
335 +
336 + local myconf=(
337 + --bindir="${EPREFIX}/bin"
338 + --enable-shared
339 + --enable-systemd
340 + --enable-sysvinit
341 + --localstatedir="${EPREFIX}/var"
342 + --sbindir="${EPREFIX}/sbin"
343 + --with-config=user
344 + --with-dracutdir="${EPREFIX}/usr/lib/dracut"
345 + --with-linux="${KV_DIR}"
346 + --with-linux-obj="${KV_OUT_DIR}"
347 + --with-udevdir="$(get_udevdir)"
348 + --with-pamconfigsdir="${EPREFIX}/unwanted_files"
349 + --with-pammoduledir="$(getpam_mod_dir)"
350 + --with-systemdunitdir="$(systemd_get_systemunitdir)"
351 + --with-systemdpresetdir="$(systemd_get_systempresetdir)"
352 + --with-vendor=gentoo
353 + $(use_enable debug)
354 + $(use_enable nls)
355 + $(use_enable pam)
356 + $(use_enable python pyzfs)
357 + --disable-static
358 + $(usex minimal --without-python --with-python="${EPYTHON}")
359 + )
360 +
361 + econf "${myconf[@]}"
362 +}
363 +
364 +src_compile() {
365 + default
366 + if use python; then
367 + pushd contrib/pyzfs >/dev/null || die
368 + distutils-r1_src_compile
369 + popd >/dev/null || die
370 + fi
371 +}
372 +
373 +src_install() {
374 + default
375 +
376 + gen_usr_ldscript -a nvpair uutil zfsbootenv zfs zfs_core zpool
377 +
378 + use pam && { rm -rv "${ED}/unwanted_files" || die ; }
379 +
380 + use test-suite || { rm -r "${ED}/usr/share/zfs" || die ; }
381 +
382 + find "${ED}" -name '*.la' -delete || die
383 +
384 + dobashcomp contrib/bash_completion.d/zfs
385 + bashcomp_alias zfs zpool
386 +
387 + # strip executable bit from conf.d file
388 + fperms 0644 /etc/conf.d/zfs
389 +
390 + if use python; then
391 + pushd contrib/pyzfs >/dev/null || die
392 + distutils-r1_src_install
393 + popd >/dev/null || die
394 + fi
395 +
396 + # enforce best available python implementation
397 + use minimal || python_fix_shebang "${ED}/bin"
398 +}
399 +
400 +pkg_postinst() {
401 + # we always need userspace utils in sync with zfs-kmod
402 + # so force initrd update for userspace as well, to avoid
403 + # situation when zfs-kmod trigger initrd rebuild before
404 + # userspace component is rebuilt
405 + # KV_* variables are provided by linux-info.eclass
406 + if [[ -z ${ROOT} ]] && use dist-kernel; then
407 + dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
408 + fi
409 +
410 + if use rootfs; then
411 + if ! has_version sys-kernel/genkernel && ! has_version sys-kernel/dracut; then
412 + elog "Root on zfs requires an initramfs to boot"
413 + elog "The following packages provide one and are tested on a regular basis:"
414 + elog " sys-kernel/dracut ( preferred, module maintained by zfs developers )"
415 + elog " sys-kernel/genkernel"
416 + fi
417 + fi
418 +
419 + if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then
420 + einfo "Adding ${P} to the module database to ensure that the"
421 + einfo "kernel modules and userland utilities stay in sync."
422 + update_moduledb
423 + fi
424 +
425 + if systemd_is_booted || has_version sys-apps/systemd; then
426 + einfo "Please refer to ${EROOT}/$(systemd_get_systempresetdir)/50-zfs.preset"
427 + einfo "for default zfs systemd service configuration"
428 + else
429 + [[ -e "${EROOT}/etc/runlevels/boot/zfs-import" ]] || \
430 + einfo "You should add zfs-import to the boot runlevel."
431 + [[ -e "${EROOT}/etc/runlevels/boot/zfs-mount" ]]|| \
432 + einfo "You should add zfs-mount to the boot runlevel."
433 + [[ -e "${EROOT}/etc/runlevels/default/zfs-share" ]] || \
434 + einfo "You should add zfs-share to the default runlevel."
435 + [[ -e "${EROOT}/etc/runlevels/default/zfs-zed" ]] || \
436 + einfo "You should add zfs-zed to the default runlevel."
437 + fi
438 +}
439 +
440 +pkg_postrm() {
441 + if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then
442 + remove_moduledb
443 + fi
444 +}