From: "Georgy Yakovlev" <gyakovlev@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs/, sys-fs/zfs/files/
Date: Fri, 4 Jun 2021 02:14:29 +0000 (UTC) [thread overview]
Message-ID: <1622772744.4826c2e6f797cfeab33aad2542d402916653fd91.gyakovlev@gentoo> (raw)
commit: 4826c2e6f797cfeab33aad2542d402916653fd91
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 4 02:12:24 2021 +0000
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Fri Jun 4 02:12:24 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4826c2e6
sys-fs/zfs: revbump 2.0.4, add scrub timers
to use with systemd
Pr: https://github.com/openzfs/zfs/pull/12193
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
sys-fs/zfs/files/2.0.4-scrub-timers.patch | 97 +++++++++++++
sys-fs/zfs/zfs-2.0.4-r1.ebuild | 230 ++++++++++++++++++++++++++++++
2 files changed, 327 insertions(+)
diff --git a/sys-fs/zfs/files/2.0.4-scrub-timers.patch b/sys-fs/zfs/files/2.0.4-scrub-timers.patch
new file mode 100644
index 00000000000..6aae1e4de59
--- /dev/null
+++ b/sys-fs/zfs/files/2.0.4-scrub-timers.patch
@@ -0,0 +1,97 @@
+From e23d7e03637e377591a480d87630b746cdaa377f Mon Sep 17 00:00:00 2001
+From: Georgy Yakovlev <gyakovlev@gentoo.org>
+Date: Sat, 22 May 2021 22:27:39 -0700
+Subject: [PATCH] systemd: add weekly and monthly scrub timers
+
+timers can be enabled as follows:
+
+systemctl enable zfs-scrub-weekly@rpool.timer --now
+systemctl enable zfs-scrub-monthly@datapool.timer --now
+
+Each timer will pull in zfs-scrub@${poolname}.service, which is not
+schedule-specific.
+
+Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
+---
+ etc/systemd/system/Makefile.am | 5 ++++-
+ etc/systemd/system/zfs-scrub-monthly@.timer.in | 12 ++++++++++++
+ etc/systemd/system/zfs-scrub-weekly@.timer.in | 12 ++++++++++++
+ etc/systemd/system/zfs-scrub@.service.in | 12 ++++++++++++
+ 4 files changed, 40 insertions(+), 1 deletion(-)
+ create mode 100644 etc/systemd/system/zfs-scrub-monthly@.timer.in
+ create mode 100644 etc/systemd/system/zfs-scrub-weekly@.timer.in
+ create mode 100644 etc/systemd/system/zfs-scrub@.service.in
+
+diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am
+index c374a52ac..5e65e1db4 100644
+--- a/etc/systemd/system/Makefile.am
++++ b/etc/systemd/system/Makefile.am
+@@ -12,7 +12,10 @@ systemdunit_DATA = \
+ zfs-volume-wait.service \
+ zfs-import.target \
+ zfs-volumes.target \
+- zfs.target
++ zfs.target \
++ zfs-scrub-monthly@.timer \
++ zfs-scrub-weekly@.timer \
++ zfs-scrub@.service
+
+ SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA)
+
+diff --git a/etc/systemd/system/zfs-scrub-monthly@.timer.in b/etc/systemd/system/zfs-scrub-monthly@.timer.in
+new file mode 100644
+index 000000000..4c585f45f
+--- /dev/null
++++ b/etc/systemd/system/zfs-scrub-monthly@.timer.in
+@@ -0,0 +1,12 @@
++[Unit]
++Description=Monthly zpool scrub timer for %i
++Documentation=man:zpool-scrub(8)
++
++[Timer]
++OnCalendar=monthly
++AccuracySec=1h
++Persistent=true
++Unit=zfs-scrub@%i.service
++
++[Install]
++WantedBy=timers.target
+diff --git a/etc/systemd/system/zfs-scrub-weekly@.timer.in b/etc/systemd/system/zfs-scrub-weekly@.timer.in
+new file mode 100644
+index 000000000..b2454be2c
+--- /dev/null
++++ b/etc/systemd/system/zfs-scrub-weekly@.timer.in
+@@ -0,0 +1,12 @@
++[Unit]
++Description=Weekly zpool scrub timer for %i
++Documentation=man:zpool-scrub(8)
++
++[Timer]
++OnCalendar=weekly
++AccuracySec=1h
++Persistent=true
++Unit=zfs-scrub@%i.service
++
++[Install]
++WantedBy=timers.target
+diff --git a/etc/systemd/system/zfs-scrub@.service.in b/etc/systemd/system/zfs-scrub@.service.in
+new file mode 100644
+index 000000000..720901165
+--- /dev/null
++++ b/etc/systemd/system/zfs-scrub@.service.in
+@@ -0,0 +1,12 @@
++[Unit]
++Description=zpool scrub on %i
++Documentation=man:zpool-scrub(8)
++Requires=zfs.target
++After=zfs.target
++ConditionPathIsDirectory=/sys/module/zfs
++
++[Service]
++Nice=19
++IOSchedulingClass=idle
++KillSignal=SIGINT
++ExecStart=@sbindir@/zpool scrub %i
+--
+2.31.1
+
diff --git a/sys-fs/zfs/zfs-2.0.4-r1.ebuild b/sys-fs/zfs/zfs-2.0.4-r1.ebuild
new file mode 100644
index 00000000000..e22f834e451
--- /dev/null
+++ b/sys-fs/zfs/zfs-2.0.4-r1.ebuild
@@ -0,0 +1,230 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_OPTIONAL=1
+DISTUTILS_USE_SETUPTOOLS=manual
+PYTHON_COMPAT=( python3_{7,8,9} )
+
+inherit autotools bash-completion-r1 distutils-r1 flag-o-matic linux-info pam systemd toolchain-funcs udev usr-ldscript
+
+DESCRIPTION="Userland utilities for ZFS Linux kernel module"
+HOMEPAGE="https://github.com/openzfs/zfs"
+
+if [[ ${PV} == "9999" ]] ; then
+ inherit git-r3 linux-mod
+ EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
+else
+ MY_P="${P/_rc/-rc}"
+ SRC_URI="https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz"
+ KEYWORDS="~amd64 ~arm64 ~ppc64"
+ S="${WORKDIR}/${P%_rc?}"
+fi
+
+LICENSE="BSD-2 CDDL MIT"
+# just libzfs soname major for now.
+# possible candidates: libuutil, libzpool, libnvpair. Those do not provide stable abi, but are considered.
+SLOT="0/4"
+IUSE="custom-cflags debug kernel-builtin minimal nls pam python +rootfs test-suite static-libs"
+
+DEPEND="
+ net-libs/libtirpc[static-libs?]
+ sys-apps/util-linux[static-libs?]
+ sys-libs/zlib[static-libs(+)?]
+ virtual/awk
+ virtual/libudev[static-libs(-)?]
+ dev-libs/openssl:0=[static-libs?]
+ !minimal? ( ${PYTHON_DEPS} )
+ pam? ( sys-libs/pam )
+ python? (
+ virtual/python-cffi[${PYTHON_USEDEP}]
+ )
+"
+
+BDEPEND="virtual/awk
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )
+ python? (
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ )
+"
+
+RDEPEND="${DEPEND}
+ !kernel-builtin? ( ~sys-fs/zfs-kmod-${PV} )
+ !prefix? ( virtual/udev )
+ sys-fs/udev-init-scripts
+ rootfs? (
+ app-arch/cpio
+ app-misc/pax-utils
+ !<sys-kernel/genkernel-3.5.1.1
+ )
+ test-suite? (
+ sys-apps/kmod[tools]
+ sys-apps/util-linux
+ sys-devel/bc
+ sys-block/parted
+ sys-fs/lsscsi
+ sys-fs/mdadm
+ sys-process/procps
+ )
+"
+
+REQUIRED_USE="
+ !minimal? ( ${PYTHON_REQUIRED_USE} )
+ python? ( !minimal )
+ test-suite? ( !minimal )
+"
+
+RESTRICT="test"
+
+PATCHES=(
+ "${FILESDIR}/bash-completion-sudo.patch"
+ "${FILESDIR}/2.0.4-scrub-timers.patch"
+)
+
+pkg_setup() {
+ if use kernel_linux && use test-suite; then
+ linux-info_pkg_setup
+
+ if ! linux_config_exists; then
+ ewarn "Cannot check the linux kernel configuration."
+ else
+ if use test-suite; then
+ if linux_chkconfig_present BLK_DEV_LOOP; then
+ eerror "The ZFS test suite requires loop device support enabled."
+ eerror "Please enable it:"
+ eerror " CONFIG_BLK_DEV_LOOP=y"
+ eerror "in /usr/src/linux/.config or"
+ eerror " Device Drivers --->"
+ eerror " Block devices --->"
+ eerror " [X] Loopback device support"
+ fi
+ fi
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+ eautoreconf
+ # Set revision number
+ sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
+
+ if use python; then
+ pushd contrib/pyzfs >/dev/null || die
+ distutils-r1_src_prepare
+ popd >/dev/null || die
+ fi
+
+ # prevent errors showing up on zfs-mount stop, #647688
+ # openrc will unmount all filesystems anyway.
+ sed -i "/^ZFS_UNMOUNT=/ s/yes/no/" "etc/default/zfs.in" || die
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ use minimal || python_setup
+
+ local myconf=(
+ --bindir="${EPREFIX}/bin"
+ --enable-shared
+ --enable-systemd
+ --enable-sysvinit
+ --localstatedir="${EPREFIX}/var"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=user
+ --with-dracutdir="${EPREFIX}/usr/lib/dracut"
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ --with-udevdir="$(get_udevdir)"
+ --with-pamconfigsdir="${EPREFIX}/unwanted_files"
+ --with-pammoduledir="$(getpam_mod_dir)"
+ --with-systemdunitdir="$(systemd_get_systemunitdir)"
+ --with-systemdpresetdir="${EPREFIX}/lib/systemd/system-preset"
+ --with-vendor=gentoo
+ $(use_enable debug)
+ $(use_enable nls)
+ $(use_enable pam)
+ $(use_enable python pyzfs)
+ $(use_enable static-libs static)
+ $(usex minimal --without-python --with-python="${EPYTHON}")
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_compile() {
+ default
+ if use python; then
+ pushd contrib/pyzfs >/dev/null || die
+ distutils-r1_src_compile
+ popd >/dev/null || die
+ fi
+}
+
+src_install() {
+ default
+
+ gen_usr_ldscript -a nvpair uutil zfsbootenv zfs zfs_core zpool
+
+ use pam && { rm -rv "${ED}/unwanted_files" || die ; }
+
+ use test-suite || { rm -r "${ED}/usr/share/zfs" || die ; }
+
+ if ! use static-libs; then
+ find "${ED}/" -name '*.la' -delete || die
+ fi
+
+ dobashcomp contrib/bash_completion.d/zfs
+ bashcomp_alias zfs zpool
+
+ # strip executable bit from conf.d file
+ fperms 0644 /etc/conf.d/zfs
+
+ if use python; then
+ pushd contrib/pyzfs >/dev/null || die
+ distutils-r1_src_install
+ popd >/dev/null || die
+ fi
+
+ # enforce best available python implementation
+ use minimal || python_fix_shebang "${ED}/bin"
+}
+
+pkg_postinst() {
+ if use rootfs; then
+ if ! has_version sys-kernel/genkernel && ! has_version sys-kernel/dracut; then
+ elog "root on zfs requires initramfs to boot"
+ elog "the following packages known to provide one and tested on regular basis:"
+ elog " sys-kernel/dracut"
+ elog " sys-kernel/genkernel"
+ fi
+ fi
+
+ if ! use kernel-builtin && [[ ${PV} = "9999" ]]; then
+ einfo "Adding ${P} to the module database to ensure that the"
+ einfo "kernel modules and userland utilities stay in sync."
+ update_moduledb
+ fi
+
+ if systemd_is_booted || has_version sys-apps/systemd; then
+ einfo "Please refer to ${EROOT}/lib/systemd/system-preset/50-zfs.preset"
+ einfo "for default zfs systemd service configuration"
+ else
+ [[ -e "${EROOT}/etc/runlevels/boot/zfs-import" ]] || \
+ einfo "You should add zfs-import to the boot runlevel."
+ [[ -e "${EROOT}/etc/runlevels/boot/zfs-mount" ]]|| \
+ einfo "You should add zfs-mount to the boot runlevel."
+ [[ -e "${EROOT}/etc/runlevels/default/zfs-share" ]] || \
+ einfo "You should add zfs-share to the default runlevel."
+ [[ -e "${EROOT}/etc/runlevels/default/zfs-zed" ]] || \
+ einfo "You should add zfs-zed to the default runlevel."
+ fi
+}
+
+pkg_postrm() {
+ if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then
+ remove_moduledb
+ fi
+}
next reply other threads:[~2021-06-04 2:14 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 2:14 Georgy Yakovlev [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-02-23 6:33 [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs/, sys-fs/zfs/files/ Sam James
2023-12-16 10:06 Sam James
2023-07-03 21:03 Sam James
2022-12-25 0:24 Georgy Yakovlev
2022-12-08 19:48 Georgy Yakovlev
2022-10-04 5:07 Sam James
2022-09-17 22:16 Georgy Yakovlev
2022-09-16 23:09 Georgy Yakovlev
2022-07-01 7:34 Sam James
2022-06-07 18:56 Georgy Yakovlev
2021-12-26 22:35 Georgy Yakovlev
2021-12-23 22:28 Georgy Yakovlev
2021-12-16 2:51 Georgy Yakovlev
2021-11-07 23:59 Georgy Yakovlev
2020-11-03 20:07 Georgy Yakovlev
2020-09-25 20:28 Georgy Yakovlev
2020-05-26 23:58 Georgy Yakovlev
2019-11-26 20:32 Georgy Yakovlev
2019-09-27 19:16 Georgy Yakovlev
2019-03-31 3:53 Georgy Yakovlev
2018-02-14 20:39 Matt Thode
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1622772744.4826c2e6f797cfeab33aad2542d402916653fd91.gyakovlev@gentoo \
--to=gyakovlev@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox