commit:     1153630cab2539454b7e6b62c2ead209c0452833
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 25 03:04:16 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 31 00:17:42 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1153630c

sys-block/ndctl: [QA] unconditionally install completion files

QA policy [0] says that we don't conditionalise installation of
small files. It's a wasteful rebuild and inconsistent across packages
for when users desire completions to be available.

[0] https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0301
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../ndctl-71.1-bash-completion-configure.patch     | 48 ++++++++++++++++++++++
 .../{ndctl-71.1-r1.ebuild => ndctl-71.1-r2.ebuild} |  8 +++-
 2 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/sys-block/ndctl/files/ndctl-71.1-bash-completion-configure.patch 
b/sys-block/ndctl/files/ndctl-71.1-bash-completion-configure.patch
new file mode 100644
index 00000000000..d6a796ab979
--- /dev/null
+++ b/sys-block/ndctl/files/ndctl-71.1-bash-completion-configure.patch
@@ -0,0 +1,48 @@
+https://github.com/pmem/ndctl/pull/174
+
+From 92485810ce872c92b925ccdf4e3b58fa37ccbb8e Mon Sep 17 00:00:00 2001
+From: Sam James <s...@gentoo.org>
+Date: Sat, 17 Jul 2021 19:31:56 +0100
+Subject: [PATCH] change bash-completion
+
+---
+ configure.ac | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5ec8d2f..f7b1aed 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -133,19 +133,22 @@ PKG_CHECK_MODULES([UUID], [uuid],
+       [AC_DEFINE([HAVE_UUID], [1], [Define to 1 if using libuuid])])
+ PKG_CHECK_MODULES([JSON], [json-c])
+ 
+-AC_ARG_WITH([bash],
+-      AS_HELP_STRING([--with-bash],
+-              [Enable bash auto-completion. @<:@default=yes@:>@]),
++AC_ARG_WITH([bash-completion-dir],
++      AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
++              [Enable bash auto-completion. Uses pkgconfig if no path given. 
@<:@default=yes@:>@]),
+       [],
+-      [with_bash=yes])
++      [with_bash_completion_dir=yes])
+ 
+-if test "x$with_bash" = "xyes"; then
++if test "x$with_bash_completion_dir" = "xyes"; then
+       PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
+-              [BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir 
bash-completion)], [])
++              [BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir 
bash-completion)],
++              [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"])
++else
++      BASH_COMPLETION_DIR="$with_bash_completion_dir"
+ fi
+ 
+ AC_SUBST([BASH_COMPLETION_DIR])
+-AM_CONDITIONAL([ENABLE_BASH_COMPLETION], [test "x$with_bash" = "xyes"])
++AM_CONDITIONAL([ENABLE_BASH_COMPLETION], [test "x$with_bash_completion_dir" 
!= "xno"])
+ 
+ AC_ARG_ENABLE([local],
+         AS_HELP_STRING([--disable-local], [build against kernel ndctl.h 
@<:@default=system@:>@]),
+-- 
+2.32.0
+

diff --git a/sys-block/ndctl/ndctl-71.1-r1.ebuild 
b/sys-block/ndctl/ndctl-71.1-r2.ebuild
similarity index 87%
rename from sys-block/ndctl/ndctl-71.1-r1.ebuild
rename to sys-block/ndctl/ndctl-71.1-r2.ebuild
index 4f2aa941c70..d6c230f369c 100644
--- a/sys-block/ndctl/ndctl-71.1-r1.ebuild
+++ b/sys-block/ndctl/ndctl-71.1-r2.ebuild
@@ -40,6 +40,10 @@ DOCS=(
        CONTRIBUTING.md
 )
 
+PATCHES=(
+       "${FILESDIR}/${PN}-71.1-bash-completion-configure.patch"
+)
+
 src_prepare() {
        default
        printf 'm4_define([GIT_VERSION], [%s])' "${PV}" > version.m4 || die
@@ -49,7 +53,7 @@ src_prepare() {
 
 src_configure() {
        econf \
-               $(use_with bash-completion bash) \
+               --with-bash-completion-dir="$(get_bashcompdir)" \
                $(use_with systemd) \
                --disable-asciidoctor
 }
@@ -61,5 +65,5 @@ src_test() {
 src_install() {
        default
 
-       use bash-completion && bashcomp_alias ndctl daxctl
+       bashcomp_alias ndctl daxctl
 }

Reply via email to