Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH v2 6/8] app-eselect/eselect-opengl: Replace path_exists
Date: Thu, 09 Aug 2018 15:19:12
Message-Id: 20180809151602.11147-7-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal by "Michał Górny"
1 Replace path_exists call with nullglob-based filename expansion.
2 ---
3 .../eselect-opengl/eselect-opengl-1.3.1-r4.ebuild | 10 +++++++---
4 1 file changed, 7 insertions(+), 3 deletions(-)
5
6 diff --git a/app-eselect/eselect-opengl/eselect-opengl-1.3.1-r4.ebuild b/app-eselect/eselect-opengl/eselect-opengl-1.3.1-r4.ebuild
7 index 1206be17c265..d3f04c9469cb 100644
8 --- a/app-eselect/eselect-opengl/eselect-opengl-1.3.1-r4.ebuild
9 +++ b/app-eselect/eselect-opengl/eselect-opengl-1.3.1-r4.ebuild
10 @@ -49,11 +49,15 @@ pkg_preinst() {
11 }
12
13 pkg_postinst() {
14 - if path_exists "${EROOT}"/usr/lib*/opengl; then
15 + local shopt_save=$(shopt -p nullglob)
16 + shopt -s nullglob
17 + local opengl_dirs=( "${EROOT}"/usr/lib*/opengl )
18 + ${shopt_save}
19 + if [[ -n ${opengl_dirs[@]} ]]; then
20 # delete broken symlinks
21 - find "${EROOT}"/usr/lib*/opengl -xtype l -delete
22 + find "${opengl_dirs[@]}" -xtype l -delete
23 # delete empty leftover directories (they confuse eselect)
24 - find "${EROOT}"/usr/lib*/opengl -depth -type d -empty -exec rmdir -v {} +
25 + find "${opengl_dirs[@]}" -depth -type d -empty -exec rmdir -v {} +
26 fi
27
28 if [[ -n "${OLD_IMPL}" && "${OLD_IMPL}" != '(none)' ]] ; then
29 --
30 2.18.0