commit:     9059463a8b642a8d4a8d5a2a25fb38a49be8c2e6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  3 04:18:58 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug  3 04:35:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9059463a

sys-fs/zfs: backport various fixes

Mostly build fixes (https://github.com/openzfs/zfs/pull/13684)
but also https://github.com/openzfs/zfs/pull/13714.

All from upstream zfs-2.1.6-staging branch.

Temporarily unkeyworded.

Bug: https://bugs.gentoo.org/863212
Bug: https://bugs.gentoo.org/855182
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-fs/zfs/Manifest                               |   1 +
 sys-fs/zfs/zfs-2.1.5-r5.ebuild                    | 334 ++++++++++++++++++++++
 sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild | 138 +++++++++
 3 files changed, 473 insertions(+)

diff --git a/sys-fs/zfs/Manifest b/sys-fs/zfs/Manifest
index 8d6ae4d6ba30..7b982f51e740 100644
--- a/sys-fs/zfs/Manifest
+++ b/sys-fs/zfs/Manifest
@@ -2,5 +2,6 @@ DIST zfs-2.0.7.tar.gz 14550055 BLAKE2B 
80f7297f04a21cd8f3f2043d895b0325512ba0cea
 DIST zfs-2.0.7.tar.gz.asc 836 BLAKE2B 
65e7df58c33ccadc4e0ca9dbc1e8c006abbec8442e2da50872a1ab0cbb841fc45152298e8d3b93ee4320ddae6416e3a856caf80d8efb21b19db53dfedbf00e38
 SHA512 
b901d8e92faa6cfe6010bd54de88c7d18057f434cb07f8a89672d6c446a0a97b23209ee8f02cfd3b2a8f431c68ec977e7dc9f95fe5d385dba0bb6d37338ba682
 DIST zfs-2.1.4.tar.gz 34896310 BLAKE2B 
be303f1181f604770536aa4aa61d5319ec408abbd04964cedadd15b3101a15deba6539bb5d833f4fed357f323d74f622d035305df699b213df41ae45bffdd200
 SHA512 
c7b57c43fc287b22905067ab022df4133d32e1a5dc335f7baf743b4ef88f64c2bf9d41318c2083230d077dd49e68f7d9e6172266e13d4b1eee29d359860f969e
 DIST zfs-2.1.4.tar.gz.asc 836 BLAKE2B 
b311730f72d534c87a782515f35a354bfbefba0513dc0cee5b0b497cf742590f13be6a49ff8a70d7d6503d0ba06b0266e7d290d718337add614812c3d1b0731a
 SHA512 
53880cd5369f468551bab685eb83739ed76aa286886fdd2cbad4270755fe809da730082a91bba61011f59594fac297ce05645ae32c2c73b4a9aa835f2991a1ee
+DIST zfs-2.1.5-patches.tar.xz 13324 BLAKE2B 
bfef8abd298cebd54491272b8c1deacace901d9a1acce67cb927bab6447eafd985352fd09f64336aa9d6611bab0e5c761d7973f0a65c408d77bb735a94c60253
 SHA512 
d2b009664f8eb4f2a8596693011fde578b6eae123c6169e5dfb70bd920c0f987f5177f7b1be008705a421574a8a9bc930f99823785c69e81573f18b0350cb9bd
 DIST zfs-2.1.5.tar.gz 34951632 BLAKE2B 
c6e3efd9c0cda91654767eaad0eaaa05cd9a5daf1cb0384c9c78b30062f5c29142ac37ab9dbdaf96c91456d11c317d782d3524ade293f03fda983e5992b79e49
 SHA512 
d9ccf1049cefa9167d25f71fbdca70092cd02368b60f09341e6489fb68dc5f89e87b026b0191f4d81181a8851449124d824a1d959d0e2fb29c8a3d624edc4f03
 DIST zfs-2.1.5.tar.gz.asc 836 BLAKE2B 
4a81c266967540850a2cc824e79555ca9d05b2e17e45fa2723893cbd85b55e3d7d791986d6667b7ee1530e7692c03818f15e8b6798393b54989f90801b775786
 SHA512 
224b0dcf4982c63a8eff0a39d054537e7d023f7c35e154e4d20490b8daf184c076bc8e4de7d2c5af4059f8a802b747e637aad4479cd8d1330cf5b26da2f19c94

diff --git a/sys-fs/zfs/zfs-2.1.5-r5.ebuild b/sys-fs/zfs/zfs-2.1.5-r5.ebuild
new file mode 100644
index 000000000000..c1f790c74a69
--- /dev/null
+++ b/sys-fs/zfs/zfs-2.1.5-r5.ebuild
@@ -0,0 +1,334 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_OPTIONAL=1
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit autotools bash-completion-r1 dist-kernel-utils distutils-r1 
flag-o-matic linux-info pam systemd udev usr-ldscript
+
+DESCRIPTION="Userland utilities for ZFS Linux kernel module"
+HOMEPAGE="https://github.com/openzfs/zfs";
+
+if [[ ${PV} == "9999" ]]; then
+       inherit git-r3 linux-mod
+       EGIT_REPO_URI="https://github.com/openzfs/zfs.git";
+else
+       VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/openzfs.asc
+       inherit verify-sig
+
+       MY_P="${P/_rc/-rc}"
+       
SRC_URI="https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz";
+       SRC_URI+=" 
https://dev.gentoo.org/~sam/distfiles/sys-fs/zfs/${P}-patches.tar.xz";
+       SRC_URI+=" verify-sig? ( 
https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )"
+       S="${WORKDIR}/${P%_rc?}"
+
+       # Unkeyworded briefly for testing
+       #if [[ ${PV} != *_rc* ]]; then
+       #       KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv"
+       #fi
+fi
+
+LICENSE="BSD-2 CDDL MIT"
+# just libzfs soname major for now.
+# possible candidates: libuutil, libzpool, libnvpair. Those do not provide 
stable abi, but are considered.
+# see libsoversion_check() below as well
+SLOT="0/5"
+IUSE="custom-cflags debug dist-kernel kernel-builtin minimal nls pam python 
+rootfs test-suite"
+
+DEPEND="
+       net-libs/libtirpc:=
+       sys-apps/util-linux
+       sys-libs/zlib
+       virtual/libudev:=
+       dev-libs/openssl:0=
+       !minimal? ( ${PYTHON_DEPS} )
+       pam? ( sys-libs/pam )
+       python? (
+               virtual/python-cffi[${PYTHON_USEDEP}]
+       )
+"
+
+BDEPEND="virtual/awk
+       virtual/pkgconfig
+       nls? ( sys-devel/gettext )
+       python? (
+               dev-python/setuptools[${PYTHON_USEDEP}]
+               || (
+                       dev-python/packaging[${PYTHON_USEDEP}]
+                       dev-python/distlib[${PYTHON_USEDEP}]
+               )
+       )
+"
+
+if [[ ${PV} != "9999" ]] ; then
+       BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
+fi
+
+# awk is used for some scripts, completions, and the Dracut module
+RDEPEND="${DEPEND}
+       !kernel-builtin? ( ~sys-fs/zfs-kmod-${PV}:= )
+       !prefix? ( virtual/udev )
+       sys-fs/udev-init-scripts
+       virtual/awk
+       dist-kernel? ( virtual/dist-kernel:= )
+       rootfs? (
+               app-arch/cpio
+               app-misc/pax-utils
+               !<sys-kernel/genkernel-3.5.1.1
+       )
+       test-suite? (
+               app-shells/ksh
+               sys-apps/kmod[tools]
+               sys-apps/util-linux
+               sys-devel/bc
+               sys-block/parted
+               sys-fs/lsscsi
+               sys-fs/mdadm
+               sys-process/procps
+       )
+"
+
+# PDEPEND in this form is needed to trick portage suggest
+# enabling dist-kernel if only 1 package have it set, without suggesting to 
disable
+PDEPEND="dist-kernel? ( ~sys-fs/zfs-kmod-${PV}[dist-kernel] )"
+
+REQUIRED_USE="
+       !minimal? ( ${PYTHON_REQUIRED_USE} )
+       python? ( !minimal )
+       test-suite? ( !minimal )
+"
+
+RESTRICT="test"
+
+PATCHES=(
+       # bug #854333
+       "${FILESDIR}"/${PV}-r2-dracut-non-root.patch
+
+       "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch
+
+       # bug #857228
+       "${FILESDIR}"/${PV}-dracut-mount.patch
+
+       # bug #863212, bug #855182
+       "${WORKDIR}"/${P}-patches/
+)
+
+pkg_pretend() {
+       use rootfs || return 0
+
+       if has_version virtual/dist-kernel && ! use dist-kernel; then
+               ewarn "You have virtual/dist-kernel installed, but"
+               ewarn "USE=\"dist-kernel\" is not enabled for ${CATEGORY}/${PN}"
+               ewarn "It's recommended to globally enable dist-kernel USE flag"
+               ewarn "to auto-trigger initrd rebuilds with kernel updates"
+       fi
+}
+
+pkg_setup() {
+       if use kernel_linux; then
+               linux-info_pkg_setup
+
+               if ! linux_config_exists; then
+                       ewarn "Cannot check the linux kernel configuration."
+               else
+                       if use test-suite; then
+                               if linux_chkconfig_present BLK_DEV_LOOP; then
+                                       eerror "The ZFS test suite requires 
loop device support enabled."
+                                       eerror "Please enable it:"
+                                       eerror "    CONFIG_BLK_DEV_LOOP=y"
+                                       eerror "in /usr/src/linux/.config or"
+                                       eerror "    Device Drivers --->"
+                                       eerror "        Block devices --->"
+                                       eerror "            [X] Loopback device 
support"
+                               fi
+                       fi
+               fi
+       fi
+}
+
+libsoversion_check() {
+       local bugurl libzfs_sover
+       
bugurl="https://bugs.gentoo.org/enter_bug.cgi?form_name=enter_bug&product=Gentoo+Linux&component=Current+packages";
+
+       libzfs_sover="$(grep 'libzfs_la_LDFLAGS += -version-info' 
lib/libzfs/Makefile.am \
+               | grep -Eo '[0-9]+:[0-9]+:[0-9]+')"
+       libzfs_sover="${libzfs_sover%%:*}"
+
+       if [[ ${libzfs_sover} -ne $(ver_cut 2 ${SLOT}) ]]; then
+               echo
+               eerror "BUG BUG BUG BUG BUG BUG BUG BUG"
+               eerror "ebuild subslot does not match libzfs soversion!"
+               eerror "libzfs soversion: ${libzfs_sover}"
+               eerror "ebuild value: $(ver_cut 2 ${SLOT})"
+               eerror "This is a bug in the ebuild, please use the following 
URL to report it"
+               eerror "${bugurl}&short_desc=${CATEGORY}%2F${P}+update+subslot"
+               echo
+               # we want to abort for releases, but just print a warning for 
live ebuild
+               # to keep package installable
+               [[  ${PV} == "9999" ]] || die
+       fi
+}
+
+src_unpack() {
+       if use verify-sig ; then
+               # Needed for downloaded patch (which is unsigned, which is fine)
+               verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.gz{,.asc}
+       fi
+
+       default
+}
+
+src_prepare() {
+       default
+       libsoversion_check
+
+       # Run unconditionally (bug #792627)
+       eautoreconf
+
+       if [[ ${PV} != "9999" ]]; then
+               # Set revision number
+               sed -i "s/\(Release:\)\(.*\)1/\1\2${PR}-gentoo/" META || die 
"Could not set Gentoo release"
+       fi
+
+       if use python; then
+               pushd contrib/pyzfs >/dev/null || die
+               distutils-r1_src_prepare
+               popd >/dev/null || die
+       fi
+
+       # prevent errors showing up on zfs-mount stop, #647688
+       # openrc will unmount all filesystems anyway.
+       sed -i "/^ZFS_UNMOUNT=/ s/yes/no/" "etc/default/zfs.in" || die
+}
+
+src_configure() {
+       use custom-cflags || strip-flags
+       use minimal || python_setup
+
+       # All the same issue:
+       # Segfaults w/ GCC 12 and 'zfs send'
+       # bug #856373
+       # https://github.com/openzfs/zfs/issues/13620
+       # https://github.com/openzfs/zfs/issues/13605
+       append-flags -fno-tree-vectorize
+
+       local myconf=(
+               --bindir="${EPREFIX}/bin"
+               --enable-shared
+               --enable-sysvinit
+               --localstatedir="${EPREFIX}/var"
+               --sbindir="${EPREFIX}/sbin"
+               --with-config=user
+               --with-dracutdir="${EPREFIX}/usr/lib/dracut"
+               --with-linux="${KV_DIR}"
+               --with-linux-obj="${KV_OUT_DIR}"
+               --with-udevdir="$(get_udevdir)"
+               --with-pamconfigsdir="${EPREFIX}/unwanted_files"
+               --with-pammoduledir="$(getpam_mod_dir)"
+               --with-systemdunitdir="$(systemd_get_systemunitdir)"
+               --with-systemdpresetdir="$(systemd_get_systempresetdir)"
+               --with-vendor=gentoo
+               # Building zfs-mount-generator.c on musl breaks as strndupa
+               # isn't available. But systemd doesn't support musl anyway, so
+               # just disable building it.
+               $(use_enable !elibc_musl systemd)
+               $(use_enable debug)
+               $(use_enable nls)
+               $(use_enable pam)
+               $(use_enable python pyzfs)
+               --disable-static
+               $(usex minimal --without-python --with-python="${EPYTHON}")
+       )
+
+       econf "${myconf[@]}"
+}
+
+src_compile() {
+       default
+       if use python; then
+               pushd contrib/pyzfs >/dev/null || die
+               distutils-r1_src_compile
+               popd >/dev/null || die
+       fi
+}
+
+src_install() {
+       default
+
+       gen_usr_ldscript -a nvpair uutil zfsbootenv zfs zfs_core zpool
+
+       use pam && { rm -rv "${ED}/unwanted_files" || die ; }
+
+       use test-suite || { rm -r 
"${ED}"/usr/share/zfs/{test-runner,zfs-tests,runfiles,*sh} || die ; }
+
+       find "${ED}" -name '*.la' -delete || die
+
+       dobashcomp contrib/bash_completion.d/zfs
+       bashcomp_alias zfs zpool
+
+       # strip executable bit from conf.d file
+       fperms 0644 /etc/conf.d/zfs
+
+       if use python; then
+               pushd contrib/pyzfs >/dev/null || die
+               distutils-r1_src_install
+               popd >/dev/null || die
+       fi
+
+       # enforce best available python implementation
+       use minimal || python_fix_shebang "${ED}/bin"
+}
+
+pkg_postinst() {
+       udev_reload
+
+       # we always need userspace utils in sync with zfs-kmod
+       # so force initrd update for userspace as well, to avoid
+       # situation when zfs-kmod trigger initrd rebuild before
+       # userspace component is rebuilt
+       # KV_* variables are provided by linux-info.eclass
+       if [[ -z ${ROOT} ]] && use dist-kernel; then
+               dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+       fi
+
+       if use rootfs; then
+               if ! has_version sys-kernel/genkernel && ! has_version 
sys-kernel/dracut; then
+                       elog "Root on zfs requires an initramfs to boot"
+                       elog "The following packages provide one and are tested 
on a regular basis:"
+                       elog "  sys-kernel/dracut ( preferred, module 
maintained by zfs developers )"
+                       elog "  sys-kernel/genkernel"
+               fi
+       fi
+
+       if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then
+               einfo "Adding ${P} to the module database to ensure that the"
+               einfo "kernel modules and userland utilities stay in sync."
+               update_moduledb
+       fi
+
+       if systemd_is_booted || has_version sys-apps/systemd; then
+               einfo "Please refer to 
${EROOT}/$(systemd_get_systempresetdir)/50-zfs.preset"
+               einfo "for default zfs systemd service configuration"
+       else
+               [[ -e "${EROOT}/etc/runlevels/boot/zfs-import" ]] || \
+                       einfo "You should add zfs-import to the boot runlevel."
+               [[ -e "${EROOT}/etc/runlevels/boot/zfs-load-key" ]] || \
+                       einfo "You should add zfs-load-key to the boot 
runlevel."
+               [[ -e "${EROOT}/etc/runlevels/boot/zfs-mount" ]]|| \
+                       einfo "You should add zfs-mount to the boot runlevel."
+               [[ -e "${EROOT}/etc/runlevels/default/zfs-share" ]] || \
+                       einfo "You should add zfs-share to the default 
runlevel."
+               [[ -e "${EROOT}/etc/runlevels/default/zfs-zed" ]] || \
+                       einfo "You should add zfs-zed to the default runlevel."
+       fi
+}
+
+pkg_postrm() {
+       udev_reload
+
+       if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then
+               remove_moduledb
+       fi
+}

