commit:     0d5fe5ac573b3e46afabd206522d0e0a511fb36c
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 14 09:16:32 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Jul 14 11:58:15 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=0d5fe5ac

Rework --lvm support

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/software.sh                               |  24 ++--
 gen_compile.sh                                     | 118 --------------------
 gen_initramfs.sh                                   | 122 +++++++++------------
 gkbuilds/libaio.gkbuild                            |   2 +
 gkbuilds/lvm.gkbuild                               |  67 +++++++++++
 .../libaio/0.3.110/libaio-0.3.109-install.patch    |  45 --------
 .../libaio/0.3.110/libaio-0.3.109-testcase-8.patch |  19 ----
 patches/libaio/0.3.110/libaio-0.3.109-x32.patch    |  63 -----------
 .../libaio/0.3.110/libaio-0.3.110-cppflags.patch   |  25 -----
 .../0.3.110/libaio-0.3.110-link-stdlib.patch       |  21 ----
 .../libaio-0.3.111-optional-werror.patch}          |  12 +-
 .../libaio/0.3.112/libaio-0.3.112-cppflags.patch   |  16 +++
 .../lvm2-001-example.conf.in.patch                 |   0
 .../lvm2-002-always-make-static-libdm.patch        |   0
 .../lvm2-003-lvm2create_initrd.patch               |   0
 .../lvm2-004-createinitrd.patch                    |   0
 .../lvm2-005-locale-muck.patch                     |   0
 .../{2.02.183 => 2.02.185}/lvm2-006-asneeded.patch |   0
 .../lvm2-007-dynamic-static-ldflags.patch          |   0
 .../lvm2-008-static-pkgconfig-libs.patch           |   0
 .../lvm2-009-pthread-pkgconfig.patch               |   0
 .../lvm2-010-static-libm.patch                     |   0
 .../lvm2-011-HPPA-no-O_DIRECT.patch                |   0
 patches/lvm/2.02.185/lvm2-012-mallinfo.patch       |  11 ++
 .../lvm/2.02.185/lvm2-013-fix-stdio-usage.patch    |  49 +++++++++
 ...m2-014-make-malloc-realloc-check-optional.patch |  23 ++++
 patches/lvm/2.02.185/lvm2-015-mksh_build.patch     |  13 +++
 27 files changed, 252 insertions(+), 378 deletions(-)

diff --git a/defaults/software.sh b/defaults/software.sh
index 420eb62..9c6ba70 100644
--- a/defaults/software.sh
+++ b/defaults/software.sh
@@ -16,16 +16,6 @@ 
GKPKG_BUSYBOX_SRCTAR="${GKPKG_BUSYBOX_SRCTAR:-${DISTDIR}/busybox-${GKPKG_BUSYBOX
 GKPKG_BUSYBOX_SRCDIR="${GKPKG_BUSYBOX_SRCDIR:-busybox-${GKPKG_BUSYBOX_PV}}"
 
GKPKG_BUSYBOX_BINPKG="${GKPKG_BUSYBOX_BINPKG:-%%CACHE%%/busybox-${GKPKG_BUSYBOX_PV}-%%ARCH%%.tar.xz}"
 
-LIBAIO_VER="${LIBAIO_VER:-VERSION_LIBAIO}"
-LIBAIO_DIR="${LIBAIO_DIR:-libaio-${LIBAIO_VER}}"
-LIBAIO_SRCTAR="${LIBAIO_SRCTAR:-${DISTDIR}/libaio-${LIBAIO_VER}.tar.gz}"
-LIBAIO_BINCACHE="${LIBAIO_BINCACHE:-%%CACHE%%/libaio-${LIBAIO_VER}-%%ARCH%%.tar.bz2}"
-
-LVM_VER="${LVM_VER:-VERSION_LVM}"
-LVM_DIR="${LVM_DIR:-LVM2.${LVM_VER}}"
-LVM_SRCTAR="${LVM_SRCTAR:-${DISTDIR}/LVM2.${LVM_VER}.tgz}"
-LVM_BINCACHE="${LVM_BINCACHE:-%%CACHE%%/LVM2.${LVM_VER}-%%ARCH%%.tar.bz2}"
-
 MDADM_VER="${MDADM_VER:-VERSION_MDADM}"
 MDADM_DIR="${MDADM_DIR:-mdadm-${MDADM_VER}}"
 MDADM_SRCTAR="${MDADM_SRCTAR:-${DISTDIR}/mdadm-${MDADM_VER}.tar.xz}"
@@ -71,6 +61,20 @@ 
GKPKG_ISCSI_SRCDIR="${GKPKG_ISCSI_SRCDIR:-open-iscsi-${GKPKG_ISCSI_PV}}"
 
GKPKG_ISCSI_SRCTAR="${GKPKG_ISCSI_SRCTAR:-${DISTDIR}/open-iscsi-${GKPKG_ISCSI_PV}.tar.gz}"
 
GKPKG_ISCSI_BINPKG="${GKPKG_ISCSI_BINPKG:-%%CACHE%%/iscsi-${GKPKG_ISCSI_PV}-%%ARCH%%.tar.xz}"
 
