e2fsprogs, xfsprogs: upgraded packages to upstream

Upgraded sys-fs/e2fsprogs to version 1.46.5-r1 on amd64, arm64
Upgraded sys-fs/xfsprogs to version 5.18.0 on amd64, arm64

BUG=b/230908058,b/230907566
TEST=presubmit
RELEASE_NOTE=Upgrade sys-fs/xfsprogs to v5.18.0 and sys-fs/e2fsprogs to
v1.46.5.

Change-Id: I163f8b73ead76391b6cfb8e62d8790b6cbb802f7
Reviewed-on: https://cos-review.googlesource.com/c/third_party/overlays/portage-stable/+/33580
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
Reviewed-by: Roy Yang <royyang@google.com>
diff --git a/sys-fs/e2fsprogs/Manifest b/sys-fs/e2fsprogs/Manifest
index 4a224a4..1affd4f 100644
--- a/sys-fs/e2fsprogs/Manifest
+++ b/sys-fs/e2fsprogs/Manifest
@@ -1,2 +1 @@
-DIST e2fsprogs-1.46.4.tar.xz 7035200 BLAKE2B 473f7fd3f521b94cdaa68e37784a518fc1919387dd114f31b5338f1b4c472f86b150229ec3dcae8b73eac95330c0dea729befc8cea08bcf1e455c0b6652d6d2b SHA512 7d9cfdf00ed58e66049585e8382fe4977088956421a0fb8155900c69afd8857309ad2b9301b3f74c9c0afa7287a0ddba2fd1538fcf57858b37a9ab712390016d
 DIST e2fsprogs-1.46.5.tar.xz 7040672 BLAKE2B 8d8c02e891c464782a7cff518c41d793fc73366b57e17d80ffc5afd96e6144e354290e667e9710509a9dde4e5dab7e7185c5bf084c5bfd26219f05e5e92e0830 SHA512 53282e1c524f62a95012b1aceef296d494f5238c82c9b08b29fbe6a803dbf7ccfdcd9124eb2f11fe2ff9de26387c78751a92c3217ca414f6db6242098a72d3fa
