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