public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 2/9] multilib-build.eclass: Add missing error checks
Date: Sun,  6 Dec 2015 19:57:47 +0100	[thread overview]
Message-ID: <1449428274-20439-3-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <1449428274-20439-1-git-send-email-mgorny@gentoo.org>

---
 eclass/multilib-build.eclass | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index dd03553..8e58a2b 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -262,19 +262,23 @@ multilib_for_best_abi() {
 # runs (if any). Dies if header files differ.
 multilib_check_headers() {
 	_multilib_header_cksum() {
-		[[ -d ${ED}usr/include ]] && \
-		find "${ED}"usr/include -type f \
-			-exec cksum {} + | sort -k2
+		set -o pipefail
+
+		if [[ -d ${ED}usr/include ]]; then
+			find "${ED}"usr/include -type f \
+				-exec cksum {} + | sort -k2
+		fi
 	}
 
-	local cksum=$(_multilib_header_cksum)
+	local cksum cksum_prev
 	local cksum_file=${T}/.multilib_header_cksum
+	cksum=$(_multilib_header_cksum) || die
 
 	if [[ -f ${cksum_file} ]]; then
-		local cksum_prev=$(< "${cksum_file}")
+		cksum_prev=$(< "${cksum_file}") || die
 
 		if [[ ${cksum} != ${cksum_prev} ]]; then
-			echo "${cksum}" > "${cksum_file}.new"
+			echo "${cksum}" > "${cksum_file}.new" || die
 
 			eerror "Header files have changed between ABIs."
 
@@ -288,7 +292,7 @@ multilib_check_headers() {
 			die "Header checksum mismatch, aborting."
 		fi
 	else
-		echo "${cksum}" > "${cksum_file}"
+		echo "${cksum}" > "${cksum_file}" || die
 	fi
 }
 
@@ -409,9 +413,9 @@ multilib_prepare_wrappers() {
 
 		if [[ -L ${root}/${f} ]]; then
 			# rewrite the symlink target
-			local target=$(readlink "${root}/${f}")
-			local target_dir
-			local target_fn=${target##*/}
+			local target
+			target=$(readlink "${root}/${f}") || die
+			local target_dir target_fn=${target##*/}
 
 			[[ ${target} == */* ]] && target_dir=${target%/*}
 
@@ -453,7 +457,7 @@ multilib_prepare_wrappers() {
 					if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
 						dodir "/tmp/multilib-include${dir}"
 						# a generic template
-						cat > "${wrapper}" <<_EOF_
+						cat > "${wrapper}" <<_EOF_ || die
 /* This file is auto-generated by multilib-build.eclass
  * as a multilib-friendly wrapper. For the original content,
  * please see the files that are #included below.
-- 
2.6.3



  parent reply	other threads:[~2015-12-06 18:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-06 18:57 [gentoo-dev] [PATCHES] multilib-build & multilib-minimal EAPI 6 patchset Michał Górny
2015-12-06 18:57 ` [gentoo-dev] [PATCH 1/9] multilib-build.eclass: Mark eclass-generated variables read-only Michał Górny
2015-12-06 18:57 ` Michał Górny [this message]
2015-12-06 20:23   ` [gentoo-dev] [PATCH 2/9] multilib-build.eclass: Add missing error checks James Le Cuirot
2015-12-06 20:28     ` James Le Cuirot
2015-12-06 18:57 ` [gentoo-dev] [PATCH 3/9] multilib-build.eclass: Unset local functions after use Michał Górny
2015-12-06 18:57 ` [gentoo-dev] [PATCH 4/9] multilib-build.eclass: Unset global-setting function " Michał Górny
2015-12-06 18:57 ` [gentoo-dev] [PATCH 5/9] multilib-build.eclass: Ban deprecated functions in EAPI 6 Michał Górny
2015-12-06 18:57 ` [gentoo-dev] [PATCH 6/9] multilib-build.eclass: Add missing eutils inherit for eqawarn Michał Górny
2015-12-06 18:57 ` [gentoo-dev] [PATCH 7/9] multilib-build.eclass: Enable EAPI 6 Michał Górny
2015-12-06 21:32   ` Ulrich Mueller
2015-12-06 21:43     ` James Le Cuirot
2015-12-06 21:48       ` Ulrich Mueller
2015-12-06 18:57 ` [gentoo-dev] [PATCH 8/9] multilib-minimal.eclass: Remove eutils in EAPI 6 (einstalldocs built-in) Michał Górny
2015-12-06 18:57 ` [gentoo-dev] [PATCH 9/9] multilib-minimal.eclass: Enable EAPI 6 Michał Górny
2015-12-09 20:45 ` [gentoo-dev] [PATCHES] multilib-build & multilib-minimal EAPI 6 patchset Michał Górny
2015-12-11  5:57 ` Doug Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449428274-20439-3-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox