From: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>, crossgcc@sourceware.org
Subject: Re: [PATCH 1/3] scripts/functions: use ${sed} instead of 'sed'
Date: Tue, 26 Aug 2014 23:58:00 -0000 [thread overview]
Message-ID: <53FD1F37.9080109@physik.tu-berlin.de> (raw)
In-Reply-To: <a2a01ab1cf7078240acf50995f1ad3b026f526da.1409095485.git.yann.morin.1998@free.fr>
[-- Attachment #1: Type: text/plain, Size: 3819 bytes --]
On 27/08/14 01:27, Yann E. MORIN wrote:
> Helps build on BSD-like systems.
>
> Reported-by: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
Signed-off-by: "Fabian Freyer" <fabian.freyer@physik.tu-berlin.de>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
> ---
> scripts/functions | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/functions b/scripts/functions
> index eae3b95..cce629c 100644
> --- a/scripts/functions
> +++ b/scripts/functions
> @@ -317,7 +317,7 @@ CT_SanitiseVarDir() {
> for var in "$@"; do
> eval "old_dir=\"\${${var}}\""
> new_dir="$( printf "${old_dir}" \
> - |sed -r -e 's:/+:/:g;' \
> + |${sed} -r -e 's:/+:/:g;' \
> )"
> eval "${var}=\"${new_dir}\""
> CT_DoLog DEBUG "Sanitised '${var}': '${old_dir}' -> '${new_dir}'"
> @@ -381,7 +381,7 @@ CT_Which() {
> # to the highest entire second
> # Usage: CT_DoDate <fmt>
> CT_DoDate() {
> - date "$1" |sed -r -e 's/%?N$/000000000/;'
> + date "$1" |${sed} -r -e 's/%?N$/000000000/;'
> }
>
> CT_STEP_COUNT=1
> @@ -403,7 +403,9 @@ CT_DoStep() {
> # Usage: CT_EndStep
> CT_EndStep() {
> local stop=$(CT_DoDate +%s%N)
> - local duration=$(printf "%032d" $((stop-${CT_STEP_START[${CT_STEP_COUNT}]})) |sed -r -e 's/([[:digit:]]{2})[[:digit:]]{7}$/\.\1/; s/^0+//; s/^\./0\./;')
> + local duration=$(printf "%032d" $((stop-${CT_STEP_START[${CT_STEP_COUNT}]})) \
> + |${sed} -r -e 's/([[:digit:]]{2})[[:digit:]]{7}$/\.\1/; s/^0+//; s/^\./0\./;'
> + )
> local elapsed=$(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60)))
> local level="${CT_STEP_LEVEL[${CT_STEP_COUNT}]}"
> local message="${CT_STEP_MESSAGE[${CT_STEP_COUNT}]}"
> @@ -1226,7 +1228,7 @@ CT_DoBuildTargetTuple() {
> # Sanity checks
> __sed_alias=""
> if [ -n "${CT_TARGET_ALIAS_SED_EXPR}" ]; then
> - __sed_alias=$(echo "${CT_TARGET}" |sed -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
> + __sed_alias=$(echo "${CT_TARGET}" |${sed} -r -e "${CT_TARGET_ALIAS_SED_EXPR}")
> fi
> case ":${CT_TARGET_VENDOR}:${CT_TARGET_ALIAS}:${__sed_alias}:" in
> :*" "*:*:*:) CT_Abort "Don't use spaces in the vendor string, it breaks things.";;
> @@ -1279,7 +1281,7 @@ CT_DoTarballIfExists() {
> CT_DoLog DEBUG " Saving '${dir}'"
> { tar c -C "${dir}" -v -f - "${extra_tar_opts[@]}" . \
> |"${compress[@]}" >"${tarball}.tar${tar_ext}" ;
> - } 2>&1 |sed -r -e 's/^/ /;' |CT_DoLog STATE
> + } 2>&1 |${sed} -r -e 's/^/ /;' |CT_DoLog STATE
> else
> CT_DoLog STATE " Not saving '${dir}': does not exist"
> fi
> @@ -1306,7 +1308,7 @@ CT_DoExtractTarballIfExists() {
> CT_DoExecLog DEBUG mkdir -p "${dir}"
> { "${uncompress[@]}" "${tarball}.tar${tar_ext}" \
> |tar x -C "${dir}" -v -f - "${extra_tar_opts[@]}" ;
> - } 2>&1 |sed -r -e 's/^/ /;' |CT_DoLog STATE
> + } 2>&1 |${sed} -r -e 's/^/ /;' |CT_DoLog STATE
> else
> CT_DoLog STATE " Not restoring '${dir}': does not exist"
> fi
> @@ -1335,7 +1337,7 @@ CT_DoSaveState() {
> $0~/^[^ ]+ \(\)/ { _p = 0; }
> _p == 1
> $0 == "}" { _p = 1; }
> - ' |sed -r -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d;
> + ' |${sed} -r -e '/^BASH_(ARGC|ARGV|LINENO|SOURCE|VERSINFO)=/d;
> /^(UID|EUID)=/d;
> /^(FUNCNAME|GROUPS|PPID|SHELLOPTS)=/d;' >"${state_dir}/env.sh"
>
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 882 bytes --]
next prev parent reply other threads:[~2014-08-26 23:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-26 23:28 [PATCH 0/3] sed and grep changes for BSD-like systems (branch yem/configure) Yann E. MORIN
2014-08-26 23:28 ` [PATCH 3/3] scripts/crosstool-NG: use ${grep} instead of 'grep' Yann E. MORIN
2014-08-27 0:04 ` Fabian Freyer
2014-08-27 0:05 ` Fabian Freyer
2014-08-26 23:28 ` [PATCH 2/3] configure: add option to specify grep Yann E. MORIN
2014-08-26 23:59 ` Fabian Freyer
2014-08-27 0:04 ` Fabian Freyer
2014-08-26 23:28 ` [PATCH 1/3] scripts/functions: use ${sed} instead of 'sed' Yann E. MORIN
2014-08-26 23:58 ` Fabian Freyer [this message]
2014-08-26 23:32 ` [PATCH 0/3] sed and grep changes for BSD-like systems (branch yem/configure) Yann E. MORIN
2014-08-26 23:49 ` Fabian Freyer
2014-08-26 23:53 ` Yann E. MORIN
2014-08-27 2:03 ` Fabian Freyer
2014-08-27 2:06 ` [PATCH] Added documentation for --with-grep Fabian Freyer
2014-08-27 2:16 ` Bryan Hundven
2014-08-27 2:22 ` Fabian Freyer
2014-08-28 20:27 ` Yann E. MORIN
2014-08-29 15:37 ` [PATCH 0/3] sed and grep changes for BSD-like systems (branch yem/configure) Yann E. MORIN
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=53FD1F37.9080109@physik.tu-berlin.de \
--to=fabian.freyer@physik.tu-berlin.de \
--cc=crossgcc@sourceware.org \
--cc=yann.morin.1998@free.fr \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).