commit:     c1b6a5ba7332ef0464a6c05ed874e0daf226de5c
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 23 04:20:24 2019 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sun Mar 31 03:53:41 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1b6a5ba

sys-fs/zfs-kmod: rework live ebuild

major rework
bump eapi to 7
add ZFS_KERNEL_COMPAT_OVERRIDE variable one can set to override compat check

Closes: https://bugs.gentoo.org/677466
Package-Manager: Portage-2.3.62, Repoman-2.3.12
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 sys-fs/zfs-kmod/zfs-kmod-9999.ebuild | 131 ++++++++++++++++++++++++-----------
 1 file changed, 89 insertions(+), 42 deletions(-)

diff --git a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild 
b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
index 19b0a9a5a51..268f0171103 100644
--- a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
+++ b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
@@ -1,53 +1,52 @@
 # Copyright 1999-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI="5"
+EAPI=7
 
-if [ ${PV} == "9999" ]; then
-       AUTOTOOLS_AUTORECONF="1"
+inherit flag-o-matic linux-info linux-mod toolchain-funcs
+
+DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
+HOMEPAGE="https://zfsonlinux.org/";
+
+if [[ ${PV} == "9999" ]]; then
+       inherit autotools git-r3
        EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git";
-       inherit git-r3
 else
        
SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz";
+       KEYWORDS="~amd64"
+       ZFS_KERNEL_COMPAT="${ZFS_KERNEL_COMPAT_OVERRIDE:-5.0}"
        S="${WORKDIR}/zfs-${PV}"
-       KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
 fi
 
-inherit flag-o-matic linux-info linux-mod toolchain-funcs autotools-utils
-
-DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
-HOMEPAGE="https://zfsonlinux.org/";
-
-LICENSE="CDDL GPL-2+"
+LICENSE="CDDL debug? ( GPL-2+ )"
 SLOT="0"
 IUSE="custom-cflags debug +rootfs"
-RESTRICT="debug? ( strip ) test"
 
-DEPEND="
-       dev-lang/perl
-       virtual/awk
-"
+DEPEND=""
 
 RDEPEND="${DEPEND}
        !sys-fs/zfs-fuse
        !sys-kernel/spl
 "
 
-AT_M4DIR="config"
-AUTOTOOLS_IN_SOURCE_BUILD="1"
+BDEPEND="
+       dev-lang/perl
+       virtual/awk
+"
+
+RESTRICT="debug? ( strip ) test"
 
-DOCS=( AUTHORS COPYRIGHT NOTICE META README.md )
+DOCS=( AUTHORS COPYRIGHT META README.md )
 
 pkg_setup() {
        linux-info_pkg_setup
+
        CONFIG_CHECK="
                !DEBUG_LOCK_ALLOC
-               !GRKERNSEC_RANDSTRUCT
-               !PAX_KERNEXEC_PLUGIN_METHOD_OR
-               !TRIM_UNUSED_KSYMS
                EFI_PARTITION
-               KALLSYMS
                MODULES
+               !PAX_KERNEXEC_PLUGIN_METHOD_OR
+               !TRIM_UNUSED_KSYMS
                ZLIB_DEFLATE
                ZLIB_INFLATE
        "
@@ -64,31 +63,42 @@ pkg_setup() {
                        DEVTMPFS
        "
 
-       kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
+       kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
+
+       kernel_is -ge 2 6 32 || die "Linux 2.6.32 or newer required"
 
-       [ ${PV} != "9999" ] && \
-               { kernel_is le 4 17 || die "Linux 4.17 is the latest supported 
version."; }
+       if [[ ${PV} != "9999" ]]; then
+               local KV_MAJOR_MAX="${ZFS_KERNEL_COMPAT%%.*}"
+               local KV_MINOR_MAX="${ZFS_KERNEL_COMPAT##*.}"
+               kernel_is -le "${KV_MAJOR_MAX}" "${KV_MINOR_MAX}" || die \
+                       "Linux ${KV_MAJOR_MAX}.${KV_MINOR_MAX} is the latest 
supported version"
+       fi
 
        check_extra_config
 }
 
 src_prepare() {
-       # Remove GPLv2-licensed ZPIOS unless we are debugging
-       use debug || sed -e 's/^subdir-m += zpios$//' -i 
"${S}/module/Makefile.in"
+       default
 
-       # Set module revision number
-       [ ${PV} != "9999" ] && \
-               { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" 
|| die "Could not set Gentoo release"; }
+       if [[ ${PV} == "9999" ]]; then
+               eautoreconf
+       else
+               # Set module revision number
+               sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die 
"Could not set Gentoo release"
+       fi
 
-       autotools-utils_src_prepare
+       # Remove GPLv2-licensed ZPIOS unless we are debugging
+       use debug || sed -e 's/^subdir-m += zpios$//' -i module/Makefile.in
 }
 
 src_configure() {
+       set_arch_to_kernel
+
        use custom-cflags || strip-flags
+
        filter-ldflags -Wl,*
 
-       set_arch_to_kernel
-       local myeconfargs=(${myeconfargs}
+       local myconf=(
                --bindir="${EPREFIX}/bin"
                --sbindir="${EPREFIX}/sbin"
                --with-config=kernel
@@ -97,23 +107,60 @@ src_configure() {
                $(use_enable debug)
        )
 
-       autotools-utils_src_configure
+       econf "${myconf[@]}"
+}
+
+src_compile() {
+       set_arch_to_kernel
+
+       default
 }
 
 src_install() {
-       autotools-utils_src_install 
INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
+       set_arch_to_kernel
+
+       emake \
+               DEPMOD="/bin/true" \
+               DESTDIR="${D}" \
+               INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}" \
+               install
+
+       einstalldocs
 }
 
 pkg_postinst() {
        linux-mod_pkg_postinst
 
        # Remove old modules
-       if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
-       then
-               ewarn "${PN} now installs modules in 
${EROOT}lib/modules/${KV_FULL}/extra/zfs"
-               ewarn "Old modules were detected in 
${EROOT}lib/modules/${KV_FULL}/addon/zfs"
+       if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
+               ewarn "${PN} now installs modules in 
${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
+               ewarn "Old modules were detected in 
${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
                ewarn "Automatically removing old modules to avoid problems."
-               rm -r "${EROOT}lib/modules/${KV_FULL}/addon/zfs" || die "Cannot 
remove modules"
-               rmdir --ignore-fail-on-non-empty 
"${EROOT}lib/modules/${KV_FULL}/addon"
+               rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die 
"Cannot remove modules"
+               rmdir --ignore-fail-on-non-empty 
"${EROOT}/lib/modules/${KV_FULL}/addon"
        fi
+
+       if use x86 || use arm; then
+               ewarn "32-bit kernels will likely require increasing vmalloc to"
+               ewarn "at least 256M and decreasing zfs_arc_max to some value 
less than that."
+       fi
+
+       ewarn "This version of ZFSOnLinux includes support for new feature 
flags"
+       ewarn "that are incompatible with previous versions. GRUB2 support for"
+       ewarn "/boot with the new feature flags is not yet available."
+       ewarn "Do *NOT* upgrade root pools to use the new feature flags."
+       ewarn "Any new pools will be created with the new feature flags by 
default"
+       ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
+       ewarn "create a newpool that is backward compatible wih GRUB2, use "
+       ewarn
+       ewarn "zpool create -d -o feature@async_destroy=enabled "
+       ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
+       ewarn " -o feature@spacemap_histogram=enabled"
+       ewarn " -o feature@enabled_txg=enabled "
+       ewarn " -o feature@extensible_dataset=enabled -o 
feature@bookmarks=enabled"
+       ewarn " ..."
+       ewarn
+       ewarn "GRUB2 support will be updated as soon as either the GRUB2"
+       ewarn "developers do a tag or the Gentoo developers find time to 
backport"
+       ewarn "support from GRUB2 HEAD."
 }

Reply via email to