From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id A86001389E2 for ; Mon, 1 Dec 2014 21:30:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C0A15E09B2; Mon, 1 Dec 2014 21:29:12 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 59224E09B1 for ; Mon, 1 Dec 2014 21:29:12 +0000 (UTC) Received: from pomiot.lan (77-255-26-226.adsl.inetia.pl [77.255.26.226]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id C41673405E8; Mon, 1 Dec 2014 21:29:10 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH 13/18] Add tentative EAPI6 nonfatal support to die() Date: Mon, 1 Dec 2014 22:28:31 +0100 Message-Id: <1417469316-25052-14-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1417469316-25052-1-git-send-email-mgorny@gentoo.org> References: <1417469316-25052-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: 9704d149-42d6-4aaf-b1c9-eb1f6dd7cd73 X-Archives-Hash: bb787855492ee1b4cade71fbaaa7c1c8 Add support for die() to respect 'nonfatal' modifier if '--respect-nonfatal' (or '-n') option is used. This allows eclasses to create custom ebuild helpers that mimic built-in helper behavior. --- bin/eapi.sh | 4 ++++ bin/isolated-functions.sh | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/bin/eapi.sh b/bin/eapi.sh index 6716b1c..c650a4c 100644 --- a/bin/eapi.sh +++ b/bin/eapi.sh @@ -166,6 +166,10 @@ ___eapi_unpack_supports_absolute_paths() { [[ ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend)$ ]] } +___eapi_die_can_respect_nonfatal() { + [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] +} + # OTHERS ___eapi_enables_failglob_in_global_scope() { diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index 251d7ee..8e789ec 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -123,6 +123,13 @@ __helpers_die() { die() { local IFS=$' \t\n' + if ___eapi_die_can_respect_nonfatal; then + if [[ ${1} == -n ]]; then + [[ ${PORTAGE_NONFATAL} == 1 ]] && return 1 + shift + fi + fi + set +e if [ -n "${QA_INTERCEPTORS}" ] ; then # die was called from inside inherit. We need to clean up -- 2.1.3