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-kmod/
Date: Sun, 31 Mar 2019 03:54:05
Message-Id: 1554004421.c1b6a5ba7332ef0464a6c05ed874e0daf226de5c.gyakovlev@gentoo
1 commit: c1b6a5ba7332ef0464a6c05ed874e0daf226de5c
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Sat Mar 23 04:20:24 2019 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 31 03:53:41 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1b6a5ba
7
8 sys-fs/zfs-kmod: rework live ebuild
9
10 major rework
11 bump eapi to 7
12 add ZFS_KERNEL_COMPAT_OVERRIDE variable one can set to override compat check
13
14 Closes: https://bugs.gentoo.org/677466
15 Package-Manager: Portage-2.3.62, Repoman-2.3.12
16 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
17
18 sys-fs/zfs-kmod/zfs-kmod-9999.ebuild | 131 ++++++++++++++++++++++++-----------
19 1 file changed, 89 insertions(+), 42 deletions(-)
20
21 diff --git a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
22 index 19b0a9a5a51..268f0171103 100644
23 --- a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
24 +++ b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild
25 @@ -1,53 +1,52 @@
26 # Copyright 1999-2019 Gentoo Authors
27 # Distributed under the terms of the GNU General Public License v2
28
29 -EAPI="5"
30 +EAPI=7
31
32 -if [ ${PV} == "9999" ]; then
33 - AUTOTOOLS_AUTORECONF="1"
34 +inherit flag-o-matic linux-info linux-mod toolchain-funcs
35 +
36 +DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
37 +HOMEPAGE="https://zfsonlinux.org/"
38 +
39 +if [[ ${PV} == "9999" ]]; then
40 + inherit autotools git-r3
41 EGIT_REPO_URI="https://github.com/zfsonlinux/zfs.git"
42 - inherit git-r3
43 else
44 SRC_URI="https://github.com/zfsonlinux/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz"
45 + KEYWORDS="~amd64"
46 + ZFS_KERNEL_COMPAT="${ZFS_KERNEL_COMPAT_OVERRIDE:-5.0}"
47 S="${WORKDIR}/zfs-${PV}"
48 - KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
49 fi
50
51 -inherit flag-o-matic linux-info linux-mod toolchain-funcs autotools-utils
52 -
53 -DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
54 -HOMEPAGE="https://zfsonlinux.org/"
55 -
56 -LICENSE="CDDL GPL-2+"
57 +LICENSE="CDDL debug? ( GPL-2+ )"
58 SLOT="0"
59 IUSE="custom-cflags debug +rootfs"
60 -RESTRICT="debug? ( strip ) test"
61
62 -DEPEND="
63 - dev-lang/perl
64 - virtual/awk
65 -"
66 +DEPEND=""
67
68 RDEPEND="${DEPEND}
69 !sys-fs/zfs-fuse
70 !sys-kernel/spl
71 "
72
73 -AT_M4DIR="config"
74 -AUTOTOOLS_IN_SOURCE_BUILD="1"
75 +BDEPEND="
76 + dev-lang/perl
77 + virtual/awk
78 +"
79 +
80 +RESTRICT="debug? ( strip ) test"
81
82 -DOCS=( AUTHORS COPYRIGHT NOTICE META README.md )
83 +DOCS=( AUTHORS COPYRIGHT META README.md )
84
85 pkg_setup() {
86 linux-info_pkg_setup
87 +
88 CONFIG_CHECK="
89 !DEBUG_LOCK_ALLOC
90 - !GRKERNSEC_RANDSTRUCT
91 - !PAX_KERNEXEC_PLUGIN_METHOD_OR
92 - !TRIM_UNUSED_KSYMS
93 EFI_PARTITION
94 - KALLSYMS
95 MODULES
96 + !PAX_KERNEXEC_PLUGIN_METHOD_OR
97 + !TRIM_UNUSED_KSYMS
98 ZLIB_DEFLATE
99 ZLIB_INFLATE
100 "
101 @@ -64,31 +63,42 @@ pkg_setup() {
102 DEVTMPFS
103 "
104
105 - kernel_is ge 2 6 32 || die "Linux 2.6.32 or newer required"
106 + kernel_is -lt 5 && CONFIG_CHECK="${CONFIG_CHECK} IOSCHED_NOOP"
107 +
108 + kernel_is -ge 2 6 32 || die "Linux 2.6.32 or newer required"
109
110 - [ ${PV} != "9999" ] && \
111 - { kernel_is le 4 17 || die "Linux 4.17 is the latest supported version."; }
112 + if [[ ${PV} != "9999" ]]; then
113 + local KV_MAJOR_MAX="${ZFS_KERNEL_COMPAT%%.*}"
114 + local KV_MINOR_MAX="${ZFS_KERNEL_COMPAT##*.}"
115 + kernel_is -le "${KV_MAJOR_MAX}" "${KV_MINOR_MAX}" || die \
116 + "Linux ${KV_MAJOR_MAX}.${KV_MINOR_MAX} is the latest supported version"
117 + fi
118
119 check_extra_config
120 }
121
122 src_prepare() {
123 - # Remove GPLv2-licensed ZPIOS unless we are debugging
124 - use debug || sed -e 's/^subdir-m += zpios$//' -i "${S}/module/Makefile.in"
125 + default
126
127 - # Set module revision number
128 - [ ${PV} != "9999" ] && \
129 - { sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" "${S}/META" || die "Could not set Gentoo release"; }
130 + if [[ ${PV} == "9999" ]]; then
131 + eautoreconf
132 + else
133 + # Set module revision number
134 + sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
135 + fi
136
137 - autotools-utils_src_prepare
138 + # Remove GPLv2-licensed ZPIOS unless we are debugging
139 + use debug || sed -e 's/^subdir-m += zpios$//' -i module/Makefile.in
140 }
141
142 src_configure() {
143 + set_arch_to_kernel
144 +
145 use custom-cflags || strip-flags
146 +
147 filter-ldflags -Wl,*
148
149 - set_arch_to_kernel
150 - local myeconfargs=(${myeconfargs}
151 + local myconf=(
152 --bindir="${EPREFIX}/bin"
153 --sbindir="${EPREFIX}/sbin"
154 --with-config=kernel
155 @@ -97,23 +107,60 @@ src_configure() {
156 $(use_enable debug)
157 )
158
159 - autotools-utils_src_configure
160 + econf "${myconf[@]}"
161 +}
162 +
163 +src_compile() {
164 + set_arch_to_kernel
165 +
166 + default
167 }
168
169 src_install() {
170 - autotools-utils_src_install INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}"
171 + set_arch_to_kernel
172 +
173 + emake \
174 + DEPMOD="/bin/true" \
175 + DESTDIR="${D}" \
176 + INSTALL_MOD_PATH="${INSTALL_MOD_PATH:-$EROOT}" \
177 + install
178 +
179 + einstalldocs
180 }
181
182 pkg_postinst() {
183 linux-mod_pkg_postinst
184
185 # Remove old modules
186 - if [ -d "${EROOT}lib/modules/${KV_FULL}/addon/zfs" ]
187 - then
188 - ewarn "${PN} now installs modules in ${EROOT}lib/modules/${KV_FULL}/extra/zfs"
189 - ewarn "Old modules were detected in ${EROOT}lib/modules/${KV_FULL}/addon/zfs"
190 + if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then
191 + ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs"
192 + ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs"
193 ewarn "Automatically removing old modules to avoid problems."
194 - rm -r "${EROOT}lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
195 - rmdir --ignore-fail-on-non-empty "${EROOT}lib/modules/${KV_FULL}/addon"
196 + rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules"
197 + rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon"
198 fi
199 +
200 + if use x86 || use arm; then
201 + ewarn "32-bit kernels will likely require increasing vmalloc to"
202 + ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
203 + fi
204 +
205 + ewarn "This version of ZFSOnLinux includes support for new feature flags"
206 + ewarn "that are incompatible with previous versions. GRUB2 support for"
207 + ewarn "/boot with the new feature flags is not yet available."
208 + ewarn "Do *NOT* upgrade root pools to use the new feature flags."
209 + ewarn "Any new pools will be created with the new feature flags by default"
210 + ewarn "and will not be compatible with older versions of ZFSOnLinux. To"
211 + ewarn "create a newpool that is backward compatible wih GRUB2, use "
212 + ewarn
213 + ewarn "zpool create -d -o feature@async_destroy=enabled "
214 + ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled"
215 + ewarn " -o feature@spacemap_histogram=enabled"
216 + ewarn " -o feature@enabled_txg=enabled "
217 + ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled"
218 + ewarn " ..."
219 + ewarn
220 + ewarn "GRUB2 support will be updated as soon as either the GRUB2"
221 + ewarn "developers do a tag or the Gentoo developers find time to backport"
222 + ewarn "support from GRUB2 HEAD."
223 }