* [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal
@ 2018-08-09 15:15 Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 1/8] media-plugins/vdr-live: Replace unnecessary path_exists calls Michał Górny
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:15 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Hi,
Here's a second version of path_exists cleanup. This time the few uses
are replaced by inline snippets, and the function is banned completely.
--
Best regards,
Michał Górny
Michał Górny (8):
media-plugins/vdr-live: Replace unnecessary path_exists calls
media-plugins/vdr-vdrmanager: Replace unnecessary path_exists call
net-vpn/openvpn: Remove obsolete postinst warning about old paths
sys-apps/openrc: Replace path_exists with inline bash test
www-apps/postfixadmin: Replace path_exists with inline logic
app-eselect/eselect-opengl: Replace path_exists
autotools-utils.eclass: Remove EAPI 2&3 support
eutils.eclass: Ban path_exists
.../eselect-opengl-1.3.1-r4.ebuild | 10 ++++--
eclass/autotools-utils.eclass | 29 +++------------
eclass/eutils.eclass | 30 +++-------------
eclass/tests/eutils_path_exists.sh | 35 -------------------
.../vdr-live-0.3.0_p20130504-r1.ebuild | 2 +-
.../vdr-live-0.3.0_p20130504-r2.ebuild | 2 +-
media-plugins/vdr-live/vdr-live-2.3.1.ebuild | 2 +-
.../vdr-vdrmanager/vdr-vdrmanager-0.14.ebuild | 2 +-
net-vpn/openvpn/openvpn-2.4.4.ebuild | 5 ---
net-vpn/openvpn/openvpn-2.4.5.ebuild | 5 ---
net-vpn/openvpn/openvpn-2.4.6.ebuild | 5 ---
net-vpn/openvpn/openvpn-9999.ebuild | 5 ---
sys-apps/openrc/openrc-0.34.11.ebuild | 2 +-
www-apps/postfixadmin/postfixadmin-3.1.ebuild | 12 ++++---
14 files changed, 27 insertions(+), 119 deletions(-)
delete mode 100755 eclass/tests/eutils_path_exists.sh
--
2.18.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH v2 1/8] media-plugins/vdr-live: Replace unnecessary path_exists calls
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
@ 2018-08-09 15:15 ` Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 2/8] media-plugins/vdr-vdrmanager: Replace unnecessary path_exists call Michał Górny
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:15 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Replace the unnecessary path_exists calls with plain bash -f test.
The path_exists function was only intended to be used when necessary
to deal with wildcards.
Bug: https://bugs.gentoo.org/662178
---
media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r1.ebuild | 2 +-
media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r2.ebuild | 2 +-
media-plugins/vdr-live/vdr-live-2.3.1.ebuild | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r1.ebuild b/media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r1.ebuild
index 6041faafd99e..24ec6897b14f 100644
--- a/media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r1.ebuild
+++ b/media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r1.ebuild
@@ -90,7 +90,7 @@ pkg_postinst() {
elog "\tadmin:live"
if use ssl ; then
- if path_exists -a "${ROOT}"/etc/vdr/plugins/live/live.pem; then
+ if [[ -f ${ROOT}/etc/vdr/plugins/live/live.pem ]]; then
einfo "found an existing SSL cert, to create a new SSL cert, run:\n"
einfo "emerge --config ${PN}"
else
diff --git a/media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r2.ebuild b/media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r2.ebuild
index 0dbcc0a04730..9ecf777aa274 100644
--- a/media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r2.ebuild
+++ b/media-plugins/vdr-live/vdr-live-0.3.0_p20130504-r2.ebuild
@@ -93,7 +93,7 @@ pkg_postinst() {
elog "\tadmin:live"
if use ssl ; then
- if path_exists -a "${ROOT}"/etc/vdr/plugins/live/live.pem; then
+ if [[ -f ${ROOT}/etc/vdr/plugins/live/live.pem ]]; then
einfo "found an existing SSL cert, to create a new SSL cert, run:\n"
einfo "emerge --config ${PN}"
else
diff --git a/media-plugins/vdr-live/vdr-live-2.3.1.ebuild b/media-plugins/vdr-live/vdr-live-2.3.1.ebuild
index f46cff93c6de..6a0ea6d24b88 100644
--- a/media-plugins/vdr-live/vdr-live-2.3.1.ebuild
+++ b/media-plugins/vdr-live/vdr-live-2.3.1.ebuild
@@ -86,7 +86,7 @@ pkg_postinst() {
elog "\tadmin:live"
if use ssl ; then
- if path_exists -a "${ROOT}"/etc/vdr/plugins/live/live.pem; then
+ if [[ -f ${ROOT}/etc/vdr/plugins/live/live.pem ]]; then
einfo "found an existing SSL cert, to create a new SSL cert, run:\n"
einfo "emerge --config ${PN}"
else
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH v2 2/8] media-plugins/vdr-vdrmanager: Replace unnecessary path_exists call
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 1/8] media-plugins/vdr-live: Replace unnecessary path_exists calls Michał Górny
@ 2018-08-09 15:15 ` Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 3/8] net-vpn/openvpn: Remove obsolete postinst warning about old paths Michał Górny
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:15 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Replace the unnecessary path_exists calls with plain bash -f test.
The path_exists function was only intended to be used when necessary
to deal with wildcards.
Closes: https://bugs.gentoo.org/662178
---
media-plugins/vdr-vdrmanager/vdr-vdrmanager-0.14.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/media-plugins/vdr-vdrmanager/vdr-vdrmanager-0.14.ebuild b/media-plugins/vdr-vdrmanager/vdr-vdrmanager-0.14.ebuild
index 8639a6df48d1..6f324f6bcdc8 100644
--- a/media-plugins/vdr-vdrmanager/vdr-vdrmanager-0.14.ebuild
+++ b/media-plugins/vdr-vdrmanager/vdr-vdrmanager-0.14.ebuild
@@ -63,7 +63,7 @@ pkg_postinst() {
einfo "Add a password to /etc/conf.d/vdr.vdrmanager"
if use ssl ; then
- if path_exists -a "${ROOT}${VDRMANAGER_SSL_KEY_FILE}.pem"; then
+ if [[ -f ${ROOT}${VDRMANAGER_SSL_KEY_FILE}.pem ]]; then
einfo "found an existing SSL cert, to create a new SSL cert, run:\n"
einfo "emerge --config ${PN}"
else
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH v2 3/8] net-vpn/openvpn: Remove obsolete postinst warning about old paths
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 1/8] media-plugins/vdr-live: Replace unnecessary path_exists calls Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 2/8] media-plugins/vdr-vdrmanager: Replace unnecessary path_exists call Michał Górny
@ 2018-08-09 15:15 ` Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 4/8] sys-apps/openrc: Replace path_exists with inline bash test Michał Górny
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:15 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Suggested-by: Michael Orlitzky <mjo@gentoo.org>
---
net-vpn/openvpn/openvpn-2.4.4.ebuild | 5 -----
net-vpn/openvpn/openvpn-2.4.5.ebuild | 5 -----
net-vpn/openvpn/openvpn-2.4.6.ebuild | 5 -----
net-vpn/openvpn/openvpn-9999.ebuild | 5 -----
4 files changed, 20 deletions(-)
diff --git a/net-vpn/openvpn/openvpn-2.4.4.ebuild b/net-vpn/openvpn/openvpn-2.4.4.ebuild
index 16fa5b91ead4..aa8b2b1360c9 100644
--- a/net-vpn/openvpn/openvpn-2.4.4.ebuild
+++ b/net-vpn/openvpn/openvpn-2.4.4.ebuild
@@ -123,11 +123,6 @@ pkg_postinst() {
enewgroup openvpn
enewuser openvpn "" "" "" openvpn
- if path_exists -o "${EROOT%/}"/etc/openvpn/*/local.conf ; then
- ewarn "WARNING: The openvpn init script has changed"
- ewarn ""
- fi
-
if use x64-macos; then
elog "You might want to install tuntaposx for TAP interface support:"
elog "http://tuntaposx.sourceforge.net"
diff --git a/net-vpn/openvpn/openvpn-2.4.5.ebuild b/net-vpn/openvpn/openvpn-2.4.5.ebuild
index ce60c5a55f98..a856d6a63b82 100644
--- a/net-vpn/openvpn/openvpn-2.4.5.ebuild
+++ b/net-vpn/openvpn/openvpn-2.4.5.ebuild
@@ -124,11 +124,6 @@ pkg_postinst() {
enewgroup openvpn
enewuser openvpn "" "" "" openvpn
- if path_exists -o "${EROOT%/}"/etc/openvpn/*/local.conf ; then
- ewarn "WARNING: The openvpn init script has changed"
- ewarn ""
- fi
-
if use x64-macos; then
elog "You might want to install tuntaposx for TAP interface support:"
elog "http://tuntaposx.sourceforge.net"
diff --git a/net-vpn/openvpn/openvpn-2.4.6.ebuild b/net-vpn/openvpn/openvpn-2.4.6.ebuild
index a52f8d6e4a8b..4205ff52a29f 100644
--- a/net-vpn/openvpn/openvpn-2.4.6.ebuild
+++ b/net-vpn/openvpn/openvpn-2.4.6.ebuild
@@ -124,11 +124,6 @@ pkg_postinst() {
enewgroup openvpn
enewuser openvpn "" "" "" openvpn
- if path_exists -o "${EROOT%/}"/etc/openvpn/*/local.conf ; then
- ewarn "WARNING: The openvpn init script has changed"
- ewarn ""
- fi
-
if use x64-macos; then
elog "You might want to install tuntaposx for TAP interface support:"
elog "http://tuntaposx.sourceforge.net"
diff --git a/net-vpn/openvpn/openvpn-9999.ebuild b/net-vpn/openvpn/openvpn-9999.ebuild
index 4f6a5737ccd7..60662fa4fd3a 100644
--- a/net-vpn/openvpn/openvpn-9999.ebuild
+++ b/net-vpn/openvpn/openvpn-9999.ebuild
@@ -120,11 +120,6 @@ pkg_postinst() {
enewgroup openvpn
enewuser openvpn "" "" "" openvpn
- if path_exists -o "${EROOT%/}"/etc/openvpn/*/local.conf ; then
- ewarn "WARNING: The openvpn init script has changed"
- ewarn ""
- fi
-
elog "The openvpn init script expects to find the configuration file"
elog "openvpn.conf in /etc/openvpn along with any extra files it may need."
elog ""
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH v2 4/8] sys-apps/openrc: Replace path_exists with inline bash test
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
` (2 preceding siblings ...)
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 3/8] net-vpn/openvpn: Remove obsolete postinst warning about old paths Michał Górny
@ 2018-08-09 15:15 ` Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 5/8] www-apps/postfixadmin: Replace path_exists with inline logic Michał Górny
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:15 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
path_exists was really meant to be used with wildcards (i.e. when plain
bash tests can't work easily). Here it is really unnecessary.
---
sys-apps/openrc/openrc-0.34.11.ebuild | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys-apps/openrc/openrc-0.34.11.ebuild b/sys-apps/openrc/openrc-0.34.11.ebuild
index 4e2ed59e45f4..7fd281798c14 100644
--- a/sys-apps/openrc/openrc-0.34.11.ebuild
+++ b/sys-apps/openrc/openrc-0.34.11.ebuild
@@ -289,7 +289,7 @@ pkg_postinst() {
fi
# Handle the conf.d/local.{start,stop} -> local.d transition
- if path_exists -o "${EROOT}"etc/conf.d/local.{start,stop} ; then
+ if [[ -f ${EROOT}etc/conf.d/local.start || -f ${EROOT}etc/conf.d/local.stop ]] ; then
elog "Moving your ${EROOT}etc/conf.d/local.{start,stop}"
elog "files to ${EROOT}etc/local.d"
mv "${EROOT}"etc/conf.d/local.start "${EROOT}"etc/local.d/baselayout1.start
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH v2 5/8] www-apps/postfixadmin: Replace path_exists with inline logic
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
` (3 preceding siblings ...)
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 4/8] sys-apps/openrc: Replace path_exists with inline bash test Michał Górny
@ 2018-08-09 15:15 ` Michał Górny
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 6/8] app-eselect/eselect-opengl: Replace path_exists Michał Górny
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:15 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Replace the call to path_exists with local filename expansion. While
at it, also kill the ugly ls-abuse in favor of using the results
of earlier expansion.
---
www-apps/postfixadmin/postfixadmin-3.1.ebuild | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/www-apps/postfixadmin/postfixadmin-3.1.ebuild b/www-apps/postfixadmin/postfixadmin-3.1.ebuild
index 3e69bc6b6573..5cb58aab877a 100644
--- a/www-apps/postfixadmin/postfixadmin-3.1.ebuild
+++ b/www-apps/postfixadmin/postfixadmin-3.1.ebuild
@@ -3,7 +3,7 @@
EAPI="6"
-inherit eutils user webapp
+inherit user webapp
DESCRIPTION="Web Based Management tool for Postfix style virtual domains and users"
HOMEPAGE="http://postfixadmin.sourceforge.net"
@@ -89,10 +89,12 @@ pkg_postinst() {
pkg_postrm() {
# Make sure we don't leave broken vacation.pl symlink
find -L "${ROOT}"/var/spool/vacation/ -type l -delete
- if [[ ! -e "${ROOT}"/var/spool/vacation/vacation.pl ]] &&
- path_exists "${ROOT}"/var/spool/vacation/vacation.pl-*; then
- ln -s $(LC_ALL=C ls -1 /var/spool/vacation/vacation.pl-* | tail -n1) \
- "${ROOT}"/var/spool/vacation/vacation.pl || die
+ local shopt_save=$(shopt -p nullglob)
+ shopt -s nullglob
+ local vacation=( "${ROOT}"/var/spool/vacation/vacation.pl-* )
+ ${shopt_save}
+ if [[ ! -e "${ROOT}"/var/spool/vacation/vacation.pl && -n ${vacation[@]} ]]; then
+ ln -s "${vacation[-1]}" "${ROOT}"/var/spool/vacation/vacation.pl || die
ewarn "/var/spool/vacation/vacation.pl was updated to point on most"
ewarn "recent verion, but please, do your own checks"
fi
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH v2 6/8] app-eselect/eselect-opengl: Replace path_exists
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
` (4 preceding siblings ...)
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 5/8] www-apps/postfixadmin: Replace path_exists with inline logic Michał Górny
@ 2018-08-09 15:16 ` Michał Górny
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 7/8] autotools-utils.eclass: Remove EAPI 2&3 support Michał Górny
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 8/8] eutils.eclass: Ban path_exists Michał Górny
7 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
Replace path_exists call with nullglob-based filename expansion.
---
.../eselect-opengl/eselect-opengl-1.3.1-r4.ebuild | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
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
index 1206be17c265..d3f04c9469cb 100644
--- a/app-eselect/eselect-opengl/eselect-opengl-1.3.1-r4.ebuild
+++ b/app-eselect/eselect-opengl/eselect-opengl-1.3.1-r4.ebuild
@@ -49,11 +49,15 @@ pkg_preinst() {
}
pkg_postinst() {
- if path_exists "${EROOT}"/usr/lib*/opengl; then
+ local shopt_save=$(shopt -p nullglob)
+ shopt -s nullglob
+ local opengl_dirs=( "${EROOT}"/usr/lib*/opengl )
+ ${shopt_save}
+ if [[ -n ${opengl_dirs[@]} ]]; then
# delete broken symlinks
- find "${EROOT}"/usr/lib*/opengl -xtype l -delete
+ find "${opengl_dirs[@]}" -xtype l -delete
# delete empty leftover directories (they confuse eselect)
- find "${EROOT}"/usr/lib*/opengl -depth -type d -empty -exec rmdir -v {} +
+ find "${opengl_dirs[@]}" -depth -type d -empty -exec rmdir -v {} +
fi
if [[ -n "${OLD_IMPL}" && "${OLD_IMPL}" != '(none)' ]] ; then
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH v2 7/8] autotools-utils.eclass: Remove EAPI 2&3 support
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
` (5 preceding siblings ...)
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 6/8] app-eselect/eselect-opengl: Replace path_exists Michał Górny
@ 2018-08-09 15:16 ` Michał Górny
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 8/8] eutils.eclass: Ban path_exists Michał Górny
7 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
---
eclass/autotools-utils.eclass | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)
diff --git a/eclass/autotools-utils.eclass b/eclass/autotools-utils.eclass
index f8d2c7fdc247..b0047048662d 100644
--- a/eclass/autotools-utils.eclass
+++ b/eclass/autotools-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: autotools-utils.eclass
@@ -89,7 +89,7 @@
case ${EAPI:-0} in
6) die "${ECLASS}.eclass is banned in EAPI ${EAPI}";;
- 2|3|4|5) ;;
+ 4|5) ;;
*) die "EAPI=${EAPI} is not supported" ;;
esac
@@ -281,8 +281,6 @@ autotools-utils_src_configure() {
[[ -z ${myeconfargs+1} || $(declare -p myeconfargs) == 'declare -a'* ]] \
|| die 'autotools-utils.eclass: myeconfargs has to be an array.'
- [[ ${EAPI} == 2 ]] && ! use prefix && EPREFIX=
-
# Common args
local econfargs=()
@@ -338,31 +336,12 @@ autotools-utils_src_install() {
emake DESTDIR="${D}" "$@" install || die "emake install failed"
popd > /dev/null || die
- # Move docs installed by autotools (in EAPI < 4).
- if [[ ${EAPI} == [23] ]] \
- && path_exists "${D}${EPREFIX}"/usr/share/doc/${PF}/*; then
- if [[ $(find "${D}${EPREFIX}"/usr/share/doc/${PF}/* -type d) ]]; then
- eqawarn "autotools-utils: directories in docdir require at least EAPI 4"
- else
- mkdir "${T}"/temp-docdir
- mv "${D}${EPREFIX}"/usr/share/doc/${PF}/* "${T}"/temp-docdir/ \
- || die "moving docs to tempdir failed"
-
- dodoc "${T}"/temp-docdir/* || die "docdir dodoc failed"
- rm -r "${T}"/temp-docdir || die
- fi
- fi
-
# XXX: support installing them from builddir as well?
if declare -p DOCS &>/dev/null; then
# an empty list == don't install anything
if [[ ${DOCS[@]} ]]; then
- if [[ ${EAPI} == [23] ]]; then
- dodoc "${DOCS[@]}" || die
- else
- # dies by itself
- dodoc -r "${DOCS[@]}"
- fi
+ # dies by itself
+ dodoc -r "${DOCS[@]}"
fi
else
local f
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-dev] [PATCH v2 8/8] eutils.eclass: Ban path_exists
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
` (6 preceding siblings ...)
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 7/8] autotools-utils.eclass: Remove EAPI 2&3 support Michał Górny
@ 2018-08-09 15:16 ` Michał Górny
7 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2018-08-09 15:16 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
---
eclass/eutils.eclass | 30 ++++---------------------
eclass/tests/eutils_path_exists.sh | 35 ------------------------------
2 files changed, 4 insertions(+), 61 deletions(-)
delete mode 100755 eclass/tests/eutils_path_exists.sh
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index 9b4767e1874a..3b9fc28319c6 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -181,33 +181,11 @@ make_wrapper() {
fi
}
-# @FUNCTION: path_exists
-# @USAGE: [-a|-o] <paths>
-# @DESCRIPTION:
-# Check if the specified paths exist. Works for all types of paths
-# (files/dirs/etc...). The -a and -o flags control the requirements
-# of the paths. They correspond to "and" and "or" logic. So the -a
-# flag means all the paths must exist while the -o flag means at least
-# one of the paths must exist. The default behavior is "and". If no
-# paths are specified, then the return value is "false".
path_exists() {
- local opt=$1
- [[ ${opt} == -[ao] ]] && shift || opt="-a"
-
- # no paths -> return false
- # same behavior as: [[ -e "" ]]
- [[ $# -eq 0 ]] && return 1
-
- local p r=0
- for p in "$@" ; do
- [[ -e ${p} ]]
- : $(( r += $? ))
- done
-
- case ${opt} in
- -a) return $(( r != 0 )) ;;
- -o) return $(( r == $# )) ;;
- esac
+ eerror "path_exists has been removed. Please see the following post"
+ eerror "for a replacement snippet:"
+ eerror "https://blogs.gentoo.org/mgorny/2018/08/09/inlining-path_exists/"
+ die "path_exists is banned"
}
# @FUNCTION: use_if_iuse
diff --git a/eclass/tests/eutils_path_exists.sh b/eclass/tests/eutils_path_exists.sh
deleted file mode 100755
index 00a89c7e446d..000000000000
--- a/eclass/tests/eutils_path_exists.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-source tests-common.sh
-
-inherit eutils
-
-test-path_exists() {
- local exp=$1; shift
- tbegin "path_exists($*) == ${exp}"
- path_exists "$@"
- [[ ${exp} -eq $? ]]
- tend $?
-}
-
-test-path_exists 1
-test-path_exists 1 -a
-test-path_exists 1 -o
-
-good="/ . tests-common.sh /bin/bash"
-test-path_exists 0 ${good}
-test-path_exists 0 -a ${good}
-test-path_exists 0 -o ${good}
-
-bad="/asjdkfljasdlfkja jlakjdsflkasjdflkasdjflkasdjflaskdjf"
-test-path_exists 1 ${bad}
-test-path_exists 1 -a ${bad}
-test-path_exists 1 -o ${bad}
-
-test-path_exists 1 ${good} ${bad}
-test-path_exists 1 -a ${good} ${bad}
-test-path_exists 0 -o ${good} ${bad}
-
-texit
--
2.18.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-08-09 15:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-09 15:15 [gentoo-dev] [PATCH v2 0/8] eutils/path_exists removal Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 1/8] media-plugins/vdr-live: Replace unnecessary path_exists calls Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 2/8] media-plugins/vdr-vdrmanager: Replace unnecessary path_exists call Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 3/8] net-vpn/openvpn: Remove obsolete postinst warning about old paths Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 4/8] sys-apps/openrc: Replace path_exists with inline bash test Michał Górny
2018-08-09 15:15 ` [gentoo-dev] [PATCH v2 5/8] www-apps/postfixadmin: Replace path_exists with inline logic Michał Górny
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 6/8] app-eselect/eselect-opengl: Replace path_exists Michał Górny
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 7/8] autotools-utils.eclass: Remove EAPI 2&3 support Michał Górny
2018-08-09 15:16 ` [gentoo-dev] [PATCH v2 8/8] eutils.eclass: Ban path_exists Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox