mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [RFC 1/2] ptxdist: print a note when calling ptxdist inside 'ptxdist bash'
Date: Fri, 15 Jan 2021 07:35:22 +0100	[thread overview]
Message-ID: <20210115063522.GZ9321@pengutronix.de> (raw)
In-Reply-To: <20210114225149.3181-1-rhi@pengutronix.de>

On Thu, Jan 14, 2021 at 11:51:48PM +0100, Roland Hieber wrote:
> For debugging purposes it might be useful to run ptxdist inside a
> 'ptxdist bash' session, but under normal conditions this will not work
> out of the box. Mention the fact to prevent confusion and useless
> debugging sessions:
> 
>     $ ptxdist
>     FATAL didn't find /scripts/ptxdist_vars.sh
>     Note: PTXdist was called inside 'ptxdist bash' – things may be broken.

I think we should just fail. So 'ptxd_bailout' instead of echo. Calling
ptxdist here is just not supported.

Michael

> 
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> ---
>  bin/ptxdist | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index 0a252e4ab22e..da3adb134962 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -1695,6 +1695,7 @@ parse_second()
>  . ~/.bashrc
>  PS1="[ptx] \${PS1}"
>  PATH="${PATH}"
> +export INSIDE_PTXDIST_BASH=1
>  alias ptxsudo='sudo env PATH=$PATH'
>  EOF
>  				"${BASH}" --init-file "${bashrc}"
> @@ -2111,7 +2112,7 @@ setup_env() {
>  	unset $({
>  		export -p  | sed -n 's/^declare -x \([^=]*\).*$/\1/p'
>  		export -fp | sed -n 's/^declare -fx \([^=]*\).*$/\1/p'
> -		} | egrep -v "^(PTXDIST_PTXRC|PTX_AUTOBUILD_DESTDIR|CCACHE_.*|PWD|HOME|USER|PATH|TERM|COLUMNS|LINES|DISPLAY|TMPDIR|KCONFIG_ALLCONFIG|KCONFIG_SEED|http_proxy|https_proxy|ftp_proxy|no_proxy${whitelist})$")
> +		} | egrep -v "^(INSIDE_PTXDIST_BASH|PTXDIST_PTXRC|PTX_AUTOBUILD_DESTDIR|CCACHE_.*|PWD|HOME|USER|PATH|TERM|COLUMNS|LINES|DISPLAY|TMPDIR|KCONFIG_ALLCONFIG|KCONFIG_SEED|http_proxy|https_proxy|ftp_proxy|no_proxy${whitelist})$")
>  
>  	######## the environment is clean now ########
>  
> @@ -2134,6 +2135,10 @@ ptxdist_trap_exit_handler() {
>  	local retval="${?}"
>  	local file
>  
> +	if [ -n "${INSIDE_PTXDIST_BASH}" ]; then
> +		echo "Note: PTXdist was called inside 'ptxdist bash' – things may be broken." >/dev/tty
> +	fi
> +
>  	if [ -n "${PTXDIST_TEMPDIR}" -a -d "${PTXDIST_TEMPDIR}" ]; then
>  		rm -fr -- "${PTXDIST_TEMPDIR}"
>  	fi
> -- 
> 2.30.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

  parent reply	other threads:[~2021-01-15  6:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14 22:51 Roland Hieber
2021-01-14 22:51 ` [ptxdist] [RFC 2/2] ptxd_lib_dgen: recompile when certain global kconfig options change Roland Hieber
2021-01-15  7:02   ` Michael Olbrich
2021-01-15 10:09     ` Roland Hieber
2021-01-15  6:35 ` Michael Olbrich [this message]
2021-01-15  6:43   ` [ptxdist] [RFC 1/2] ptxdist: print a note when calling ptxdist inside 'ptxdist bash' Michael Olbrich
2021-06-06 13:53 ` [ptxdist] [PATCH v1] " Roland Hieber
2021-06-16 10:35   ` [ptxdist] [APPLIED] " Michael Olbrich

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=20210115063522.GZ9321@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /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