| 1 |
|
# Copyright 1999-2025 Gentoo Authors
|
|
1 |
# Copyright 1999-2026 Gentoo Authors
|
| 2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
3 |
|
| 4 |
4 |
EAPI=8
|
| ... | ... | |
| 12 |
12 |
inherit git-r3
|
| 13 |
13 |
EGIT_REPO_URI="https://github.com/Zygo/bees.git"
|
| 14 |
14 |
else
|
| 15 |
|
SRC_URI="https://github.com/Zygo/bees/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
|
15 |
MY_PV=${PV/_/-}
|
|
16 |
MY_P=${P/_/-}
|
|
17 |
S=${WORKDIR}/${MY_P}
|
|
18 |
|
|
19 |
SRC_URI="https://github.com/Zygo/bees/archive/v${MY_PV}.tar.gz -> ${MY_P}.tar.gz"
|
| 16 |
20 |
KEYWORDS="amd64 ~arm64"
|
| 17 |
21 |
fi
|
| 18 |
22 |
|
| ... | ... | |
| 29 |
33 |
ERROR_BTRFS_FS="CONFIG_BTRFS_FS: bees does currently only work with btrfs"
|
| 30 |
34 |
|
| 31 |
35 |
PATCHES=(
|
| 32 |
|
"${FILESDIR}/0001-context-demote-abandoned-toxic-match-to-debug-log-le.patch"
|
| 33 |
|
"${FILESDIR}/0002-HACK-crucible-Work-around-kernel-memory-fragmentatio_v2.patch"
|
|
36 |
"${FILESDIR}/${PN}-0.11-glibc2.43.patch"
|
| 34 |
37 |
)
|
| 35 |
38 |
|
| 36 |
39 |
pkg_pretend() {
|
| 37 |
40 |
if [[ ${MERGE_TYPE} != buildonly ]]; then
|
| 38 |
|
if kernel_is -lt 4 11; then
|
| 39 |
|
ewarn "With kernel versions below 4.11, bees may severely degrade system performance"
|
| 40 |
|
ewarn "and responsiveness. Especially, the kernel may deadlock while bees is"
|
| 41 |
|
ewarn "running, it's recommended to run at least kernel 4.11."
|
| 42 |
|
ewarn
|
| 43 |
|
elif kernel_is -lt 4 14 29; then
|
| 44 |
|
ewarn "With kernel versions below 4.14.29, bees may generate a lot of bogus WARN_ON()"
|
| 45 |
|
ewarn "messages in the kernel log. These messages can be ignored and this is fixed"
|
| 46 |
|
ewarn "with more recent kernels:"
|
| 47 |
|
ewarn "# WARNING: CPU: 3 PID: 18172 at fs/btrfs/backref.c:1391 find_parent_nodes+0xc41/0x14e0"
|
| 48 |
|
ewarn
|
| 49 |
|
elif kernel_is -lt 5 7 0; then
|
|
41 |
if kernel_is -lt 5 7; then
|
| 50 |
42 |
ewarn "With kernel versions below 5.4.96 and 5.7, the kernel may hold file system"
|
| 51 |
43 |
ewarn "locks for a long time while at the same time CPU usage increases when bees is"
|
| 52 |
44 |
ewarn "operating. bees tries to avoid this behavior by excluding very common extents"
|
| 53 |
45 |
ewarn "from deduplication. This has only a minimal impact on dedupe effectiveness."
|
| 54 |
46 |
ewarn
|
| 55 |
47 |
fi
|
| 56 |
|
if kernel_is -lt 5 1 0; then
|
| 57 |
|
ewarn "IMPORTANT: With kernel versions below 5.1.0, you may experience data corruption"
|
| 58 |
|
ewarn "due to bees using compression in btrfs. You are adviced to use a chronologically"
|
| 59 |
|
ewarn "later kernel, that includes older LTS versions released after 5.0.4:"
|
| 60 |
|
ewarn "Fixed in: 5.1+, 5.0.4+, 4.19.31+, 4.14.108+, 4.9.165+, 4.4.177+, 3.18.137+"
|
| 61 |
|
ewarn "# commit 8e92821 btrfs: fix corruption reading shared and compressed extents after hole punching"
|
| 62 |
|
ewarn
|
| 63 |
|
fi
|
| 64 |
48 |
if kernel_is -lt 5 4 19; then
|
| 65 |
49 |
ewarn "With kernel versions below 5.4.19, bees may trigger a btrfs bug when running"
|
| 66 |
50 |
ewarn "btrfs-balance in parallel. This may lead to meta-data corruption in the worst"
|
| ... | ... | |
| 80 |
64 |
ewarn
|
| 81 |
65 |
fi
|
| 82 |
66 |
fi
|
|
67 |
if kernel_is -lt 5.7; then
|
|
68 |
ewarn "WARNING: Starting with bees v0.11, kernel versions below 5.7 (except 5.4 LTS)"
|
|
69 |
ewarn "are no longer supported. Using bees with such kernels may introduce kernel"
|
|
70 |
ewarn "crashes, system hangs, or data corruption. Please DO NOT runs bees with such"
|
|
71 |
ewarn "kernels. You will be using bees AT YOUR OWN RISK!"
|
|
72 |
ewarn
|
|
73 |
fi
|
|
74 |
fi
|
|
75 |
}
|
| 83 |
76 |
|
|
77 |
pkg_postinst() {
|
|
78 |
if [[ ${MERGE_TYPE} != buildonly ]]; then
|
| 84 |
79 |
elog "Bees recommends running the latest current kernel for performance and"
|
| 85 |
80 |
elog "reliability reasons, see README.md."
|
|
81 |
elog
|
|
82 |
elog "NEWS: bees now defaults to a much improved extent-based scanner. It is compatible"
|
|
83 |
elog "with your existing state database in \`\$BEESHOME\` but it may start over from the"
|
|
84 |
elog "beginning. However, it will keep the state of the old scanner, so you can switch"
|
|
85 |
elog "back and forth. To actually use the new scanner, use scan mode 4 or remove the"
|
|
86 |
elog "scan mode parameter from your init script. Requires kernel 4.14 or higher!"
|
| 86 |
87 |
fi
|
| 87 |
88 |
}
|
| 88 |
89 |
|
| ... | ... | |
| 101 |
102 |
DEFAULT_MAKE_TARGET=all
|
| 102 |
103 |
EOF
|
| 103 |
104 |
if [[ ${PV} != "9999" ]] ; then
|
| 104 |
|
echo BEES_VERSION=v${PV} >>localconf || die
|
|
105 |
echo BEES_VERSION=v${MY_PV} >>localconf || die
|
| 105 |
106 |
fi
|
| 106 |
107 |
}
|
| 107 |
108 |
|