Gentoo Archives: gentoo-dev

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-dev@l.g.o
Cc: Georgy Yakovlev <gyakovlev@g.o>
Subject: [gentoo-dev] [PATCH] metadata/install-qa-check.d: add virtual/libcrypt dep check
Date: Fri, 25 Jun 2021 05:25:51
Message-Id: 20210625052519.1434328-1-gyakovlev@gentoo.org
1 Bug: https://bugs.gentoo.org/699422
2 Signed-off-by: Georgy Yakovlev <gyakovlev@g.o>
3 ---
4 metadata/install-qa-check.d/60libcrypt-deps | 38 +++++++++++++++++++++
5 1 file changed, 38 insertions(+)
6 create mode 100644 metadata/install-qa-check.d/60libcrypt-deps
7
8 diff --git a/metadata/install-qa-check.d/60libcrypt-deps b/metadata/install-qa-check.d/60libcrypt-deps
9 new file mode 100644
10 index 000000000000..bc7b8d3dced2
11 --- /dev/null
12 +++ b/metadata/install-qa-check.d/60libcrypt-deps
13 @@ -0,0 +1,38 @@
14 +# Copyright 2021 Gentoo Authors
15 +# Distributed under the terms of the GNU General Public License v2
16 +
17 +# QA check: ensure that package specifies a dependency on virtual/libcrypt
18 +# Author: Georgy Yakovlev <gyakovlev@g.o>
19 +# Maintainer Sam James <sam@g.o>
20 +
21 +libcrypt_check() {
22 + if ! type -P scanelf >/dev/null || has binchecks ${PORTAGE_RESTRICT}; then
23 + return
24 + fi
25 +
26 + # nothing to do here
27 + if grep -q virtual/libcrypt <<<${RDEPEND}; then
28 + return
29 + fi
30 +
31 + local libcrypt_consumers
32 + # grep outputs newline separated list of files, so it's ok to skip specifying delimiter
33 + IFS= mapfile libcrypt_consumers < <(find "${ED}" -type f -executable \
34 + -print0 | xargs -0 scanelf -qyRF '%F %n' {} + | grep 'libcrypt.so' 2>/dev/null )
35 +
36 + if [[ -n ${libcrypt_consumers[@]} ]]; then
37 + eqawarn "Binary files linked to libcrypt.so found"
38 + eqawarn "But dependency on virtual/libcrypt is not declared"
39 + eqawarn
40 + eqatag -v virtual-libcrypt.missing "${libcrypt_consumers[@]%% *}"
41 + eqawarn
42 + eqawarn "Please add virtual/libcrypt dependency"
43 + eqawarn "Gentoo Bug: https://bugs.gentoo.org/699422"
44 + fi
45 +
46 +}
47 +
48 +libcrypt_check
49 +: # guarantee successful exit
50 +
51 +# vim:ft=sh
52 --
53 2.32.0

Replies