diff --git a/sys-fs/e2fsprogs/e2fsprogs-1.46.4-r1.ebuild b/sys-fs/e2fsprogs/e2fsprogs-1.46.4-r1.ebuild
deleted file mode 120000
index 89f995a..0000000
--- a/sys-fs/e2fsprogs/e2fsprogs-1.46.4-r1.ebuild
+++ /dev/null
@@ -1 +0,0 @@
-e2fsprogs-1.46.4.ebuild
\ No newline at end of file
diff --git a/sys-fs/e2fsprogs/e2fsprogs-1.46.4.ebuild b/sys-fs/e2fsprogs/e2fsprogs-1.46.4.ebuild
deleted file mode 100644
index 05e3320..0000000
--- a/sys-fs/e2fsprogs/e2fsprogs-1.46.4.ebuild
+++ /dev/null
@@ -1,121 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit flag-o-matic systemd toolchain-funcs udev usr-ldscript
-
-DESCRIPTION="Standard EXT2/EXT3/EXT4 filesystem utilities"
-HOMEPAGE="http://e2fsprogs.sourceforge.net/"
-SRC_URI="https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v${PV}/${P}.tar.xz"
-
-LICENSE="GPL-2 BSD"
-SLOT="0"
-KEYWORDS="*"
-IUSE="cron fuse lto nls static-libs +threads"
-
-RDEPEND="~sys-libs/${PN}-libs-${PV}
-	>=sys-apps/util-linux-2.16
-	cron? ( sys-fs/lvm2[-device-mapper-only(-)] )
-	fuse? ( sys-fs/fuse:0 )
-	nls? ( virtual/libintl )"
-DEPEND="${RDEPEND}"
-BDEPEND="
-	nls? ( sys-devel/gettext )
-	virtual/pkgconfig
-	sys-apps/texinfo
-"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-1.40-fbsd.patch
-	"${FILESDIR}"/${PN}-1.42.13-fix-build-cflags.patch #516854
-	"${FILESDIR}"/${PN}-1.46-add-extended-option-for-prezeroed-storage.patch
-
-	# Upstream patches (can usually removed with next version bump)
-)
-
-src_prepare() {
-	default
-
-	cp doc/RelNotes/v${PV}.txt ChangeLog || die "Failed to copy Release Notes"
-
-	# Get rid of doc -- we don't use them. This also prevents a sandbox
-	# violation due to mktexfmt invocation
-	rm -r doc || die "Failed to remove doc dir"
-
-	# blargh ... trick e2fsprogs into using e2fsprogs-libs
-	sed -i -r \
-		-e 's:@LIBINTL@:@LTLIBINTL@:' \
-		-e '/^(STATIC_)?LIB(COM_ERR|SS)/s:[$][(]LIB[)]/lib([^@]*)@(STATIC_)?LIB_EXT@:-l\1:' \
-		-e '/^DEP(STATIC_)?LIB(COM_ERR|SS)/s:=.*:=:' \
-		MCONFIG.in || die "muck libs" #122368
-	sed -i -r \
-		-e '/^LIB_SUBDIRS/s:lib/(et|ss)::g' \
-		Makefile.in || die "remove subdirs"
-	ln -s $(which mk_cmds) lib/ss/ || die
-
-	# Avoid rebuild
-	echo '#include_next <ss/ss_err.h>' > lib/ss/ss_err.h
-}
-
-src_configure() {
-	# Keep the package from doing silly things #261411
-	export VARTEXFONTS="${T}/fonts"
-
-	# needs open64() prototypes and friends
-	append-cppflags -D_GNU_SOURCE
-
-	local myeconfargs=(
-		--with-root-prefix="${EPREFIX}"
-		$(use_with cron crond-dir "${EPREFIX}/etc/cron.d")
-		--with-systemd-unit-dir="$(systemd_get_systemunitdir)"
-		--with-udev-rules-dir="${EPREFIX}$(get_udevdir)/rules.d"
-		--enable-symlink-install
-		--enable-elf-shlibs
-		$(tc-has-tls || echo --disable-tls)
-		$(use_enable fuse fuse2fs)
-		$(use_enable nls)
-		--disable-libblkid
-		--disable-libuuid
-		--disable-fsck
-		--disable-uuidd
-		$(use_enable lto)
-		$(use_with threads pthread)
-	)
-	ac_cv_path_LDCONFIG=: econf "${myeconfargs[@]}"
-
-	if grep -qs 'USE_INCLUDED_LIBINTL.*yes' config.{log,status} ; then
-		eerror "INTL sanity check failed, aborting build."
-		eerror "Please post your ${S}/config.log file as an"
-		eerror "attachment to https://bugs.gentoo.org/show_bug.cgi?id=81096"
-		die "Preventing included intl cruft from building"
-	fi
-}
-
-src_compile() {
-	emake V=1 COMPILE_ET=compile_et MK_CMDS=mk_cmds
-}
-
-src_install() {
-	# need to set root_libdir= manually as any --libdir options in the
-	# econf above (i.e. multilib) will screw up the default #276465
-	emake \
-		STRIP=: \
-		root_libdir="${EPREFIX}/usr/$(get_libdir)" \
-		DESTDIR="${D}" \
-		install
-
-	einstalldocs
-
-	insinto /etc
-	doins "${FILESDIR}"/e2fsck.conf
-
-	# Move shared libraries to /lib/, install static libraries to
-	# /usr/lib/, and install linker scripts to /usr/lib/.
-	gen_usr_ldscript -a e2p ext2fs
-
-	# configure doesn't have an option to disable static libs :/
-	if ! use static-libs ; then
-		find "${ED}" -name '*.a' -delete || die
-	fi
-}
diff --git a/sys-fs/e2fsprogs/e2fsprogs-1.46.5-r1.ebuild b/sys-fs/e2fsprogs/e2fsprogs-1.46.5-r1.ebuild
new file mode 100644
index 0000000..38cc7f9
--- /dev/null
+++ b/sys-fs/e2fsprogs/e2fsprogs-1.46.5-r1.ebuild
@@ -0,0 +1,158 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic systemd toolchain-funcs udev usr-ldscript multilib-minimal
+
+DESCRIPTION="Standard EXT2/EXT3/EXT4 filesystem utilities"
+HOMEPAGE="http://e2fsprogs.sourceforge.net/"
+SRC_URI="https://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2 BSD"
+SLOT="0"
+KEYWORDS="*"
+IUSE="cron fuse lto nls static-libs test +threads +tools"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	!sys-libs/${PN}-libs
+	cron? ( sys-fs/lvm2[-device-mapper-only(-)] )
+	fuse? ( sys-fs/fuse:0 )
+	nls? ( virtual/libintl )
+	tools? ( sys-apps/util-linux )"
+# For testing lib/ext2fs, lib/support/libsupport.a is required, which
+# unconditionally includes '<blkid/blkid.h>' from sys-apps/util-linux.
+DEPEND="
+	${RDEPEND}
+	test? ( sys-apps/util-linux[${MULTILIB_USEDEP}] )"
+BDEPEND="
+	virtual/pkgconfig
+	sys-apps/texinfo
+	nls? ( sys-devel/gettext )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.42.13-fix-build-cflags.patch #516854
+
+	# Upstream patches (can usually removed with next version bump)
+	"${FILESDIR}"/${P}-parallel-make.patch
+)
+
+MULTILIB_WRAPPED_HEADERS=(
+	/usr/include/ext2fs/ext2_types.h
+)
+
+src_prepare() {
+	default
+
+	cp doc/RelNotes/v${PV}.txt ChangeLog || die "Failed to copy Release Notes"
+
+	# Get rid of doc -- we don't use them. This also prevents a sandbox
+	# violation due to mktexfmt invocation
+	rm -r doc || die "Failed to remove doc dir"
+
+	# prevent included intl cruft from building #81096
+	sed -i -r \
+		-e 's:@LIBINTL@:@LTLIBINTL@:' \
+		MCONFIG.in || die 'intl cruft'
+}
+
+multilib_src_configure() {
+	# Keep the package from doing silly things #261411
+	export VARTEXFONTS="${T}/fonts"
+
+	# needs open64() prototypes and friends
+	append-cppflags -D_GNU_SOURCE
+
+	local myeconfargs=(
+		--with-root-prefix="${EPREFIX}"
+		$(use_with cron crond-dir "${EPREFIX}/etc/cron.d")
+		--with-systemd-unit-dir="$(systemd_get_systemunitdir)"
+		--with-udev-rules-dir="${EPREFIX}$(get_udevdir)/rules.d"
+		--enable-symlink-install
+		--enable-elf-shlibs
+		$(tc-has-tls || echo --disable-tls)
+		$(multilib_native_use_enable fuse fuse2fs)
+		$(use_enable nls)
+		$(multilib_native_use_enable tools e2initrd-helper)
+		--disable-fsck
+		--disable-uuidd
+		$(use_enable lto)
+		$(use_with threads pthread)
+	)
+
+	# we use blkid/uuid from util-linux now
+	if use kernel_linux ; then
+		export ac_cv_lib_{uuid_uuid_generate,blkid_blkid_get_cache}=yes
+		myeconfargs+=( --disable-lib{blkid,uuid} )
+	fi
+
+	ac_cv_path_LDCONFIG=: \
+		ECONF_SOURCE="${S}" \
+		CC="$(tc-getCC)" \
+		BUILD_CC="$(tc-getBUILD_CC)" \
+		BUILD_LD="$(tc-getBUILD_LD)" \
+		econf "${myeconfargs[@]}"
+
+	if grep -qs 'USE_INCLUDED_LIBINTL.*yes' config.{log,status} ; then
+		eerror "INTL sanity check failed, aborting build."
+		eerror "Please post your ${S}/config.log file as an"
+		eerror "attachment to https://bugs.gentoo.org/show_bug.cgi?id=81096"
+		die "Preventing included intl cruft from building"
+	fi
+}
+
+multilib_src_compile() {
+	if multilib_is_native_abi && use tools ; then
+		emake V=1
+	else
+		emake -C lib/et V=1
+		emake -C lib/ss V=1
+		emake -C lib/ext2fs V=1
+		emake -C lib/e2p V=1
+	fi
+}
+
+multilib_src_test() {
+	if multilib_is_native_abi && use tools ; then
+		emake V=1 check
+	else
+		# required by lib/ext2fs's check target
+		emake -C lib/support V=1
+
+		# For non-native, there's no binaries to test. Just libraries.
+		emake -C lib/et V=1 check
+		emake -C lib/ss V=1 check
+		emake -C lib/ext2fs V=1 check
+		emake -C lib/e2p V=1 check
+	fi
+}
+
+multilib_src_install() {
+	if multilib_is_native_abi && use tools ; then
+		emake STRIP=':' V=1 DESTDIR="${D}" install
+	else
+		emake -C lib/et V=1 DESTDIR="${D}" install
+		emake -C lib/ss V=1 DESTDIR="${D}" install
+		emake -C lib/ext2fs V=1 DESTDIR="${D}" install
+		emake -C lib/e2p V=1 DESTDIR="${D}" install
+	fi
+
+	# Move shared libraries to /lib/, install static libraries to
+	# /usr/lib/, and install linker scripts to /usr/lib/.
+	gen_usr_ldscript -a com_err ss ext2fs e2p
+
+	# configure doesn't have an option to disable static libs :/
+	if ! use static-libs ; then
+		find "${ED}" -name '*.a' -delete || die
+	fi
+}
+
+multilib_src_install_all() {
+	einstalldocs
+
+	if use tools ; then
+		insinto /etc
+		doins "${FILESDIR}"/e2fsck.conf
+	fi
+}
diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch
deleted file mode 100644
index 7d09196..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.40-fbsd.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/lib/ext2fs/ext2_fs.h
-+++ b/lib/ext2fs/ext2_fs.h
-@@ -414,7 +414,7 @@
- 
- #define i_size_high	i_dir_acl
- 
--#if defined(__KERNEL__) || defined(__linux__)
-+#if defined(__KERNEL__) || defined(__linux__) || defined(__FreeBSD__)
- #define i_reserved1	osd1.linux1.l_i_reserved1
- #define i_frag		osd2.linux2.l_i_frag
- #define i_fsize		osd2.linux2.l_i_fsize
diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.46-add-extended-option-for-prezeroed-storage.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.46-add-extended-option-for-prezeroed-storage.patch
deleted file mode 100644
index 2633037..0000000
--- a/sys-fs/e2fsprogs/files/e2fsprogs-1.46-add-extended-option-for-prezeroed-storage.patch
+++ /dev/null
@@ -1,200 +0,0 @@
-From bd2e72c5c5521b561d20a881c843a64a5832721a Mon Sep 17 00:00:00 2001
-From: Sarthak Kukreti <sarthakkukreti@chromium.org>
-Date: Mon, 27 Sep 2021 03:39:10 -0700
-Subject: [PATCH] mke2fs: add extended option for prezeroed storage devices
-
-This patch adds an extended option "assume_storage_prezeroed" to
-mke2fs. When enabled, this option acts as a hint to mke2fs that the
-underlying block device was zeroed before mke2fs was called.  This
-allows mke2fs to optimize out the zeroing of the inode table and the
-journal, which speeds up the filesystem creation time.
-
-Additionally, on thinly provisioned storage devices (like Ceph,
-dm-thin, newly created sparse loopback files), reads on unmapped
-extents return zero. This property allows mke2fs (with
-assume_storage_prezeroed) to avoid pre-allocating metadata space for
-inode tables for the entire filesystem and saves space that would
-normally be preallocated for zero inode tables.
-
-Tests
------
-1) Running 'mke2fs -t ext4' on 10G sparse files on an ext4
-filesystem drops the time taken by mke2fs from 0.09s to 0.04s
-and reduces the initial metadata space allocation (stat on
-sparse file) from 139736 blocks (545M) to 8672 blocks (34M).
-
-2) On ChromeOS (running linux kernel 4.19) with dm-thin
-and 200GB thin logical volumes using 'mke2fs -t ext4 <dev>':
-
-- Time taken by mke2fs drops from 1.07s to 0.08s.
-- Avoiding zeroing out the inode table and journal reduces the
-  initial metadata space allocation from 0.48% to 0.01%.
-- Lazy inode table zeroing results in a further 1.45% of logical
-  volume space getting allocated for inode tables, even if no file
-  data is added to the filesystem. With assume_storage_prezeroed,
-  the metadata allocation remains at 0.01%.
-
-[ Fixed regression test to work on newer versions of e2fsprogs -- TYT ]
-
-Signed-off-by: Sarthak Kukreti <sarthakkukreti@chromium.org>
-Signed-off-by: Theodore Ts'o <tytso@mit.edu>
----
- misc/mke2fs.8.in                        |  7 +++
- misc/mke2fs.c                           | 21 ++++++++-
- tests/m_assume_storage_prezeroed/expect |  2 +
- tests/m_assume_storage_prezeroed/script | 63 +++++++++++++++++++++++++
- 4 files changed, 92 insertions(+), 1 deletion(-)
- create mode 100644 tests/m_assume_storage_prezeroed/expect
- create mode 100644 tests/m_assume_storage_prezeroed/script
-
-diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
-index b378e4d7..30f97bb5 100644
---- a/misc/mke2fs.8.in
-+++ b/misc/mke2fs.8.in
-@@ -365,6 +365,13 @@ small risk if the system crashes before the journal has been overwritten
- entirely one time.  If the option value is omitted, it defaults to 1 to
- enable lazy journal inode zeroing.
- .TP
-+.B assume_storage_prezeroed\fR[\fB= \fI<0 to disable, 1 to enable>\fR]
-+If enabled,
-+.BR mke2fs
-+assumes that the storage device has been prezeroed, skips zeroing the journal
-+and inode tables, and annotates the block group flags to signal that the inode
-+table has been zeroed.
-+.TP
- .B no_copy_xattrs
- Normally
- .B mke2fs
-diff --git a/misc/mke2fs.c b/misc/mke2fs.c
-index c955b318..76b8b8c6 100644
---- a/misc/mke2fs.c
-+++ b/misc/mke2fs.c
-@@ -96,6 +96,7 @@ int	journal_flags;
- int	journal_fc_size;
- static e2_blkcnt_t	orphan_file_blocks;
- static int	lazy_itable_init;
-+static int	assume_storage_prezeroed;
- static int	packed_meta_blocks;
- int		no_copy_xattrs;
- static char	*bad_blocks_filename = NULL;
-@@ -1013,6 +1014,11 @@ static void parse_extended_opts(struct ext2_super_block *param,
- 				lazy_itable_init = strtoul(arg, &p, 0);
- 			else
- 				lazy_itable_init = 1;
-+		} else if (!strcmp(token, "assume_storage_prezeroed")) {
-+			if (arg)
-+				assume_storage_prezeroed = strtoul(arg, &p, 0);
-+			else
-+				assume_storage_prezeroed = 1;
- 		} else if (!strcmp(token, "lazy_journal_init")) {
- 			if (arg)
- 				journal_flags |= strtoul(arg, &p, 0) ?
-@@ -1131,7 +1137,8 @@ static void parse_extended_opts(struct ext2_super_block *param,
- 			"\tnodiscard\n"
- 			"\tencoding=<encoding>\n"
- 			"\tencoding_flags=<flags>\n"
--			"\tquotatype=<quota type(s) to be enabled>\n\n"),
-+			"\tquotatype=<quota type(s) to be enabled>\n"
-+			"\tassume_storage_prezeroed=<0 to disable, 1 to enable>\n\n"),
- 			badopt ? badopt : "");
- 		free(buf);
- 		exit(1);
-@@ -3125,6 +3132,18 @@ int main (int argc, char *argv[])
- 		io_channel_set_options(fs->io, opt_string);
- 	}
- 
-+	if (assume_storage_prezeroed) {
-+		if (verbose)
-+			printf("%s",
-+			       _("Assuming the storage device is prezeroed "
-+			       "- skipping inode table and journal wipe\n"));
-+
-+		lazy_itable_init = 1;
-+		itable_zeroed = 1;
-+		zero_hugefile = 0;
-+		journal_flags |= EXT2_MKJOURNAL_LAZYINIT;
-+	}
-+
- 	/* Can't undo discard ... */
- 	if (!noaction && discard && dev_size && (io_ptr != undo_io_manager)) {
- 		retval = mke2fs_discard_device(fs);
-diff --git a/tests/m_assume_storage_prezeroed/expect b/tests/m_assume_storage_prezeroed/expect
-new file mode 100644
-index 00000000..b735e242
---- /dev/null
-+++ b/tests/m_assume_storage_prezeroed/expect
-@@ -0,0 +1,2 @@
-+> 10000
-+224
-diff --git a/tests/m_assume_storage_prezeroed/script b/tests/m_assume_storage_prezeroed/script
-new file mode 100644
-index 00000000..1a8d8463
---- /dev/null
-+++ b/tests/m_assume_storage_prezeroed/script
-@@ -0,0 +1,63 @@
-+test_description="test prezeroed storage metadata allocation"
-+FILE_SIZE=16M
-+
-+LOG=$test_name.log
-+OUT=$test_name.out
-+EXP=$test_dir/expect
-+
-+if test "$(id -u)" -ne 0 ; then
-+    echo "$test_name: $test_description: skipped (not root)"
-+elif ! command -v losetup >/dev/null ; then
-+    echo "$test_name: $test_description: skipped (no losetup)"
-+else
-+    dd if=/dev/zero of=$TMPFILE.1 bs=1 count=0 seek=$FILE_SIZE >> $LOG 2>&1
-+    dd if=/dev/zero of=$TMPFILE.2 bs=1 count=0 seek=$FILE_SIZE >> $LOG 2>&1
-+
-+    LOOP1=$(losetup --show --sector-size 4096 -f $TMPFILE.1)
-+    if [ ! -b "$LOOP1" ]; then
-+        echo "$test_name: $DESCRIPTION: skipped (no loop devices)"
-+        rm -f $TMPFILE.1 $TMPFILE.2
-+        exit 0
-+    fi
-+    LOOP2=$(losetup --show --sector-size 4096 -f $TMPFILE.2)
-+    if [ ! -b "$LOOP2" ]; then
-+        echo "$test_name: $DESCRIPTION: skipped (no loop devices)"
-+        rm -f $TMPFILE.1 $TMPFILE.2
-+	losetup -d $LOOP1
-+        exit 0
-+    fi
-+
-+    echo $MKE2FS -o Linux -t ext4 $LOOP1 >> $LOG 2>&1
-+    $MKE2FS -o Linux -t ext4 $LOOP1 >> $LOG 2>&1
-+    sync
-+    stat $TMPFILE.1 >> $LOG 2>&1
-+    SZ=$(stat -c "%b" $TMPFILE.1)
-+    if test $SZ -gt 10000 ; then
-+	echo "> 10000" > $OUT
-+    else
-+	echo "$SZ" > $OUT
-+    fi
-+
-+    echo $MKE2FS -o Linux -t ext4 -E assume_storage_prezeroed=1 $LOOP2 >> $LOG 2>&1
-+    $MKE2FS -o Linux -t ext4 -E assume_storage_prezeroed=1 $LOOP2 >> $LOG 2>&1
-+    sync
-+    stat $TMPFILE.2 >> $LOG 2>&1
-+    stat -c "%b" $TMPFILE.2 >> $OUT
-+
-+    losetup -d $LOOP1
-+    losetup -d $LOOP2
-+    rm -f $TMPFILE.1 $TMPFILE.2
-+
-+    cmp -s $OUT $EXP
-+    status=$?
-+
-+    if [ "$status" = 0 ] ; then
-+	echo "$test_name: $test_description: ok"
-+	touch $test_name.ok
-+    else
-+	echo "$test_name: $test_description: failed"
-+	cat $LOG > $test_name.failed
-+	diff $EXP $OUT >> $test_name.failed
-+    fi
-+fi
-+unset LOG OUT EXP FILE_SIZE LOOP1 LOOP2
--- 
-2.31.0
-
diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.46.5-parallel-make.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.46.5-parallel-make.patch
new file mode 100644
index 0000000..335f665
--- /dev/null
+++ b/sys-fs/e2fsprogs/files/e2fsprogs-1.46.5-parallel-make.patch
@@ -0,0 +1,29 @@
+--- a/lib/ext2fs/Makefile.in
++++ b/lib/ext2fs/Makefile.in
+@@ -729,6 +729,12 @@
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
+  $(srcdir)/hashmap.h $(srcdir)/bitops.h $(srcdir)/bmap64.h $(srcdir)/rbtree.h \
+  $(srcdir)/compiler.h
++blknum.o: $(srcdir)/blknum.c $(top_builddir)/lib/config.h \
++ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
++ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \
++ $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h $(top_srcdir)/lib/et/com_err.h \
++ $(srcdir)/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
++ $(srcdir)/ext2_ext_attr.h $(srcdir)/hashmap.h $(srcdir)/bitops.h
+ block.o: $(srcdir)/block.c $(top_builddir)/lib/config.h \
+  $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
+  $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fs.h \
+@@ -837,6 +843,13 @@
+  $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
+  $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fsP.h \
+  $(srcdir)/ext2fs.h $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h \
++ $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
++ $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
++ $(srcdir)/hashmap.h $(srcdir)/bitops.h $(srcdir)/e2image.h
++fallocate.o: $(srcdir)/fallocate.c $(top_builddir)/lib/config.h \
++ $(top_builddir)/lib/dirpaths.h $(srcdir)/ext2_fs.h \
++ $(top_builddir)/lib/ext2fs/ext2_types.h $(srcdir)/ext2fsP.h \
++ $(srcdir)/ext2fs.h $(srcdir)/ext2_fs.h $(srcdir)/ext3_extents.h \
+  $(top_srcdir)/lib/et/com_err.h $(srcdir)/ext2_io.h \
+  $(top_builddir)/lib/ext2fs/ext2_err.h $(srcdir)/ext2_ext_attr.h \
+  $(srcdir)/hashmap.h $(srcdir)/bitops.h $(srcdir)/e2image.h
diff --git a/sys-fs/xfsprogs/Manifest b/sys-fs/xfsprogs/Manifest
index ab614e1..f904310 100644
--- a/sys-fs/xfsprogs/Manifest
+++ b/sys-fs/xfsprogs/Manifest
@@ -1,3 +1,5 @@
 DIST xfsprogs-5.10.0.tar.xz 1273332 BLAKE2B 8caaa0ca8a94480f131d36b383afcf732b3a5a7a3c7927b4b4da4855fc5a0fb97a56fcebb98391a4dd0f02465868a4bd857e57eeba053a419df47d42f74bc958 SHA512 da09e687c87c4b133888dba7b4458017ec028020637ea5066be0232bf5c7da18239cc33eadd02d9b99d1c835aab38cab1ec9d45ae8b83897f9157cfcb0271fbd
-DIST xfsprogs-5.14.1.tar.xz 1308968 BLAKE2B fda20f824a030113717cc46de1920696dc8f9eed13b54809e6b21275cf4f8673385e8bbb1c1c668ba2592ab43fb230c9d46edf4c0e5abe59a9572cc9a90ae5da SHA512 5bb79fff45048bebee2fde85ec788658dd8dc8d5ddac222b1f74c6cd525e1239d920814e8e713f045e38398a785321bf0a7421ff1c690cd0be5dbb224f8dafea
 DIST xfsprogs-5.14.2.tar.xz 1308912 BLAKE2B 04083bf7952015d64f16e1aec0fa74be1957543e2264914f69defe45a3dc9f2524d941abc064a25a2fd760ebd6dcdcdc2404fd305e08fff7f6be6c5fc11d4d2f SHA512 cb9794247a2eed8bd9f10ff811d38f97e4adbed97bad334b0fa8a26503ec224237eddd92fd78892584a153967417ab2009fb2fc8bab6ef12cd53fd20bdba1b4e
+DIST xfsprogs-5.15.0.tar.xz 1303080 BLAKE2B e2d60eb554d206b2d2910d07e20051fb0abd71723186bcdfa07f1ebd2c10c0a7ae387ea5f41e1be008d8e8cede97371581da06505e1675aa210fc3ac242d0782 SHA512 be7ee319fd13c103d88c7fc939277594a386d88d65349594a33eea2899ec4f28115b4ea53b64176cacbd52f3c801e103a085388e3539fc445a4ecd2775766438
+DIST xfsprogs-5.16.0.tar.xz 1306100 BLAKE2B da328fe0c146a7b8ba866c5872f26ce95010939e05da51c73ed6374f00474605a81f4a822d65b60a132a4de47fff286e9f5f1ac809c1aa29420633f573b61aef SHA512 949ddb42d37523d6494aa33d1f73757a6379ee661147b9bb84372bdc3ccf60cdf07580f5337b2f0aebdc5d9c2b7de37cc05d010a2b094d1119d900225fc5b711
+DIST xfsprogs-5.18.0.tar.xz 1310008 BLAKE2B a2a2835d53ee6ac55279636f3f3cdcecab8757911ce5c1ea5f350a4da9ff4c1ca64b2aba1c0e5424c0c0a01fd0504396d5fecca12e4689c372ed5bb76b9ac24e SHA512 47d035a33367edae7357e34c70bdb0fe9219231153fb4c4f418ed1462d137dd77338c12a199eb71cd70e88903e5fc11e1e4fb595c622183786e87346e2f65739
diff --git a/sys-fs/xfsprogs/files/xfsprogs-5.18.0-docdir.patch b/sys-fs/xfsprogs/files/xfsprogs-5.18.0-docdir.patch
new file mode 100644
index 0000000..480f44c
--- /dev/null
+++ b/sys-fs/xfsprogs/files/xfsprogs-5.18.0-docdir.patch
@@ -0,0 +1,11 @@
+--- a/scrub/Makefile
++++ b/scrub/Makefile
+@@ -25,7 +25,7 @@
+ CRONTABS = xfs_scrub_all.cron
+ OPTIONAL_TARGETS += $(CRONTABS)
+ # Don't enable the crontab by default for now
+-CROND_DIR = $(PKG_LIB_SCRIPT_DIR)/$(PKG_NAME)
++CROND_DIR = $(PKG_DOC_DIR)
+ endif
+ 
+ endif	# scrub_prereqs
diff --git a/sys-fs/xfsprogs/xfsprogs-5.14.2.ebuild b/sys-fs/xfsprogs/xfsprogs-5.18.0.ebuild
similarity index 82%
rename from sys-fs/xfsprogs/xfsprogs-5.14.2.ebuild
rename to sys-fs/xfsprogs/xfsprogs-5.18.0.ebuild
index 6ddd079..df415ad 100644
--- a/sys-fs/xfsprogs/xfsprogs-5.14.2.ebuild
+++ b/sys-fs/xfsprogs/xfsprogs-5.18.0.ebuild
@@ -1,11 +1,11 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
 inherit flag-o-matic systemd usr-ldscript
 
-DESCRIPTION="xfs filesystem utilities"
+DESCRIPTION="XFS filesystem utilities"
 HOMEPAGE="https://xfs.wiki.kernel.org/"
 SRC_URI="https://www.kernel.org/pub/linux/utils/fs/xfs/${PN}/${P}.tar.xz"
 
@@ -14,21 +14,18 @@
 KEYWORDS="*"
 IUSE="icu libedit nls selinux"
 
-RDEPEND=">=sys-apps/util-linux-2.17.2
-	dev-libs/inih
-	dev-libs/userspace-rcu
+RDEPEND="dev-libs/inih
+	dev-libs/userspace-rcu:=
+	>=sys-apps/util-linux-2.17.2
 	icu? ( dev-libs/icu:= )
-	libedit? ( dev-libs/libedit )
-"
+	libedit? ( dev-libs/libedit )"
 DEPEND="${RDEPEND}"
-BDEPEND="
-	nls? ( sys-devel/gettext )
-"
+BDEPEND="nls? ( sys-devel/gettext )"
 RDEPEND+=" selinux? ( sec-policy/selinux-xfs )"
 
 PATCHES=(
-	"${FILESDIR}"/${PN}-4.15.0-docdir.patch
 	"${FILESDIR}"/${PN}-5.3.0-libdir.patch
+	"${FILESDIR}"/${PN}-5.18.0-docdir.patch
 )
 
 src_prepare() {
@@ -48,6 +45,9 @@
 	# unnecessarily clutter CFLAGS (and fortran isn't used)
 	unset FCFLAGS
 
+	# If set in user env, this breaks configure
+	unset PLATFORM
+
 	export DEBUG=-DNDEBUG
 
 	# Package is honoring CFLAGS; No need to use OPTIMIZER anymore.
@@ -55,9 +55,7 @@
 	# flags.
 	export OPTIMIZER=" "
 
-	unset PLATFORM # if set in user env, this breaks configure
-
-	# Avoid automagic on libdevmapper, #709694
+	# Avoid automagic on libdevmapper (bug #709694)
 	export ac_cv_search_dm_task_create=no
 
 	# Build fails with -O3 (bug #712698)