+GKPKG_LIBAIO_PN="libaio"
+GKPKG_LIBAIO_PV="${GKPKG_LIBAIO_PV:-VERSION_LIBAIO}"
+GKPKG_LIBAIO_DEPS=""
+GKPKG_LIBAIO_SRCDIR="${GKPKG_LIBAIO_SRCDIR:-libaio-${GKPKG_LIBAIO_PV}}"
+GKPKG_LIBAIO_SRCTAR="${GKPKG_LIBAIO_SRCTAR:-${DISTDIR}/libaio-${GKPKG_LIBAIO_PV}.tar.gz}"
+GKPKG_LIBAIO_BINPKG="${GKPKG_LIBAIO_BINPKG:-%%CACHE%%/libaio-${GKPKG_LIBAIO_PV}-%%ARCH%%.tar.xz}"
+
+GKPKG_LVM_PN="lvm"
+GKPKG_LVM_PV="${GKPKG_LVM_PV:-VERSION_LVM}"
+GKPKG_LVM_DEPS="util-linux libaio"
+GKPKG_LVM_SRCDIR="${GKPKG_LVM_SRCDIR:-LVM2.${GKPKG_LVM_PV}}"
+GKPKG_LVM_SRCTAR="${GKPKG_LVM_SRCTAR:-${DISTDIR}/LVM2.${GKPKG_LVM_PV}.tgz}"
+GKPKG_LVM_BINPKG="${GKPKG_LVM_BINPKG:-%%CACHE%%/LVM2.${GKPKG_LVM_PV}-%%ARCH%%.tar.xz}"
+
 GKPKG_UNIONFS_FUSE_PN="unionfs-fuse"
 GKPKG_UNIONFS_FUSE_PV="${GKPKG_UNIONFS_FUSE_PV:-VERSION_UNIONFS_FUSE}"
 GKPKG_UNIONFS_FUSE_DEPS="fuse"

diff --git a/gen_compile.sh b/gen_compile.sh
index 6a31a6c..438a251 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -529,120 +529,6 @@ compile_kernel() {
        fi
 }
 
