summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-01-05 00:27:31 +0000
committerSam James <sam@gentoo.org>2023-01-05 00:27:31 +0000
commit205c9c405c1182613231e3564c678fb4855ac308 (patch)
tree204ff5abc54dd788e0e69303fa196690553f11ad
parentdev-util/ropper: Stabilize 1.13.8 amd64, #889766 (diff)
downloadgentoo-205c9c405c1182613231e3564c678fb4855ac308.tar.gz
gentoo-205c9c405c1182613231e3564c678fb4855ac308.tar.bz2
gentoo-205c9c405c1182613231e3564c678fb4855ac308.zip
sys-fs/btrfs-progs: fix installed headers
Closes: https://bugs.gentoo.org/888579 Closes: https://bugs.gentoo.org/889694 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--sys-fs/btrfs-progs/btrfs-progs-6.1.1-r1.ebuild154
-rw-r--r--sys-fs/btrfs-progs/files/btrfs-progs-6.1.1-ioctl-fix.patch87
2 files changed, 241 insertions, 0 deletions
diff --git a/sys-fs/btrfs-progs/btrfs-progs-6.1.1-r1.ebuild b/sys-fs/btrfs-progs/btrfs-progs-6.1.1-r1.ebuild
new file mode 100644
index 000000000000..e9f08a83a90e
--- /dev/null
+++ b/sys-fs/btrfs-progs/btrfs-progs-6.1.1-r1.ebuild
@@ -0,0 +1,154 @@
+# Copyright 2008-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+
+inherit bash-completion-r1 python-single-r1 udev
+
+libbtrfs_soname=0
+
+if [[ ${PV} != 9999 ]]; then
+ MY_PV="v${PV/_/-}"
+ SRC_URI="https://www.kernel.org/pub/linux/kernel/people/kdave/${PN}/${PN}-${MY_PV}.tar.xz"
+
+ if [[ ${PV} != *_rc* ]] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+ fi
+
+ S="${WORKDIR}"/${PN}-${MY_PV}
+else
+ EGIT_REPO_URI="https://github.com/kdave/btrfs-progs.git"
+ EGIT_BRANCH="devel"
+ WANT_LIBTOOL="none"
+ inherit autotools git-r3
+fi
+
+DESCRIPTION="Btrfs filesystem utilities"
+HOMEPAGE="https://btrfs.wiki.kernel.org https://btrfs.readthedocs.io/en/latest/"
+
+LICENSE="GPL-2"
+SLOT="0/${libbtrfs_soname}"
+IUSE="+convert python +man reiserfs static static-libs udev +zstd"
+# Could support it with just !systemd => eudev, see mdadm, but let's
+# see if someone asks for it first.
+REQUIRED_USE="static? ( !udev )"
+
+# Tries to mount repaired filesystems
+RESTRICT="test"
+
+RDEPEND="
+ dev-libs/lzo:2=
+ sys-apps/util-linux:=[static-libs(+)?]
+ sys-libs/zlib:=
+ convert? (
+ sys-fs/e2fsprogs:=
+ reiserfs? (
+ >=sys-fs/reiserfsprogs-3.6.27
+ )
+ )
+ python? ( ${PYTHON_DEPS} )
+ udev? ( virtual/libudev:= )
+ zstd? ( app-arch/zstd:= )
+"
+DEPEND="${RDEPEND}
+ >=sys-kernel/linux-headers-5.10
+ convert? ( sys-apps/acl )
+ python? (
+ $(python_gen_cond_dep '
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ ')
+ )
+ static? (
+ dev-libs/lzo:2[static-libs(+)]
+ sys-apps/util-linux:0[static-libs(+)]
+ sys-libs/zlib:0[static-libs(+)]
+ convert? (
+ sys-fs/e2fsprogs[static-libs(+)]
+ reiserfs? (
+ >=sys-fs/reiserfsprogs-3.6.27[static-libs(+)]
+ )
+ )
+ zstd? ( app-arch/zstd[static-libs(+)] )
+ )
+"
+BDEPEND="virtual/pkgconfig
+ man? ( dev-python/sphinx )"
+
+if [[ ${PV} == 9999 ]]; then
+ BDEPEND+=" sys-devel/gnuconfig"
+fi
+
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-ioctl-fix.patch
+)
+
+pkg_setup() {
+ use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ default
+
+ if [[ ${PV} == 9999 ]]; then
+ AT_M4DIR="m4" eautoreconf
+
+ mkdir config || die
+ local automakedir="$(autotools_run_tool --at-output automake --print-libdir)"
+ [[ -e ${automakedir} ]] || die "Could not locate automake directory"
+
+ ln -s "${automakedir}"/install-sh config/install-sh || die
+ ln -s "${BROOT}"/usr/share/gnuconfig/config.guess config/config.guess || die
+ ln -s "${BROOT}"/usr/share/gnuconfig/config.sub config/config.sub || die
+ fi
+}
+
+src_configure() {
+ local myeconfargs=(
+ --bindir="${EPREFIX}"/sbin
+
+ --enable-lzo
+ --disable-experimental
+ $(use_enable convert)
+ $(use_enable man documentation)
+ $(use_enable elibc_glibc backtrace)
+ $(use_enable python)
+ $(use_enable static-libs static)
+ $(use_enable udev libudev)
+ $(use_enable zstd)
+
+ # Could support libgcrypt, libsodium, libkcapi
+ --with-crypto=builtin
+ --with-convert=ext2$(usex reiserfs ',reiserfs' '')
+ )
+
+ econf "${myeconfargs[@]}"
+}
+
+src_compile() {
+ emake V=1 all $(usev static)
+}
+
+src_install() {
+ local makeargs=(
+ $(usex python install_python '')
+ $(usex static install-static '')
+ )
+
+ emake V=1 DESTDIR="${D}" install "${makeargs[@]}"
+
+ newbashcomp btrfs-completion btrfs
+
+ use python && python_optimize
+}
+
+pkg_postinst() {
+ udev_reload
+}
+
+pkg_postrm() {
+ udev_reload
+}
diff --git a/sys-fs/btrfs-progs/files/btrfs-progs-6.1.1-ioctl-fix.patch b/sys-fs/btrfs-progs/files/btrfs-progs-6.1.1-ioctl-fix.patch
new file mode 100644
index 000000000000..d8149b6220ef
--- /dev/null
+++ b/sys-fs/btrfs-progs/files/btrfs-progs-6.1.1-ioctl-fix.patch
@@ -0,0 +1,87 @@
+https://bugs.gentoo.org/888579
+https://bugs.gentoo.org/889694
+https://github.com/kdave/btrfs-progs/issues/566
+https://github.com/kdave/btrfs-progs/commit/27bb4f6819df6ad7771e089e1fd3f1bd1163e437
+
+From 27bb4f6819df6ad7771e089e1fd3f1bd1163e437 Mon Sep 17 00:00:00 2001
+From: David Sterba <dsterba@suse.com>
+Date: Wed, 4 Jan 2023 16:34:51 +0100
+Subject: [PATCH] btrfs-progs: libbtrfs: revert to v6.0.2 ioctl.h
+
+The file ioctl.h has been copied to libbtrfs in 5fc1d0cd64ee
+("btrfs-progs: copy ioctl.h into libbtrfs") but that was after changes
+to the btrfs_qgroup_limit in 03451430de7c ("btrfs-progs: rename qgroup
+items to match the kernel naming scheme"). This caused build breakage
+but hasn't been fixed in v6.1.1.
+
+Revert the contents of libbtrfs/ioctl.h to be completely just v6.0.2
+though the other changes may not be needed, it's the version we know
+works.
+
+Issue: #566
+Signed-off-by: David Sterba <dsterba@suse.com>
+--- a/libbtrfs/ioctl.h
++++ b/libbtrfs/ioctl.h
+@@ -71,10 +71,10 @@ BUILD_ASSERT(sizeof(struct btrfs_ioctl_vol_args) == 4096);
+
+ struct btrfs_qgroup_limit {
+ __u64 flags;
+- __u64 max_rfer;
+- __u64 max_excl;
+- __u64 rsv_rfer;
+- __u64 rsv_excl;
++ __u64 max_referenced;
++ __u64 max_exclusive;
++ __u64 rsv_referenced;
++ __u64 rsv_exclusive;
+ };
+ BUILD_ASSERT(sizeof(struct btrfs_qgroup_limit) == 40);
+
+@@ -192,6 +192,7 @@ BUILD_ASSERT(sizeof(struct btrfs_ioctl_dev_replace_status_params) == 48);
+ #define BTRFS_IOCTL_DEV_REPLACE_CMD_START 0
+ #define BTRFS_IOCTL_DEV_REPLACE_CMD_STATUS 1
+ #define BTRFS_IOCTL_DEV_REPLACE_CMD_CANCEL 2
++#define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT -1
+ #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR 0
+ #define BTRFS_IOCTL_DEV_REPLACE_RESULT_NOT_STARTED 1
+ #define BTRFS_IOCTL_DEV_REPLACE_RESULT_ALREADY_STARTED 2
+@@ -934,6 +935,38 @@ enum btrfs_err_code {
+ BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET,
+ };
+
++/* An error code to error string mapping for the kernel
++* error codes
++*/
++static inline char *btrfs_err_str(enum btrfs_err_code err_code)
++{
++ switch (err_code) {
++ case BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET:
++ return "unable to go below two devices on raid1";
++ case BTRFS_ERROR_DEV_RAID1C3_MIN_NOT_MET:
++ return "unable to go below three devices on raid1c3";
++ case BTRFS_ERROR_DEV_RAID1C4_MIN_NOT_MET:
++ return "unable to go below four devices on raid1c4";
++ case BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET:
++ return "unable to go below four/two devices on raid10";
++ case BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET:
++ return "unable to go below two devices on raid5";
++ case BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET:
++ return "unable to go below three devices on raid6";
++ case BTRFS_ERROR_DEV_TGT_REPLACE:
++ return "unable to remove the dev_replace target dev";
++ case BTRFS_ERROR_DEV_MISSING_NOT_FOUND:
++ return "no missing devices found to remove";
++ case BTRFS_ERROR_DEV_ONLY_WRITABLE:
++ return "unable to remove the only writeable device";
++ case BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS:
++ return "add/delete/balance/replace/resize operation "
++ "in progress";
++ default:
++ return NULL;
++ }
++}
++
+ #define BTRFS_IOC_SNAP_CREATE _IOW(BTRFS_IOCTL_MAGIC, 1, \
+ struct btrfs_ioctl_vol_args)
+ #define BTRFS_IOC_DEFRAG _IOW(BTRFS_IOCTL_MAGIC, 2, \
+