From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1064334-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 9D8EF138334
	for <garchives@archives.gentoo.org>; Sat, 29 Dec 2018 20:06:22 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id CD959E0B1D;
	Sat, 29 Dec 2018 20:06:21 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 86AE8E0B1D
	for <gentoo-commits@lists.gentoo.org>; Sat, 29 Dec 2018 20:06:21 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E00F3335C8E
	for <gentoo-commits@lists.gentoo.org>; Sat, 29 Dec 2018 20:06:19 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 1017C4CE
	for <gentoo-commits@lists.gentoo.org>; Sat, 29 Dec 2018 20:06:18 +0000 (UTC)
From: "Anthony G. Basile" <blueness@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" <blueness@gentoo.org>
Message-ID: <1546113970.a51e6715937b32acc2e33ca76d54897b0fe05966.blueness@gentoo>
Subject: [gentoo-commits] proj/musl:master commit in: sys-fs/lvm2/, sys-fs/lvm2/files/
X-VCS-Repository: proj/musl
X-VCS-Files: sys-fs/lvm2/Manifest sys-fs/lvm2/files/lvm.rc-2.02.116-r4 sys-fs/lvm2/files/lvm.rc-2.02.166-r2 sys-fs/lvm2/files/lvm.rc-2.02.172 sys-fs/lvm2/files/lvm2-2.02.129-dynamic-static-ldflags.patch sys-fs/lvm2/files/lvm2-2.02.166-HPPA-no-O_DIRECT.patch sys-fs/lvm2/files/lvm2-2.02.166-fix-stdio-usage.patch sys-fs/lvm2/files/lvm2-2.02.166-portability.patch sys-fs/lvm2/files/lvm2-2.02.171-static-libm.patch sys-fs/lvm2/files/lvm2-2.02.176-pthread-pkgconfig.patch sys-fs/lvm2/files/lvm2-2.02.178-asneeded.patch sys-fs/lvm2/files/lvm2-2.02.178-dynamic-static-ldflags.patch sys-fs/lvm2/files/lvm2-2.02.178-example.conf.in.patch sys-fs/lvm2/files/lvm2-2.02.178-static-pkgconfig-libs.patch sys-fs/lvm2/files/lvm2-avoid-mallinfo.patch sys-fs/lvm2/files/lvm2-fix-stdio-usage.patch sys-fs/lvm2/files/lvm2-musl-fixes.patch sys-fs/lvm2/lvm2-2.02.116-r4.ebuild sys-fs/lvm2/lvm2-2.02.116.ebuild sys-fs/lvm2/lvm2-2.02.145-r2.ebuild sys-fs/lvm2/lvm2-2.02.166-r2.ebuild sys-fs/lvm2/lvm2-2.02.171.ebuild sys-f
 s/lvm2/metadata.xml
X-VCS-Directories: sys-fs/lvm2/files/ sys-fs/lvm2/
X-VCS-Committer: blueness
X-VCS-Committer-Name: Anthony G. Basile
X-VCS-Revision: a51e6715937b32acc2e33ca76d54897b0fe05966
X-VCS-Branch: master
Date: Sat, 29 Dec 2018 20:06:18 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 6c5e22e6-4b52-415f-8e71-179413ec3202
X-Archives-Hash: bc704b280a809158303bf71ebbfe0d9b

commit:     a51e6715937b32acc2e33ca76d54897b0fe05966
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 29 20:06:10 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sat Dec 29 20:06:10 2018 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=a51e6715

sys-fs/lvm2: sync with upstream

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-fs/lvm2/Manifest                               |   5 +-
 sys-fs/lvm2/files/lvm.rc-2.02.116-r4               | 132 ---------
 .../files/{lvm.rc-2.02.166-r2 => lvm.rc-2.02.172}  |  68 ++---
 .../lvm2-2.02.129-dynamic-static-ldflags.patch     |  59 ++++
 .../files/lvm2-2.02.166-HPPA-no-O_DIRECT.patch     |  12 +
 .../lvm2/files/lvm2-2.02.166-fix-stdio-usage.patch |  53 ----
 sys-fs/lvm2/files/lvm2-2.02.166-portability.patch  |  40 ---
 sys-fs/lvm2/files/lvm2-2.02.171-static-libm.patch  |  13 +
 .../files/lvm2-2.02.176-pthread-pkgconfig.patch    |  29 ++
 sys-fs/lvm2/files/lvm2-2.02.178-asneeded.patch     |  15 +
 .../lvm2-2.02.178-dynamic-static-ldflags.patch     |  59 ++++
 .../lvm2/files/lvm2-2.02.178-example.conf.in.patch |  50 ++++
 .../lvm2-2.02.178-static-pkgconfig-libs.patch      | 102 +++++++
 sys-fs/lvm2/files/lvm2-avoid-mallinfo.patch        |  71 -----
 sys-fs/lvm2/files/lvm2-fix-stdio-usage.patch       | 111 --------
 sys-fs/lvm2/files/lvm2-musl-fixes.patch            |  33 ---
 sys-fs/lvm2/lvm2-2.02.116-r4.ebuild                | 285 -------------------
 sys-fs/lvm2/lvm2-2.02.116.ebuild                   | 275 -------------------
 sys-fs/lvm2/lvm2-2.02.145-r2.ebuild                |  58 +---
 sys-fs/lvm2/lvm2-2.02.166-r2.ebuild                | 301 ---------------------
 sys-fs/lvm2/lvm2-2.02.171.ebuild                   | 301 ---------------------
 sys-fs/lvm2/metadata.xml                           |   5 -
 22 files changed, 388 insertions(+), 1689 deletions(-)

diff --git a/sys-fs/lvm2/Manifest b/sys-fs/lvm2/Manifest
index ab4e667..353cb66 100644
--- a/sys-fs/lvm2/Manifest
+++ b/sys-fs/lvm2/Manifest
@@ -1,4 +1 @@
-DIST LVM2.2.02.116.tgz 1538340 SHA256 2479d6ea61c405efcfcd8a78390d00c1d2e9c92c0262f3ed599f2c0fb6f0b767 SHA512 992541339637d597257850b4ff7f5348fb7cdcccf806ac8d986a3be1ad1edc5f6bfaedeed5128690c541d1a485cdc75742e90a766363c39867901003518fb84d WHIRLPOOL 1e89ec941882fddba62c9649be46eb5bc6c9cb899669d4bbe4a4a1023c8bf7d8264c4815ef88bb39dedcb9637815411feb826aa102e629d77b80e45e099e398d
-DIST LVM2.2.02.145.tgz 1986370 SHA256 98b7c4c07c485a462c6a86e1a5265757133ceea36289ead8a419af29ef39560b SHA512 84e28b3efc940837ea9da70fce620744aea0945ba29383b76ad7bcd4b5259b897c714162a8e8b7cfe26ae736a3ad2eca633a3e0df4d6280a32b28bd4cf472d27 WHIRLPOOL b8c6f4b737625547d4c2994d055f3334e2954f160d10840f1405b6a78f25fc17ba1d270f574408c151140e2afceb007cbfa1c146ed105bbdeca001a03368d549
-DIST LVM2.2.02.166.tgz 2148324 SHA256 e120b066b85b224552efda40204488c5123de068725676fd6e5c8bc655051b94 SHA512 8bebe9b474f791b5edf5366b0bd24861fbbaf8a83afa2a9e2a8e3917e05e4ecbf6877f018be03ffb4e9b4c8832208264165b85182bf79a07661adf35128b4a21 WHIRLPOOL a4c2e0b2e8da85301b2518b35193304436715fdf45cbc7bc28fd6f7b88af15e611134d5a530d2311b23544aa67c3a7f13fd3780d4d46fc10854e624fb8b27870
-DIST LVM2.2.02.171.tgz 2333643 SHA256 b815a711a2fabaa5c3dc1a4a284df0268bf0f325f0fc0f5c9530c9bbb54b9964 SHA512 801adcc2ae483f81edf6bfba73090b6b8f710370e48764f08a62da71d617157075bea01593c2535ad5ba71dcb5e0cfe83cec9a65180a6e8b9e0d214bdee79883 WHIRLPOOL fedd62612c6bb4b7764277a0d4474ff3557f041858c71eb7bf2a1c06b646637fe719f91a12c1b5c58ccefa7f4d2daba6bf30409340c52fd3a1b8b01ce62467ab
+DIST LVM2.2.02.145.tgz 1986370 BLAKE2B 0c9e5efae17f26ff86152cecbf0b11a74e85007b2fa9491f44dec03ac8c11375bacf6685213b4be19037c8fbf70e13549516716ecf8fa262919a44625e6aab34 SHA512 84e28b3efc940837ea9da70fce620744aea0945ba29383b76ad7bcd4b5259b897c714162a8e8b7cfe26ae736a3ad2eca633a3e0df4d6280a32b28bd4cf472d27

diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.116-r4 b/sys-fs/lvm2/files/lvm.rc-2.02.116-r4
deleted file mode 100644
index 74b4a41..0000000
--- a/sys-fs/lvm2/files/lvm.rc-2.02.116-r4
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-_get_lvm_path() {
-	local lvm_path=
-	for lvm_path in /bin/lvm /sbin/lvm ; do
-		[ -x "$lvm_path" ] && break
-	done
-	echo "${lvm_path}"
-}
-
-_need_lvmetad()
-{
-	local lvm_path="$(_get_lvm_path)"
-	[ ! -x "${lvm_path}" ] && return 1
-	${lvm_path} dumpconfig global | grep -q 'use_lvmetad=1'
-}
-
-depend() {
-	before checkfs fsck
-	after modules device-mapper
-	# We may use lvmetad based on the configuration. If we added lvmetad
-	# support while lvm2 is running then we aren't dependent on it. For the
-	# more common case, if its disabled in the config we aren't dependent
-	# on it.
-	config /etc/lvm/lvm.conf
-	local _need=
-	if service_started; then
-		_need=$(service_get_value need)
-	else
-		if _need_lvmetad; then
-			_need="${_need} lvmetad"
-		fi
-	fi
-	need sysfs ${_need}
-}
-
-config='global { locking_dir = "/run/lock/lvm" }'
-
-dm_in_proc() {
-	local retval=0
-	for x in devices misc ; do
-		grep -qs 'device-mapper' /proc/${x}
-		retval=$((${retval} + $?))
-	done
-	return ${retval}
-}
-
-start() {
-	# LVM support for /usr, /home, /opt ....
-	# This should be done *before* checking local
-	# volumes, or they never get checked.
-
-	# NOTE: Add needed modules for LVM or RAID, etc
-	#       to /etc/modules.autoload if needed
-	lvm_path="$(_get_lvm_path)"
-	for lvm_path in /bin/lvm /sbin/lvm ; do
-		[ -x "$lvm_path" ] && break
-	done
-	if [ ! -x "$lvm_path" ]; then
-		eerror "Cannot find lvm binary in /sbin or /bin!"
-		return 1
-	fi
-	if [ -z "${CDBOOT}" ] ; then
-		if [ -e /proc/modules ] && ! dm_in_proc ; then
-			modprobe dm-mod 2>/dev/null
-		fi
-		if [ -d /proc/lvm ] || dm_in_proc ; then
-			ebegin "Setting up the Logical Volume Manager"
-			#still echo stderr for debugging
-			lvm_commands="#! ${lvm_path} --config '${config}'\n"
-			# Extra PV find pass because some devices might not have been available until very recently
-			lvm_commands="${lvm_commands}pvscan\n"
-			# Now make the nodes
-			lvm_commands="${lvm_commands}vgscan --mknodes\n"
-			# And turn them on!
-			lvm_commands="${lvm_commands}vgchange --sysinit -a ly\n"
-			# Order of this is important, have to work around dash and LVM readline
-			printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null
-			eend $? "Failed to setup the LVM"
-		fi
-	fi
-}
-
-start_post()
-{
-	# Save if we needed lvmetad
-	if _need_lvmetad; then
-		service_set_value need lvmetad
-	fi
-}
-
-stop() {
-	for lvm_path in /bin/lvm /sbin/lvm ; do
-		[ -x "$lvm_path" ] && break
-	done
-	if [ ! -x "$lvm_path" ]; then
-		eerror "Cannot find lvm binary in /sbin or /bin!"
-		return 1
-	fi
-# Stop LVM2
-if [ -x /sbin/vgs ] && \
-   [ -x /sbin/vgchange ] && \
-   [ -x /sbin/lvchange ] && \
-   [ -f /etc/lvmtab -o -d /etc/lvm ] && \
-   [ -d /proc/lvm  -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
-then
-	einfo "Shutting down the Logical Volume Manager"
-
-        VGS=$($lvm_path vgs --config "${config}" -o vg_name --noheadings --nosuffix --rows 2> /dev/null)
-
-        if [ "$VGS" ]
-        then
-            ebegin "  Shutting Down LVs & VGs"
-			#still echo stderr for debugging
-			lvm_commands="#! ${lvm_path} --config '${config}'\n"
-			# Extra PV find pass because some devices might not have been available until very recently
-			lvm_commands="${lvm_commands}lvchange --sysinit -a ln ${VGS}\n"
-			# Now make the nodes
-			lvm_commands="${lvm_commands}vgchange --sysinit -a ln ${VGS}\n"
-			# Order of this is important, have to work around dash and LVM readline
-			printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null
-			eend $? "Failed (possibly some LVs still needed for /usr or root)"
-        fi
-
-	einfo "Finished shutting down the Logical Volume Manager"
-	return 0
-fi
-}
-
-# vim:ts=4

diff --git a/sys-fs/lvm2/files/lvm.rc-2.02.166-r2 b/sys-fs/lvm2/files/lvm.rc-2.02.172
similarity index 61%
rename from sys-fs/lvm2/files/lvm.rc-2.02.166-r2
rename to sys-fs/lvm2/files/lvm.rc-2.02.172
index 11329bb..4bc363c 100644
--- a/sys-fs/lvm2/files/lvm.rc-2.02.166-r2
+++ b/sys-fs/lvm2/files/lvm.rc-2.02.172
@@ -1,5 +1,5 @@
 #!/sbin/openrc-run
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 _get_lvm_path() {
@@ -23,6 +23,7 @@ _need_lvmlockd()
 	[ ! -x "${lvm_path}" ] && return 1
 	${lvm_path} dumpconfig global 2>/dev/null | grep -q 'use_lvmlockd=1'
 }
+
 depend() {
 	before checkfs fsck
 	after modules device-mapper
@@ -78,19 +79,19 @@ start() {
 		if [ -d /proc/lvm ] || dm_in_proc ; then
 			ebegin "Setting up the Logical Volume Manager"
 			#still echo stderr for debugging
-			lvm_commands="#! ${lvm_path} --config '${config}'\n"
+			lvm_commands="#!${lvm_path}\n"
 			# Extra PV find pass because some devices might not have been available until very recently
-			lvm_commands="${lvm_commands}pvscan\n"
+			lvm_commands="${lvm_commands}pvscan --config '${config}'\n"
 			# Now make the nodes
-			lvm_commands="${lvm_commands}vgscan --mknodes\n"
+			lvm_commands="${lvm_commands}vgscan --config '${config}' --mknodes\n"
 			# And turn them on!
-			lvm_commands="${lvm_commands}vgchange --sysinit -a ly\n"
+			lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ly\n"
 			if _need_lvmlockd; then
 				# Start lockd VGs as required
-				lvm_commands="${lvm_commands}vgchange --lock-start --lock-opt auto\n"
+				lvm_commands="${lvm_commands}vgchange --config '${config}' --lock-start --lock-opt auto\n"
 			fi
 			# Order of this is important, have to work around dash and LVM readline
-			printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null
+			printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 >/dev/null
 			eend $? "Failed to setup the LVM"
 		fi
 	fi
@@ -112,34 +113,37 @@ stop() {
 		eerror "Cannot find lvm binary in /sbin or /bin!"
 		return 1
 	fi
-# Stop LVM2
-if [ -x /sbin/vgs ] && \
-   [ -x /sbin/vgchange ] && \
-   [ -x /sbin/lvchange ] && \
-   [ -f /etc/lvmtab -o -d /etc/lvm ] && \
-   [ -d /proc/lvm  -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
-then
-	einfo "Shutting down the Logical Volume Manager"
 
-        VGS=$($lvm_path vgs --config "${config}" -o vg_name --noheadings --nosuffix --rows 2> /dev/null)
+	# Stop LVM2
+	if [ -x /sbin/vgs ] && \
+		[ -x /sbin/vgchange ] && \
+		[ -x /sbin/lvchange ] && \
+		[ -f /etc/lvmtab -o -d /etc/lvm ] && \
+		[ -d /proc/lvm  -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
+	then
+		einfo "Shutting down the Logical Volume Manager"
 
-        if [ "$VGS" ]
-        then
-            ebegin "  Shutting Down LVs & VGs"
-			#still echo stderr for debugging
-			lvm_commands="#! ${lvm_path} --config '${config}'\n"
-			# Extra PV find pass because some devices might not have been available until very recently
-			lvm_commands="${lvm_commands}lvchange --sysinit -a ln ${VGS}\n"
-			# Now make the nodes
-			lvm_commands="${lvm_commands}vgchange --sysinit -a ln ${VGS}\n"
-			# Order of this is important, have to work around dash and LVM readline
-			printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null
-			eend $? "Failed (possibly some LVs still needed for /usr or root)"
-        fi
+		VGS=$($lvm_path vgs --config "${config}" -o vg_name --noheadings --nosuffix --rows 2> /dev/null)
+
+		if [ "$VGS" ]
+		then
+			local _ending="eend"
+			[ "$RC_RUNLEVEL" = shutdown ] && _ending="ewend"
+			ebegin "  Shutting Down LVs & VGs"
+				#still echo stderr for debugging
+				lvm_commands="#!${lvm_path}\n"
+				# Extra PV find pass because some devices might not have been available until very recently
+				lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln ${VGS}\n"
+				# Now make the nodes
+				lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ln ${VGS}\n"
+				# Order of this is important, have to work around dash and LVM readline
+				printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null
+			${_ending} $? "Failed (possibly some LVs still needed for /usr or root)"
+		fi
 
-	einfo "Finished shutting down the Logical Volume Manager"
-	return 0
-fi
+		einfo "Finished shutting down the Logical Volume Manager"
+		return 0
+	fi
 }
 
 # vim:ts=4

diff --git a/sys-fs/lvm2/files/lvm2-2.02.129-dynamic-static-ldflags.patch b/sys-fs/lvm2/files/lvm2-2.02.129-dynamic-static-ldflags.patch
new file mode 100644
index 0000000..efdfb81
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.129-dynamic-static-ldflags.patch
@@ -0,0 +1,59 @@
+--- LVM2.2.02.129/configure.in
++++ LVM2.2.02.129/configure.in
+@@ -31,6 +31,7 @@
+ 	linux*)
+ 		CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
+ 		ELDFLAGS="-Wl,--export-dynamic"
++		STATIC_LDFLAGS="-Wl,--no-export-dynamic"
+ 		# FIXME Generate list and use --dynamic-list=.dlopen.sym
+ 		CLDWHOLEARCHIVE="-Wl,-whole-archive"
+ 		CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
+@@ -2008,6 +2009,7 @@
+ AC_SUBST(SELINUX_PC)
+ AC_SUBST(SNAPSHOTS)
+ AC_SUBST(STATICDIR)
++AC_SUBST(STATIC_LDFLAGS)
+ AC_SUBST(STATIC_LINK)
+ AC_SUBST(TESTING)
+ AC_SUBST(TESTSUITE_DATA)
+--- LVM2.2.02.129/daemons/dmeventd/Makefile.in
++++ LVM2.2.02.129/daemons/dmeventd/Makefile.in
+@@ -66,7 +66,7 @@
+ 	$(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic
+ 
+ dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
++	$(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) $(STATIC_LDFLAGS) -static -L. -L$(interfacebuilddir) -o $@ \
+ 	dmeventd.o $(DL_LIBS) $(LVMLIBS) $(LIBS) $(STATIC_LIBS)
+ 
+ ifeq ("@PKGCONFIG@", "yes")
+--- LVM2.2.02.129/make.tmpl.in
++++ LVM2.2.02.129/make.tmpl.in
+@@ -48,6 +48,7 @@
+ # FIXME set this only where it's needed, not globally?
+ CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
+ LDFLAGS ?= @COPTIMISE_FLAG@ @LDFLAGS@
++STATIC_LDFLAGS += @STATIC_LDFLAGS@
+ CLDFLAGS += @CLDFLAGS@
+ ELDFLAGS += @ELDFLAGS@
+ LDDEPS += @LDDEPS@
+--- LVM2.2.02.129/tools/Makefile.in
++++ LVM2.2.02.129/tools/Makefile.in
+@@ -129,7 +129,7 @@
+ 	      -o $@ dmsetup.o -ldevmapper $(LIBS)
+ 
+ dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
++	$(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) \
+ 	      -o $@ dmsetup.o -ldevmapper $(STATIC_LIBS) $(LIBS)
+ 
+ all: device-mapper
+@@ -146,7 +146,7 @@
+ endif
+ 
+ lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a  $(interfacebuilddir)/libdevmapper.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
++	$(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
+ 	      $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
+ 
+ liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o

diff --git a/sys-fs/lvm2/files/lvm2-2.02.166-HPPA-no-O_DIRECT.patch b/sys-fs/lvm2/files/lvm2-2.02.166-HPPA-no-O_DIRECT.patch
new file mode 100644
index 0000000..0f830e4
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.166-HPPA-no-O_DIRECT.patch
@@ -0,0 +1,12 @@
+--- a/lib/device/dev-io.c
++++ b/lib/device/dev-io.c
+@@ -505,7 +505,9 @@
+ 			dev->flags |= DEV_NOT_O_NOATIME;
+ 			if ((dev->fd = open(name, flags, 0777)) >= 0) {
+ 				log_debug_devs("%s: Not using O_NOATIME", name);
++#ifdef O_DIRECT_SUPPORT
+ 				goto opened;
++#endif
+ 			}
+ 		}
+ #endif

diff --git a/sys-fs/lvm2/files/lvm2-2.02.166-fix-stdio-usage.patch b/sys-fs/lvm2/files/lvm2-2.02.166-fix-stdio-usage.patch
deleted file mode 100644
index 43964e2..0000000
--- a/sys-fs/lvm2/files/lvm2-2.02.166-fix-stdio-usage.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-diff -Naur LVM2.2.02.166.orig/lib/log/log.c LVM2.2.02.166/lib/log/log.c
---- LVM2.2.02.166.orig/lib/log/log.c	2016-09-26 06:21:54.000000000 -0700
-+++ LVM2.2.02.166/lib/log/log.c	2016-10-23 15:54:11.538608214 -0700
-@@ -161,6 +161,7 @@
-  * Close and reopen standard stream on file descriptor fd.
-  */
- int reopen_standard_stream(FILE **stream, const char *mode)
-+#if defined(__GLIBC__)
- {
- 	int fd, fd_copy, new_fd;
- 	const char *name;
-@@ -207,6 +208,11 @@
- 	*stream = new_stream;
- 	return 1;
- }
-+#else
-+{
-+	return freopen(NULL, mode, *stream) != NULL;
-+}
-+#endif
- 
- void init_log_fn(lvm2_log_fn_t log_fn)
- {
-diff -Naur LVM2.2.02.166.orig/tools/lvmcmdline.c LVM2.2.02.166/tools/lvmcmdline.c
---- LVM2.2.02.166.orig/tools/lvmcmdline.c	2016-09-26 06:21:55.000000000 -0700
-+++ LVM2.2.02.166/tools/lvmcmdline.c	2016-10-23 15:49:07.910610692 -0700
-@@ -1818,7 +1818,7 @@
- 	int err = is_valid_fd(STDERR_FILENO);
- 
- 	if (!is_valid_fd(STDIN_FILENO) &&
--	    !(stdin = fopen(_PATH_DEVNULL, "r"))) {
-+	    !(freopen(_PATH_DEVNULL, "r", stdin))) {
- 		if (err)
- 			perror("stdin stream open");
- 		else
-@@ -1828,7 +1828,7 @@
- 	}
- 
- 	if (!is_valid_fd(STDOUT_FILENO) &&
--	    !(stdout = fopen(_PATH_DEVNULL, "w"))) {
-+	    !(freopen(_PATH_DEVNULL, "w", stdout))) {
- 		if (err)
- 			perror("stdout stream open");
- 		/* else no stdout */
-@@ -1836,7 +1836,7 @@
- 	}
- 
- 	if (!is_valid_fd(STDERR_FILENO) &&
--	    !(stderr = fopen(_PATH_DEVNULL, "w"))) {
-+	    !(freopen(_PATH_DEVNULL, "w", stderr))) {
- 		printf("stderr stream open: %s\n",
- 		       strerror(errno));
- 		return 0;

diff --git a/sys-fs/lvm2/files/lvm2-2.02.166-portability.patch b/sys-fs/lvm2/files/lvm2-2.02.166-portability.patch
deleted file mode 100644
index 5957aef..0000000
--- a/sys-fs/lvm2/files/lvm2-2.02.166-portability.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff -Naur LVM2.2.02.166.orig/lib/mm/memlock.c LVM2.2.02.166/lib/mm/memlock.c
---- LVM2.2.02.166.orig/lib/mm/memlock.c	2016-09-26 06:21:54.000000000 -0700
-+++ LVM2.2.02.166/lib/mm/memlock.c	2016-10-23 15:43:03.957002700 -0700
-@@ -173,6 +173,7 @@
-          *  MMAP'd memory directly. Since MMAP-as-MORECORE does not munmap the
-          *  memory on free(), this is good enough for our purposes.
-          */
-+#ifdef __GLIBC__
- 	while (missing > 0) {
- 		struct mallinfo inf = mallinfo();
- 		hblks = inf.hblks;
-@@ -200,14 +201,17 @@
- 			break;
- 		}
- 	}
-+#endif
- 
- 	if ((_malloc_mem = malloc(_size_malloc)))
- 		_touch_memory(_malloc_mem, _size_malloc);
- 
-+#ifdef __GLIBC__
- 	/* free up the reserves so subsequent malloc's can use that memory */
- 	for (i = 0; i < area; ++i)
- 		free(areas[i]);
- #endif
-+#endif
- }
- 
- static void _release_memory(void)
-diff -Naur LVM2.2.02.166.orig/libdaemon/server/daemon-server.c LVM2.2.02.166/libdaemon/server/daemon-server.c
---- LVM2.2.02.166.orig/libdaemon/server/daemon-server.c	2016-09-26 06:21:55.000000000 -0700
-+++ LVM2.2.02.166/libdaemon/server/daemon-server.c	2016-10-23 15:43:25.962220845 -0700
-@@ -18,6 +18,7 @@
- #include "daemon-server.h"
- #include "daemon-log.h"
- 
-+#include <fcntl.h>
- #include <dlfcn.h>
- #include <errno.h>
- #include <pthread.h>

diff --git a/sys-fs/lvm2/files/lvm2-2.02.171-static-libm.patch b/sys-fs/lvm2/files/lvm2-2.02.171-static-libm.patch
new file mode 100644
index 0000000..1cbf956
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.171-static-libm.patch
@@ -0,0 +1,13 @@
+diff --git a/make.tmpl.in b/make.tmpl.in
+index a40eaaa15..7eea943aa 100644
+--- a/make.tmpl.in
++++ b/make.tmpl.in
+@@ -53,7 +53,7 @@ PYCOMPILE = $(top_srcdir)/autoconf/py-compile
+ 
+ LIBS = @LIBS@
+ # Extra libraries always linked with static binaries
+-STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS)
++STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS) $(M_LIBS)
+ DEFS += @DEFS@
+ # FIXME set this only where it's needed, not globally?
+ CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@

diff --git a/sys-fs/lvm2/files/lvm2-2.02.176-pthread-pkgconfig.patch b/sys-fs/lvm2/files/lvm2-2.02.176-pthread-pkgconfig.patch
new file mode 100644
index 0000000..c0265e8
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.176-pthread-pkgconfig.patch
@@ -0,0 +1,29 @@
+--- LVM2.2.02.176/libdm/libdevmapper.pc.in
++++ LVM2.2.02.176/libdm/libdevmapper.pc.in
+@@ -9,4 +9,4 @@
+ Cflags: -I${includedir} 
+ Libs: -L${libdir} -ldevmapper
+ Requires.private: @SELINUX_PC@ @UDEV_PC@
+-Libs.private: -lm @RT_LIBS@
++Libs.private: -lm @RT_LIBS@ @PTHREAD_LIBS@
+--- LVM2.2.02.176/tools/Makefile.in
++++ LVM2.2.02.176/tools/Makefile.in
+@@ -93,6 +93,7 @@
+   INSTALL_LVM_TARGETS += install_tools_static
+   INSTALL_DMSETUP_TARGETS += install_dmsetup_static
+   INSTALL_CMDLIB_TARGETS += install_cmdlib_static
++  STATIC_LIBS += @PTHREAD_LIBS@
+ endif
+ 
+ LVMLIBS = $(LVMINTERNAL_LIBS) -ldevmapper
+@@ -118,6 +119,10 @@
+ 
+ include $(top_builddir)/make.tmpl
+ 
++ifeq ("@STATIC_LINK@", "yes")
++  STATIC_LIBS += @PTHREAD_LIBS@
++endif
++
+ device-mapper: $(TARGETS_DM)
+ 
+ CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)

diff --git a/sys-fs/lvm2/files/lvm2-2.02.178-asneeded.patch b/sys-fs/lvm2/files/lvm2-2.02.178-asneeded.patch
new file mode 100644
index 0000000..c831c6d
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.178-asneeded.patch
@@ -0,0 +1,15 @@
+http://bugs.gentoo.org/330255
+
+liblvm2app.so: undefined reference to `floor'
+
+--- LVM2.2.02.178/liblvm/Makefile.in
++++ LVM2.2.02.178/liblvm/Makefile.in
+@@ -43,7 +43,7 @@
+ include $(top_builddir)/make.tmpl
+ 
+ LDFLAGS += -L$(top_builddir)/lib -L$(top_builddir)/daemons/dmeventd
+-LIBS += $(LVMINTERNAL_LIBS) -ldevmapper -laio
++LIBS += $(LVMINTERNAL_LIBS) -ldevmapper -laio -lm
+ 
+ .PHONY: install_dynamic install_static install_include install_pkgconfig
+ 

diff --git a/sys-fs/lvm2/files/lvm2-2.02.178-dynamic-static-ldflags.patch b/sys-fs/lvm2/files/lvm2-2.02.178-dynamic-static-ldflags.patch
new file mode 100644
index 0000000..0a0e732
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.178-dynamic-static-ldflags.patch
@@ -0,0 +1,59 @@
+--- LVM2.2.02.178/configure.ac
++++ LVM2.2.02.178/configure.ac
+@@ -33,6 +33,7 @@
+ 		CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
+ 		# equivalent to -rdynamic
+ 		ELDFLAGS="-Wl,--export-dynamic"
++		STATIC_LDFLAGS="-Wl,--no-export-dynamic"
+ 		# FIXME Generate list and use --dynamic-list=.dlopen.sym
+ 		CLDWHOLEARCHIVE="-Wl,-whole-archive"
+ 		CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
+@@ -2042,6 +2043,7 @@
+ AC_SUBST(SYSTEMD_LIBS)
+ AC_SUBST(SNAPSHOTS)
+ AC_SUBST(STATICDIR)
++AC_SUBST(STATIC_LDFLAGS)
+ AC_SUBST(STATIC_LINK)
+ AC_SUBST(TESTSUITE_DATA)
+ AC_SUBST(THIN)
+--- LVM2.2.02.178/daemons/dmeventd/Makefile.in
++++ LVM2.2.02.178/daemons/dmeventd/Makefile.in
+@@ -64,7 +64,7 @@
+ 		-o $@ $(DL_LIBS) $(DMEVENT_LIBS) $(LIBS)
+ 
+ dmeventd.static: $(LIB_STATIC) dmeventd.o $(interfacebuilddir)/libdevmapper.a
+-	$(CC) $(CFLAGS) $(LDFLAGS) -static -L. -L$(interfacebuilddir) dmeventd.o \
++	$(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L. -L$(interfacebuilddir) dmeventd.o \
+ 		-o $@ $(DL_LIBS) $(DMEVENT_LIBS) $(LIBS) $(STATIC_LIBS)
+ 
+ ifeq ("@PKGCONFIG@", "yes")
+--- LVM2.2.02.178/make.tmpl.in
++++ LVM2.2.02.178/make.tmpl.in
+@@ -64,6 +64,7 @@
+ # FIXME set this only where it's needed, not globally?
+ CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
+ LDFLAGS ?= @LDFLAGS@
++STATIC_LDFLAGS += @STATIC_LDFLAGS@
+ CLDFLAGS += @CLDFLAGS@
+ ELDFLAGS += @ELDFLAGS@
+ LDDEPS += @LDDEPS@
+--- LVM2.2.02.178/tools/Makefile.in
++++ LVM2.2.02.178/tools/Makefile.in
+@@ -129,7 +129,7 @@
+ 
+ dmsetup.static: dmsetup.o $(interfacebuilddir)/libdevmapper.a
+ 	@echo "    [CC] $@"
+-	$(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
++	$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) \
+ 	      -o $@ dmsetup.o -ldevmapper $(M_LIBS) $(PTHREAD_LIBS) $(STATIC_LIBS) $(LIBS)
+ 
+ all: device-mapper
+@@ -159,7 +159,7 @@
+ 
+ lvm.static: $(OBJECTS) lvm-static.o $(top_builddir)/lib/liblvm-internal.a  $(interfacebuilddir)/libdevmapper.a
+ 	@echo "    [CC] $@"
+-	$(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
++	$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(STATIC_LDFLAGS) -static -L$(interfacebuilddir) -o $@ \
+ 	      $(OBJECTS) lvm-static.o $(LVMLIBS) $(STATIC_LIBS) $(LIBS)
+ 
+ liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o

diff --git a/sys-fs/lvm2/files/lvm2-2.02.178-example.conf.in.patch b/sys-fs/lvm2/files/lvm2-2.02.178-example.conf.in.patch
new file mode 100644
index 0000000..34c710d
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.178-example.conf.in.patch
@@ -0,0 +1,50 @@
+--- LVM2.2.02.178/conf/example.conf.in
++++ LVM2.2.02.178/conf/example.conf.in
+@@ -128,6 +128,9 @@
+ 	# Example
+ 	# Accept every block device:
+ 	# filter = [ "a|.*/|" ]
++	# Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel
++	# noise when you probed while not available.
++	filter = [ "r|/dev/nbd.*|", "a/.*/" ]
+ 	# Reject the cdrom drive:
+ 	# filter = [ "r|/dev/cdrom|" ]
+ 	# Work with just loopback devices, e.g. for testing:
+@@ -704,7 +707,8 @@
+ 	# Configuration option global/fallback_to_lvm1.
+ 	# This setting is no longer used.
+ 	# This configuration option has an automatic default value.
+-	# fallback_to_lvm1 = 0
++	# Gentoo: the LVM tools are a seperate package.
++	fallback_to_lvm1 = 0
+ 
+ 	# Configuration option global/format.
+ 	# This setting is no longer used.
+@@ -1508,7 +1512,7 @@
+ 
+ # Configuration section metadata.
+ # This configuration section has an automatic default value.
+-# metadata {
++metadata {
+ 
+ 	# Configuration option metadata/check_pv_device_sizes.
+ 	# Check device sizes are not smaller than corresponding PV sizes.
+@@ -1553,7 +1557,8 @@
+ 	# 
+ 	# This configuration option is advanced.
+ 	# This configuration option has an automatic default value.
+-	# pvmetadatacopies = 1
++	# Gentoo: enable for data safety, but PV resize is then disabled.
++	# pvmetadatacopies = 2
+ 
+ 	# Configuration option metadata/vgmetadatacopies.
+ 	# Number of copies of metadata to maintain for each VG.
+@@ -1608,7 +1613,7 @@
+ 	# 
+ 	# This configuration option is advanced.
+ 	# This configuration option does not have a default value defined.
+-# }
++}
+ 
+ # Configuration section report.
+ # LVM report command output formatting.

diff --git a/sys-fs/lvm2/files/lvm2-2.02.178-static-pkgconfig-libs.patch b/sys-fs/lvm2/files/lvm2-2.02.178-static-pkgconfig-libs.patch
new file mode 100644
index 0000000..989b308
--- /dev/null
+++ b/sys-fs/lvm2/files/lvm2-2.02.178-static-pkgconfig-libs.patch
@@ -0,0 +1,102 @@
+--- LVM2.2.02.178/configure.ac
++++ LVM2.2.02.178/configure.ac
+@@ -1238,6 +1238,7 @@
+ 	PKG_CHECK_MODULES(BLKID, blkid >= 2.24,
+ 			  [ BLKID_WIPING=yes
+ 			    BLKID_PC="blkid"
++			    BLKID_STATIC_LIBS=`$PKG_CONFIG --static --libs $BLKID_PC`
+ 			    DEFAULT_USE_BLKID_WIPING=1
+ 			    AC_DEFINE([BLKID_WIPING_SUPPORT], 1, [Define to 1 to use libblkid detection of signatures when wiping.])
+ 			  ], [if test "$BLKID_WIPING" = maybe; then
+@@ -1286,6 +1287,7 @@
+ if test "$UDEV_SYNC" = yes; then
+ 	pkg_config_init
+ 	PKG_CHECK_MODULES(UDEV, libudev >= 143, [UDEV_PC="libudev"])
++	UDEV_STATIC_LIBS=`$PKG_CONFIG --static --libs libudev`
+ 	AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
+ 
+ 	AC_CHECK_LIB(udev, udev_device_get_is_initialized, AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1,
+@@ -1564,19 +1566,32 @@
+ if test "$SELINUX" = yes; then
+ 	AC_CHECK_LIB([sepol], [sepol_check_context], [
+ 		AC_DEFINE([HAVE_SEPOL], 1, [Define to 1 if sepol_check_context is available.])
+-		SELINUX_LIBS="-lsepol"])
++		SEPOL_LIBS="-lsepol"])
++
++	dnl -- init pkgconfig if required
++	if  test x$PKGCONFIG_INIT != x1; then
++		pkg_config_init
++	fi
++	PKG_CHECK_MODULES(SELINUX, libselinux, [
++		SELINUX_PC="libselinux"
++		SELINUX_STATIC_LIBS=`$PKG_CONFIG --static --libs libselinux`
++		SELINUX_LIBS="$SELINUX_LIBS $SEPOL_LIBS"
++		AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
++	],[
++		dnl -- old non-pkgconfig method, is buggy with static builds
+ 
+ 	AC_CHECK_LIB([selinux], [is_selinux_enabled], [
+ 		AC_CHECK_HEADERS([selinux/selinux.h],, hard_bailout)
+ 		AC_CHECK_HEADERS([selinux/label.h])
+ 		AC_DEFINE([HAVE_SELINUX], 1, [Define to 1 to include support for selinux.])
+-		SELINUX_LIBS="-lselinux $SELINUX_LIBS"
++		SELINUX_LIBS="-lselinux $SEPOL_LIBS"
+ 		SELINUX_PC="libselinux"
+ 		HAVE_SELINUX=yes ], [
+ 		AC_MSG_WARN(Disabling selinux)
+ 		SELINUX_LIBS=
+ 		SELINUX_PC=
+ 		HAVE_SELINUX=no ])
++	])
+ fi
+ 
+ ################################################################################
+@@ -1927,6 +1942,7 @@
+ ################################################################################
+ AC_SUBST(APPLIB)
+ AC_SUBST(AWK)
++AC_SUBST(BLKID_STATIC_LIBS)
+ AC_SUBST(BLKID_PC)
+ AC_SUBST(BUILD_CMIRRORD)
+ AC_SUBST(BUILD_DMEVENTD)
+@@ -2037,6 +2053,7 @@
+ AC_SUBST(SALCK_LIBS)
+ AC_SUBST(SBINDIR)
+ AC_SUBST(SELINUX_LIBS)
++AC_SUBST(SELINUX_STATIC_LIBS)
+ AC_SUBST(SELINUX_PC)
+ AC_SUBST(SYSCONFDIR)
+ AC_SUBST(SYSTEMD_LIBS)
+@@ -2053,6 +2070,7 @@
+ AC_SUBST(CACHE_DUMP_CMD)
+ AC_SUBST(CACHE_REPAIR_CMD)
+ AC_SUBST(CACHE_RESTORE_CMD)
++AC_SUBST(UDEV_STATIC_LIBS)
+ AC_SUBST(UDEV_PC)
+ AC_SUBST(UDEV_RULES)
+ AC_SUBST(UDEV_SYNC)
+--- LVM2.2.02.178/make.tmpl.in
++++ LVM2.2.02.178/make.tmpl.in
+@@ -59,7 +59,7 @@
+ 
+ LIBS = @LIBS@
+ # Extra libraries always linked with static binaries
+-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
++STATIC_LIBS = $(SELINUX_STATIC_LIBS) $(UDEV_STATIC_LIBS) $(BLKID_STATIC_LIBS)
+ DEFS += @DEFS@
+ # FIXME set this only where it's needed, not globally?
+ CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
+@@ -75,10 +75,13 @@
+ PTHREAD_LIBS = @PTHREAD_LIBS@
+ READLINE_LIBS = @READLINE_LIBS@
+ SELINUX_LIBS = @SELINUX_LIBS@
++SELINUX_STATIC_LIBS = @SELINUX_STATIC_LIBS@
+ UDEV_CFLAGS = @UDEV_CFLAGS@
+ UDEV_LIBS = @UDEV_LIBS@
++UDEV_STATIC_LIBS = @UDEV_STATIC_LIBS@
+ BLKID_CFLAGS = @BLKID_CFLAGS@
+ BLKID_LIBS = @BLKID_LIBS@
++BLKID_STATIC_LIBS = @BLKID_STATIC_LIBS@
+ SYSTEMD_LIBS = @SYSTEMD_LIBS@
+ VALGRIND_CFLAGS = @VALGRIND_CFLAGS@
+ 

diff --git a/sys-fs/lvm2/files/lvm2-avoid-mallinfo.patch b/sys-fs/lvm2/files/lvm2-avoid-mallinfo.patch
deleted file mode 100644
index b7da941..0000000
--- a/sys-fs/lvm2/files/lvm2-avoid-mallinfo.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-File lvm2-2.02.116-r99.orig/.ipc_in is a fifo while file lvm2-2.02.116-r99/.ipc_in is a fifo
-File lvm2-2.02.116-r99.orig/.ipc_out is a fifo while file lvm2-2.02.116-r99/.ipc_out is a fifo
-diff -Naur lvm2-2.02.116-r99.orig/work/LVM2.2.02.116/lib/mm/memlock.c lvm2-2.02.116-r99/work/LVM2.2.02.116/lib/mm/memlock.c
---- lvm2-2.02.116-r99.orig/work/LVM2.2.02.116/lib/mm/memlock.c	2015-01-30 16:19:53.000000000 +0000
-+++ lvm2-2.02.116-r99/work/LVM2.2.02.116/lib/mm/memlock.c	2015-10-13 21:02:49.385224386 +0000
-@@ -134,10 +134,8 @@
- static void _allocate_memory(void)
- {
- #ifndef VALGRIND_POOL
--	void *stack_mem;
-+	void *stack_mem, *temp_malloc_mem;
- 	struct rlimit limit;
--	int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
--	char *areas[max_areas];
- 
- 	/* Check if we could preallocate requested stack */
- 	if ((getrlimit (RLIMIT_STACK, &limit) == 0) &&
-@@ -146,50 +144,13 @@
- 		_touch_memory(stack_mem, _size_stack);
- 	/* FIXME else warn user setting got ignored */
- 
--        /*
--         *  When a brk() fails due to fragmented address space (which sometimes
--         *  happens when we try to grab 8M or so), glibc will make a new
--         *  arena. In this arena, the rules for using “direct” mmap are relaxed,
--         *  circumventing the MAX_MMAPs and MMAP_THRESHOLD settings. We can,
--         *  however, detect when this happens with mallinfo() and try to co-opt
--         *  malloc into using MMAP as a MORECORE substitute instead of returning
--         *  MMAP'd memory directly. Since MMAP-as-MORECORE does not munmap the
--         *  memory on free(), this is good enough for our purposes.
--         */
--	while (missing > 0) {
--		struct mallinfo inf = mallinfo();
--		hblks = inf.hblks;
--
--		if ((areas[area] = malloc(_size_malloc_tmp)))
--			_touch_memory(areas[area], _size_malloc_tmp);
--
--		inf = mallinfo();
--
--		if (hblks < inf.hblks) {
--			/* malloc cheated and used mmap, even though we told it
--			   not to; we try with twice as many areas, each half
--			   the size, to circumvent the faulty logic in glibc */
--			free(areas[area]);
--			_size_malloc_tmp /= 2;
--		} else {
--			++ area;
--			missing -= _size_malloc_tmp;
--		}
--
--		if (area == max_areas && missing > 0) {
--			/* Too bad. Warn the user and proceed, as things are
--			 * most likely going to work out anyway. */
--			log_warn("WARNING: Failed to reserve memory, %d bytes missing.", missing);
--			break;
--		}
--	}
-+	if ((temp_malloc_mem = malloc(_size_malloc_tmp)))
-+		_touch_memory(temp_malloc_mem, _size_malloc_tmp);
- 
- 	if ((_malloc_mem = malloc(_size_malloc)))
- 		_touch_memory(_malloc_mem, _size_malloc);
- 
--	/* free up the reserves so subsequent malloc's can use that memory */
--	for (i = 0; i < area; ++i)
--		free(areas[i]);
-+	free(temp_malloc_mem);
- #endif
- }
- 

diff --git a/sys-fs/lvm2/files/lvm2-fix-stdio-usage.patch b/sys-fs/lvm2/files/lvm2-fix-stdio-usage.patch
deleted file mode 100644
index 71fa5bf..0000000
--- a/sys-fs/lvm2/files/lvm2-fix-stdio-usage.patch
+++ /dev/null
@@ -1,111 +0,0 @@
---- LVM2.2.02.103.orig/lib/commands/toolcontext.c
-+++ LVM2.2.02.103/lib/commands/toolcontext.c
-@@ -1336,7 +1336,10 @@
- /*
-  * Close and reopen stream on file descriptor fd.
-  */
--static int _reopen_stream(FILE *stream, int fd, const char *mode, const char *name, FILE **new_stream)
-+#ifdef __GLIBC__
-+#define _reopen_stream(stream, fd, mode, name) __reopen_stream(stream, fd, mode, name, &stream)
-+
-+static int __reopen_stream(FILE *stream, int fd, const char *mode, const char *name, FILE **new_stream)
- {
- 	int fd_copy, new_fd;
- 
-@@ -1363,6 +1366,9 @@
- 
- 	return 1;
- }
-+#else
-+#define _reopen_stream(stream, fd, mode, name) (freopen(NULL, mode, stream) != NULL)
-+#endif
- 
- /* Entry point */
- struct cmd_context *create_toolcontext(unsigned is_long_lived,
-@@ -1371,7 +1377,6 @@
- 				       unsigned threaded)
- {
- 	struct cmd_context *cmd;
--	FILE *new_stream;
- 	int flags;
- 
- #ifdef M_MMAP_MAX
-@@ -1421,9 +1426,8 @@
- 		if (is_valid_fd(STDIN_FILENO) &&
- 		    ((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) &&
- 		    (flags & O_ACCMODE) != O_WRONLY) {
--			if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream))
-+			if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin"))
- 				goto_out;
--			stdin = new_stream;
- 			if (setvbuf(stdin, cmd->linebuffer, _IOLBF, linebuffer_size)) {
- 				log_sys_error("setvbuf", "");
- 				goto out;
-@@ -1433,9 +1437,8 @@
- 		if (is_valid_fd(STDOUT_FILENO) &&
- 		    ((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) &&
- 		    (flags & O_ACCMODE) != O_RDONLY) {
--			if (!_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream))
-+			if (!_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout"))
- 				goto_out;
--			stdout = new_stream;
- 			if (setvbuf(stdout, cmd->linebuffer + linebuffer_size,
- 				     _IOLBF, linebuffer_size)) {
- 				log_sys_error("setvbuf", "");
-@@ -1715,7 +1718,6 @@
- void destroy_toolcontext(struct cmd_context *cmd)
- {
- 	struct dm_config_tree *cft_cmdline;
--	FILE *new_stream;
- 	int flags;
- 
- 	if (cmd->dump_filter && cmd->filter && cmd->filter->dump &&
-@@ -1752,8 +1754,7 @@
- 		if (is_valid_fd(STDIN_FILENO) &&
- 		    ((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) &&
- 		    (flags & O_ACCMODE) != O_WRONLY) {
--			if (_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream)) {
--				stdin = new_stream;
-+			if (_reopen_stream(stdin, STDIN_FILENO, "r", "stdin")) {
- 				setlinebuf(stdin);
- 			} else
- 				cmd->linebuffer = NULL;	/* Leave buffer in place (deliberate leak) */
-@@ -1762,8 +1763,7 @@
- 		if (is_valid_fd(STDOUT_FILENO) &&
- 		    ((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) &&
- 		    (flags & O_ACCMODE) != O_RDONLY) {
--			if (_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream)) {
--				stdout = new_stream;
-+			if (_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout")) {
- 				setlinebuf(stdout);
- 			} else
- 				cmd->linebuffer = NULL;	/* Leave buffer in place (deliberate leak) */
---- LVM2.2.02.103.orig/tools/lvmcmdline.c
-+++ LVM2.2.02.103/tools/lvmcmdline.c
-@@ -1252,7 +1252,7 @@
- 	int err = is_valid_fd(STDERR_FILENO);
- 
- 	if (!is_valid_fd(STDIN_FILENO) &&
--	    !(stdin = fopen(_PATH_DEVNULL, "r"))) {
-+	    !freopen(_PATH_DEVNULL, "r", stdin)) {
- 		if (err)
- 			perror("stdin stream open");
- 		else
-@@ -1262,7 +1262,7 @@
- 	}
- 
- 	if (!is_valid_fd(STDOUT_FILENO) &&
--	    !(stdout = fopen(_PATH_DEVNULL, "w"))) {
-+	    !freopen(_PATH_DEVNULL, "w", stdout)) {
- 		if (err)
- 			perror("stdout stream open");
- 		/* else no stdout */
-@@ -1270,7 +1270,7 @@
- 	}
- 
- 	if (!is_valid_fd(STDERR_FILENO) &&
--	    !(stderr = fopen(_PATH_DEVNULL, "w"))) {
-+	    !freopen(_PATH_DEVNULL, "w", stderr)) {
- 		printf("stderr stream open: %s\n",
- 		       strerror(errno));
- 		return 0;

diff --git a/sys-fs/lvm2/files/lvm2-musl-fixes.patch b/sys-fs/lvm2/files/lvm2-musl-fixes.patch
deleted file mode 100644
index b62e80a..0000000
--- a/sys-fs/lvm2/files/lvm2-musl-fixes.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-diff -uar LVM2.2.02.110-old/daemons/lvmetad/lvmetad-core.c LVM2.2.02.110/daemons/lvmetad/lvmetad-core.c
---- LVM2.2.02.110-old/daemons/lvmetad/lvmetad-core.c	2015-05-14 21:37:01.226755157 +0000
-+++ LVM2.2.02.110/daemons/lvmetad/lvmetad-core.c	2015-05-14 21:44:08.098585801 +0000
-@@ -124,7 +124,7 @@
- 	if (!(vg = dm_hash_lookup(s->lock.vg, id))) {
- 		if (!(vg = malloc(sizeof(pthread_mutex_t))) ||
- 		    pthread_mutexattr_init(&rec) ||
--		    pthread_mutexattr_settype(&rec, PTHREAD_MUTEX_RECURSIVE_NP) ||
-+		    pthread_mutexattr_settype(&rec, PTHREAD_MUTEX_RECURSIVE) ||
- 		    pthread_mutex_init(vg, &rec))
- 			goto bad;
- 		if (!dm_hash_insert(s->lock.vg, id, vg)) {
-@@ -1152,7 +1152,7 @@
- 	ls->log = s->log;
- 
- 	pthread_mutexattr_init(&rec);
--	pthread_mutexattr_settype(&rec, PTHREAD_MUTEX_RECURSIVE_NP);
-+	pthread_mutexattr_settype(&rec, PTHREAD_MUTEX_RECURSIVE);
- 	pthread_mutex_init(&ls->lock.pvid_to_pvmeta, &rec);
- 	pthread_mutex_init(&ls->lock.vgid_to_metadata, &rec);
- 	pthread_mutex_init(&ls->lock.pvid_to_vgid, NULL);
-Only in LVM2.2.02.110/lib/commands: toolcontext.c.orig
-diff -uar LVM2.2.02.110-old/libdaemon/server/daemon-server.c LVM2.2.02.110/libdaemon/server/daemon-server.c
---- LVM2.2.02.110-old/libdaemon/server/daemon-server.c	2015-05-14 21:37:01.256755555 +0000
-+++ LVM2.2.02.110/libdaemon/server/daemon-server.c	2015-05-14 21:37:51.108437752 +0000
-@@ -26,6 +26,7 @@
- #include <sys/un.h>
- #include <unistd.h>
- #include <signal.h>
-+#include <fcntl.h>
- 
- #include <syslog.h> /* FIXME. For the global closelog(). */
- 

diff --git a/sys-fs/lvm2/lvm2-2.02.116-r4.ebuild b/sys-fs/lvm2/lvm2-2.02.116-r4.ebuild
deleted file mode 100644
index ac14fae..0000000
--- a/sys-fs/lvm2/lvm2-2.02.116-r4.ebuild
+++ /dev/null
@@ -1,285 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic
-
-DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
-HOMEPAGE="https://sourceware.org/lvm2/"
-SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
-	ftp://sourceware.org/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="amd64 arm arm64 ~mips ppc ~x86"
-IUSE="readline static static-libs systemd clvm cman lvm1 lvm2create_initrd selinux +udev +thin device-mapper-only"
-REQUIRED_USE="device-mapper-only? ( !clvm !cman !lvm1 !lvm2create_initrd !thin )
-	systemd? ( udev )
-	clvm? ( !systemd )"
-
-DEPEND_COMMON="clvm? ( cman? ( =sys-cluster/cman-3* ) =sys-cluster/libdlm-3* )
-	readline? ( sys-libs/readline:0= )
-	udev? ( >=virtual/libudev-208:=[static-libs?] )"
-# /run is now required for locking during early boot. /var cannot be assumed to
-# be available -- thus, pull in recent enough baselayout for /run.
-# This version of LVM is incompatible with cryptsetup <1.1.2.
-RDEPEND="${DEPEND_COMMON}
-	>=sys-apps/baselayout-2.2
-	!<sys-apps/openrc-0.11
-	!<sys-fs/cryptsetup-1.1.2
-	!!sys-fs/clvm
-	!!sys-fs/lvm-user
-	>=sys-apps/util-linux-2.16
-	lvm2create_initrd? (
-		app-arch/cpio
-		sys-apps/makedev
-	)
-	thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
-# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
-# USE 'static' currently only works with eudev, bug 520450
-DEPEND="${DEPEND_COMMON}
-	virtual/pkgconfig
-	>=sys-devel/binutils-2.20.1-r1
-	static? (
-		selinux? ( sys-libs/libselinux[static-libs] )
-		udev? ( >=sys-fs/eudev-3.1.2[static-libs] )
-		>=sys-apps/util-linux-2.16[static-libs]
-	)"
-
-S=${WORKDIR}/${PN/lvm/LVM}.${PV}
-
-pkg_setup() {
-	local CONFIG_CHECK="~SYSVIPC"
-
-	if use udev; then
-		local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
-		if linux_config_exists; then
-			local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
-			if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then
-				ewarn "It's recommended to set an empty value to the following kernel config option:"
-				ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
-			fi
-		fi
-	fi
-
-	check_extra_config
-
-	# 1. Genkernel no longer copies /sbin/lvm blindly.
-	if use static; then
-		elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
-		elog "their static versions. If you need the static binaries,"
-		elog "you must append .static to the filename!"
-	fi
-}
-
-src_prepare() {
-	# Gentoo specific modification(s):
-	epatch "${FILESDIR}"/${PN}-2.02.108-example.conf.in.patch
-
-	sed -i \
-		-e "1iAR = $(tc-getAR)" \
-		-e "s:CC ?= @CC@:CC = $(tc-getCC):" \
-		make.tmpl.in || die #444082
-
-	sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212
-
-	if use udev && ! use device-mapper-only; then
-		sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196
-		elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in"
-		elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad"
-		elog "if it was previously disabled."
-	fi
-
-	sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514
-
-	# For upstream -- review and forward:
-	epatch "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
-	epatch "${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch
-	epatch "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331
-	epatch "${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373
-	epatch "${FILESDIR}"/${PN}-2.02.70-asneeded.patch # -Wl,--as-needed
-	epatch "${FILESDIR}"/${PN}-2.02.92-dynamic-static-ldflags.patch #332905
-	epatch "${FILESDIR}"/${PN}-2.02.108-static-pkgconfig-libs.patch #370217, #439414 + blkid
-	epatch "${FILESDIR}"/${PN}-2.02.106-pthread-pkgconfig.patch #492450
-	# Patches for musl
-	epatch "${FILESDIR}"/${PN}-fix-stdio-usage.patch # Patch from alpine linux
-	epatch "${FILESDIR}"/${PN}-musl-fixes.patch
-	epatch "${FILESDIR}"/${PN}-avoid-mallinfo.patch
-
-	# Without thin-privision-tools, there is nothing to install for target install_man7:
-	use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; }
-
-	eautoreconf
-}
-
-src_configure() {
-	filter-flags -flto
-	local myconf
-	local buildmode
-
-	myconf="${myconf} $(use_enable !device-mapper-only dmeventd)"
-	myconf="${myconf} $(use_enable !device-mapper-only cmdlib)"
-	myconf="${myconf} $(use_enable !device-mapper-only applib)"
-	myconf="${myconf} $(use_enable !device-mapper-only fsadm)"
-	myconf="${myconf} $(use_enable !device-mapper-only lvmetad)"
-	use device-mapper-only && myconf="${myconf} --disable-udev-systemd-background-jobs"
-
-	# Most of this package does weird stuff.
-	# The build options are tristate, and --without is NOT supported
-	# options: 'none', 'internal', 'shared'
-	if use static; then
-		buildmode="internal"
-		# This only causes the .static versions to become available
-		myconf="${myconf} --enable-static_link"
-	else
-		buildmode="shared"
-	fi
-	dmbuildmode=$(use !device-mapper-only && echo internal || echo none)
-
-	# dmeventd requires mirrors to be internal, and snapshot available
-	# so we cannot disable them
-	myconf="${myconf} --with-mirrors=${dmbuildmode}"
-	myconf="${myconf} --with-snapshots=${dmbuildmode}"
-	if use thin; then
-		myconf="${myconf} --with-thin=internal --with-cache=internal"
-		local texec
-		for texec in check dump repair restore; do
-			myconf="${myconf} --with-thin-${texec}=${EPREFIX}/sbin/thin_${texec}"
-			myconf="${myconf} --with-cache-${texec}=${EPREFIX}/sbin/cache_${texec}"
-		done
-	else
-		myconf="${myconf} --with-thin=none --with-cache=none"
-	fi
-
-	if use lvm1; then
-		myconf="${myconf} --with-lvm1=${buildmode}"
-	else
-		myconf="${myconf} --with-lvm1=none"
-	fi
-
-	# disable O_DIRECT support on hppa, breaks pv detection (#99532)
-	use hppa && myconf="${myconf} --disable-o_direct"
-
-	if use clvm; then
-		myconf="${myconf} --with-cluster=${buildmode}"
-		# 4-state! Make sure we get it right, per bug 210879
-		# Valid options are: none, cman, gulm, all
-		#
-		# 2009/02:
-		# gulm is removed now, now dual-state:
-		# cman, none
-		# all still exists, but is not needed
-		#
-		# 2009/07:
-		# TODO: add corosync and re-enable ALL
-		local clvmd=""
-		use cman && clvmd="cman"
-		#clvmd="${clvmd/cmangulm/all}"
-		[ -z "${clvmd}" ] && clvmd="none"
-		myconf="${myconf} --with-clvmd=${clvmd}"
-		myconf="${myconf} --with-pool=${buildmode}"
-	else
-		myconf="${myconf} --with-clvmd=none --with-cluster=none"
-	fi
-
-	econf \
-		$(use_enable readline) \
-		$(use_enable selinux) \
-		--enable-pkgconfig \
-		--with-confdir="${EPREFIX}"/etc \
-		--exec-prefix="${EPREFIX}" \
-		--sbindir="${EPREFIX}/sbin" \
-		--with-staticdir="${EPREFIX}"/sbin \
-		--libdir="${EPREFIX}/$(get_libdir)" \
-		--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
-		--with-default-dm-run-dir=/run \
-		--with-default-run-dir=/run/lvm \
-		--with-default-locking-dir=/run/lock/lvm \
-		--with-default-pid-dir=/run \
-		$(use_enable udev udev_rules) \
-		$(use_enable udev udev_sync) \
-		$(use_with udev udevdir "$(get_udevdir)"/rules.d) \
-		$(use_enable systemd udev-systemd-background-jobs) \
-		"$(systemd_with_unitdir)" \
-		${myconf} \
-		CLDFLAGS="${LDFLAGS}"
-}
-
-src_compile() {
-	pushd include >/dev/null
-	emake
-	popd >/dev/null
-
-	if use device-mapper-only ; then
-		emake device-mapper
-	else
-		emake
-		emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat
-	fi
-}
-
-src_install() {
-	local inst
-	INSTALL_TARGETS="install install_tmpfiles_configuration"
-	# install systemd related files only when requested, bug #522430
-	use systemd && INSTALL_TARGETS="${INSTALL_TARGETS} install_systemd_units install_systemd_generators"
-	use device-mapper-only && INSTALL_TARGETS="install_device-mapper"
-	for inst in ${INSTALL_TARGETS}; do
-		emake DESTDIR="${D}" ${inst}
-	done
-
-	newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper
-	newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
-
-	if use !device-mapper-only ; then
-		newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd
-		newinitd "${FILESDIR}"/lvm.rc-2.02.116-r4 lvm
-		newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm
-
-		newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring
-		newinitd "${FILESDIR}"/lvmetad.initd-2.02.116-r3 lvmetad
-	fi
-
-	if use clvm; then
-		newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd
-		newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd
-	fi
-
-	if use static-libs; then
-		dolib.a libdm/ioctl/libdevmapper.a
-		dolib.a libdaemon/client/libdaemonclient.a #462908
-		#gen_usr_ldscript libdevmapper.so
-		dolib.a daemons/dmeventd/libdevmapper-event.a
-		#gen_usr_ldscript libdevmapper-event.so
-	else
-		rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
-	fi
-
-	if use lvm2create_initrd; then
-		dosbin scripts/lvm2create_initrd/lvm2create_initrd
-		doman scripts/lvm2create_initrd/lvm2create_initrd.8
-		newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd
-	fi
-
-	insinto /etc
-	doins "${FILESDIR}"/dmtab
-
-	dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
-}
-
-pkg_postinst() {
-	ewarn "Make sure the \"lvm\" init script is in the runlevels:"
-	ewarn "# rc-update add lvm boot"
-	ewarn
-	ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want"
-	ewarn "to enable lvm autoactivation and metadata caching."
-	ewarn
-	ewarn "After enabling or disabling lvmetad in /etc/lvm/lvm.conf you must"
-	ewarn "run the following to update the init script dependencies: "
-	ewarn "# rc-update -u"
-}
-
-src_test() {
-	einfo "Tests are disabled because of device-node mucking, if you want to"
-	einfo "run tests, compile the package and see ${S}/tests"
-}

diff --git a/sys-fs/lvm2/lvm2-2.02.116.ebuild b/sys-fs/lvm2/lvm2-2.02.116.ebuild
deleted file mode 100644
index 3d573a8..0000000
--- a/sys-fs/lvm2/lvm2-2.02.116.ebuild
+++ /dev/null
@@ -1,275 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic
-
-DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
-HOMEPAGE="https://sourceware.org/lvm2/"
-SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
-	ftp://sourceware.org/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="amd64 arm arm64 ~mips ppc x86"
-IUSE="readline static static-libs systemd clvm cman lvm1 lvm2create_initrd selinux +udev +thin device-mapper-only"
-REQUIRED_USE="device-mapper-only? ( !clvm !cman !lvm1 !lvm2create_initrd !thin )
-	systemd? ( udev )
-	static? ( !udev )" #520450
-
-DEPEND_COMMON="clvm? ( cman? ( =sys-cluster/cman-3* ) =sys-cluster/libdlm-3* )
-	readline? ( sys-libs/readline:0= )
-	udev? ( >=virtual/libudev-208:=[static-libs?] )"
-# /run is now required for locking during early boot. /var cannot be assumed to
-# be available -- thus, pull in recent enough baselayout for /run.
-# This version of LVM is incompatible with cryptsetup <1.1.2.
-RDEPEND="${DEPEND_COMMON}
-	>=sys-apps/baselayout-2.2
-	!<sys-apps/openrc-0.11
-	!<sys-fs/cryptsetup-1.1.2
-	!!sys-fs/clvm
-	!!sys-fs/lvm-user
-	>=sys-apps/util-linux-2.16
-	lvm2create_initrd? ( sys-apps/makedev )
-	thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
-# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
-DEPEND="${DEPEND_COMMON}
-	virtual/pkgconfig
-	>=sys-devel/binutils-2.20.1-r1
-	static? (
-		selinux? ( sys-libs/libselinux[static-libs] )
-		udev? ( >=virtual/libudev-208:=[static-libs] )
-		>=sys-apps/util-linux-2.16[static-libs]
-	)"
-
-S=${WORKDIR}/${PN/lvm/LVM}.${PV}
-
-pkg_setup() {
-	local CONFIG_CHECK="~SYSVIPC"
-
-	if use udev; then
-		local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
-		if linux_config_exists; then
-			local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
-			if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then
-				ewarn "It's recommended to set an empty value to the following kernel config option:"
-				ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
-			fi
-		fi
-	fi
-
-	check_extra_config
-
-	# 1. Genkernel no longer copies /sbin/lvm blindly.
-	if use static; then
-		elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
-		elog "their static versions. If you need the static binaries,"
-		elog "you must append .static to the filename!"
-	fi
-}
-
-src_prepare() {
-	# Gentoo specific modification(s):
-	epatch "${FILESDIR}"/${PN}-2.02.108-example.conf.in.patch
-
-	sed -i \
-		-e "1iAR = $(tc-getAR)" \
-		-e "s:CC ?= @CC@:CC = $(tc-getCC):" \
-		make.tmpl.in || die #444082
-
-	sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212
-
-	if use udev && ! use device-mapper-only; then
-		sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196
-		elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in"
-		elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad"
-		elog "if it was previously disabled."
-	fi
-
-	sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514
-
-	# For upstream -- review and forward:
-	epatch "${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
-	epatch "${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch
-	epatch "${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331
-	epatch "${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373
-	epatch "${FILESDIR}"/${PN}-2.02.70-asneeded.patch # -Wl,--as-needed
-	epatch "${FILESDIR}"/${PN}-2.02.92-dynamic-static-ldflags.patch #332905
-	epatch "${FILESDIR}"/${PN}-2.02.108-static-pkgconfig-libs.patch #370217, #439414 + blkid
-	epatch "${FILESDIR}"/${PN}-2.02.106-pthread-pkgconfig.patch #492450
-	# Patches for musl
-	epatch "${FILESDIR}"/${PN}-fix-stdio-usage.patch # Patch from alpine linux
-	epatch "${FILESDIR}"/${PN}-musl-fixes.patch
-	epatch "${FILESDIR}"/${PN}-avoid-mallinfo.patch
-
-	# Without thin-privision-tools, there is nothing to install for target install_man7:
-	use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; }
-
-	eautoreconf
-}
-
-src_configure() {
-	filter-flags -flto
-	local myconf
-	local buildmode
-
-	myconf="${myconf} $(use_enable !device-mapper-only dmeventd)"
-	myconf="${myconf} $(use_enable !device-mapper-only cmdlib)"
-	myconf="${myconf} $(use_enable !device-mapper-only applib)"
-	myconf="${myconf} $(use_enable !device-mapper-only fsadm)"
-	myconf="${myconf} $(use_enable !device-mapper-only lvmetad)"
-	use device-mapper-only && myconf="${myconf} --disable-udev-systemd-background-jobs"
-
-	# Most of this package does weird stuff.
-	# The build options are tristate, and --without is NOT supported
-	# options: 'none', 'internal', 'shared'
-	if use static; then
-		buildmode="internal"
-		# This only causes the .static versions to become available
-		myconf="${myconf} --enable-static_link"
-	else
-		buildmode="shared"
-	fi
-	dmbuildmode=$(use !device-mapper-only && echo internal || echo none)
-
-	# dmeventd requires mirrors to be internal, and snapshot available
-	# so we cannot disable them
-	myconf="${myconf} --with-mirrors=${dmbuildmode}"
-	myconf="${myconf} --with-snapshots=${dmbuildmode}"
-	if use thin; then
-		myconf="${myconf} --with-thin=internal --with-cache=internal"
-		local texec
-		for texec in check dump repair restore; do
-			myconf="${myconf} --with-thin-${texec}=${EPREFIX}/sbin/thin_${texec}"
-			myconf="${myconf} --with-cache-${texec}=${EPREFIX}/sbin/cache_${texec}"
-		done
-	else
-		myconf="${myconf} --with-thin=none --with-cache=none"
-	fi
-
-	if use lvm1; then
-		myconf="${myconf} --with-lvm1=${buildmode}"
-	else
-		myconf="${myconf} --with-lvm1=none"
-	fi
-
-	# disable O_DIRECT support on hppa, breaks pv detection (#99532)
-	use hppa && myconf="${myconf} --disable-o_direct"
-
-	if use clvm; then
-		myconf="${myconf} --with-cluster=${buildmode}"
-		# 4-state! Make sure we get it right, per bug 210879
-		# Valid options are: none, cman, gulm, all
-		#
-		# 2009/02:
-		# gulm is removed now, now dual-state:
-		# cman, none
-		# all still exists, but is not needed
-		#
-		# 2009/07:
-		# TODO: add corosync and re-enable ALL
-		local clvmd=""
-		use cman && clvmd="cman"
-		#clvmd="${clvmd/cmangulm/all}"
-		[ -z "${clvmd}" ] && clvmd="none"
-		myconf="${myconf} --with-clvmd=${clvmd}"
-		myconf="${myconf} --with-pool=${buildmode}"
-	else
-		myconf="${myconf} --with-clvmd=none --with-cluster=none"
-	fi
-
-	econf \
-		$(use_enable readline) \
-		$(use_enable selinux) \
-		--enable-pkgconfig \
-		--with-confdir="${EPREFIX}"/etc \
-		--exec-prefix="${EPREFIX}" \
-		--sbindir="${EPREFIX}/sbin" \
-		--with-staticdir="${EPREFIX}"/sbin \
-		--libdir="${EPREFIX}/$(get_libdir)" \
-		--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
-		--with-default-dm-run-dir=/run \
-		--with-default-run-dir=/run/lvm \
-		--with-default-locking-dir=/run/lock/lvm \
-		--with-default-pid-dir=/run \
-		$(use_enable udev udev_rules) \
-		$(use_enable udev udev_sync) \
-		$(use_with udev udevdir "$(get_udevdir)"/rules.d) \
-		$(use_enable systemd udev-systemd-background-jobs) \
-		"$(systemd_with_unitdir)" \
-		${myconf} \
-		CLDFLAGS="${LDFLAGS}"
-}
-
-src_compile() {
-	pushd include >/dev/null
-	emake
-	popd >/dev/null
-
-	if use device-mapper-only ; then
-		emake device-mapper
-	else
-		emake
-		emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat
-	fi
-}
-
-src_install() {
-	local inst
-	INSTALL_TARGETS="install install_systemd_units install_systemd_generators install_tmpfiles_configuration"
-	use device-mapper-only && INSTALL_TARGETS="install_device-mapper"
-	for inst in ${INSTALL_TARGETS}; do
-		emake DESTDIR="${D}" ${inst}
-	done
-
-	newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper
-	newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
-
-	if use !device-mapper-only ; then
-		newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd
-		newinitd "${FILESDIR}"/lvm.rc-2.02.105-r2 lvm
-		newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm
-
-		newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring
-		newinitd "${FILESDIR}"/lvmetad.initd-2.02.105-r2 lvmetad
-	fi
-
-	if use clvm; then
-		newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd
-		newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd
-	fi
-
-	if use static-libs; then
-		dolib.a libdm/ioctl/libdevmapper.a
-		dolib.a libdaemon/client/libdaemonclient.a #462908
-		#gen_usr_ldscript libdevmapper.so
-		dolib.a daemons/dmeventd/libdevmapper-event.a
-		#gen_usr_ldscript libdevmapper-event.so
-	else
-		rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
-	fi
-
-	if use lvm2create_initrd; then
-		dosbin scripts/lvm2create_initrd/lvm2create_initrd
-		doman scripts/lvm2create_initrd/lvm2create_initrd.8
-		newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd
-	fi
-
-	insinto /etc
-	doins "${FILESDIR}"/dmtab
-
-	dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
-}
-
-pkg_postinst() {
-	ewarn "Make sure the \"lvm\" init script is in the runlevels:"
-	ewarn "# rc-update add lvm boot"
-	ewarn
-	ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want"
-	ewarn "to enable lvm autoactivation and metadata caching."
-}
-
-src_test() {
-	einfo "Tests are disabled because of device-node mucking, if you want to"
-	einfo "run tests, compile the package and see ${S}/tests"
-}

diff --git a/sys-fs/lvm2/lvm2-2.02.145-r2.ebuild b/sys-fs/lvm2/lvm2-2.02.145-r2.ebuild
index f0fb589..80210ff 100644
--- a/sys-fs/lvm2/lvm2-2.02.145-r2.ebuild
+++ b/sys-fs/lvm2/lvm2-2.02.145-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -11,20 +11,12 @@ SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
 
 LICENSE="GPL-2"
 SLOT="0"
-KEYWORDS="amd64 arm arm64 ~mips ppc x86"
-IUSE="readline static static-libs systemd clvm cman corosync lvm1 lvm2create_initrd openais selinux +udev +thin device-mapper-only"
-REQUIRED_USE="device-mapper-only? ( !clvm !cman !corosync !lvm1 !lvm2create_initrd !openais !thin )
-	systemd? ( udev )
-	clvm? ( !systemd )"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 ~sh sparc x86 ~amd64-linux ~x86-linux"
+IUSE="readline static static-libs systemd lvm1 lvm2create_initrd selinux +udev +thin device-mapper-only"
+REQUIRED_USE="device-mapper-only? ( !lvm1 !lvm2create_initrd !thin )
+	systemd? ( udev )"
 
 DEPEND_COMMON="
-	clvm? (
-		cman? ( =sys-cluster/cman-3* )
-		corosync? ( sys-cluster/corosync )
-		openais? ( sys-cluster/openais )
-		=sys-cluster/libdlm-3*
-	)
-
 	readline? ( sys-libs/readline:0= )
 	systemd? ( >=sys-apps/systemd-205:0= )
 	udev? ( >=virtual/libudev-208:=[static-libs?] )"
@@ -35,7 +27,6 @@ RDEPEND="${DEPEND_COMMON}
 	>=sys-apps/baselayout-2.2
 	!<sys-apps/openrc-0.11
 	!<sys-fs/cryptsetup-1.1.2
-	!!sys-fs/clvm
 	!!sys-fs/lvm-user
 	>=sys-apps/util-linux-2.16
 	lvm2create_initrd? ( sys-apps/makedev )
@@ -171,29 +162,7 @@ src_configure() {
 	# disable O_DIRECT support on hppa, breaks pv detection (#99532)
 	use hppa && myconf+=( --disable-o_direct )
 
-	if use clvm; then
-		myconf+=( --with-cluster=${buildmode} )
-		# 4-state! Make sure we get it right, per bug 210879
-		# Valid options are: none, cman, gulm, all
-		#
-		# 2009/02:
-		# gulm is removed now, now dual-state:
-		# cman, none
-		# all still exists, but is not needed
-		#
-		# 2009/07:
-		# TODO: add corosync and re-enable ALL
-		local clvmd=""
-		use cman && clvmd="cman"
-		#clvmd="${clvmd/cmangulm/all}"
-		use corosync && clvmd="${clvmd:+$clvmd,}corosync"
-		use openais && clvmd="${clvmd:+$clvmd,}openais"
-		[ -z "${clvmd}" ] && clvmd="none"
-		myconf+=( --with-clvmd=${clvmd} )
-		myconf+=( --with-pool=${buildmode} )
-	else
-		myconf+=( --with-clvmd=none --with-cluster=none )
-	fi
+	myconf+=( --with-clvmd=none --with-cluster=none )
 
 	econf \
 		$(use_enable readline) \
@@ -253,17 +222,14 @@ src_install() {
 		newinitd "${FILESDIR}"/lvmetad.initd-2.02.116-r3 lvmetad
 	fi
 
-	if use clvm; then
-		newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd
-		newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd
-	fi
-
 	if use static-libs; then
 		dolib.a libdm/ioctl/libdevmapper.a
-		dolib.a libdaemon/client/libdaemonclient.a #462908
-		#gen_usr_ldscript libdevmapper.so
-		dolib.a daemons/dmeventd/libdevmapper-event.a
-		#gen_usr_ldscript libdevmapper-event.so
+		if use !device-mapper-only ; then
+			dolib.a libdaemon/client/libdaemonclient.a #462908
+			#gen_usr_ldscript libdevmapper.so
+			dolib.a daemons/dmeventd/libdevmapper-event.a
+			#gen_usr_ldscript libdevmapper-event.so
+		fi
 	else
 		rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
 	fi

diff --git a/sys-fs/lvm2/lvm2-2.02.166-r2.ebuild b/sys-fs/lvm2/lvm2-2.02.166-r2.ebuild
deleted file mode 100644
index 212f396..0000000
--- a/sys-fs/lvm2/lvm2-2.02.166-r2.ebuild
+++ /dev/null
@@ -1,301 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic
-
-DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
-HOMEPAGE="https://sourceware.org/lvm2/"
-SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
-	ftp://sourceware.org/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
-IUSE="readline static static-libs systemd clvm cman corosync lvm1 lvm2create_initrd openais sanlock selinux +udev +thin device-mapper-only"
-REQUIRED_USE="device-mapper-only? ( !clvm !cman !corosync !lvm1 !lvm2create_initrd !openais !sanlock !thin )
-	systemd? ( udev )
-	clvm? ( !systemd )"
-
-DEPEND_COMMON="
-	clvm? (
-		cman? ( =sys-cluster/cman-3* )
-		corosync? ( sys-cluster/corosync )
-		openais? ( sys-cluster/openais )
-		=sys-cluster/libdlm-3*
-	)
-
-	readline? ( sys-libs/readline:0= )
-	sanlock? ( sys-cluster/sanlock )
-	systemd? ( >=sys-apps/systemd-205:0= )
-	udev? ( >=virtual/libudev-208:=[static-libs?] )"
-# /run is now required for locking during early boot. /var cannot be assumed to
-# be available -- thus, pull in recent enough baselayout for /run.
-# This version of LVM is incompatible with cryptsetup <1.1.2.
-RDEPEND="${DEPEND_COMMON}
-	>=sys-apps/baselayout-2.2
-	!<sys-apps/openrc-0.11
-	!<sys-fs/cryptsetup-1.1.2
-	!!sys-fs/clvm
-	!!sys-fs/lvm-user
-	>=sys-apps/util-linux-2.16
-	lvm2create_initrd? ( sys-apps/makedev )
-	thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
-# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
-# USE 'static' currently only works with eudev, bug 520450
-DEPEND="${DEPEND_COMMON}
-	virtual/pkgconfig
-	>=sys-devel/binutils-2.20.1-r1
-	sys-devel/autoconf-archive
-	static? (
-		selinux? ( sys-libs/libselinux[static-libs] )
-		udev? ( >=sys-fs/eudev-3.1.2[static-libs] )
-		>=sys-apps/util-linux-2.16[static-libs]
-	)"
-
-S=${WORKDIR}/${PN/lvm/LVM}.${PV}
-
-PATCHES=(
-	# Gentoo specific modification(s):
-	"${FILESDIR}"/${PN}-2.02.129-example.conf.in.patch
-
-	# Musl fixes
-	"${FILESDIR}"/${PN}-2.02.166-fix-stdio-usage.patch
-	"${FILESDIR}"/${PN}-2.02.166-portability.patch
-
-	# For upstream -- review and forward:
-	"${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
-	"${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch
-	"${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331
-	"${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373
-	"${FILESDIR}"/${PN}-2.02.70-asneeded.patch # -Wl,--as-needed
-	"${FILESDIR}"/${PN}-2.02.139-dynamic-static-ldflags.patch #332905
-	"${FILESDIR}"/${PN}-2.02.129-static-pkgconfig-libs.patch #370217, #439414 + blkid
-	"${FILESDIR}"/${PN}-2.02.130-pthread-pkgconfig.patch #492450
-	#"${FILESDIR}"/${PN}-2.02.145-mkdev.patch #580062 # Merged upstream
-)
-
-pkg_setup() {
-	local CONFIG_CHECK="~SYSVIPC"
-
-	if use udev; then
-		local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
-		if linux_config_exists; then
-			local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
-			if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then
-				ewarn "It's recommended to set an empty value to the following kernel config option:"
-				ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
-			fi
-		fi
-	fi
-
-	check_extra_config
-
-	# 1. Genkernel no longer copies /sbin/lvm blindly.
-	if use static; then
-		elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
-		elog "their static versions. If you need the static binaries,"
-		elog "you must append .static to the filename!"
-	fi
-}
-
-src_prepare() {
-	default
-
-	sed -i \
-		-e "1iAR = $(tc-getAR)" \
-		-e "s:CC ?= @CC@:CC = $(tc-getCC):" \
-		make.tmpl.in || die #444082
-
-	sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212
-
-	if use udev && ! use device-mapper-only; then
-		sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196
-		elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in"
-		elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad"
-		elog "if it was previously disabled."
-	fi
-
-	sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514
-
-	# Without thin-privision-tools, there is nothing to install for target install_man7:
-	use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; }
-
-	eautoreconf
-}
-
-src_configure() {
-	filter-flags -flto
-	local myconf=()
-	local buildmode
-
-	myconf+=( $(use_enable !device-mapper-only dmeventd) )
-	myconf+=( $(use_enable !device-mapper-only cmdlib) )
-	myconf+=( $(use_enable !device-mapper-only applib) )
-	myconf+=( $(use_enable !device-mapper-only fsadm) )
-	myconf+=( $(use_enable !device-mapper-only lvmetad) )
-	use device-mapper-only && myconf+=( --disable-udev-systemd-background-jobs )
-
-	# Most of this package does weird stuff.
-	# The build options are tristate, and --without is NOT supported
-	# options: 'none', 'internal', 'shared'
-	if use static; then
-		buildmode="internal"
-		# This only causes the .static versions to become available
-		myconf+=( --enable-static_link )
-	else
-		buildmode="shared"
-	fi
-	dmbuildmode=$(use !device-mapper-only && echo internal || echo none)
-
-	# dmeventd requires mirrors to be internal, and snapshot available
-	# so we cannot disable them
-	myconf+=( --with-mirrors=${dmbuildmode} )
-	myconf+=( --with-snapshots=${dmbuildmode} )
-	if use thin; then
-		myconf+=( --with-thin=internal --with-cache=internal )
-		local texec
-		for texec in check dump repair restore; do
-			myconf+=( --with-thin-${texec}="${EPREFIX}"/sbin/thin_${texec} )
-			myconf+=( --with-cache-${texec}="${EPREFIX}"/sbin/cache_${texec} )
-		done
-	else
-		myconf+=( --with-thin=none --with-cache=none )
-	fi
-
-	if use lvm1; then
-		myconf+=( --with-lvm1=${buildmode} )
-	else
-		myconf+=( --with-lvm1=none )
-	fi
-
-	# disable O_DIRECT support on hppa, breaks pv detection (#99532)
-	use hppa && myconf+=( --disable-o_direct )
-
-	if use clvm; then
-		myconf+=( --with-cluster=${buildmode} )
-		# 4-state! Make sure we get it right, per bug 210879
-		# Valid options are: none, cman, gulm, all
-		#
-		# 2009/02:
-		# gulm is removed now, now dual-state:
-		# cman, none
-		# all still exists, but is not needed
-		#
-		# 2009/07:
-		# TODO: add corosync and re-enable ALL
-		local clvmd=""
-		use cman && clvmd="cman"
-		#clvmd="${clvmd/cmangulm/all}"
-		use corosync && clvmd="${clvmd:+$clvmd,}corosync"
-		use openais && clvmd="${clvmd:+$clvmd,}openais"
-		[ -z "${clvmd}" ] && clvmd="none"
-		myconf+=( --with-clvmd=${clvmd} )
-		myconf+=( --with-pool=${buildmode} )
-
-	else
-		myconf+=( --with-clvmd=none --with-cluster=none )
-	fi
-
-	econf \
-		$(use_enable readline) \
-		$(use_enable selinux) \
-		--enable-pkgconfig \
-		--with-confdir="${EPREFIX}"/etc \
-		--exec-prefix="${EPREFIX}" \
-		--sbindir="${EPREFIX}/sbin" \
-		--with-staticdir="${EPREFIX}"/sbin \
-		--libdir="${EPREFIX}/$(get_libdir)" \
-		--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
-		--with-default-dm-run-dir=/run \
-		--with-default-run-dir=/run/lvm \
-		--with-default-locking-dir=/run/lock/lvm \
-		--with-default-pid-dir=/run \
-		$(use_enable udev udev_rules) \
-		$(use_enable udev udev_sync) \
-		$(use_with udev udevdir "$(get_udevdir)"/rules.d) \
-		$(use_enable sanlock lockd-sanlock) \
-		$(use_enable systemd udev-systemd-background-jobs) \
-		--with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
-		${myconf[@]} \
-		CLDFLAGS="${LDFLAGS}"
-}
-
-src_compile() {
-	pushd include >/dev/null
-	emake
-	popd >/dev/null
-
-	if use device-mapper-only ; then
-		emake device-mapper
-	else
-		emake
-		emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat
-	fi
-}
-
-src_install() {
-	local inst
-	INSTALL_TARGETS="install install_tmpfiles_configuration"
-	# install systemd related files only when requested, bug #522430
-	use systemd && INSTALL_TARGETS="${INSTALL_TARGETS} install_systemd_units install_systemd_generators"
-	use device-mapper-only && INSTALL_TARGETS="install_device-mapper"
-	for inst in ${INSTALL_TARGETS}; do
-		emake DESTDIR="${D}" ${inst}
-	done
-
-	newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper
-	newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
-
-	if use !device-mapper-only ; then
-		newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd
-		newinitd "${FILESDIR}"/lvm.rc-2.02.166-r2 lvm
-		newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm
-
-		newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring
-		newinitd "${FILESDIR}"/lvmetad.initd-2.02.116-r3 lvmetad
-	fi
-
-	if use sanlock; then
-		newinitd "${FILESDIR}"/lvmlockd.initd-2.02.166-r1 lvmlockd
-	fi
-
-	if use clvm; then
-		newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd
-		newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd
-	fi
-
-	if use static-libs; then
-		dolib.a libdm/ioctl/libdevmapper.a
-		dolib.a libdaemon/client/libdaemonclient.a #462908
-		#gen_usr_ldscript libdevmapper.so
-		dolib.a daemons/dmeventd/libdevmapper-event.a
-		#gen_usr_ldscript libdevmapper-event.so
-	else
-		rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
-	fi
-
-	if use lvm2create_initrd; then
-		dosbin scripts/lvm2create_initrd/lvm2create_initrd
-		doman scripts/lvm2create_initrd/lvm2create_initrd.8
-		newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd
-	fi
-
-	insinto /etc
-	doins "${FILESDIR}"/dmtab
-
-	dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
-}
-
-pkg_postinst() {
-	ewarn "Make sure the \"lvm\" init script is in the runlevels:"
-	ewarn "# rc-update add lvm boot"
-	ewarn
-	ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want"
-	ewarn "to enable lvm autoactivation and metadata caching."
-}
-
-src_test() {
-	einfo "Tests are disabled because of device-node mucking, if you want to"
-	einfo "run tests, compile the package and see ${S}/tests"
-}

diff --git a/sys-fs/lvm2/lvm2-2.02.171.ebuild b/sys-fs/lvm2/lvm2-2.02.171.ebuild
deleted file mode 100644
index 9397471..0000000
--- a/sys-fs/lvm2/lvm2-2.02.171.ebuild
+++ /dev/null
@@ -1,301 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic
-
-DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
-HOMEPAGE="https://sourceware.org/lvm2/"
-SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
-	ftp://sourceware.org/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86"
-IUSE="readline static static-libs systemd clvm cman corosync lvm1 lvm2create_initrd openais sanlock selinux +udev +thin device-mapper-only"
-REQUIRED_USE="device-mapper-only? ( !clvm !cman !corosync !lvm1 !lvm2create_initrd !openais !sanlock !thin )
-	systemd? ( udev )
-	clvm? ( !systemd )"
-
-DEPEND_COMMON="
-	clvm? (
-		cman? ( =sys-cluster/cman-3* )
-		corosync? ( sys-cluster/corosync )
-		openais? ( sys-cluster/openais )
-		=sys-cluster/libdlm-3*
-	)
-
-	readline? ( sys-libs/readline:0= )
-	sanlock? ( sys-cluster/sanlock )
-	systemd? ( >=sys-apps/systemd-205:0= )
-	udev? ( >=virtual/libudev-208:=[static-libs?] )"
-# /run is now required for locking during early boot. /var cannot be assumed to
-# be available -- thus, pull in recent enough baselayout for /run.
-# This version of LVM is incompatible with cryptsetup <1.1.2.
-RDEPEND="${DEPEND_COMMON}
-	>=sys-apps/baselayout-2.2
-	!<sys-apps/openrc-0.11
-	!<sys-fs/cryptsetup-1.1.2
-	!!sys-fs/clvm
-	!!sys-fs/lvm-user
-	>=sys-apps/util-linux-2.16
-	lvm2create_initrd? ( sys-apps/makedev )
-	thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
-# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
-# USE 'static' currently only works with eudev, bug 520450
-DEPEND="${DEPEND_COMMON}
-	virtual/pkgconfig
-	>=sys-devel/binutils-2.20.1-r1
-	sys-devel/autoconf-archive
-	static? (
-		selinux? ( sys-libs/libselinux[static-libs] )
-		udev? ( >=sys-fs/eudev-3.1.2[static-libs] )
-		>=sys-apps/util-linux-2.16[static-libs]
-	)"
-
-S=${WORKDIR}/${PN/lvm/LVM}.${PV}
-
-PATCHES=(
-	# Gentoo specific modification(s):
-	"${FILESDIR}"/${PN}-2.02.129-example.conf.in.patch
-
-	# Musl fixes
-	"${FILESDIR}"/${PN}-2.02.166-fix-stdio-usage.patch
-	"${FILESDIR}"/${PN}-2.02.166-portability.patch
-
-	# For upstream -- review and forward:
-	"${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
-	"${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch
-	"${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331
-	"${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373
-	"${FILESDIR}"/${PN}-2.02.70-asneeded.patch # -Wl,--as-needed
-	"${FILESDIR}"/${PN}-2.02.139-dynamic-static-ldflags.patch #332905
-	"${FILESDIR}"/${PN}-2.02.129-static-pkgconfig-libs.patch #370217, #439414 + blkid
-	"${FILESDIR}"/${PN}-2.02.130-pthread-pkgconfig.patch #492450
-	#"${FILESDIR}"/${PN}-2.02.145-mkdev.patch #580062 # Merged upstream
-)
-
-pkg_setup() {
-	local CONFIG_CHECK="~SYSVIPC"
-
-	if use udev; then
-		local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
-		if linux_config_exists; then
-			local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
-			if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then
-				ewarn "It's recommended to set an empty value to the following kernel config option:"
-				ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
-			fi
-		fi
-	fi
-
-	check_extra_config
-
-	# 1. Genkernel no longer copies /sbin/lvm blindly.
-	if use static; then
-		elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
-		elog "their static versions. If you need the static binaries,"
-		elog "you must append .static to the filename!"
-	fi
-}
-
-src_prepare() {
-	default
-
-	sed -i \
-		-e "1iAR = $(tc-getAR)" \
-		-e "s:CC ?= @CC@:CC = $(tc-getCC):" \
-		make.tmpl.in || die #444082
-
-	sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212
-
-	if use udev && ! use device-mapper-only; then
-		sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196
-		elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in"
-		elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad"
-		elog "if it was previously disabled."
-	fi
-
-	sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514
-
-	# Without thin-privision-tools, there is nothing to install for target install_man7:
-	use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; }
-
-	eautoreconf
-}
-
-src_configure() {
-	filter-flags -flto
-	local myconf=()
-	local buildmode
-
-	myconf+=( $(use_enable !device-mapper-only dmeventd) )
-	myconf+=( $(use_enable !device-mapper-only cmdlib) )
-	myconf+=( $(use_enable !device-mapper-only applib) )
-	myconf+=( $(use_enable !device-mapper-only fsadm) )
-	myconf+=( $(use_enable !device-mapper-only lvmetad) )
-	use device-mapper-only && myconf+=( --disable-udev-systemd-background-jobs )
-
-	# Most of this package does weird stuff.
-	# The build options are tristate, and --without is NOT supported
-	# options: 'none', 'internal', 'shared'
-	if use static; then
-		buildmode="internal"
-		# This only causes the .static versions to become available
-		myconf+=( --enable-static_link )
-	else
-		buildmode="shared"
-	fi
-	dmbuildmode=$(use !device-mapper-only && echo internal || echo none)
-
-	# dmeventd requires mirrors to be internal, and snapshot available
-	# so we cannot disable them
-	myconf+=( --with-mirrors=${dmbuildmode} )
-	myconf+=( --with-snapshots=${dmbuildmode} )
-	if use thin; then
-		myconf+=( --with-thin=internal --with-cache=internal )
-		local texec
-		for texec in check dump repair restore; do
-			myconf+=( --with-thin-${texec}="${EPREFIX}"/sbin/thin_${texec} )
-			myconf+=( --with-cache-${texec}="${EPREFIX}"/sbin/cache_${texec} )
-		done
-	else
-		myconf+=( --with-thin=none --with-cache=none )
-	fi
-
-	if use lvm1; then
-		myconf+=( --with-lvm1=${buildmode} )
-	else
-		myconf+=( --with-lvm1=none )
-	fi
-
-	# disable O_DIRECT support on hppa, breaks pv detection (#99532)
-	use hppa && myconf+=( --disable-o_direct )
-
-	if use clvm; then
-		myconf+=( --with-cluster=${buildmode} )
-		# 4-state! Make sure we get it right, per bug 210879
-		# Valid options are: none, cman, gulm, all
-		#
-		# 2009/02:
-		# gulm is removed now, now dual-state:
-		# cman, none
-		# all still exists, but is not needed
-		#
-		# 2009/07:
-		# TODO: add corosync and re-enable ALL
-		local clvmd=""
-		use cman && clvmd="cman"
-		#clvmd="${clvmd/cmangulm/all}"
-		use corosync && clvmd="${clvmd:+$clvmd,}corosync"
-		use openais && clvmd="${clvmd:+$clvmd,}openais"
-		[ -z "${clvmd}" ] && clvmd="none"
-		myconf+=( --with-clvmd=${clvmd} )
-		myconf+=( --with-pool=${buildmode} )
-		myconf+=( --enable-lvmlockd-dlm )
-	else
-		myconf+=( --with-clvmd=none --with-cluster=none )
-	fi
-
-	econf \
-		$(use_enable readline) \
-		$(use_enable selinux) \
-		--enable-pkgconfig \
-		--with-confdir="${EPREFIX}"/etc \
-		--exec-prefix="${EPREFIX}" \
-		--sbindir="${EPREFIX}/sbin" \
-		--with-staticdir="${EPREFIX}"/sbin \
-		--libdir="${EPREFIX}/$(get_libdir)" \
-		--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
-		--with-default-dm-run-dir=/run \
-		--with-default-run-dir=/run/lvm \
-		--with-default-locking-dir=/run/lock/lvm \
-		--with-default-pid-dir=/run \
-		$(use_enable udev udev_rules) \
-		$(use_enable udev udev_sync) \
-		$(use_with udev udevdir "$(get_udevdir)"/rules.d) \
-		$(use_enable sanlock lvmlockd-sanlock) \
-		$(use_enable systemd udev-systemd-background-jobs) \
-		--with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
-		${myconf[@]} \
-		CLDFLAGS="${LDFLAGS}"
-}
-
-src_compile() {
-	pushd include >/dev/null
-	emake
-	popd >/dev/null
-
-	if use device-mapper-only ; then
-		emake device-mapper
-	else
-		emake
-		emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat
-	fi
-}
-
-src_install() {
-	local inst
-	INSTALL_TARGETS="install install_tmpfiles_configuration"
-	# install systemd related files only when requested, bug #522430
-	use systemd && INSTALL_TARGETS="${INSTALL_TARGETS} install_systemd_units install_systemd_generators"
-	use device-mapper-only && INSTALL_TARGETS="install_device-mapper"
-	for inst in ${INSTALL_TARGETS}; do
-		emake DESTDIR="${D}" ${inst}
-	done
-
-	newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper
-	newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
-
-	if use !device-mapper-only ; then
-		newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd
-		newinitd "${FILESDIR}"/lvm.rc-2.02.166-r2 lvm
-		newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm
-
-		newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring
-		newinitd "${FILESDIR}"/lvmetad.initd-2.02.116-r3 lvmetad
-	fi
-
-	if use sanlock; then
-		newinitd "${FILESDIR}"/lvmlockd.initd-2.02.166-r1 lvmlockd
-	fi
-
-	if use clvm; then
-		newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd
-		newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd
-	fi
-
-	if use static-libs; then
-		dolib.a libdm/ioctl/libdevmapper.a
-		dolib.a libdaemon/client/libdaemonclient.a #462908
-		#gen_usr_ldscript libdevmapper.so
-		dolib.a daemons/dmeventd/libdevmapper-event.a
-		#gen_usr_ldscript libdevmapper-event.so
-	else
-		rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
-	fi
-
-	if use lvm2create_initrd; then
-		dosbin scripts/lvm2create_initrd/lvm2create_initrd
-		doman scripts/lvm2create_initrd/lvm2create_initrd.8
-		newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd
-	fi
-
-	insinto /etc
-	doins "${FILESDIR}"/dmtab
-
-	dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
-}
-
-pkg_postinst() {
-	ewarn "Make sure the \"lvm\" init script is in the runlevels:"
-	ewarn "# rc-update add lvm boot"
-	ewarn
-	ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want"
-	ewarn "to enable lvm autoactivation and metadata caching."
-}
-
-src_test() {
-	einfo "Tests are disabled because of device-node mucking, if you want to"
-	einfo "run tests, compile the package and see ${S}/tests"
-}

diff --git a/sys-fs/lvm2/metadata.xml b/sys-fs/lvm2/metadata.xml
index cca547c..7d493c0 100644
--- a/sys-fs/lvm2/metadata.xml
+++ b/sys-fs/lvm2/metadata.xml
@@ -16,15 +16,10 @@
 		<description>Backup to Robin. Please CC on bugs.</description>
 	</maintainer>
 	<use>
-		<flag name="clvm">Allow users to build clustered lvm2</flag>
-		<flag name="cman">Cman support for clustered lvm</flag>
-		<flag name="corosync">Corosync support for clustered lvm</flag>
 		<flag name="lvm1">Allow users to build lvm2 with lvm1 support</flag>
 		<flag name="lvm2create_initrd">Install lvm2create_initrd script and pull in <pkg>sys-apps/makedev</pkg> for the /sbin/MAKEDEV command</flag>
-		<flag name="openais">Openais support for clustered lvm</flag>
 		<flag name="thin">Support for thin volumes</flag>
 		<flag name="device-mapper-only">Build only device-mapper and not the rest of LVM2 (UNSUPPORTED)</flag>
-		<flag name="sanlock">Enable lvmlockd with support for sanlock</flag>
 	</use>
 	<upstream>
 		<remote-id type="cpe">cpe:/a:heinz_mauelshagen:lvm2</remote-id>