bcachefs-tools-1.25.2gentoo
download
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
CRATES="
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
"
LLVM_COMPAT=( {17..20} )
PYTHON_COMPAT=( python3_{10..13} )
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kentoverstreet.asc
inherit cargo flag-o-matic llvm-r1 python-any-r1 shell-completion toolchain-funcs unpacker verify-sig
DESCRIPTION="Tools for bcachefs"
HOMEPAGE="https://bcachefs.org/"
if [[ ${PV} == "9999" ]]; then
inherit git-r3
EGIT_REPO_URI="https://evilpiepirate.org/git/bcachefs-tools.git"
else
SRC_URI="https://evilpiepirate.org/bcachefs-tools/bcachefs-tools-${PV}.tar.zst
${CARGO_CRATE_URIS}
"
SRC_URI+=" verify-sig? ( https://evilpiepirate.org/bcachefs-tools/bcachefs-tools-${PV}.tar.sign )"
S="${WORKDIR}/${P}"
KEYWORDS="amd64 arm64"
fi
LICENSE="Apache-2.0 BSD GPL-2 MIT"
SLOT="0"
IUSE="fuse verify-sig"
RESTRICT="test"
DEPEND="
app-arch/lz4:=
app-arch/zstd:=
dev-libs/libaio
dev-libs/libsodium:=
dev-libs/userspace-rcu:=
sys-apps/keyutils:=
sys-apps/util-linux
virtual/zlib:=
virtual/udev
fuse? ( >=sys-fs/fuse-3.7.0 )
"
RDEPEND="${DEPEND}"
# Clang is required for bindgen
BDEPEND="
${PYTHON_DEPS}
$(python_gen_any_dep '
dev-python/docutils[${PYTHON_USEDEP}]
')
$(unpacker_src_uri_depends)
$(llvm_gen_dep '
llvm-core/clang:${LLVM_SLOT}
')
elibc_musl? ( >=sys-libs/musl-1.2.5 )
virtual/pkgconfig
verify-sig? ( >=sec-keys/openpgp-keys-kentoverstreet-20241012 )
"
QA_FLAGS_IGNORED="/sbin/bcachefs"
python_check_deps() {
python_has_version "dev-python/docutils[${PYTHON_USEDEP}]"
}
pkg_setup() {
rust_pkg_setup
llvm-r1_pkg_setup
python-any-r1_pkg_setup
}
src_unpack() {
# Upstream signs the uncompressed tarball
if use verify-sig; then
einfo "Unpacking ${P}.tar.zst ..."
verify-sig_verify_detached - "${DISTDIR}"/${P}.tar.sign \
< <(zstd -fdc "${DISTDIR}"/${P}.tar.zst | tee >(tar -xf -))
assert "Unpack failed"
fi
if [[ ${PV} == "9999" ]]; then
git-r3_src_unpack
S="${S}/rust-src" cargo_live_src_unpack
else
unpacker ${P}.tar.zst
cargo_src_unpack
fi
}
src_prepare() {
default
tc-export CC
sed \
-e '/^CFLAGS/s:-O2::' \
-e '/^CFLAGS/s:-g::' \
-i Makefile || die
append-lfs-flags
}
src_compile() {
use fuse && export BCACHEFS_FUSE=1
export BUILD_VERBOSE=1
export VERSION=${PV}
default
# This version mangles the symbolic link,
# please check if this can be removed before bumping
rm "${S}"/bcachefs
ln -s "${S}"/target/release/bcachefs bcachefs
local shell
for shell in bash fish zsh; do
./bcachefs completions ${shell} > ${shell}.completion || die
done
}
src_install() {
into /
dosbin bcachefs
dosym bcachefs /sbin/fsck.bcachefs
dosym bcachefs /sbin/mkfs.bcachefs
dosym bcachefs /sbin/mount.bcachefs
if use fuse; then
dosym bcachefs /sbin/fsck.fuse.bcachefs
dosym bcachefs /sbin/mkfs.fuse.bcachefs
dosym bcachefs /sbin/mount.fuse.bcachefs
fi
newbashcomp bash.completion bcachefs
newfishcomp fish.completion bcachefs.fish
newzshcomp zsh.completion _bcachefs
doman bcachefs.8
}
pkg_postinst() {
if use fuse; then
ewarn "FUSE support is experimental."
ewarn "Please only use it for development purposes at the risk of losing your data."
ewarn "You have been warned."
fi
}