1 |
commit: 422737f5b83682f126d435dfdf22f6a7eb978b75 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 25 03:04:17 2021 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jul 31 00:17:48 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=422737f5 |
7 |
|
8 |
sys-apps/usbguard: [QA] unconditionally install completion files |
9 |
|
10 |
QA policy [0] says that we don't conditionalise installation of |
11 |
small files. It's a wasteful rebuild and inconsistent across packages |
12 |
for when users desire completions to be available. |
13 |
|
14 |
[0] https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0301 |
15 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
16 |
|
17 |
.../usbguard-1.0.0-bash-completion-configure.patch | 105 +++++++++++++++++++++ |
18 |
...rd-1.0.0-r1.ebuild => usbguard-1.0.0-r2.ebuild} | 7 +- |
19 |
2 files changed, 109 insertions(+), 3 deletions(-) |
20 |
|
21 |
diff --git a/sys-apps/usbguard/files/usbguard-1.0.0-bash-completion-configure.patch b/sys-apps/usbguard/files/usbguard-1.0.0-bash-completion-configure.patch |
22 |
new file mode 100644 |
23 |
index 00000000000..c63a85f23a5 |
24 |
--- /dev/null |
25 |
+++ b/sys-apps/usbguard/files/usbguard-1.0.0-bash-completion-configure.patch |
26 |
@@ -0,0 +1,105 @@ |
27 |
+https://github.com/USBGuard/usbguard/pull/483 |
28 |
+ |
29 |
+From b3bb39e0e5de61e1c713cb98ebca5e4c6529e2b9 Mon Sep 17 00:00:00 2001 |
30 |
+From: Sam James <sam@g.o> |
31 |
+Date: Sun, 18 Jul 2021 03:42:21 +0100 |
32 |
+Subject: [PATCH] configure.ac: Use standard --with-bash-completion-dir option |
33 |
+ |
34 |
+Rationale: |
35 |
+This makes it a lot easier to enable/disable installation |
36 |
+of bash completion files rather than it being based on |
37 |
+a certain package being installed (or not). It's useful |
38 |
+in Gentoo Linux for example where we may want to always |
39 |
+install Bash completion files to the right location, even |
40 |
+if the user isn't using it yet, to save rebuilds. |
41 |
+ |
42 |
+This makes a few changes to the current Bash completion logic, mainly: |
43 |
+* Falls back gracefully to a standard directory if bash-completion |
44 |
+ itself is not installed (in that case, we can't ask it via pkgconfig |
45 |
+ where to place files). |
46 |
+ |
47 |
+* So the behaviour is now: |
48 |
+ * no argument / --with-bash-completion-dir=yes: |
49 |
+ |
50 |
+ Asks pkgconfig, but falls back to standard directory. |
51 |
+ |
52 |
+ * --with-bash-completion-dir=dir: |
53 |
+ |
54 |
+ Use the given directory with no detection. |
55 |
+ |
56 |
+ * --without-bash-completion-dir: |
57 |
+ |
58 |
+ No installation of Bash completion files. |
59 |
+ |
60 |
+Signed-off-by: Sam James <sam@g.o> |
61 |
+--- |
62 |
+ Makefile.am | 2 +- |
63 |
+ configure.ac | 32 ++++++++++++++------------------ |
64 |
+ 2 files changed, 15 insertions(+), 19 deletions(-) |
65 |
+ |
66 |
+diff --git a/Makefile.am b/Makefile.am |
67 |
+index 34a2e96..910c3c5 100644 |
68 |
+--- a/Makefile.am |
69 |
++++ b/Makefile.am |
70 |
+@@ -438,7 +438,7 @@ usbguard_LDADD=\ |
71 |
+ $(top_builddir)/libusbguard.la \ |
72 |
+ ${PTHREAD_LIBS} |
73 |
+ |
74 |
+-if BASH_COMPLETION_ENABLED |
75 |
++if ENABLE_BASH_COMPLETION |
76 |
+ bashcompletiondir = $(BASH_COMPLETION_DIR) |
77 |
+ dist_bashcompletion_DATA = $(top_srcdir)/scripts/bash_completion/usbguard |
78 |
+ endif |
79 |
+diff --git a/configure.ac b/configure.ac |
80 |
+index 73021b6..4207ae2 100644 |
81 |
+--- a/configure.ac |
82 |
++++ b/configure.ac |
83 |
+@@ -663,11 +663,18 @@ AC_ARG_ENABLE([systemd], |
84 |
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-systemd]) ;; |
85 |
+ esac], [systemd=no]) |
86 |
+ |
87 |
+- |
88 |
+-PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], |
89 |
+- [bash_completion_dir="`$PKG_CONFIG --variable=completionsdir bash-completion`" |
90 |
+- bash_completion=yes], |
91 |
+- [bash_completion=no]) |
92 |
++AC_ARG_WITH([bash-completion-dir], |
93 |
++ AS_HELP_STRING([--with-bash-completion-dir[=PATH]], |
94 |
++ [Enable bash auto-completion. Uses pkgconfig if no path given. @<:@default=yes@:>@]), |
95 |
++ [], [with_bash_completion_dir=yes]) |
96 |
++ |
97 |
++if test "x$with_bash_completion_dir" = "xyes"; then |
98 |
++ PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], |
99 |
++ [BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir bash-completion)], |
100 |
++ [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]) |
101 |
++else |
102 |
++ BASH_COMPLETION_DIR="$with_bash_completion_dir" |
103 |
++fi |
104 |
+ |
105 |
+ if test "x$debug" = xyes; then |
106 |
+ CXXFLAGS="$CXXFLAGS $CXXFLAGS_DEBUG_ENABLED" |
107 |
+@@ -706,19 +713,8 @@ fi |
108 |
+ |
109 |
+ AC_SUBST([ANALYZE_CONFIGURE_ARGS], $ac_configure_args) |
110 |
+ |
111 |
+-case "$bash_completion_dir" in |
112 |
+- /usr/share/*|/usr/local/share/*) |
113 |
+- bash_completion_dir=$(echo "$bash_completion_dir" | sed -r 's,^(/usr/share|/usr/local/share),${datadir},') |
114 |
+- ;; |
115 |
+- /usr/*|/usr/local/*) |
116 |
+- bash_completion_dir=$(echo "$bash_completion_dir" | sed -r 's,^(/usr|/usr/local),${prefix},') |
117 |
+- ;; |
118 |
+- /*) |
119 |
+- bash_completion_dir='${prefix}'"$bash_completion_dir" |
120 |
+- ;; |
121 |
+-esac |
122 |
+- |
123 |
+-AC_SUBST([BASH_COMPLETION_DIR], $bash_completion_dir) |
124 |
++AC_SUBST([BASH_COMPLETION_DIR]) |
125 |
++AM_CONDITIONAL([ENABLE_BASH_COMPLETION], [test "x$with_bash_completion_dir" != "xno"]) |
126 |
+ |
127 |
+ AM_CONDITIONAL([SYSTEMD_SUPPORT_ENABLED], [test "x$systemd" = xyes ]) |
128 |
+ AM_CONDITIONAL([DBUS_ENABLED], [test "x$with_dbus" = xyes ]) |
129 |
+-- |
130 |
+2.32.0 |
131 |
+ |
132 |
|
133 |
diff --git a/sys-apps/usbguard/usbguard-1.0.0-r1.ebuild b/sys-apps/usbguard/usbguard-1.0.0-r2.ebuild |
134 |
similarity index 91% |
135 |
rename from sys-apps/usbguard/usbguard-1.0.0-r1.ebuild |
136 |
rename to sys-apps/usbguard/usbguard-1.0.0-r2.ebuild |
137 |
index 45cb81c1a51..cf0a6c5a14d 100644 |
138 |
--- a/sys-apps/usbguard/usbguard-1.0.0-r1.ebuild |
139 |
+++ b/sys-apps/usbguard/usbguard-1.0.0-r2.ebuild |
140 |
@@ -3,7 +3,7 @@ |
141 |
|
142 |
EAPI=7 |
143 |
|
144 |
-inherit autotools |
145 |
+inherit autotools bash-completion-r1 |
146 |
|
147 |
DESCRIPTION="Daemon protecting your computer against BadUSB" |
148 |
HOMEPAGE="https://github.com/USBGuard/usbguard" |
149 |
@@ -12,7 +12,7 @@ SRC_URI="https://github.com/USBGuard/usbguard/releases/download/${P}/${P}.tar.gz |
150 |
LICENSE="GPL-2+" |
151 |
SLOT="0/1" # due to libusbguard.so.<1>.0.0 |
152 |
KEYWORDS="~amd64 ~x86" |
153 |
-IUSE="bash-completion dbus ldap policykit static-libs systemd test umockdev" |
154 |
+IUSE="dbus ldap policykit static-libs systemd test umockdev" |
155 |
|
156 |
REQUIRED_USE="policykit? ( dbus )" |
157 |
|
158 |
@@ -29,7 +29,6 @@ CDEPEND=" |
159 |
>=sys-libs/libcap-ng-0.7.0 |
160 |
>=sys-libs/libseccomp-2.0.0 |
161 |
>=sys-process/audit-2.7.7 |
162 |
- bash-completion? ( >=app-shells/bash-completion-2.0 ) |
163 |
dbus? ( |
164 |
dev-libs/glib:2 |
165 |
sys-apps/dbus |
166 |
@@ -56,6 +55,7 @@ RESTRICT="!test? ( test )" |
167 |
|
168 |
PATCHES=( |
169 |
"${FILESDIR}"/${PN}-1.0.0-pthreads-link.patch |
170 |
+ "${FILESDIR}"/${PN}-1.0.0-bash-completion-configure.patch |
171 |
) |
172 |
|
173 |
src_prepare() { |
174 |
@@ -65,6 +65,7 @@ src_prepare() { |
175 |
|
176 |
src_configure() { |
177 |
local myargs=( |
178 |
+ --with-bash-completion-dir=$(get_bashcompdir) |
179 |
$(use_with dbus) |
180 |
$(use_with ldap) |
181 |
$(use_with policykit polkit) |