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 3E920138262 for ; Wed, 18 May 2016 23:34:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CC90214355; Wed, 18 May 2016 23:34:03 +0000 (UTC) Received: from foo.stuge.se (foo.stuge.se [212.116.89.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 661AE14340 for ; Wed, 18 May 2016 23:34:01 +0000 (UTC) Received: (qmail 7248 invoked by uid 1000); 18 May 2016 23:26:59 -0000 Date: Wed, 18 May 2016 23:26:59 +0000 From: Peter Stuge To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] rebar.eclass: Build Erlang/OTP projects using dev-util/rebar Message-ID: <20160518232658.GM26940@foo.stuge.se> References: <1463610918-4062-1-git-send-email-aidecoe@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1463610918-4062-1-git-send-email-aidecoe@gentoo.org> X-Archives-Salt: 4ca82ab6-c29d-4fa8-a4f3-85ccee0c445b X-Archives-Hash: 61ef2fded62ad8dc23cc8a1f296b8e2f Cool! aidecoe@gentoo.org wrote: > +_find_dep_version() { > + local pn="$1" > + local p > + > + pushd "${EPREFIX}$(get_erl_libs)" >/dev/null > + for p in ${pn} ${pn}-*; do > + if [[ -d ${p} ]]; then > + echo "${p#${pn}-}" > + return 0 No popd on success? > + fi > + done > + popd >/dev/null > + > + return 1 > +} > +# @FUNCTION: eawk > +# @USAGE: > +# @DESCRIPTION: > +# Edit file in place with awk. Pass all arguments following to > +# awk. > +eawk() { > + local f="$1"; shift > + local tmpf="$(emktemp)" > + > + cat "${f}" >"${tmpf}" || return 1 > + awk "$@" "${tmpf}" >"${f}" > +} Wouldn't it be nicer to cut cat, awk > $tmpf && mv $tmpf $f ? //Peter