diff --git a/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild 
b/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild
new file mode 100644
index 000000000000..dfbe222efc20
--- /dev/null
+++ b/sys-libs/compiler-rt/compiler-rt-14.0.6-r1.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit cmake flag-o-matic llvm llvm.org python-any-r1 toolchain-funcs
+
+DESCRIPTION="Compiler runtime library for clang (built-in part)"
+HOMEPAGE="https://llvm.org/";
+
+LICENSE="Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT )"
+SLOT="$(ver_cut 1-3)"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86 ~amd64-linux ~ppc-macos 
~x64-macos"
+IUSE="+abi_x86_32 abi_x86_64 +clang debug test"
+RESTRICT="!test? ( test ) !clang? ( test )"
+
+CLANG_SLOT=${SLOT%%.*}
+# llvm-6 for new lit options
+DEPEND="
+       >=sys-devel/llvm-6
+"
+BDEPEND="
+       >=dev-util/cmake-3.16
+       clang? ( sys-devel/clang )
+       test? (
+               $(python_gen_any_dep 
">=dev-python/lit-9.0.1[\${PYTHON_USEDEP}]")
+               =sys-devel/clang-${PV%_*}*:${CLANG_SLOT}
+       )
+       !test? (
+               ${PYTHON_DEPS}
+       )
+"
+
+LLVM_COMPONENTS=( runtimes compiler-rt cmake llvm/cmake )
+LLVM_PATCHSET=${PV}-r2
+llvm.org_set_globals
+
+python_check_deps() {
+       use test || return 0
+       has_version "dev-python/lit[${PYTHON_USEDEP}]"
+}
+
+pkg_pretend() {
+       if ! use clang && ! tc-is-clang; then
+               ewarn "Building using a compiler other than clang may result in 
broken atomics"
+               ewarn "library. Enable USE=clang unless you have a very good 
reason not to."
+       fi
+}
+
+pkg_setup() {
+       # Darwin Prefix builds do not have llvm installed yet, so rely on
+       # bootstrap-prefix to set the appropriate path vars to LLVM instead
+       # of using llvm_pkg_setup.
+       if [[ ${CHOST} != *-darwin* ]] || has_version dev-lang/llvm; then
+               llvm_pkg_setup
+       fi
+       python-any-r1_pkg_setup
+}
+
+test_compiler() {
+       $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${@}" -o /dev/null -x c - \
+               <<<'int main() { return 0; }' &>/dev/null
+}
+
+src_configure() {
+       # LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
+       use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
+
+       # pre-set since we need to pass it to cmake
+       BUILD_DIR=${WORKDIR}/${P}_build
+
+       if use clang; then
+               # Only do this conditionally to allow overriding with
+               # e.g. CC=clang-13 in case of breakage
+               if ! tc-is-clang ; then
+                       local -x CC=${CHOST}-clang
+                       local -x CXX=${CHOST}-clang++
+               fi
+               strip-unsupported-flags
+       fi
+
+       local mycmakeargs=(
+               -DLLVM_ENABLE_RUNTIMES=compiler-rt
+               # this only adds unnecessary req on llvm-lit directory
+               -DLLVM_INCLUDE_TESTS=OFF
+
+               -DCOMPILER_RT_INSTALL_PATH="${EPREFIX}/usr/lib/clang/${SLOT}"
+               -DCOMPILER_RT_INCLUDE_TESTS=$(usex test)
+               -DCOMPILER_RT_BUILD_LIBFUZZER=OFF
+               -DCOMPILER_RT_BUILD_MEMPROF=OFF
+               -DCOMPILER_RT_BUILD_ORC=OFF
+               -DCOMPILER_RT_BUILD_PROFILE=OFF
+               -DCOMPILER_RT_BUILD_SANITIZERS=OFF
+               -DCOMPILER_RT_BUILD_XRAY=OFF
+
+               -DPython3_EXECUTABLE="${PYTHON}"
+       )
+
+       if use amd64; then
+               mycmakeargs+=(
+                       -DCAN_TARGET_i386=$(usex abi_x86_32)
+                       -DCAN_TARGET_x86_64=$(usex abi_x86_64)
+               )
+       fi
+
+       if use prefix && [[ "${CHOST}" == *-darwin* ]] ; then
+               mycmakeargs+=(
+                       # setting -isysroot is disabled with 
compiler-rt-prefix-paths.patch
+                       # this allows adding arm64 support using SDK in EPREFIX
+                       -DDARWIN_macosx_CACHED_SYSROOT="${EPREFIX}/MacOSX.sdk"
+                       # Set version based on the SDK in EPREFIX.
+                       # This disables i386 for SDK >= 10.15
+                       -DDARWIN_macosx_OVERRIDE_SDK_VERSION="$(realpath 
${EPREFIX}/MacOSX.sdk | sed -e 's/.*MacOSX\(.*\)\.sdk/\1/')"
+                       # Use our libtool instead of looking it up with xcrun
+                       -DCMAKE_LIBTOOL="${EPREFIX}/usr/bin/${CHOST}-libtool"
+               )
+       fi
+
+       if use test; then
+               mycmakeargs+=(
+                       -DLLVM_EXTERNAL_LIT="${EPREFIX}/usr/bin/lit"
+                       -DLLVM_LIT_ARGS="$(get_lit_flags)"
+
+                       
-DCOMPILER_RT_TEST_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang"
+                       
-DCOMPILER_RT_TEST_CXX_COMPILER="${EPREFIX}/usr/lib/llvm/${CLANG_SLOT}/bin/clang++"
+               )
+       fi
+
+       cmake_src_configure
+}
+
+src_test() {
+       # respect TMPDIR!
+       local -x LIT_PRESERVES_TMP=1
+
+       cmake_build check-builtins
+}

Reply via email to