-compile_libaio() {
-       if [ -f "${LIBAIO_BINCACHE}" ]
-       then
-               print_info 1 "$(getIndent 2)libaio: >> Using cache ..."
-       else
-               [ -f "${LIBAIO_SRCTAR}" ] ||
-                       gen_die "Could not find libaio source tarball: 
${LIBAIO_SRCTAR}! Please place it there, or place another version, changing 
/etc/genkernel.conf as necessary!"
-               cd "${TEMP}"
-               rm -rf ${LIBAIO_DIR} > /dev/null
-               /bin/tar -xpf ${LIBAIO_SRCTAR} ||
-                       gen_die 'Could not extract libaio source tarball!'
-               [ -d "${LIBAIO_DIR}" ] ||
-                       gen_die "libaio directory ${LIBAIO_DIR} is invalid!"
-
-               cd "${LIBAIO_DIR}" || gen_die "cannot chdir into 
'${LIBAIO_DIR}'"
-               apply_patches libaio ${LIBAIO_VER}
-
-               print_info 1 "$(getIndent 2)libaio: >> Compiling ..."
-               CFLAGS="-fPIC" \
-               LDFLAGS='-Wl,--no-as-needed' \
-               compile_generic '' utils || gen_die "failed to build libaio"
-
-               print_info 1 "$(getIndent 2)libaio: >> Installing to DESTDIR 
..."
-               compile_generic "prefix=${TEMP}/libaio install" utils || 
gen_die "failed to install libaio"
-
-               print_info 1 "$(getIndent 2)libaio: >> Copying to bincache ..."
-               cd "${TEMP}/libaio" || gen_die "cannot chdir into 
'${TEMP}/libaio'"
-               /bin/tar -cjf "${LIBAIO_BINCACHE}" . ||
-                       gen_die 'Could not create libaio binary cache'
-
-               cd "${TEMP}"
-               isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${LIBAIO_DIR}" libaio
-               return 0
-       fi
-}
-
-compile_lvm() {
-       compile_libaio
-
-       if [[ -f "${LVM_BINCACHE}" && "${LVM_BINCACHE}" -nt 
"${LIBAIO_BINCACHE}" ]]
-       then
-               print_info 1 "$(getIndent 2)lvm: >> Using cache ..."
-       else
-               [ -f "${LVM_SRCTAR}" ] ||
-                       gen_die "Could not find LVM source tarball: 
${LVM_SRCTAR}! Please place it there, or place another version, changing 
/etc/genkernel.conf as necessary!"
-               cd "${TEMP}"
-               rm -rf ${LVM_DIR} > /dev/null
-               /bin/tar -xpf ${LVM_SRCTAR} ||
-                       gen_die 'Could not extract LVM source tarball!'
-               [ -d "${LVM_DIR}" ] ||
-                       gen_die "LVM directory ${LVM_DIR} is invalid!"
-
-               rm -rf "${TEMP}/libaio" > /dev/null
-               mkdir -p "${TEMP}/libaio"
-               /bin/tar -xpf "${LIBAIO_BINCACHE}" -C "${TEMP}/libaio" ||
-                       gen_die "Could not extract libaio binary cache!";
-
-               cd "${LVM_DIR}"
-               apply_patches lvm ${LVM_VER}
-               # we currently have a patch that changes configure.ac
-               # once given patch is dropped, drop autoconf too
-               print_info 1 "$(getIndent 2)lvm: >> Autoconf ..."
-               autoconf || gen_die 'Autoconf failed for LVM2'
-               print_info 1 "$(getIndent 2)lvm: >> Configuring ..."
-               LVM_CONF=(
-                       --enable-static_link
-                       --prefix=/
-                       --enable-dmeventd
-                       --enable-cmdlib
-                       --enable-applib
-                       --disable-lvmetad
-                       --with-lvm1=internal
-                       --with-clvmd=none
-                       --with-cluster=none
-                       --disable-readline
-                       --disable-selinux
-                       --with-mirrors=internal
-                       --with-snapshots=internal
-                       --with-pool=internal
-                       --with-thin=internal
-                       --with-cache=internal
-                       --with-raid=internal
-               )
-               CFLAGS="-fPIC" \
-               LDFLAGS="-L${TEMP}/libaio/lib" \
-               ./configure "${LVM_CONF[@]}" \
-                       >> ${LOGFILE} 2>&1 || \
-                       gen_die 'Configure of lvm failed!'
-               print_info 1 "$(getIndent 2)lvm: >> Compiling ..."
-               compile_generic '' utils || gen_die "failed to build LVM"
-
-               print_info 1 "$(getIndent 2)lvm: >> Installing to DESTDIR ..."
-               mkdir -p "${TEMP}/lvm/sbin"
-               compile_generic "install DESTDIR=${TEMP}/lvm/" utils || gen_die 
"failed to install LVM"
-               # Upstream does u-w on files, and this breaks stuff.
-               chmod -R u+w "${TEMP}/lvm/"
-
-               print_info 1 "$(getIndent 2)lvm: >> Copying to bincache ..."
-               cd "${TEMP}/lvm" || gen_die "cannot chdir into '${TEMP}/lvm'"
-               ${UTILS_CROSS_COMPILE}strip "sbin/lvm.static" ||
-                       gen_die 'Could not strip lvm.static!'
-               # See bug 382555
-               ${UTILS_CROSS_COMPILE}strip "sbin/dmsetup.static" ||
-                       gen_die 'Could not strip dmsetup.static'
-               /bin/tar -cjf "${LVM_BINCACHE}" . ||
-                       gen_die 'Could not create binary cache'
-
-               cd "${TEMP}"
-               isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${TEMP}/lvm" > /dev/null
-               isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${LVM_DIR}" libaio lvm
-               return 0
-       fi
-}
-
 compile_mdadm() {
        if [ -f "${MDADM_BINCACHE}" ]
        then
@@ -741,10 +627,6 @@ compile_dmraid() {
        fi
 }
 
-compile_device_mapper() {
-       compile_lvm
-}
-
 determine_busybox_config_file() {
        print_info 2 "$(get_indent 3)busybox: >> Checking for suitable busybox 
configuration ..."
 

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index 0b660da..82dc5f5 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -432,88 +432,74 @@ append_iscsi() {
                || gen_die "Failed to append iscsi to cpio!"
 }
 
-append_lvm(){
-       if [ -d "${TEMP}/initramfs-lvm-temp" ]
+append_lvm() {
+       local PN=lvm
+       local TDIR="${TEMP}/initramfs-${PN}-temp"
+       if [ -d "${TDIR}" ]
        then
-               rm -r "${TEMP}/initramfs-lvm-temp/"
+               rm -r "${TDIR}" || gen_die "Failed to clean out existing 
'${TDIR}'!"
        fi
-       cd ${TEMP}
-       mkdir -p "${TEMP}/initramfs-lvm-temp/bin/"
-       mkdir -p "${TEMP}/initramfs-lvm-temp/sbin/"
-       mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/"
-       mkdir -p "${TEMP}/initramfs-lvm-temp/etc/lvm/cache"
-       if false && [ -e '/sbin/lvm.static' ]
-       then
-               print_info 1 "$(getIndent 2)LVM: Adding support (using local 
static binary /sbin/lvm.static)..."
-               cp /sbin/lvm.static "${TEMP}/initramfs-lvm-temp/sbin/lvm" ||
-                       gen_die 'Could not copy over lvm!'
-               # See bug 382555
-               if [ -e '/sbin/dmsetup.static' ]
-               then
-                       cp /sbin/dmsetup.static 
"${TEMP}/initramfs-lvm-temp/bin/dmsetup"
-               fi
-       elif false && [ -e '/sbin/lvm' ] && LC_ALL="C" ldd /sbin/lvm|grep -q 
'not a dynamic executable'
+
+       populate_binpkg ${PN}
+
+       mkdir "${TDIR}" || gen_die "Failed to create '${TDIR}'!"
+
+       unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}"
+
+       cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
+
+       local mydir=
+       for mydir in \
+               etc/lvm/cache \
+               sbin \
+       ; do
+               mkdir -p ${mydir} || gen_die "Failed to create 
'${TDIR}/${mydir}'!"
+       done
+
+       # Delete unneeded files
+       rm -rf \
+               usr/lib \
+               usr/share \
+               usr/include
+
+       # Include the LVM config
+       if [ -x /sbin/lvm -o -x /bin/lvm ]
        then
-               print_info 1 "$(getIndent 2)LVM: Adding support (using local 
static binary /sbin/lvm)..."
-               cp /sbin/lvm "${TEMP}/initramfs-lvm-temp/sbin/lvm" ||
-                       gen_die 'Could not copy over lvm!'
-               # See bug 382555
-               if [ -e '/sbin/dmsetup' ] && LC_ALL="C" ldd /sbin/dmsetup | 
grep -q 'not a dynamic executable'
+               local ABORT_ON_ERRORS=$(kconfig_get_opt "/etc/lvm/lvm.conf" 
"abort_on_errors")
+               if isTrue "${ABORT_ON_ERRORS}" && [[ ${CBUILD} == ${CHOST} ]]
                then
-                       cp /sbin/dmsetup 
"${TEMP}/initramfs-lvm-temp/bin/dmsetup"
+                       # Make sure the LVM binary we created is able to handle
+                       # system's lvm.conf
+                       "${TDIR}"/sbin/lvm dumpconfig 
1>"${TDIR}"/etc/lvm/lvm.conf 2>/dev/null \
+                               || gen_die "Bundled LVM version does NOT 
support system's lvm.conf!"
+
+                       # Sanity check
+                       if [ ! -s "${TDIR}/etc/lvm/lvm.conf" ]
+                       then
+                               gen_die "Sanity check failed: 
'${TDIR}/etc/lvm/lvm.conf' looks empty?!"
+                       fi
+               else
+                       cp -aL /etc/lvm/lvm.conf "${TDIR}"/etc/lvm/lvm.conf 
2>/dev/null \
+                               || gen_die "Failed to copy '/etc/lvm/lvm.conf'!"
                fi
-       else
-               print_info 1 "$(getIndent 2)LVM: Adding support (compiling 
binaries)..."
-               compile_lvm || gen_die "Could not compile LVM"
-               /bin/tar -xpf "${LVM_BINCACHE}" -C "${TEMP}/initramfs-lvm-temp" 
||
-                       gen_die "Could not extract lvm binary cache!";
-               # Remove any dynamic binaries that exist, so the rest of the 
code will
-               # fail better if something is missing
-               for f in ${TEMP}/initramfs-lvm-temp/{bin,sbin}/* ; do
-                       [ -x "$f" ] && LC_ALL="C" ldd $f | grep -sq '(' && rm 
-f "$f"
-               done
-               # Now move the static binaries into good places.
-               mv ${TEMP}/initramfs-lvm-temp/sbin/lvm.static 
${TEMP}/initramfs-lvm-temp/sbin/lvm ||
-                       gen_die 'LVM error: Could not move lvm.static to lvm!'
-               # See bug 382555; use /sbin/dmsetup to match multipath code
-               mv ${TEMP}/initramfs-lvm-temp/sbin/dmsetup.static 
${TEMP}/initramfs-lvm-temp/sbin/dmsetup ||
-                       gen_die 'LVM error: Could not move dmsetup.static to 
dmsetup!'
-               # Clean up other stuff we don't need
-               rm -rf 
${TEMP}/initramfs-lvm-temp/{lib*,share,man,include,sbin/dmeventd.static}
-       fi
-       # Include a symlink in the old location, for people with other appended
-       # scripts that might look for it in the old location.
-       ln -s ../sbin/lvm "${TEMP}/initramfs-lvm-temp/bin/lvm"
-       # Include the LVM config now
-       if [ -x /sbin/lvm -o -x /bin/lvm ]
-       then
-#              lvm dumpconfig 2>&1 > /dev/null || gen_die 'Could not copy over 
lvm.conf!'
-#              ret=$?
-#              if [ ${ret} != 0 ]
-#              then
-                       cp /etc/lvm/lvm.conf 
"${TEMP}/initramfs-lvm-temp/etc/lvm/" || \
-                               gen_die 'Could not copy over lvm.conf!'
-#              else
-#                      gen_die 'Could not copy over lvm.conf!'
-#              fi
 
                # Some LVM config options need changing, because the 
functionality is
                # not compiled in:
                sed -r -i \
                        -e '/^[[:space:]]*obtain_device_list_from_udev/s,=.*,= 
0,g' \
                        -e '/^[[:space:]]*use_lvmetad/s,=.*,= 0,g' \
+                       -e '/^[[:space:]]*use_lvmlockd/s,=.*,= 0,g' \
+                       -e '/^[[:space:]]*use_lvmpolld/s,=.*,= 0,g' \
                        -e '/^[[:space:]]*monitoring/s,=.*,= 0,g' \
                        -e '/^[[:space:]]*external_device_info_source/s,=.*,= 
"none",g' \
                        -e '/^[[:space:]]*units/s,=.*"r",= "h",g' \
-                       "${TEMP}/initramfs-lvm-temp/etc/lvm/lvm.conf" || \
-                               gen_die 'Could not sed lvm.conf!'
+                       "${TDIR}"/etc/lvm/lvm.conf \
+                               || gen_die 'Could not sed lvm.conf!'
        fi
-       cd "${TEMP}/initramfs-lvm-temp/"
+
        log_future_cpio_content
        find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}" \
-                       || gen_die "compressing lvm cpio"
-       cd "${TEMP}"
-       rm -r "${TEMP}/initramfs-lvm-temp/"
+               || gen_die "Failed to append lvm to cpio!"
 }
 
 append_mdadm(){
@@ -1434,12 +1420,6 @@ create_initramfs() {
                local CONFGREP=grep
        fi
 
-       if isTrue "${LVM}" ; then
-               if ! ${CONFGREP} -q "^CONFIG_FILE_LOCKING=y" 
"${ACTUAL_KERNEL_CONFIG}" ; then
-                       gen_die "LVM will require a kernel with 
CONFIG_FILE_LOCKING=y set!"
-               fi
-       fi
-
        if isTrue "${INTEGRATED_INITRAMFS}"
        then
                # Explicitly do not compress if we are integrating into the 
kernel.

diff --git a/gkbuilds/libaio.gkbuild b/gkbuilds/libaio.gkbuild
new file mode 100644
index 0000000..c103679
--- /dev/null
+++ b/gkbuilds/libaio.gkbuild
@@ -0,0 +1,2 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2

diff --git a/gkbuilds/lvm.gkbuild b/gkbuilds/lvm.gkbuild
new file mode 100644
index 0000000..05fd087
--- /dev/null
+++ b/gkbuilds/lvm.gkbuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+src_configure() {
+
+       append-ldflags -Wl,-rpath-link,${BROOT}/usr/lib
+
+       export ac_cv_header_security_pam_misc_h=no
+       export ac_cv_header_security_pam_appl_h=no
+
+       local myconf=(
+               --enable-static_link
+               --enable-pkgconfig
+               --enable-dmeventd
+               --enable-cmdlib
+               --disable-lvmetad
+               --with-clvmd=none
+               --with-cluster=none
+               --disable-readline
+               --disable-selinux
+               --with-mirrors=internal
+               --with-snapshots=internal
+               --with-thin=internal
+               --with-cache=internal
+               --disable-udev-systemd-background-jobs
+               --disable-udev_sync
+               --disable-udev_rules
+       )
+
+       gkconf "${myconf[@]}"
+}
+
+src_install() {
+       default
+
+       rm -rf \
+               "${D}"/etc \
+               "${D}"/usr/sbin/* \
+               "${D}"/share
+
+       cp -a tools/lvm.static "${D}"/usr/sbin/lvm \
+               || die "Failed to copy '${S}/tools/lvm.static' to 
'${D}/usr/sbin/lvm'!"
+
+       "${STRIP}" --strip-all "${D}"/usr/sbin/lvm \
+               || die "Failed to strip '${D}/usr/sbin/lvm'!"
+
+       cp -a tools/dmsetup.static "${D}"/usr/sbin/dmsetup \
+               || die "Failed to copy '${S}/tools/dmsetup.static' to 
'${D}/usr/sbin/dmsetup'!"
+
+       "${STRIP}" --strip-all "${D}"/usr/sbin/dmsetup \
+               || die "Failed to strip '${D}/usr/sbin/dmsetup'!"
+
+       ln -s dmsetup "${D}"/usr/sbin/dmstats \
+               || die "Failed to create symlink '${D}/usr/sbin/dmstats' to 
'${D}/usr/sbin/dmsetup'!"
+
+       # For backward compatibility
+       mkdir "${D}"/sbin || die "Failed to create '${D}/sbin'!"
+
+       ln -s ../usr/sbin/dmsetup "${D}"/sbin/dmsetup \
+               || die "Failed to create symlink '${D}/sbin/dmstats' to 
'${D}/usr/sbin/dmstats'!"
+
+       ln -s ../usr/sbin/dmstats "${D}"/sbin/dmstats \
+               || die "Failed to create symlink '${D}/sbin/dmstats' to 
'${D}/usr/sbin/dmstats'!"
+
+       ln -s ../usr/sbin/lvm "${D}"/sbin/lvm \
+               || die "Failed to create symlink '${D}/sbin/lvm' to 
'${D}/usr/sbin/lvm'!"
+}

diff --git a/patches/libaio/0.3.110/libaio-0.3.109-install.patch 
b/patches/libaio/0.3.110/libaio-0.3.109-install.patch
deleted file mode 100644
index 9c049fc..0000000
--- a/patches/libaio/0.3.110/libaio-0.3.109-install.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From 2e34caef82a2367a85de4f06daf5e5a92f61e845 Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <[email protected]>
-Date: Sun, 17 Jan 2010 17:10:14 -0500
-Subject: [PATCH] fix up install paths
-
-This is similar to the Fedora patch, but this uses more common conventions
-like "DESTDIR" instead of "destdir".
-
-Signed-off-by: Mike Frysinger <[email protected]>
----
- src/Makefile |   11 ++++++-----
- 1 files changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/src/Makefile b/src/Makefile
-index 687c7be..ee431a1 100644
---- a/src/Makefile
-+++ b/src/Makefile
-@@ -1,6 +1,7 @@
- prefix=/usr
- includedir=$(prefix)/include
- libdir=$(prefix)/lib
-+usrlibdir=$(libdir)
- 
- CFLAGS ?= -g -fomit-frame-pointer -O2
- CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
-@@ -53,11 +54,11 @@ $(libname): $(libaio_sobjs) libaio.map
-       $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map 
-Wl,-soname,$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
- 
- install: $(all_targets)
--      install -D -m 644 libaio.h $(includedir)/libaio.h
--      install -D -m 644 libaio.a $(libdir)/libaio.a
--      install -D -m 755 $(libname) $(libdir)/$(libname)
--      ln -sf $(libname) $(libdir)/$(soname)
--      ln -sf $(libname) $(libdir)/libaio.so
-+      install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h
-+      install -D -m 644 libaio.a $(DESTDIR)$(usrlibdir)/libaio.a
-+      install -D -m 755 $(libname) $(DESTDIR)$(libdir)/$(libname)
-+      ln -sf $(libname) $(DESTDIR)$(usrlibdir)/$(soname)
-+      ln -sf $(libname) $(DESTDIR)$(usrlibdir)/libaio.so
- 
- $(libaio_objs): libaio.h
- 
--- 
-1.7.3.1
-

diff --git a/patches/libaio/0.3.110/libaio-0.3.109-testcase-8.patch 
b/patches/libaio/0.3.110/libaio-0.3.109-testcase-8.patch
deleted file mode 100644
index de66f21..0000000
--- a/patches/libaio/0.3.110/libaio-0.3.109-testcase-8.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Do not ignore return value of ftruncate(): testcases are compiled with -Werror,
-and ftruncate is declared with attribute warn_unused_result.
---- harness/cases/8.t.orig     2012-03-09 16:40:04.074168070 +0100
-+++ harness/cases/8.t  2012-03-09 16:40:57.777278646 +0100
-@@ -9,12 +9,13 @@
- {
-       long long min = 0, max = 9223372036854775807LL;
-       char c = 0;
-+      int ret;
- 
-       while (max - min > 1) {
-               if (pwrite64(fd, &c, 1, (min + max) / 2) == -1)
-                       max = (min + max) / 2;
-               else {
--                      ftruncate(fd, 0);
-+                      ret = ftruncate(fd, 0);         assert(ret == 0);
-                       min = (min + max) / 2;
-               }
-       }

diff --git a/patches/libaio/0.3.110/libaio-0.3.109-x32.patch 
b/patches/libaio/0.3.110/libaio-0.3.109-x32.patch
deleted file mode 100644
index 1d2c2a9..0000000
--- a/patches/libaio/0.3.110/libaio-0.3.109-x32.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=f5c071d93c9e6f57930bce56b1e4f009c160a826
-
-Upstream-Status: Pending
-
-Properly load arguments 5 an 6 for x86-64 syscall
-Use asm ("r10") and asm ("r8") to load arguments 5 an 6 for x86-64
-syscall so that it works with both x32 and x86-64.
-
-Received this patch from H.J. Lu <[email protected]>
-
-Signed-Off-By: Nitin A Kamble <[email protected]>
-2011/12/02
-
---- libaio-0.3.109/src/syscall-x86_64.h.x32    2009-10-09 11:17:02.000000000 
-0700
-+++ libaio-0.3.109/src/syscall-x86_64.h        2011-12-02 09:09:07.537603224 
-0800
-@@ -1,8 +1,18 @@
-+#ifndef __NR_io_setup
- #define __NR_io_setup         206
-+#endif
-+#ifndef __NR_io_destroy
- #define __NR_io_destroy               207
-+#endif
-+#ifndef __NR_io_getevents
- #define __NR_io_getevents     208
-+#endif
-+#ifndef __NR_io_submit
- #define __NR_io_submit                209
-+#endif
-+#ifndef __NR_io_cancel
- #define __NR_io_cancel                210
-+#endif
- 
- #define __syscall_clobber "r11","rcx","memory" 
- #define __syscall "syscall"
-@@ -42,10 +52,11 @@ return __res;                                              
                \
- type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4)           \
- {                                                                     \
- long __res;                                                           \
--__asm__ volatile ("movq %5,%%r10 ;" __syscall                         \
-+register long __a4 asm ("r10") = (long) arg4;                         \
-+__asm__ volatile (__syscall                                           \
-       : "=a" (__res)                                                  \
-       : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)),     \
--        "d" ((long)(arg3)),"g" ((long)(arg4)) : __syscall_clobber,"r10" ); \
-+        "d" ((long)(arg3)),"r" (__a4)); \
- return __res;                                                         \
- } 
- 
-@@ -54,10 +65,11 @@ return __res;                                              
                \
- type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5)   \
- {                                                                     \
- long __res;                                                           \
--__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall         \
-+register long __a4 asm ("r10") = (long) arg4;                         \
-+register long __a5 asm ("r8") = (long) arg5;                          \
-+__asm__ volatile ( __syscall                                          \
-       : "=a" (__res)                                                  \
-       : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)),     \
--        "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)) :    \
--      __syscall_clobber,"r8","r10" );                                 \
-+        "d" ((long)(arg3)),"r" (__a4),"r" (__a5));                    \
- return __res;                                                         \
- }

diff --git a/patches/libaio/0.3.110/libaio-0.3.110-cppflags.patch 
b/patches/libaio/0.3.110/libaio-0.3.110-cppflags.patch
deleted file mode 100644
index 4567ac9..0000000
--- a/patches/libaio/0.3.110/libaio-0.3.110-cppflags.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 3bf96bb62370035dba18d4b25459406b32365cfc Mon Sep 17 00:00:00 2001
-From: Mike Frysinger <[email protected]>
-Date: Wed, 26 Mar 2014 23:10:18 -0400
-Subject: [PATCH] respect env CPPFLAGS
-
-Signed-off-by: Mike Frysinger <[email protected]>
----
- src/Makefile | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/Makefile b/src/Makefile
-index 49f448f..b918c8b 100644
---- a/src/Makefile
-+++ b/src/Makefile
-@@ -5,6 +5,7 @@ usrlibdir=$(libdir)
- 
- CFLAGS ?= -g -fomit-frame-pointer -O2
- CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
-+CFLAGS += $(CPPFLAGS)
- SO_CFLAGS=-shared $(CFLAGS)
- L_CFLAGS=$(CFLAGS)
- LINK_FLAGS=
--- 
-1.9.1
-

diff --git a/patches/libaio/0.3.110/libaio-0.3.110-link-stdlib.patch 
b/patches/libaio/0.3.110/libaio-0.3.110-link-stdlib.patch
deleted file mode 100644
index 696a928..0000000
--- a/patches/libaio/0.3.110/libaio-0.3.110-link-stdlib.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From: Gokturk Yuksek <[email protected]>
-Subject: [PATCH] Link against stdlib to resolve fortified functions
-
-When '-fstack-protector-strong' is included in CFLAGS, the function
-'__stack_chk_fail_local' needs to be pulled from libc. However, upstream
-uses '-nostdlib' to avoid linking against any C library or gcc libs. Remove
-'-nostdlib' and '-nostartfiles' to pull the required symbols from libc.
-
-Gentoo-Bug: https://bugs.gentoo.org/show_bug.cgi?id=558406
-
---- a/src/Makefile
-+++ b/src/Makefile
-@@ -4,7 +4,7 @@
- usrlibdir=$(libdir)
- 
- CFLAGS ?= -g -fomit-frame-pointer -O2
--CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
-+CFLAGS += -Wall -I. -fPIC
- CFLAGS += $(CPPFLAGS)
- SO_CFLAGS=-shared $(CFLAGS)
- L_CFLAGS=$(CFLAGS)

diff --git a/patches/libaio/0.3.110/libaio-0.3.110-optional-werror.patch 
b/patches/libaio/0.3.112/libaio-0.3.111-optional-werror.patch
similarity index 66%
rename from patches/libaio/0.3.110/libaio-0.3.110-optional-werror.patch
rename to patches/libaio/0.3.112/libaio-0.3.111-optional-werror.patch
index 2933cf5..5b6f91e 100644
--- a/patches/libaio/0.3.110/libaio-0.3.110-optional-werror.patch
+++ b/patches/libaio/0.3.112/libaio-0.3.111-optional-werror.patch
@@ -1,6 +1,6 @@
-From 0cc7dc108d0b2288b40d82bb2fd1fd8bdc08f764 Mon Sep 17 00:00:00 2001
+From ebe62b178f3e5fcde8a311e64aaffe62099204a5 Mon Sep 17 00:00:00 2001
 From: Mike Frysinger <[email protected]>
-Date: Wed, 26 Mar 2014 23:07:58 -0400
+Date: Sun, 21 Apr 2019 12:44:26 +0200
 Subject: [PATCH] make -Werror into an optional flag
 
 This lets distros disable the flag as random errors might come up with
@@ -12,19 +12,19 @@ Signed-off-by: Mike Frysinger <[email protected]>
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/harness/Makefile b/harness/Makefile
-index 2a88e71..cf8c90d 100644
+index f477737..a155c4b 100644
 --- a/harness/Makefile
 +++ b/harness/Makefile
 @@ -6,7 +6,8 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS)
  HARNESS_SRCS:=main.c
  # io_queue.c
  
--CFLAGS+=-Wall -Werror -I../src -g -O
+-CFLAGS+=-Wall -Werror -I../src -g -O2 -DPAGE_SIZE=$(shell getconf PAGESIZE)
 +CFLAGS_WERROR?=-Werror
-+CFLAGS+=-Wall $(CFLAGS_WERROR) -I../src -g -O
++CFLAGS+=-Wall $(CFLAGS_WERROR) -I../src -g -O2 -DPAGE_SIZE=$(shell getconf 
PAGESIZE)
  #-lpthread -lrt
  
  all: $(PROGS)
 -- 
-1.9.1
+2.21.0
 

diff --git a/patches/libaio/0.3.112/libaio-0.3.112-cppflags.patch 
b/patches/libaio/0.3.112/libaio-0.3.112-cppflags.patch
new file mode 100644
index 0000000..dddb9c2
--- /dev/null
+++ b/patches/libaio/0.3.112/libaio-0.3.112-cppflags.patch
@@ -0,0 +1,16 @@
+respect env CPPFLAGS
+
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -2,8 +2,9 @@ prefix=/usr
+ includedir=$(prefix)/include
+ libdir=$(prefix)/lib
+ 
+-CFLAGS ?= -g -fomit-frame-pointer -O2
+-CFLAGS += -Wall -I. -fPIC
++CFLAGS ?= -fomit-frame-pointer -O2
++CFLAGS += -I. -fPIC
++CFLAGS += $(CPPFLAGS)
+ SO_CFLAGS=-shared $(CFLAGS)
+ L_CFLAGS=$(CFLAGS)
+ LINK_FLAGS=

diff --git a/patches/lvm/2.02.183/lvm2-001-example.conf.in.patch 
b/patches/lvm/2.02.185/lvm2-001-example.conf.in.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-001-example.conf.in.patch
rename to patches/lvm/2.02.185/lvm2-001-example.conf.in.patch

diff --git a/patches/lvm/2.02.183/lvm2-002-always-make-static-libdm.patch 
b/patches/lvm/2.02.185/lvm2-002-always-make-static-libdm.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-002-always-make-static-libdm.patch
rename to patches/lvm/2.02.185/lvm2-002-always-make-static-libdm.patch

diff --git a/patches/lvm/2.02.183/lvm2-003-lvm2create_initrd.patch 
b/patches/lvm/2.02.185/lvm2-003-lvm2create_initrd.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-003-lvm2create_initrd.patch
rename to patches/lvm/2.02.185/lvm2-003-lvm2create_initrd.patch

diff --git a/patches/lvm/2.02.183/lvm2-004-createinitrd.patch 
b/patches/lvm/2.02.185/lvm2-004-createinitrd.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-004-createinitrd.patch
rename to patches/lvm/2.02.185/lvm2-004-createinitrd.patch

diff --git a/patches/lvm/2.02.183/lvm2-005-locale-muck.patch 
b/patches/lvm/2.02.185/lvm2-005-locale-muck.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-005-locale-muck.patch
rename to patches/lvm/2.02.185/lvm2-005-locale-muck.patch

diff --git a/patches/lvm/2.02.183/lvm2-006-asneeded.patch 
b/patches/lvm/2.02.185/lvm2-006-asneeded.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-006-asneeded.patch
rename to patches/lvm/2.02.185/lvm2-006-asneeded.patch

diff --git a/patches/lvm/2.02.183/lvm2-007-dynamic-static-ldflags.patch 
b/patches/lvm/2.02.185/lvm2-007-dynamic-static-ldflags.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-007-dynamic-static-ldflags.patch
rename to patches/lvm/2.02.185/lvm2-007-dynamic-static-ldflags.patch

diff --git a/patches/lvm/2.02.183/lvm2-008-static-pkgconfig-libs.patch 
b/patches/lvm/2.02.185/lvm2-008-static-pkgconfig-libs.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-008-static-pkgconfig-libs.patch
rename to patches/lvm/2.02.185/lvm2-008-static-pkgconfig-libs.patch

diff --git a/patches/lvm/2.02.183/lvm2-009-pthread-pkgconfig.patch 
b/patches/lvm/2.02.185/lvm2-009-pthread-pkgconfig.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-009-pthread-pkgconfig.patch
rename to patches/lvm/2.02.185/lvm2-009-pthread-pkgconfig.patch

diff --git a/patches/lvm/2.02.183/lvm2-010-static-libm.patch 
b/patches/lvm/2.02.185/lvm2-010-static-libm.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-010-static-libm.patch
rename to patches/lvm/2.02.185/lvm2-010-static-libm.patch

diff --git a/patches/lvm/2.02.183/lvm2-011-HPPA-no-O_DIRECT.patch 
b/patches/lvm/2.02.185/lvm2-011-HPPA-no-O_DIRECT.patch
similarity index 100%
rename from patches/lvm/2.02.183/lvm2-011-HPPA-no-O_DIRECT.patch
rename to patches/lvm/2.02.185/lvm2-011-HPPA-no-O_DIRECT.patch

diff --git a/patches/lvm/2.02.185/lvm2-012-mallinfo.patch 
b/patches/lvm/2.02.185/lvm2-012-mallinfo.patch
new file mode 100644
index 0000000..2b64d4a
--- /dev/null
+++ b/patches/lvm/2.02.185/lvm2-012-mallinfo.patch
@@ -0,0 +1,11 @@
+--- a/lib/mm/memlock.c.orig    2015-03-09 11:18:41.560028850 -0100
++++ b/lib/mm/memlock.c 2015-03-09 11:19:54.504373309 -0100
+@@ -137,7 +137,7 @@
+ 
+ static void _allocate_memory(void)
+ {
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+       void *stack_mem;
+       struct rlimit limit;
+       int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;

diff --git a/patches/lvm/2.02.185/lvm2-013-fix-stdio-usage.patch 
b/patches/lvm/2.02.185/lvm2-013-fix-stdio-usage.patch
new file mode 100644
index 0000000..b2c13d0
--- /dev/null
+++ b/patches/lvm/2.02.185/lvm2-013-fix-stdio-usage.patch
@@ -0,0 +1,49 @@
+--- a/tools/lvmcmdline.c
++++ b/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;
+--- ./lib/commands/toolcontext.c.orig
++++ ./lib/commands/toolcontext.c
+@@ -1860,7 +1860,7 @@
+       /* FIXME Make this configurable? */
+       reset_lvm_errno(1);
+ 
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+       /* Set in/out stream buffering before glibc */
+       if (set_buffering) {
+               /* Allocate 2 buffers */
+@@ -2241,7 +2241,7 @@
+       if (cmd->libmem)
+               dm_pool_destroy(cmd->libmem);
+ 
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+       if (cmd->linebuffer) {
+               /* Reset stream buffering to defaults */
+               if (is_valid_fd(STDIN_FILENO) &&

diff --git 
a/patches/lvm/2.02.185/lvm2-014-make-malloc-realloc-check-optional.patch 
b/patches/lvm/2.02.185/lvm2-014-make-malloc-realloc-check-optional.patch
new file mode 100644
index 0000000..a5bd48a
--- /dev/null
+++ b/patches/lvm/2.02.185/lvm2-014-make-malloc-realloc-check-optional.patch
@@ -0,0 +1,23 @@
+Breaks cross-compilation
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -154,15 +154,16 @@ AC_FUNC_CLOSEDIR_VOID
+ AC_FUNC_CHOWN
+ AC_FUNC_FORK
+ AC_FUNC_LSTAT
+-AC_FUNC_MALLOC
+ AC_FUNC_MEMCMP
+ AC_FUNC_MKTIME
+ AC_FUNC_MMAP
+-AC_FUNC_REALLOC
+ AC_FUNC_STAT
+ AC_FUNC_STRTOD
+ AC_FUNC_VPRINTF
+ 
++# Optional functions
++AC_CHECK_FUNCS([malloc realloc])
++
+ 
################################################################################
+ dnl -- Disable dependency tracking
+ AC_MSG_CHECKING(whether to enable dependency tracking)

diff --git a/patches/lvm/2.02.185/lvm2-015-mksh_build.patch 
b/patches/lvm/2.02.185/lvm2-015-mksh_build.patch
new file mode 100644
index 0000000..49c6853
--- /dev/null
+++ b/patches/lvm/2.02.185/lvm2-015-mksh_build.patch
@@ -0,0 +1,13 @@
+https://bugs.gentoo.org/686652
+
+--- LVM2.2.02.184/tools/Makefile.in
++++ LVM2.2.02.184/tools/Makefile.in
+@@ -220,6 +220,6 @@
+         echo "/* Do not edit. This file is generated by the Makefile. */" && \
+         echo -en "const char _command_input[] =\n\n\"" && \
+         $(EGREP) -v '^#|\-\-\-|^$$' $(srcdir)/command-lines.in | $(AWK) 
'BEGIN {ORS = "\\n\"\n\""} //' && \
+-        echo "\\n\";" \
++        printf "%s\n" "\\n\";" \
+       ) > $@
+ 
+ $(SOURCES:%.c=%.d) $(SOURCES2:%.c=%.d): command-lines-input.h command-count.h 
cmds.h

Reply via email to