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/
Date: Wed, 29 Sep 2021 23:11:56
Message-Id: 1632956906.fb6dc9685037adb18df3519a91bde592f65cef4f.gyakovlev@gentoo
1 commit: fb6dc9685037adb18df3519a91bde592f65cef4f
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 29 23:01:59 2021 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 29 23:08:26 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb6dc968
7
8 sys-fs/zfs: revbump 2.0.6, add coreutils-9 blocker
9
10 https://github.com/openzfs/zfs/issues/11900
11 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
12
13 sys-fs/zfs/zfs-2.0.6-r1.ebuild | 298 +++++++++++++++++++++++++++++++++++++++++
14 1 file changed, 298 insertions(+)
15
16 diff --git a/sys-fs/zfs/zfs-2.0.6-r1.ebuild b/sys-fs/zfs/zfs-2.0.6-r1.ebuild
17 new file mode 100644
18 index 00000000000..30672ab45c2
19 --- /dev/null
20 +++ b/sys-fs/zfs/zfs-2.0.6-r1.ebuild
21 @@ -0,0 +1,298 @@
22 +# Copyright 1999-2021 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=7
26 +
27 +DISTUTILS_OPTIONAL=1
28 +DISTUTILS_USE_SETUPTOOLS=manual
29 +PYTHON_COMPAT=( python3_{7,8,9} )
30 +
31 +inherit autotools bash-completion-r1 dist-kernel-utils distutils-r1 flag-o-matic linux-info pam systemd udev usr-ldscript
32 +
33 +DESCRIPTION="Userland utilities for ZFS Linux kernel module"
34 +HOMEPAGE="https://github.com/openzfs/zfs"
35 +
36 +if [[ ${PV} == "9999" ]]; then
37 + inherit git-r3 linux-mod
38 + EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
39 +else
40 + VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
41 + inherit verify-sig
42 +
43 + MY_P="${P/_rc/-rc}"
44 + SRC_URI="https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz"
45 + SRC_URI+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )"
46 + S="${WORKDIR}/${P%_rc?}"
47 +
48 + if [[ ${PV} != *_rc* ]]; then
49 + KEYWORDS="~amd64 ~arm64 ~ppc64"
50 + fi
51 +fi
52 +
53 +LICENSE="BSD-2 CDDL MIT"
54 +# just libzfs soname major for now.
55 +# possible candidates: libuutil, libzpool, libnvpair. Those do not provide stable abi, but are considered.
56 +# see libsoversion_check() below as well
57 +SLOT="0/4"
58 +IUSE="custom-cflags debug dist-kernel kernel-builtin minimal nls pam python +rootfs test-suite"
59 +
60 +DEPEND="
61 + net-libs/libtirpc
62 + sys-apps/util-linux
63 + sys-libs/zlib
64 + virtual/libudev:=
65 + dev-libs/openssl:0=
66 + !minimal? ( ${PYTHON_DEPS} )
67 + pam? ( sys-libs/pam )
68 + python? (
69 + virtual/python-cffi[${PYTHON_USEDEP}]
70 + )
71 +"
72 +
73 +BDEPEND="virtual/awk
74 + virtual/pkgconfig
75 + nls? ( sys-devel/gettext )
76 + python? (
77 + dev-python/setuptools[${PYTHON_USEDEP}]
78 + )
79 +"
80 +
81 +if [[ ${PV} != "9999" ]] ; then
82 + BDEPEND+=" verify-sig? ( app-crypt/openpgp-keys-openzfs )"
83 +fi
84 +
85 +# awk is used for some scripts, completions, and the Dracut module
86 +RDEPEND="${DEPEND}
87 + !kernel-builtin? ( ~sys-fs/zfs-kmod-${PV}:=[dist-kernel?] )
88 + !prefix? ( virtual/udev )
89 + sys-fs/udev-init-scripts
90 + virtual/awk
91 + dist-kernel? ( virtual/dist-kernel:= )
92 + rootfs? (
93 + app-arch/cpio
94 + app-misc/pax-utils
95 + !<sys-kernel/genkernel-3.5.1.1
96 + )
97 + test-suite? (
98 + sys-apps/kmod[tools]
99 + sys-apps/util-linux
100 + sys-devel/bc
101 + sys-block/parted
102 + sys-fs/lsscsi
103 + sys-fs/mdadm
104 + sys-process/procps
105 + )
106 +"
107 +
108 +# temporary block new coreutils
109 +# https://github.com/openzfs/zfs/issues/11900
110 +RDEPEND+="
111 + !>=sys-apps/coreutils-9
112 +"
113 +
114 +REQUIRED_USE="
115 + !minimal? ( ${PYTHON_REQUIRED_USE} )
116 + python? ( !minimal )
117 + test-suite? ( !minimal )
118 +"
119 +
120 +RESTRICT="test"
121 +
122 +PATCHES=(
123 + "${FILESDIR}/bash-completion-sudo.patch"
124 + "${FILESDIR}/2.0.4-scrub-timers.patch"
125 +)
126 +
127 +pkg_pretend() {
128 + use rootfs || return 0
129 +
130 + if has_version virtual/dist-kernel && ! use dist-kernel; then
131 + ewarn "You have virtual/dist-kernel installed, but"
132 + ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
133 + ewarn "It's recommended to globally enable dist-kernel USE flag"
134 + ewarn "to auto-trigger initrd rebuilds with kernel updates"
135 + fi
136 +}
137 +
138 +pkg_setup() {
139 + if use kernel_linux; then
140 + linux-info_pkg_setup
141 +
142 + if ! linux_config_exists; then
143 + ewarn "Cannot check the linux kernel configuration."
144 + else
145 + if use test-suite; then
146 + if linux_chkconfig_present BLK_DEV_LOOP; then
147 + eerror "The ZFS test suite requires loop device support enabled."
148 + eerror "Please enable it:"
149 + eerror " CONFIG_BLK_DEV_LOOP=y"
150 + eerror "in /usr/src/linux/.config or"
151 + eerror " Device Drivers --->"
152 + eerror " Block devices --->"
153 + eerror " [X] Loopback device support"
154 + fi
155 + fi
156 + fi
157 + fi
158 +}
159 +
160 +libsoversion_check() {
161 +
162 + local bugurl libzfs_sover
163 + bugurl="https://bugs.gentoo.org/enter_bug.cgi?form_name=enter_bug&product=Gentoo+Linux&component=Current+packages"
164 +
165 + libzfs_sover="$(grep 'libzfs_la_LDFLAGS += -version-info' lib/libzfs/Makefile.am \
166 + | grep -Eo '[0-9]+:[0-9]+:[0-9]+')"
167 + libzfs_sover="${libzfs_sover%%:*}"
168 +
169 + if [[ ${libzfs_sover} -ne $(ver_cut 2 ${SLOT}) ]]; then
170 + echo
171 + eerror "BUG BUG BUG BUG BUG BUG BUG BUG"
172 + eerror "ebuild subslot does not match libzfs soversion!"
173 + eerror "libzfs soversion: ${libzfs_sover}"
174 + eerror "ebuild value: $(ver_cut 2 ${SLOT})"
175 + eerror "This is a bug in the ebuild, please use the following URL to report it"
176 + eerror "${bugurl}&short_desc=${CATEGORY}%2F${P}+update+subslot"
177 + echo
178 + # we want to abort for releases, but just print a warning for live ebuild
179 + # to keep package installable
180 + [[ ${PV} == "9999" ]] || die
181 + fi
182 +}
183 +
184 +src_prepare() {
185 + default
186 + libsoversion_check
187 +
188 + # Run unconditionally (bug #792627)
189 + eautoreconf
190 +
191 + if [[ ${PV} != "9999" ]]; then
192 + # Set revision number
193 + sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die "Could not set Gentoo release"
194 + fi
195 +
196 + if use python; then
197 + pushd contrib/pyzfs >/dev/null || die
198 + distutils-r1_src_prepare
199 + popd >/dev/null || die
200 + fi
201 +
202 + # prevent errors showing up on zfs-mount stop, #647688
203 + # openrc will unmount all filesystems anyway.
204 + sed -i "/^ZFS_UNMOUNT=/ s/yes/no/" "etc/default/zfs.in" || die
205 +}
206 +
207 +src_configure() {
208 + use custom-cflags || strip-flags
209 + use minimal || python_setup
210 +
211 + local myconf=(
212 + --bindir="${EPREFIX}/bin"
213 + --enable-shared
214 + --enable-systemd
215 + --enable-sysvinit
216 + --localstatedir="${EPREFIX}/var"
217 + --sbindir="${EPREFIX}/sbin"
218 + --with-config=user
219 + --with-dracutdir="${EPREFIX}/usr/lib/dracut"
220 + --with-linux="${KV_DIR}"
221 + --with-linux-obj="${KV_OUT_DIR}"
222 + --with-udevdir="$(get_udevdir)"
223 + --with-pamconfigsdir="${EPREFIX}/unwanted_files"
224 + --with-pammoduledir="$(getpam_mod_dir)"
225 + --with-systemdunitdir="$(systemd_get_systemunitdir)"
226 + --with-systemdpresetdir="${EPREFIX}/lib/systemd/system-preset"
227 + --with-vendor=gentoo
228 + $(use_enable debug)
229 + $(use_enable nls)
230 + $(use_enable pam)
231 + $(use_enable python pyzfs)
232 + --disable-static
233 + $(usex minimal --without-python --with-python="${EPYTHON}")
234 + )
235 +
236 + econf "${myconf[@]}"
237 +}
238 +
239 +src_compile() {
240 + default
241 + if use python; then
242 + pushd contrib/pyzfs >/dev/null || die
243 + distutils-r1_src_compile
244 + popd >/dev/null || die
245 + fi
246 +}
247 +
248 +src_install() {
249 + default
250 +
251 + gen_usr_ldscript -a nvpair uutil zfsbootenv zfs zfs_core zpool
252 +
253 + use pam && { rm -rv "${ED}/unwanted_files" || die ; }
254 +
255 + use test-suite || { rm -r "${ED}/usr/share/zfs" || die ; }
256 +
257 + find "${ED}" -name '*.la' -delete || die
258 +
259 + dobashcomp contrib/bash_completion.d/zfs
260 + bashcomp_alias zfs zpool
261 +
262 + # strip executable bit from conf.d file
263 + fperms 0644 /etc/conf.d/zfs
264 +
265 + if use python; then
266 + pushd contrib/pyzfs >/dev/null || die
267 + distutils-r1_src_install
268 + popd >/dev/null || die
269 + fi
270 +
271 + # enforce best available python implementation
272 + use minimal || python_fix_shebang "${ED}/bin"
273 +}
274 +
275 +pkg_postinst() {
276 + # we always need userspace utils in sync with zfs-kmod
277 + # so force initrd update for userspace as well, to avoid
278 + # situation when zfs-kmod trigger initrd rebuild before
279 + # userspace component is rebuilt
280 + # KV_* variables are provided by linux-info.eclass
281 + if [[ -z ${ROOT} ]] && use dist-kernel; then
282 + dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
283 + fi
284 +
285 + if use rootfs; then
286 + if ! has_version sys-kernel/genkernel && ! has_version sys-kernel/dracut; then
287 + elog "Root on zfs requires an initramfs to boot"
288 + elog "The following packages provide one and are tested on a regular basis:"
289 + elog " sys-kernel/dracut"
290 + elog " sys-kernel/genkernel"
291 + fi
292 + fi
293 +
294 + if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then
295 + einfo "Adding ${P} to the module database to ensure that the"
296 + einfo "kernel modules and userland utilities stay in sync."
297 + update_moduledb
298 + fi
299 +
300 + if systemd_is_booted || has_version sys-apps/systemd; then
301 + einfo "Please refer to ${EROOT}/lib/systemd/system-preset/50-zfs.preset"
302 + einfo "for default zfs systemd service configuration"
303 + else
304 + [[ -e "${EROOT}/etc/runlevels/boot/zfs-import" ]] || \
305 + einfo "You should add zfs-import to the boot runlevel."
306 + [[ -e "${EROOT}/etc/runlevels/boot/zfs-mount" ]]|| \
307 + einfo "You should add zfs-mount to the boot runlevel."
308 + [[ -e "${EROOT}/etc/runlevels/default/zfs-share" ]] || \
309 + einfo "You should add zfs-share to the default runlevel."
310 + [[ -e "${EROOT}/etc/runlevels/default/zfs-zed" ]] || \
311 + einfo "You should add zfs-zed to the default runlevel."
312 + fi
313 +}
314 +
315 +pkg_postrm() {
316 + if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then
317 + remove_moduledb
318 + fi
319 +}