diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0a4605d..ac68cb2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -33,10 +33,20 @@ jobs: # create a Github release with the generated artifacts - name: Release uses: softprops/action-gh-release@v1 + if: github.ref == 'refs/heads/main' with: files: | SHA256SUMS *.raw + - name: Pre Release + uses: softprops/action-gh-release@v1 + if: github.ref != 'refs/heads/main' + with: + prerelease: true + files: | + SHA256SUMS + *.raw + multi-build: name: Multi version build runs-on: ubuntu-22.04 @@ -44,7 +54,7 @@ jobs: strategy: max-parallel: 6 matrix: - flatcarversion: ["3510.2.6"] + flatcarversion: ["3510.2.6", "3510.2.7"] permissions: # allow the action to create a release contents: write @@ -73,7 +83,16 @@ jobs: # create a Github release with the generated artifacts - name: Release uses: softprops/action-gh-release@v1 + if: github.ref == 'refs/heads/main' + with: + files: | + SHA256SUMS + *.raw + - name: Pre Release + uses: softprops/action-gh-release@v1 + if: github.ref != 'refs/heads/main' with: + prerelease: true files: | SHA256SUMS *.raw diff --git a/bake.sh b/bake.sh index 8d42126..eb44700 100755 --- a/bake.sh +++ b/bake.sh @@ -20,6 +20,7 @@ elif [ "$1" = "-h" ] || [ "$1" = "--help" ]; then fi SYSEXTNAME="$1" +VERSION_ID="${2:-}" if [ "${FORMAT}" != "squashfs" ] && [ "${FORMAT}" != "btrfs" ] && [ "${FORMAT}" != "ext4" ] && [ "${FORMAT}" != "ext2" ]; then echo "Expected FORMAT=squashfs, FORMAT=btrfs, FORMAT=ext4, or FORMAT=ext2, got '${FORMAT}'" >&2 @@ -36,7 +37,9 @@ fi mkdir -p "${SYSEXTNAME}/usr/lib/extension-release.d" { echo "ID=${OS}" - if [ "${OS}" != "_any" ]; then + if [ "${VERSION_ID}" != "" ]; then + echo "VERSION_ID=${VERSION_ID}" + elif [ "${OS}" != "_any" ]; then echo "SYSEXT_LEVEL=1.0" fi if [ "${ARCH}" != "" ]; then diff --git a/create_zfs_sysext.sh b/create_zfs_sysext.sh index acaba92..ffbbcda 100755 --- a/create_zfs_sysext.sh +++ b/create_zfs_sysext.sh @@ -46,8 +46,6 @@ mkdir -p ${SYSEXTNAME}/lib/modules rsync -a /lib/modules/${kernel} ${SYSEXTNAME}/lib/modules/ echo "========== Emerge packages" pkgs=$(emerge 2>/dev/null --usepkgonly --pretend zfs| awk -F'] ' '/binary/{ print $ 2 }' | awk '{ print "="$1 }'); emerge --usepkgonly --root=${SYSEXTNAME} --nodeps $pkgs -echo "========== Create sysext metadata file" -mkdir -p ${SYSEXTNAME}/usr/lib/extension-release.d && echo -e 'ID=flatcar\nSYSEXT_LEVEL=1.0' >${SYSEXTNAME}/usr/lib/extension-release.d/extension-release.zfs mv ${SYSEXTNAME}/etc ${SYSEXTNAME}/usr/etc echo "========== Copy static files (systemd) to workdir" rsync -a files/zfs/usr/ ${SYSEXTNAME}/usr/ @@ -62,5 +60,5 @@ rm -rf ${SYSEXTNAME}/usr/include -"${SCRIPTFOLDER}"/bake.sh "${SYSEXTNAME}" +"${SCRIPTFOLDER}"/bake.sh "${SYSEXTNAME}" "${FLATCARVERSION}" rm -rf "${SYSEXTNAME}" diff --git a/files/zfs/3510.2.7/overlay/eclass/dist-kernel-utils.eclass b/files/zfs/3510.2.7/overlay/eclass/dist-kernel-utils.eclass new file mode 100644 index 0000000..6903183 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/eclass/dist-kernel-utils.eclass @@ -0,0 +1,201 @@ +# Copyright 2020-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: dist-kernel-utils.eclass +# @MAINTAINER: +# Distribution Kernel Project +# @AUTHOR: +# Michał Górny +# @SUPPORTED_EAPIS: 7 8 +# @BLURB: Utility functions related to Distribution Kernels +# @DESCRIPTION: +# This eclass provides various utility functions related to Distribution +# Kernels. + +# @ECLASS_VARIABLE: KERNEL_IUSE_SECUREBOOT +# @PRE_INHERIT +# @DEFAULT_UNSET +# @DESCRIPTION: +# If set to a non-null value, inherits secureboot.eclass +# and allows signing of generated kernel images. + +if [[ ! ${_DIST_KERNEL_UTILS} ]]; then + +case ${EAPI} in + 7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; +esac + +if [[ ${KERNEL_IUSE_SECUREBOOT} ]]; then + inherit secureboot +fi + +# @FUNCTION: dist-kernel_build_initramfs +# @USAGE: +# @DESCRIPTION: +# Build an initramfs for the kernel. specifies the absolute +# path where initramfs will be created, while specifies +# the kernel version, used to find modules. +# +# Note: while this function uses dracut at the moment, other initramfs +# variants may be supported in the future. +dist-kernel_build_initramfs() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" + local output=${1} + local version=${2} + + local rel_image_path=$(dist-kernel_get_image_path) + local image=${output%/*}/${rel_image_path##*/} + + local args=( + --force + # if uefi=yes is used, dracut needs to locate the kernel image + --kernel-image "${image}" + + # positional arguments + "${output}" "${version}" + ) + + ebegin "Building initramfs via dracut" + dracut "${args[@]}" + eend ${?} || die -n "Building initramfs failed" +} + +# @FUNCTION: dist-kernel_get_image_path +# @DESCRIPTION: +# Get relative kernel image path specific to the current ${ARCH}. +dist-kernel_get_image_path() { + case ${ARCH} in + amd64|x86) + echo arch/x86/boot/bzImage + ;; + arm64) + echo arch/arm64/boot/Image.gz + ;; + arm) + echo arch/arm/boot/zImage + ;; + hppa|ppc|ppc64|sparc) + # https://www.kernel.org/doc/html/latest/powerpc/bootwrapper.html + # ./ is required because of ${image_path%/*} + # substitutions in the code + echo ./vmlinux + ;; + riscv) + echo arch/riscv/boot/Image.gz + ;; + *) + die "${FUNCNAME}: unsupported ARCH=${ARCH}" + ;; + esac +} + +# @FUNCTION: dist-kernel_install_kernel +# @USAGE: +# @DESCRIPTION: +# Install kernel using installkernel tool. specifies +# the kernel version, full path to the image, +# full path to System.map. +dist-kernel_install_kernel() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 3 ]] || die "${FUNCNAME}: invalid arguments" + local version=${1} + local image=${2} + local map=${3} + + # if dracut is used in uefi=yes mode, initrd will actually + # be a combined kernel+initramfs UEFI executable. we can easily + # recognize it by PE magic (vs cpio for a regular initramfs) + local initrd=${image%/*}/initrd + local magic + [[ -s ${initrd} ]] && read -n 2 magic < "${initrd}" + if [[ ${magic} == MZ ]]; then + einfo "Combined UEFI kernel+initramfs executable found" + # install the combined executable in place of kernel + image=${initrd%/*}/uki.efi + mv "${initrd}" "${image}" || die + # We moved the generated initrd, prevent dracut from running again + # https://github.com/dracutdevs/dracut/pull/2405 + shopt -s nullglob + local plugins=() + for file in "${EROOT}"/etc/kernel/install.d/*.install; do + plugins+=( "${file}" ) + done + for file in "${EROOT}"/usr/lib/kernel/install.d/*.install; do + if ! has "${file##*/}" 50-dracut.install 51-dracut-rescue.install "${plugins[@]##*/}"; then + plugins+=( "${file}" ) + fi + done + shopt -u nullglob + export KERNEL_INSTALL_PLUGINS="${KERNEL_INSTALL_PLUGINS} ${plugins[@]}" + fi + + if [[ ${KERNEL_IUSE_SECUREBOOT} ]]; then + # Kernel-install requires uki's are named uki.efi, sign in-place + secureboot_sign_efi_file "${image}" "${image}" + fi + + ebegin "Installing the kernel via installkernel" + # note: .config is taken relatively to System.map; + # initrd relatively to bzImage + installkernel "${version}" "${image}" "${map}" + eend ${?} || die -n "Installing the kernel failed" +} + +# @FUNCTION: dist-kernel_reinstall_initramfs +# @USAGE: +# @DESCRIPTION: +# Rebuild and install initramfs for the specified dist-kernel. +# is the kernel source directory (${KV_DIR} from linux-info), +# while is the full kernel version (${KV_FULL}). +# The function will determine whether is actually +# a dist-kernel, and whether initramfs was used. +# +# This function is to be used in pkg_postinst() of ebuilds installing +# kernel modules that are included in the initramfs. +dist-kernel_reinstall_initramfs() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -eq 2 ]] || die "${FUNCNAME}: invalid arguments" + local kernel_dir=${1} + local ver=${2} + + local image_path=${kernel_dir}/$(dist-kernel_get_image_path) + local initramfs_path=${image_path%/*}/initrd + if [[ ! -f ${image_path} ]]; then + eerror "Kernel install missing, image not found:" + eerror " ${image_path}" + eerror "Initramfs will not be updated. Please reinstall your kernel." + return + fi + if [[ ! -f ${initramfs_path} && ! -f ${initramfs_path%/*}/uki.efi ]]; then + einfo "No initramfs or uki found at ${image_path}" + return + fi + + dist-kernel_build_initramfs "${initramfs_path}" "${ver}" + dist-kernel_install_kernel "${ver}" "${image_path}" \ + "${kernel_dir}/System.map" +} + +# @FUNCTION: dist-kernel_PV_to_KV +# @USAGE: +# @DESCRIPTION: +# Convert a Gentoo-style ebuild version to kernel "x.y.z[-rcN]" version. +dist-kernel_PV_to_KV() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${#} -ne 1 ]] && die "${FUNCNAME}: invalid arguments" + local pv=${1} + + local kv=${pv%%_*} + [[ -z $(ver_cut 3- "${kv}") ]] && kv+=".0" + [[ ${pv} == *_* ]] && kv+=-${pv#*_} + echo "${kv}" +} + +_DIST_KERNEL_UTILS=1 +fi diff --git a/files/zfs/3510.2.7/overlay/metadata/layout.conf b/files/zfs/3510.2.7/overlay/metadata/layout.conf new file mode 100644 index 0000000..e85e826 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/metadata/layout.conf @@ -0,0 +1,4 @@ +masters = portage-stable +thin-manifests = true +sign-commits = false +sign-manifests = false diff --git a/files/zfs/3510.2.7/overlay/profiles/repo_name b/files/zfs/3510.2.7/overlay/profiles/repo_name new file mode 100644 index 0000000..e0f34db --- /dev/null +++ b/files/zfs/3510.2.7/overlay/profiles/repo_name @@ -0,0 +1 @@ +zfs-overlay diff --git a/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/Manifest b/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/Manifest new file mode 100644 index 0000000..838b43a --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/Manifest @@ -0,0 +1,2 @@ +DIST udev-init-scripts-34.tar.gz 3660 BLAKE2B 954b003c78b31649fef69213a5424098f40e17e7ed11f4ec1443247950ea60db8536f37ca603caa06e5c9f8bab07b5ac3cb8c9435144532a97ff04836c24da49 SHA512 ed48bcd0815e235b2b3fa38f857cd97f164aac7c6ea805be87890eb06a0d52064bd733da240c6e2a34c8c73e10fd047b5e53096de06f17bc81d8266d70c0cc9d +DIST udev-init-scripts-35.tar.gz 3666 BLAKE2B fddae466428605ea930519e8a47e0ea91f89f9eacc1fd97c137d175142125b12c3d045aec68db35a463de444ac6d8c037cca55f9628f10576c968259d566a9e4 SHA512 da9d2093149967e2e1b9bc7190ddfd55a87c9ae2177e3216f7cb2694fc9b64037eb6f2599ad8a4b7594ef32ced88fbb319c92904bc72a81ea5404945f8a8378a diff --git a/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/metadata.xml b/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/metadata.xml new file mode 100644 index 0000000..31123d0 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/metadata.xml @@ -0,0 +1,7 @@ + + + + + systemd@gentoo.org + + diff --git a/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/udev-init-scripts-34.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/udev-init-scripts-34.ebuild new file mode 100644 index 0000000..26fa347 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/udev-init-scripts/udev-init-scripts-34.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +OLD_PN=udev-gentoo-scripts +OLD_P=${OLD_PN}-${PV} + +if [ "${PV}" = "9999" ]; then + EGIT_REPO_URI="git://anongit.gentoo.org/proj/${OLD_PN}.git" + inherit git-r3 +else + SRC_URI="https://gitweb.gentoo.org/proj/${OLD_PN}.git/snapshot/${OLD_P}.tar.gz -> ${P}.tar.gz" + S="${WORKDIR}/${OLD_P}" + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" +fi + +DESCRIPTION="udev startup scripts for openrc" +HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage" + +LICENSE="GPL-2" +SLOT="0" + +RESTRICT="test" + +RDEPEND=">=virtual/udev-217 + ! +Date: Fri, 18 Dec 2020 11:35:07 -0800 +Subject: [PATCH] copy-builtin: handle missing .gitignore + +acfc4944d0d6db114db9f2bb5401251c5bd767b6 broke copy-builtin in +release tarballs, because those do not contain .gitignore file. +Adding -f to rm call will make it return 0 even if file does not exist. + +Signed-off-by: Georgy Yakovlev +--- + copy-builtin | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/copy-builtin b/copy-builtin +index 84f469fef02..6a6eb1f3695 100755 +--- a/copy-builtin ++++ b/copy-builtin +@@ -36,7 +36,7 @@ rm -rf "$KERNEL_DIR/include/zfs" "$KERNEL_DIR/fs/zfs" + cp --recursive include "$KERNEL_DIR/include/zfs" + cp --recursive module "$KERNEL_DIR/fs/zfs" + cp zfs_config.h "$KERNEL_DIR/include/zfs/" +-rm "$KERNEL_DIR/include/zfs/.gitignore" ++rm -f "$KERNEL_DIR/include/zfs/.gitignore" + + for MODULE in "${MODULES[@]}" + do diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/files/2.1.4-ZERO_RANGE.patch b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/files/2.1.4-ZERO_RANGE.patch new file mode 100644 index 0000000..338b142 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/files/2.1.4-ZERO_RANGE.patch @@ -0,0 +1,304 @@ +https://github.com/openzfs/zfs/commit/c220771a47e4206fb43e6849957657c9504b1b14 +https://github.com/openzfs/zfs/issues/13329 + +From c220771a47e4206fb43e6849957657c9504b1b14 Mon Sep 17 00:00:00 2001 +From: Rich Ercolani <214141+rincebrain@users.noreply.github.com> +Date: Wed, 20 Apr 2022 19:07:03 -0400 +Subject: [PATCH] Corrected oversight in ZERO_RANGE behavior + +It turns out, no, in fact, ZERO_RANGE and PUNCH_HOLE do +have differing semantics in some ways - in particular, +one requires KEEP_SIZE, and the other does not. + +Also added a zero-range test to catch this, corrected a flaw +that made the punch-hole test succeed vacuously, and a typo +in file_write. + +Reviewed-by: Brian Behlendorf +Signed-off-by: Rich Ercolani +Closes #13329 +Closes #13338 +--- a/module/os/linux/zfs/zpl_file.c ++++ b/module/os/linux/zfs/zpl_file.c +@@ -781,11 +781,13 @@ zpl_fallocate_common(struct inode *ip, int mode, loff_t offset, loff_t len) + if (mode & (test_mode)) { + flock64_t bf; + +- if (offset > olen) +- goto out_unmark; ++ if (mode & FALLOC_FL_KEEP_SIZE) { ++ if (offset > olen) ++ goto out_unmark; + +- if (offset + len > olen) +- len = olen - offset; ++ if (offset + len > olen) ++ len = olen - offset; ++ } + bf.l_type = F_WRLCK; + bf.l_whence = SEEK_SET; + bf.l_start = offset; +--- a/tests/runfiles/linux.run ++++ b/tests/runfiles/linux.run +@@ -94,7 +94,7 @@ tests = ['events_001_pos', 'events_002_pos', 'zed_rc_filter', 'zed_fd_spill'] + tags = ['functional', 'events'] + + [tests/functional/fallocate:Linux] +-tests = ['fallocate_prealloc'] ++tests = ['fallocate_prealloc', 'fallocate_zero-range'] + tags = ['functional', 'fallocate'] + + [tests/functional/fault:Linux] +--- a/tests/zfs-tests/cmd/file_write/file_write.c ++++ b/tests/zfs-tests/cmd/file_write/file_write.c +@@ -251,7 +251,7 @@ usage(char *prog) + "\t[-s offset] [-c write_count] [-d data]\n\n" + "Where [data] equal to zero causes chars " + "0->%d to be repeated throughout, or [data]\n" +- "equal to 'R' for psudorandom data.\n", ++ "equal to 'R' for pseudorandom data.\n", + prog, DATA_RANGE); + + exit(1); +--- a/tests/zfs-tests/include/libtest.shlib ++++ b/tests/zfs-tests/include/libtest.shlib +@@ -4236,6 +4236,22 @@ function punch_hole # offset length file + esac + } + ++function zero_range # offset length file ++{ ++ typeset offset=$1 ++ typeset length=$2 ++ typeset file=$3 ++ ++ case "$UNAME" in ++ Linux) ++ fallocate --zero-range --offset $offset --length $length "$file" ++ ;; ++ *) ++ false ++ ;; ++ esac ++} ++ + # + # Wait for the specified arcstat to reach non-zero quiescence. + # If echo is 1 echo the value after reaching quiescence, otherwise +--- a/tests/zfs-tests/tests/functional/fallocate/Makefile.am ++++ b/tests/zfs-tests/tests/functional/fallocate/Makefile.am +@@ -3,4 +3,5 @@ dist_pkgdata_SCRIPTS = \ + setup.ksh \ + cleanup.ksh \ + fallocate_prealloc.ksh \ +- fallocate_punch-hole.ksh ++ fallocate_punch-hole.ksh \ ++ fallocate_zero-range.ksh +--- a/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh ++++ b/tests/zfs-tests/tests/functional/fallocate/fallocate_punch-hole.ksh +@@ -60,13 +60,17 @@ function cleanup + [[ -e $TESTDIR ]] && log_must rm -f $FILE + } + +-function check_disk_size ++function check_reported_size + { + typeset expected_size=$1 + +- disk_size=$(du $TESTDIR/file | awk '{print $1}') +- if [ $disk_size -ne $expected_size ]; then +- log_fail "Incorrect size: $disk_size != $expected_size" ++ if ! [ -e "${FILE}" ]; then ++ log_fail "$FILE does not exist" ++ fi ++ ++ reported_size=$(du "${FILE}" | awk '{print $1}') ++ if [ "$reported_size" != "$expected_size" ]; then ++ log_fail "Incorrect reported size: $reported_size != $expected_size" + fi + } + +@@ -74,9 +78,9 @@ function check_apparent_size + { + typeset expected_size=$1 + +- apparent_size=$(stat_size) +- if [ $apparent_size -ne $expected_size ]; then +- log_fail "Incorrect size: $apparent_size != $expected_size" ++ apparent_size=$(stat_size "${FILE}") ++ if [ "$apparent_size" != "$expected_size" ]; then ++ log_fail "Incorrect apparent size: $apparent_size != $expected_size" + fi + } + +@@ -86,25 +90,30 @@ log_onexit cleanup + + # Create a dense file and check it is the correct size. + log_must file_write -o create -f $FILE -b $BLKSZ -c 8 +-log_must check_disk_size $((131072 * 8)) ++sync_pool $TESTPOOL ++log_must check_reported_size 1027 + + # Punch a hole for the first full block. + log_must punch_hole 0 $BLKSZ $FILE +-log_must check_disk_size $((131072 * 7)) ++sync_pool $TESTPOOL ++log_must check_reported_size 899 + + # Partially punch a hole in the second block. + log_must punch_hole $BLKSZ $((BLKSZ / 2)) $FILE +-log_must check_disk_size $((131072 * 7)) ++sync_pool $TESTPOOL ++log_must check_reported_size 899 + +-# Punch a hole which overlaps the third and forth block. ++# Punch a hole which overlaps the third and fourth block. + log_must punch_hole $(((BLKSZ * 2) + (BLKSZ / 2))) $((BLKSZ)) $FILE +-log_must check_disk_size $((131072 * 7)) ++sync_pool $TESTPOOL ++log_must check_reported_size 899 + + # Punch a hole from the fifth block past the end of file. The apparent + # file size should not change since --keep-size is implied. + apparent_size=$(stat_size $FILE) + log_must punch_hole $((BLKSZ * 4)) $((BLKSZ * 10)) $FILE +-log_must check_disk_size $((131072 * 4)) ++sync_pool $TESTPOOL ++log_must check_reported_size 387 + log_must check_apparent_size $apparent_size + + log_pass "Ensure holes can be punched in files making them sparse" +--- /dev/null ++++ b/tests/zfs-tests/tests/functional/fallocate/fallocate_zero-range.ksh +@@ -0,0 +1,119 @@ ++#!/bin/ksh -p ++# ++# CDDL HEADER START ++# ++# The contents of this file are subject to the terms of the ++# Common Development and Distribution License (the "License"). ++# You may not use this file except in compliance with the License. ++# ++# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE ++# or http://www.opensolaris.org/os/licensing. ++# See the License for the specific language governing permissions ++# and limitations under the License. ++# ++# When distributing Covered Code, include this CDDL HEADER in each ++# file and include the License file at usr/src/OPENSOLARIS.LICENSE. ++# If applicable, add the following below this CDDL HEADER, with the ++# fields enclosed by brackets "[]" replaced with your own identifying ++# information: Portions Copyright [yyyy] [name of copyright owner] ++# ++# CDDL HEADER END ++# ++ ++# ++# Copyright (c) 2020 by Lawrence Livermore National Security, LLC. ++# Copyright (c) 2021 by The FreeBSD Foundation. ++# ++ ++. $STF_SUITE/include/libtest.shlib ++ ++# ++# DESCRIPTION: ++# Test FALLOC_FL_ZERO_RANGE functionality ++# ++# STRATEGY: ++# 1. Create a dense file ++# 2. Zero various ranges in the file and verify the result. ++# ++ ++verify_runnable "global" ++ ++if is_freebsd; then ++ log_unsupported "FreeBSD does not implement an analogue to ZERO_RANGE." ++fi ++ ++FILE=$TESTDIR/$TESTFILE0 ++BLKSZ=$(get_prop recordsize $TESTPOOL) ++ ++function cleanup ++{ ++ [[ -e $TESTDIR ]] && log_must rm -f $FILE ++} ++ ++# Helpfully, this function expects kilobytes, and check_apparent_size expects bytes. ++function check_reported_size ++{ ++ typeset expected_size=$1 ++ ++ if ! [ -e "${FILE}" ]; then ++ log_fail "$FILE does not exist" ++ fi ++ ++ reported_size=$(du "${FILE}" | awk '{print $1}') ++ if [ "$reported_size" != "$expected_size" ]; then ++ log_fail "Incorrect reported size: $reported_size != $expected_size" ++ fi ++} ++ ++function check_apparent_size ++{ ++ typeset expected_size=$1 ++ ++ apparent_size=$(stat_size "${FILE}") ++ if [ "$apparent_size" != "$expected_size" ]; then ++ log_fail "Incorrect apparent size: $apparent_size != $expected_size" ++ fi ++} ++ ++log_assert "Ensure ranges can be zeroed in files" ++ ++log_onexit cleanup ++ ++# Create a dense file and check it is the correct size. ++log_must file_write -o create -f $FILE -b $BLKSZ -c 8 ++sync_pool $TESTPOOL ++log_must check_reported_size 1027 ++ ++# Zero a range covering the first full block. ++log_must zero_range 0 $BLKSZ $FILE ++sync_pool $TESTPOOL ++log_must check_reported_size 899 ++ ++# Partially zero a range in the second block. ++log_must zero_range $BLKSZ $((BLKSZ / 2)) $FILE ++sync_pool $TESTPOOL ++log_must check_reported_size 899 ++ ++# Zero range which overlaps the third and fourth block. ++log_must zero_range $(((BLKSZ * 2) + (BLKSZ / 2))) $((BLKSZ)) $FILE ++sync_pool $TESTPOOL ++log_must check_reported_size 899 ++ ++# Zero range from the fifth block past the end of file, with --keep-size. ++# The apparent file size must not change, since we did specify --keep-size. ++apparent_size=$(stat_size $FILE) ++log_must fallocate --keep-size --zero-range --offset $((BLKSZ * 4)) --length $((BLKSZ * 10)) "$FILE" ++sync_pool $TESTPOOL ++log_must check_reported_size 387 ++log_must check_apparent_size $apparent_size ++ ++# Zero range from the fifth block past the end of file. The apparent ++# file size should change since --keep-size is not implied, unlike ++# with PUNCH_HOLE. ++apparent_size=$(stat_size $FILE) ++log_must zero_range $((BLKSZ * 4)) $((BLKSZ * 10)) $FILE ++sync_pool $TESTPOOL ++log_must check_reported_size 387 ++log_must check_apparent_size $((BLKSZ * 14)) ++ ++log_pass "Ensure ranges can be zeroed in files" +--- a/tests/zfs-tests/tests/functional/fallocate/setup.ksh ++++ b/tests/zfs-tests/tests/functional/fallocate/setup.ksh +@@ -26,4 +26,7 @@ + . $STF_SUITE/include/libtest.shlib + + DISK=${DISKS%% *} +-default_setup $DISK ++default_setup_noexit $DISK ++log_must zfs set compression=off $TESTPOOL ++log_pass ++ + diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/files/zfs-kmod-2.1.11-gentoo.patch b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/files/zfs-kmod-2.1.11-gentoo.patch new file mode 100644 index 0000000..53c5f27 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/files/zfs-kmod-2.1.11-gentoo.patch @@ -0,0 +1,24 @@ +Hack to pass the full linux-mod-r1 toolchain to make during ./configure. +Not needed at build time given can pass it normally then. + +Eclass has workarounds, compiler/version matching, and its own set of +user variables which creates disparity between ebuilds if not used. + +For the (normal) alternative: KERNEL_{CC,LD} alone is insufficient, +but combining with KERNEL_LLVM=1 when CC_IS_CLANG will allow it +to work for *most* people (will likely still need KERNEL_LD from +linux-mod-r1, or ThinLTO kernels may fail with sandbox violations). + +Note KERNEL_* also cause failure if they contain spaces. + +https://bugs.gentoo.org/865157 +--- a/config/kernel.m4 ++++ b/config/kernel.m4 +@@ -646,6 +646,5 @@ + AC_TRY_COMMAND([ + KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6" +- make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC} +- ${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM} ++ make modules -k -j$TEST_JOBS '${GENTOO_MAKEARGS_EVAL}' + CONFIG_MODULES=y CFLAGS_MODULE=-DCONFIG_MODULES + -C $LINUX_OBJ $ARCH_UM M=$PWD/$1 >$1/build.log 2>&1]) diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/metadata.xml b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/metadata.xml new file mode 100644 index 0000000..7e27782 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/metadata.xml @@ -0,0 +1,21 @@ + + + + + gyakovlev@gentoo.org + Georgy Yakovlev + + + sam@gentoo.org + Sam James + + + Prevents upgrading to an unsupported kernel version when combined with USE=dist-kernel + Pull dependencies and check kernel options required for root-on-zfs + + + https://github.com/openzfs/zfs/issues + https://openzfs.github.io/openzfs-docs + openzfs/zfs + + diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild new file mode 100644 index 0000000..f3bf1e8 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-0.8.6.ebuild @@ -0,0 +1,212 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs + +DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs" +HOMEPAGE="https://github.com/openzfs/zfs" + +if [[ ${PV} == "9999" ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/openzfs/zfs.git" +else + SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${PV}/zfs-${PV}.tar.gz" + KEYWORDS="amd64 arm64 ppc64" + S="${WORKDIR}/zfs-${PV}" + ZFS_KERNEL_COMPAT="5.9" + + # increments minor eg 5.14 -> 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" +fi + +LICENSE="CDDL debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" + +DEPEND="" + +RDEPEND="${DEPEND} + !sys-kernel/spl +" + +BDEPEND=" + dev-lang/perl + virtual/awk + dist-kernel? ( added by KBUILD + ) + + emake "${myemakeargs[@]}" install + + einstalldocs +} + +pkg_postinst() { + linux-mod_pkg_postinst + + # Remove old modules + if [[ -d "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" ]]; then + ewarn "${PN} now installs modules in ${EROOT}/lib/modules/${KV_FULL}/extra/zfs" + ewarn "Old modules were detected in ${EROOT}/lib/modules/${KV_FULL}/addon/zfs" + ewarn "Automatically removing old modules to avoid problems." + rm -r "${EROOT}/lib/modules/${KV_FULL}/addon/zfs" || die "Cannot remove modules" + rmdir --ignore-fail-on-non-empty "${EROOT}/lib/modules/${KV_FULL}/addon" + fi + + if [[ -z ${ROOT} ]] && use dist-kernel; then + set_arch_to_portage + dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}" + fi + + if use x86 || use arm; then + ewarn "32-bit kernels will likely require increasing vmalloc to" + ewarn "at least 256M and decreasing zfs_arc_max to some value less than that." + fi + + ewarn "This version of OpenZFS includes support for new feature flags" + ewarn "that are incompatible with previous versions. GRUB2 support for" + ewarn "/boot with the new feature flags is not yet available." + ewarn "Do *NOT* upgrade root pools to use the new feature flags." + ewarn "Any new pools will be created with the new feature flags by default" + ewarn "and will not be compatible with older versions of OpenZFS. To" + ewarn "create a newpool that is backward compatible wih GRUB2, use " + ewarn + ewarn "zpool create -d -o feature@async_destroy=enabled " + ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled" + ewarn " -o feature@spacemap_histogram=enabled" + ewarn " -o feature@enabled_txg=enabled " + ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled" + ewarn " ..." + ewarn + ewarn "GRUB2 support will be updated as soon as either the GRUB2" + ewarn "developers do a tag or the Gentoo developers find time to backport" + ewarn "support from GRUB2 HEAD." +} diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.0.7.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.0.7.ebuild new file mode 100644 index 0000000..154ef60 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.0.7.ebuild @@ -0,0 +1,212 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs + +DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs" +HOMEPAGE="https://github.com/openzfs/zfs" + +if [[ ${PV} == "9999" ]]; then + inherit git-r3 + 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_PV="${PV/_rc/-rc}" + SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz" + SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )" + S="${WORKDIR}/zfs-${PV%_rc?}" + ZFS_KERNEL_COMPAT="5.15" + + # increments minor eg 5.14 -> 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="amd64 arm64 ppc64" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" + +RDEPEND="${DEPEND} + !sys-kernel/spl +" + +BDEPEND=" + dev-lang/perl + virtual/awk +" + +# we want dist-kernel block in BDEPEND because of portage resolver. +# since linux-mod.eclass already sets version-unbounded dep, portage +# will pull new versions. So we set it in BDEPEND which takes priority. +# and we don't need in in git ebuild. +if [[ ${PV} != "9999" ]] ; then + BDEPEND+=" + verify-sig? ( sec-keys/openpgp-keys-openzfs ) + dist-kernel? ( added by KBUILD + ) + + emake "${myemakeargs[@]}" install + + einstalldocs +} + +pkg_postinst() { + linux-mod_pkg_postinst + + if [[ -z ${ROOT} ]] && use dist-kernel; then + set_arch_to_portage + dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}" + fi + + if use x86 || use arm; then + ewarn "32-bit kernels will likely require increasing vmalloc to" + ewarn "at least 256M and decreasing zfs_arc_max to some value less than that." + fi + + if has_version sys-boot/grub; then + ewarn "This version of OpenZFS includes support for new feature flags" + ewarn "that are incompatible with previous versions. GRUB2 support for" + ewarn "/boot with the new feature flags is not yet available." + ewarn "Do *NOT* upgrade root pools to use the new feature flags." + ewarn "Any new pools will be created with the new feature flags by default" + ewarn "and will not be compatible with older versions of OpenZFS. To" + ewarn "create a newpool that is backward compatible wih GRUB2, use " + ewarn + ewarn "zpool create -d -o feature@async_destroy=enabled " + ewarn " -o feature@empty_bpobj=enabled -o feature@lz4_compress=enabled" + ewarn " -o feature@spacemap_histogram=enabled" + ewarn " -o feature@enabled_txg=enabled " + ewarn " -o feature@extensible_dataset=enabled -o feature@bookmarks=enabled" + ewarn " ..." + ewarn + ewarn "GRUB2 support will be updated as soon as either the GRUB2" + ewarn "developers do a tag or the Gentoo developers find time to backport" + ewarn "support from GRUB2 HEAD." + fi +} diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.1.11-r1.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.1.11-r1.ebuild new file mode 100644 index 0000000..7bf3eba --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.1.11-r1.ebuild @@ -0,0 +1,177 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools dist-kernel-utils flag-o-matic linux-mod-r1 multiprocessing + +DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs" +HOMEPAGE="https://github.com/openzfs/zfs" + +MODULES_KERNEL_MAX=6.2 +MODULES_KERNEL_MIN=3.10 + +if [[ ${PV} == 9999 ]] ; then + EGIT_REPO_URI="https://github.com/openzfs/zfs.git" + inherit git-r3 + unset MODULES_KERNEL_MAX +else + VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/openzfs.asc + inherit verify-sig + + MY_PV=${PV/_rc/-rc} + SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz" + SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )" + S="${WORKDIR}/zfs-${PV%_rc?}" + + ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}" + # Increments minor eg 5.14 -> 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]] ; then + KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" +RESTRICT="test" + +BDEPEND=" + dev-lang/perl + app-alternatives/awk +" + +if [[ ${PV} != 9999 ]] ; then + BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )" + + IUSE+=" +dist-kernel-cap" + RDEPEND=" + dist-kernel-cap? ( dist-kernel? ( + 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="amd64 arm64 ppc64 ~riscv ~sparc" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" + +RDEPEND="${DEPEND}" + +BDEPEND=" + dev-lang/perl + app-alternatives/awk +" + +# we want dist-kernel block in BDEPEND because of portage resolver. +# since linux-mod.eclass already sets version-unbounded dep, portage +# will pull new versions. So we set it in BDEPEND which takes priority. +# and we don't need in in git ebuild. +if [[ ${PV} != "9999" ]] ; then + BDEPEND+=" + verify-sig? ( sec-keys/openpgp-keys-openzfs ) + dist-kernel? ( 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="amd64 arm64 ppc64 ~riscv" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" + +RDEPEND="${DEPEND} + !sys-kernel/spl +" + +BDEPEND=" + dev-lang/perl + virtual/awk +" + +# we want dist-kernel block in BDEPEND because of portage resolver. +# since linux-mod.eclass already sets version-unbounded dep, portage +# will pull new versions. So we set it in BDEPEND which takes priority. +# and we don't need in in git ebuild. +if [[ ${PV} != "9999" ]] ; then + BDEPEND+=" + verify-sig? ( sec-keys/openpgp-keys-openzfs ) + dist-kernel? ( added by KBUILD + ) + + emake "${myemakeargs[@]}" install + + einstalldocs +} + +pkg_postinst() { + linux-mod_pkg_postinst + + if [[ -z ${ROOT} ]] && use dist-kernel; then + set_arch_to_portage + dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}" + fi + + if use x86 || use arm; then + ewarn "32-bit kernels will likely require increasing vmalloc to" + ewarn "at least 256M and decreasing zfs_arc_max to some value less than that." + fi + + if has_version sys-boot/grub; then + ewarn "This version of OpenZFS includes support for new feature flags" + ewarn "that are incompatible with previous versions. GRUB2 support for" + ewarn "/boot with the new feature flags is not yet available." + ewarn "Do *NOT* upgrade root pools to use the new feature flags." + ewarn "Any new pools will be created with the new feature flags by default" + ewarn "and will not be compatible with older versions of OpenZFS. To" + ewarn "create a newpool that is backward compatible wih GRUB2, use " + ewarn + ewarn "zpool create -o compatibility=grub2 ..." + ewarn + ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features." + fi +} diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.1.4-r1.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.1.4-r1.ebuild new file mode 100644 index 0000000..a861d60 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs-kmod/zfs-kmod-2.1.4-r1.ebuild @@ -0,0 +1,209 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools dist-kernel-utils flag-o-matic linux-mod toolchain-funcs + +DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs" +HOMEPAGE="https://github.com/openzfs/zfs" + +if [[ ${PV} == "9999" ]]; then + inherit git-r3 + 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_PV="${PV/_rc/-rc}" + SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz" + SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )" + S="${WORKDIR}/zfs-${PV%_rc?}" + ZFS_KERNEL_COMPAT="5.17" + + # increments minor eg 5.14 -> 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="amd64 ~arm64 ppc64 ~riscv" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" + +RDEPEND="${DEPEND} + !sys-kernel/spl +" + +BDEPEND=" + dev-lang/perl + virtual/awk +" + +# we want dist-kernel block in BDEPEND because of portage resolver. +# since linux-mod.eclass already sets version-unbounded dep, portage +# will pull new versions. So we set it in BDEPEND which takes priority. +# and we don't need in in git ebuild. +if [[ ${PV} != "9999" ]] ; then + BDEPEND+=" + verify-sig? ( sec-keys/openpgp-keys-openzfs ) + dist-kernel? ( 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" + +RDEPEND="${DEPEND} + !sys-kernel/spl +" + +BDEPEND=" + dev-lang/perl + virtual/awk +" + +# we want dist-kernel block in BDEPEND because of portage resolver. +# since linux-mod.eclass already sets version-unbounded dep, portage +# will pull new versions. So we set it in BDEPEND which takes priority. +# and we don't need in in git ebuild. +if [[ ${PV} != "9999" ]] ; then + BDEPEND+=" + verify-sig? ( sec-keys/openpgp-keys-openzfs ) + dist-kernel? ( 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="amd64 arm64 ppc64 ~riscv ~sparc" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" + +RDEPEND="${DEPEND}" + +BDEPEND=" + dev-lang/perl + app-alternatives/awk +" + +# we want dist-kernel block in BDEPEND because of portage resolver. +# since linux-mod.eclass already sets version-unbounded dep, portage +# will pull new versions. So we set it in BDEPEND which takes priority. +# and we don't need in in git ebuild. +if [[ ${PV} != "9999" ]] ; then + BDEPEND+=" + verify-sig? ( sec-keys/openpgp-keys-openzfs ) + dist-kernel? ( 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]] ; then + KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" +RESTRICT="test" + +BDEPEND=" + app-alternatives/awk + dev-lang/perl +" + +if [[ ${PV} != 9999 ]] ; then + BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )" + + IUSE+=" +dist-kernel-cap" + RDEPEND=" + dist-kernel-cap? ( dist-kernel? ( + 5.15, and still supports override. + ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}" + ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))" + + if [[ ${PV} != *_rc* ]] ; then + KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc" + fi +fi + +LICENSE="CDDL MIT debug? ( GPL-2+ )" +SLOT="0/${PVR}" +IUSE="custom-cflags debug +rootfs" +RESTRICT="test" + +BDEPEND=" + app-alternatives/awk + dev-lang/perl +" + +if [[ ${PV} != 9999 ]] ; then + BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )" + + IUSE+=" +dist-kernel-cap" + RDEPEND=" + dist-kernel-cap? ( dist-kernel? ( + +Date: Sat, 22 May 2021 22:27:39 -0700 +Subject: [PATCH 1/2] systemd: add weekly and monthly scrub timers + +timers can be enabled as follows: + +systemctl enable zfs-scrub-weekly@rpool.timer --now +systemctl enable zfs-scrub-monthly@datapool.timer --now + +Each timer will pull in zfs-scrub@${poolname}.service, which is not +schedule-specific. + +Signed-off-by: Georgy Yakovlev +--- + etc/systemd/system/.gitignore | 1 + + etc/systemd/system/Makefile.am | 5 ++++- + etc/systemd/system/zfs-scrub-monthly@.timer.in | 12 ++++++++++++ + etc/systemd/system/zfs-scrub-weekly@.timer.in | 12 ++++++++++++ + etc/systemd/system/zfs-scrub@.service.in | 14 ++++++++++++++ + 5 files changed, 43 insertions(+), 1 deletion(-) + create mode 100644 etc/systemd/system/zfs-scrub-monthly@.timer.in + create mode 100644 etc/systemd/system/zfs-scrub-weekly@.timer.in + create mode 100644 etc/systemd/system/zfs-scrub@.service.in + +diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am +index c374a52ac..5e65e1db4 100644 +--- a/etc/systemd/system/Makefile.am ++++ b/etc/systemd/system/Makefile.am +@@ -12,7 +12,10 @@ systemdunit_DATA = \ + zfs-volume-wait.service \ + zfs-import.target \ + zfs-volumes.target \ +- zfs.target ++ zfs.target \ ++ zfs-scrub-monthly@.timer \ ++ zfs-scrub-weekly@.timer \ ++ zfs-scrub@.service + + SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA) + +diff --git a/etc/systemd/system/zfs-scrub-monthly@.timer.in b/etc/systemd/system/zfs-scrub-monthly@.timer.in +new file mode 100644 +index 000000000..903068468 +--- /dev/null ++++ b/etc/systemd/system/zfs-scrub-monthly@.timer.in +@@ -0,0 +1,12 @@ ++[Unit] ++Description=Monthly zpool scrub timer for %i ++Documentation=man:zpool-scrub(8) ++ ++[Timer] ++OnCalendar=monthly ++Persistent=true ++RandomizedDelaySec=1h ++Unit=zfs-scrub@%i.service ++ ++[Install] ++WantedBy=timers.target +diff --git a/etc/systemd/system/zfs-scrub-weekly@.timer.in b/etc/systemd/system/zfs-scrub-weekly@.timer.in +new file mode 100644 +index 000000000..ede699500 +--- /dev/null ++++ b/etc/systemd/system/zfs-scrub-weekly@.timer.in +@@ -0,0 +1,12 @@ ++[Unit] ++Description=Weekly zpool scrub timer for %i ++Documentation=man:zpool-scrub(8) ++ ++[Timer] ++OnCalendar=weekly ++Persistent=true ++RandomizedDelaySec=1h ++Unit=zfs-scrub@%i.service ++ ++[Install] ++WantedBy=timers.target +diff --git a/etc/systemd/system/zfs-scrub@.service.in b/etc/systemd/system/zfs-scrub@.service.in +new file mode 100644 +index 000000000..c04ac292a +--- /dev/null ++++ b/etc/systemd/system/zfs-scrub@.service.in +@@ -0,0 +1,14 @@ ++[Unit] ++Description=zpool scrub on %i ++Documentation=man:zpool-scrub(8) ++Requires=zfs.target ++After=zfs.target ++ConditionACPower=true ++ConditionPathIsDirectory=/sys/module/zfs ++ ++[Service] ++ExecStart=/bin/sh -c '\ ++if @sbindir@/zpool status %i | grep "scrub in progress"; then\ ++exec @sbindir@/zpool wait -t scrub %i;\ ++else exec @sbindir@/zpool scrub -w %i; fi' ++ExecStop=-/bin/sh -c '@sbindir@/zpool scrub -p %i 2>/dev/null || true' +-- +2.34.1 diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-musl-tests.patch b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-musl-tests.patch new file mode 100644 index 0000000..3d2c563 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-musl-tests.patch @@ -0,0 +1,58 @@ +From 123c87b3c2d75636da79f57a4b0ed60d2a3133a8 Mon Sep 17 00:00:00 2001 +From: Georgy Yakovlev +Date: Mon, 20 Dec 2021 12:25:11 -0800 +Subject: [PATCH] zfs-test/mmap_seek: fix build on musl + +it needs linux/fs.h for SEEK_DATA and friends + +without linux/fs.h: + +``` +mmap_seek.c +mmap_seek.c: In function 'seek_data': +mmap_seek.c:37:40: error: 'SEEK_DATA' undeclared (first use in this function); +did you mean 'SEEK_SET'? + 37 | off_t data_offset = lseek(fd, offset, SEEK_DATA); +``` + +also it needs sys/sysmacros.h for P2ROUNDUP +without it: + +``` +mmap_seek.c: In function 'main': +mmap_seek.c:122:19: warning: +implicit declaration of function 'P2ROUNDUP' [-Wimplicit-function-declaration] + 122 | seek_hole(fd, 0, P2ROUNDUP(file_size / 2, block_size)); + | ^~~~~~~~~ +powerpc64-gentoo-linux-musl/bin/ld: mmap_seek.o: in function `main': +mmap_seek.c:(.text.startup+0x1b8): undefined reference to `P2ROUNDUP' +powerpc64-gentoo-linux-musl/bin/ld: mmap_seek.c:(.text.startup+0x1d8): + undefined reference to `P2ROUNDUP' +powerpc64-gentoo-linux-musl/bin/ld: mmap_seek.c:(.text.startup+0x21c): + undefined reference to `P2ROUNDUP' +collect2: error: ld returned 1 exit status +make[5]: *** [Makefile:754: mmap_seek] Error 1 +``` + +Closes: https://github.com/openzfs/zfs/pull/12891 +Signed-off-by: Georgy Yakovlev +--- + tests/zfs-tests/cmd/mmap_seek/mmap_seek.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c b/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c +index f476e1dba9a..bb36527aafe 100644 +--- a/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c ++++ b/tests/zfs-tests/cmd/mmap_seek/mmap_seek.c +@@ -29,7 +29,11 @@ + #include + #include + #include ++#include + #include ++#ifdef __linux__ ++#include ++#endif + + static void + seek_data(int fd, off_t offset, off_t expected) diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-openrc-vendor.patch b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-openrc-vendor.patch new file mode 100644 index 0000000..abe222a --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-openrc-vendor.patch @@ -0,0 +1,42 @@ +From 6ef28c526ba7199a3740407d764b6505618ca8ba Mon Sep 17 00:00:00 2001 +From: Peter Levine +Date: Fri, 29 Oct 2021 18:34:37 -0400 +Subject: [PATCH] Set DEFAULT_INIT_SHELL to /sbin/openrc-run for Gentoo and + Alpine + +Gentoo and Alpine always set the rc init scripts' shebang to +#!/sbin/openrc-run, whether or not openrc is installed. + +Reviewed-by: Brian Behlendorf +Signed-off-by: Peter Levine +Closes #12683 +Closes #12692 +--- + config/zfs-build.m4 | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 +index 27041c054c2..ec4a2026bf5 100644 +--- a/config/zfs-build.m4 ++++ b/config/zfs-build.m4 +@@ -564,15 +564,11 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ + *) DEFAULT_INIT_SCRIPT=lsb ;; + esac + +- # On gentoo, it's possible that OpenRC isn't installed. Check if +- # /sbin/openrc-run exists, and if not, fall back to generic defaults. +- +- DEFAULT_INIT_SHELL="/bin/sh" +- AS_IF([test "$DEFAULT_INIT_SCRIPT" = "openrc"], [ +- AS_IF([test -x "/sbin/openrc-run"], +- [DEFAULT_INIT_SHELL="/sbin/openrc-run"], +- [DEFAULT_INIT_SCRIPT=lsb]) +- ]) ++ case "$VENDOR" in ++ gentoo) DEFAULT_INIT_SHELL="/sbin/openrc-run";; ++ alpine) DEFAULT_INIT_SHELL="/sbin/openrc-run";; ++ *) DEFAULT_INIT_SHELL="/bin/sh" ;; ++ esac + + AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT:$DEFAULT_INIT_SHELL]) + AC_SUBST(DEFAULT_INIT_SCRIPT) diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-scrub-timers.patch b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-scrub-timers.patch new file mode 100644 index 0000000..f1c5b56 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.2-scrub-timers.patch @@ -0,0 +1,147 @@ +From 2c9844d159024d4c742d24639a218213fb53d537 Mon Sep 17 00:00:00 2001 +From: Georgy Yakovlev +Date: Sat, 22 May 2021 22:27:39 -0700 +Subject: [PATCH 1/2] systemd: add weekly and monthly scrub timers + +timers can be enabled as follows: + +systemctl enable zfs-scrub-weekly@rpool.timer --now +systemctl enable zfs-scrub-monthly@datapool.timer --now + +Each timer will pull in zfs-scrub@${poolname}.service, which is not +schedule-specific. + +Signed-off-by: Georgy Yakovlev +--- + etc/systemd/system/.gitignore | 1 + + etc/systemd/system/Makefile.am | 5 ++++- + etc/systemd/system/zfs-scrub-monthly@.timer.in | 12 ++++++++++++ + etc/systemd/system/zfs-scrub-weekly@.timer.in | 12 ++++++++++++ + etc/systemd/system/zfs-scrub@.service.in | 14 ++++++++++++++ + 5 files changed, 43 insertions(+), 1 deletion(-) + create mode 100644 etc/systemd/system/zfs-scrub-monthly@.timer.in + create mode 100644 etc/systemd/system/zfs-scrub-weekly@.timer.in + create mode 100644 etc/systemd/system/zfs-scrub@.service.in + +diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am +index c374a52ac..5e65e1db4 100644 +--- a/etc/systemd/system/Makefile.am ++++ b/etc/systemd/system/Makefile.am +@@ -12,7 +12,10 @@ systemdunit_DATA = \ + zfs-volume-wait.service \ + zfs-import.target \ + zfs-volumes.target \ +- zfs.target ++ zfs.target \ ++ zfs-scrub-monthly@.timer \ ++ zfs-scrub-weekly@.timer \ ++ zfs-scrub@.service + + SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA) + +diff --git a/etc/systemd/system/zfs-scrub-monthly@.timer.in b/etc/systemd/system/zfs-scrub-monthly@.timer.in +new file mode 100644 +index 000000000..903068468 +--- /dev/null ++++ b/etc/systemd/system/zfs-scrub-monthly@.timer.in +@@ -0,0 +1,12 @@ ++[Unit] ++Description=Monthly zpool scrub timer for %i ++Documentation=man:zpool-scrub(8) ++ ++[Timer] ++OnCalendar=monthly ++Persistent=true ++RandomizedDelaySec=1h ++Unit=zfs-scrub@%i.service ++ ++[Install] ++WantedBy=timers.target +diff --git a/etc/systemd/system/zfs-scrub-weekly@.timer.in b/etc/systemd/system/zfs-scrub-weekly@.timer.in +new file mode 100644 +index 000000000..ede699500 +--- /dev/null ++++ b/etc/systemd/system/zfs-scrub-weekly@.timer.in +@@ -0,0 +1,12 @@ ++[Unit] ++Description=Weekly zpool scrub timer for %i ++Documentation=man:zpool-scrub(8) ++ ++[Timer] ++OnCalendar=weekly ++Persistent=true ++RandomizedDelaySec=1h ++Unit=zfs-scrub@%i.service ++ ++[Install] ++WantedBy=timers.target +diff --git a/etc/systemd/system/zfs-scrub@.service.in b/etc/systemd/system/zfs-scrub@.service.in +new file mode 100644 +index 000000000..c04ac292a +--- /dev/null ++++ b/etc/systemd/system/zfs-scrub@.service.in +@@ -0,0 +1,14 @@ ++[Unit] ++Description=zpool scrub on %i ++Documentation=man:zpool-scrub(8) ++Requires=zfs.target ++After=zfs.target ++ConditionACPower=true ++ConditionPathIsDirectory=/sys/module/zfs ++ ++[Service] ++ExecStart=/bin/sh -c '\ ++if @sbindir@/zpool status %i | grep "scrub in progress"; then\ ++exec @sbindir@/zpool wait -t scrub %i;\ ++else exec @sbindir@/zpool scrub -w %i; fi' ++ExecStop=-/bin/sh -c '@sbindir@/zpool scrub -p %i 2>/dev/null || true' +-- +2.34.1 + +From 4bac4eae0345fb322337b66a9b4923e9f3f52b0f Mon Sep 17 00:00:00 2001 +From: Georgy Yakovlev +Date: Fri, 29 Oct 2021 21:40:50 -0700 +Subject: [PATCH 2/2] zpool-scrub.8: add PERIODIC SCRUB section + +Signed-off-by: Georgy Yakovlev +--- + man/man8/zpool-scrub.8 | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/man/man8/zpool-scrub.8 b/man/man8/zpool-scrub.8 +index 768f71539..69ae825b6 100644 +--- a/man/man8/zpool-scrub.8 ++++ b/man/man8/zpool-scrub.8 +@@ -116,8 +116,29 @@ scanned at 100M/s, and 68.4M of that file data has been + scrubbed sequentially at 10.0M/s. + .El + .El ++.Sh PERIODIC SCRUB ++On machines using systemd, scrub timers can be enabled on per-pool basis. ++.Nm weekly ++and ++.Nm monthly ++timer units are provided. ++.Bl -tag -width Ds ++.It Xo ++.Xc ++.Nm systemctl ++.Cm enable ++.Cm zfs-scrub-\fIweekly\fB@\fIrpool\fB.timer ++.Cm --now ++.It Xo ++.Xc ++.Nm systemctl ++.Cm enable ++.Cm zfs-scrub-\fImonthly\fB@\fIotherpool\fB.timer ++.Cm --now ++.El + . + .Sh SEE ALSO ++.Xr systemd.timer 5 , + .Xr zpool-iostat 8 , + .Xr zpool-resilver 8 , + .Xr zpool-status 8 +-- +2.34.1 + diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.5-dracut-zfs-missing.patch b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.5-dracut-zfs-missing.patch new file mode 100644 index 0000000..077bcd5 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.5-dracut-zfs-missing.patch @@ -0,0 +1,14 @@ +https://github.com/openzfs/zfs/commit/ebbfc6cb853d2d2f3f0671362d5ff5588be39e9d +https://github.com/openzfs/zfs/issues/13595 +--- b/contrib/dracut/90zfs/module-setup.sh.in ++++ a/contrib/dracut/90zfs/module-setup.sh.in +@@ -19,7 +19,7 @@ + } + + installkernel() { ++ instmods zfs +- instmods -c zfs + } + + install() { + diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.5-r2-dracut-non-root.patch b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.5-r2-dracut-non-root.patch new file mode 100644 index 0000000..a9c6130 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/2.1.5-r2-dracut-non-root.patch @@ -0,0 +1,60 @@ +https://github.com/openzfs/zfs/commit/eefe83eaa68f7cb4a49c580dd940d3688e42c849 +https://bugs.gentoo.org/854333 + +From eefe83eaa68f7cb4a49c580dd940d3688e42c849 Mon Sep 17 00:00:00 2001 +From: Toyam Cox +Date: Thu, 30 Jun 2022 13:47:58 -0400 +Subject: [PATCH] dracut: fix boot on non-zfs-root systems + +Simply prevent overwriting root until it needs to be overwritten. + +Dracut could change this value before this module is called, but won't +change the kernel command line. + +Reviewed-by: Andrew J. Hesford +Signed-off-by: Toyam Cox +Closes #13592 +--- + contrib/dracut/90zfs/zfs-lib.sh.in | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/contrib/dracut/90zfs/zfs-lib.sh.in b/contrib/dracut/90zfs/zfs-lib.sh.in +index e44673c2d75..3a43e514d6f 100755 +--- a/contrib/dracut/90zfs/zfs-lib.sh.in ++++ b/contrib/dracut/90zfs/zfs-lib.sh.in +@@ -88,11 +88,11 @@ decode_root_args() { + return + fi + +- root=$(getarg root=) ++ xroot=$(getarg root=) + rootfstype=$(getarg rootfstype=) + + # shellcheck disable=SC2249 +- case "$root" in ++ case "$xroot" in + ""|zfs|zfs:|zfs:AUTO) + root=zfs:AUTO + rootfstype=zfs +@@ -100,7 +100,7 @@ decode_root_args() { + ;; + + ZFS=*|zfs:*) +- root="${root#zfs:}" ++ root="${xroot#zfs:}" + root="${root#ZFS=}" + root=$(echo "$root" | tr '+' ' ') + rootfstype=zfs +@@ -109,9 +109,9 @@ decode_root_args() { + esac + + if [ "$rootfstype" = "zfs" ]; then +- case "$root" in ++ case "$xroot" in + "") root=zfs:AUTO ;; +- *) root=$(echo "$root" | tr '+' ' ') ;; ++ *) root=$(echo "$xroot" | tr '+' ' ') ;; + esac + return 0 + fi + diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/bash-completion-sudo.patch b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/bash-completion-sudo.patch new file mode 100644 index 0000000..8ae9d25 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/files/bash-completion-sudo.patch @@ -0,0 +1,35 @@ +From 3829d0b867f6aa4bde8798147dee74a86435d12c Mon Sep 17 00:00:00 2001 +From: Georgy Yakovlev +Date: Fri, 22 Mar 2019 22:04:40 -0700 +Subject: [PATCH] contrib/bash_completion.d/zfs: remove sudo reference + +--- + contrib/bash_completion.d/zfs | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/contrib/bash_completion.d/zfs b/contrib/bash_completion.d/zfs +index 914db43c..b1aded36 100644 +--- a/contrib/bash_completion.d/zfs ++++ b/contrib/bash_completion.d/zfs +@@ -21,13 +21,13 @@ + # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + # OTHER DEALINGS IN THE SOFTWARE. + +-if [[ -w /dev/zfs ]]; then ++#if [[ -w /dev/zfs ]]; then + __ZFS_CMD="zfs" + __ZPOOL_CMD="zpool" +-else +- __ZFS_CMD="sudo zfs" +- __ZPOOL_CMD="sudo zpool" +-fi ++#else ++# __ZFS_CMD="sudo zfs" ++# __ZPOOL_CMD="sudo zpool" ++#fi + + __zfs_get_commands() + { +-- +2.21.0 + diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/metadata.xml b/files/zfs/3510.2.7/overlay/sys-fs/zfs/metadata.xml new file mode 100644 index 0000000..8518b15 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/metadata.xml @@ -0,0 +1,42 @@ + + + + + gyakovlev@gentoo.org + Georgy Yakovlev + + + sam@gentoo.org + Sam James + + + Disable dependency on sys-fs/zfs-kmod under the assumption that ZFS is part of the kernel source tree + Don't install python scripts (arcstat, dbufstat etc) and avoid dependency on dev-lang/python + Install zfs_key pam module, for automatically loading zfs encryption keys for home datasets + Enable dependencies required for booting off a pool containing a rootfs + Install regression test suite + + + https://github.com/openzfs/zfs/issues + https://openzfs.github.io/openzfs-docs + openzfs/zfs + + + OpenZFS is an advanced file system and volume manager which was originally developed + for Solaris and is now maintained by the OpenZFS community + + It includes the functionality of both traditional file systems and volume manager. + It has many advanced features including: + * Protection against data corruption. Integrity checking for both data and metadata. + * Continuous integrity verification and automatic “self-healing” repair + * Data redundancy with mirroring, RAID-Z1/2/3 [and DRAID] + * Support for high storage capacities — up to 256 trillion yobibytes (2^128 bytes) + * Space-saving with transparent compression using LZ4, GZIP or ZSTD + * Hardware-accelerated native encryption + * Efficient storage with snapshots and copy-on-write clones + * Efficient local or remote replication — send only changed blocks with ZFS send and receive + + The OpenZFS project brings together developers from the Linux, FreeBSD, illumos, MacOS, and Windows platforms. + OpenZFS is supported by a wide range of companies. + + diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-0.8.6-r2.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-0.8.6-r2.ebuild new file mode 100644 index 0000000..46403d3 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-0.8.6-r2.ebuild @@ -0,0 +1,245 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +DISTUTILS_OPTIONAL=1 +PYTHON_COMPAT=( python3_{7,8,9} ) + +inherit autotools bash-completion-r1 dist-kernel-utils distutils-r1 flag-o-matic linux-info 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 + SRC_URI="https://github.com/openzfs/${PN}/releases/download/${P}/${P}.tar.gz" + KEYWORDS="amd64 arm64 ppc64" +fi + +LICENSE="BSD-2 CDDL MIT" +SLOT="0/2" # just libzfs soname major for now. possible candidates: libuutil, libzpool, libnvpair +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/awk + virtual/libudev:= + dev-libs/openssl:0= + !minimal? ( ${PYTHON_DEPS} ) + python? ( + virtual/python-cffi[${PYTHON_USEDEP}] + ) +" + +BDEPEND="virtual/awk + virtual/pkgconfig + nls? ( sys-devel/gettext ) + python? ( + dev-python/setuptools[${PYTHON_USEDEP}] + ) +" + +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 + !" + eerror " Block devices --->" + eerror " [X] Loopback device support" + fi + fi + fi + fi +} + +src_prepare() { + default + + if [[ ${PV} == "9999" ]]; then + eautoreconf + else + # 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 + + local myconf=( + --bindir="${EPREFIX}/bin" + --enable-shared + --enable-systemd + --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-systemdunitdir="$(systemd_get_systemunitdir)" + --with-systemdpresetdir="$(systemd_get_systempresetdir)" + $(use_enable debug) + $(use_enable nls) + $(use_enable python pyzfs) + --disable-static + $(usex minimal --without-python --with-python="${EPYTHON}") + ) + + CONFIG_SHELL="${EPREFIX}/bin/bash" 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 uutil nvpair zpool zfs zfs_core + + use test-suite || rm -rf "${ED}/usr/share/zfs" + + 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() { + # 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 initramfs to boot" + elog "the following packages known to provide one and tested on 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-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() { + if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then + remove_moduledb + fi +} diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.0.7.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.0.7.ebuild new file mode 100644 index 0000000..e4ff7ef --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.0.7.ebuild @@ -0,0 +1,302 @@ +# 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+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )" + S="${WORKDIR}/${P%_rc?}" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="amd64 arm64 ppc64" + 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/4" +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 + !" + 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_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 + + local myconf=( + --bindir="${EPREFIX}/bin" + --enable-shared + --enable-systemd + --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 + $(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" || 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() { + # 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-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() { + if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then + remove_moduledb + fi +} diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.11.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.11.ebuild new file mode 100644 index 0000000..c67dc48 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.11.ebuild @@ -0,0 +1,320 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_OPTIONAL=1 +PYTHON_COMPAT=( python3_{9..11} ) + +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 + 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+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )" + S="${WORKDIR}/${P%_rc?}" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="amd64 arm64 ppc64 ~riscv ~sparc" + 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 selinux 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="app-alternatives/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 + app-alternatives/awk + dist-kernel? ( virtual/dist-kernel:= ) + rootfs? ( + app-arch/cpio + app-misc/pax-utils + ) + selinux? ( sec-policy/selinux-zfs ) + 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}"/2.1.5-r2-dracut-non-root.patch + + "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch +) + +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 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/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.2-r1.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.2-r1.ebuild new file mode 100644 index 0000000..d119026 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.2-r1.ebuild @@ -0,0 +1,303 @@ +# 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,9,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+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )" + S="${WORKDIR}/${P%_rc?}" + + 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 + !" + 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_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 + + 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() { + # 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-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() { + if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then + remove_moduledb + fi +} diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.4.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.4.ebuild new file mode 100644 index 0000000..f5e9ee0 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.4.ebuild @@ -0,0 +1,300 @@ +# 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,9,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+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )" + S="${WORKDIR}/${P%_rc?}" + + # 2.1.3 unkeyworded briefly for some 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 + !" + 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_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 + + 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() { + # 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() { + if ! use kernel-builtin && [[ ${PV} == "9999" ]]; then + remove_moduledb + fi +} diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.9.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.9.ebuild new file mode 100644 index 0000000..2930846 --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.1.9.ebuild @@ -0,0 +1,326 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_OPTIONAL=1 +PYTHON_COMPAT=( python3_{9..11} ) + +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+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )" + S="${WORKDIR}/${P%_rc?}" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="amd64 arm64 ppc64 ~riscv ~sparc" + 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 selinux 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="app-alternatives/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 + app-alternatives/awk + dist-kernel? ( virtual/dist-kernel:= ) + rootfs? ( + app-arch/cpio + app-misc/pax-utils + ) + selinux? ( sec-policy/selinux-zfs ) + 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}"/2.1.5-r2-dracut-non-root.patch + + "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch +) + +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/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.2.0_rc3.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.2.0_rc3.ebuild new file mode 100644 index 0000000..e9d67dd --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-2.2.0_rc3.ebuild @@ -0,0 +1,306 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_OPTIONAL=1 +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..11} ) + +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+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )" + S="${WORKDIR}/${MY_P}" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc" + 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 selinux test-suite" + +DEPEND=" + dev-libs/openssl:= + net-libs/libtirpc:= + sys-apps/util-linux + sys-libs/zlib + virtual/libudev:= + !minimal? ( ${PYTHON_DEPS} ) + pam? ( sys-libs/pam ) + python? ( + $(python_gen_cond_dep 'dev-python/cffi[${PYTHON_USEDEP}]' 'python*') + ) +" + +BDEPEND=" + app-alternatives/awk + virtual/pkgconfig + nls? ( sys-devel/gettext ) + python? ( + ${DISTUTILS_DEPS} + || ( + 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 ) + app-alternatives/awk + sys-fs/udev-init-scripts + dist-kernel? ( virtual/dist-kernel:= ) + rootfs? ( + app-arch/cpio + app-misc/pax-utils + ) + selinux? ( sec-policy/selinux-zfs ) + 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=( + "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch +) + +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_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 + + # Tries to use /etc/conf.d which we reserve for OpenRC + sed -i -e '/EnvironmentFile/d' etc/systemd/system/zfs*.in || die + + # 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 + + 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. + # UPDATE: it has been fixed since, + # https://github.com/openzfs/zfs/commit/1f19826c9ac85835cbde61a7439d9d1fefe43a4a + # but we still leave it as this for now. + $(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 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 +} diff --git a/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-9999.ebuild b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-9999.ebuild new file mode 100644 index 0000000..e9d67dd --- /dev/null +++ b/files/zfs/3510.2.7/overlay/sys-fs/zfs/zfs-9999.ebuild @@ -0,0 +1,306 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_OPTIONAL=1 +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{10..11} ) + +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+=" verify-sig? ( https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz.asc )" + S="${WORKDIR}/${MY_P}" + + if [[ ${PV} != *_rc* ]]; then + KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~sparc" + 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 selinux test-suite" + +DEPEND=" + dev-libs/openssl:= + net-libs/libtirpc:= + sys-apps/util-linux + sys-libs/zlib + virtual/libudev:= + !minimal? ( ${PYTHON_DEPS} ) + pam? ( sys-libs/pam ) + python? ( + $(python_gen_cond_dep 'dev-python/cffi[${PYTHON_USEDEP}]' 'python*') + ) +" + +BDEPEND=" + app-alternatives/awk + virtual/pkgconfig + nls? ( sys-devel/gettext ) + python? ( + ${DISTUTILS_DEPS} + || ( + 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 ) + app-alternatives/awk + sys-fs/udev-init-scripts + dist-kernel? ( virtual/dist-kernel:= ) + rootfs? ( + app-arch/cpio + app-misc/pax-utils + ) + selinux? ( sec-policy/selinux-zfs ) + 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=( + "${FILESDIR}"/2.1.5-dracut-zfs-missing.patch +) + +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_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 + + # Tries to use /etc/conf.d which we reserve for OpenRC + sed -i -e '/EnvironmentFile/d' etc/systemd/system/zfs*.in || die + + # 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 + + 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. + # UPDATE: it has been fixed since, + # https://github.com/openzfs/zfs/commit/1f19826c9ac85835cbde61a7439d9d1fefe43a4a + # but we still leave it as this for now. + $(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 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 +}