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