mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v2] barebox: fix CONFIG_DEFAULT_ENVIRONMENT_PATH on (interrupted) oldconfig/nconfig/menuconfig
@ 2017-09-13 16:49 Bastian Stender
  2017-09-14  6:47 ` Michael Olbrich
  0 siblings, 1 reply; 3+ messages in thread
From: Bastian Stender @ 2017-09-13 16:49 UTC (permalink / raw)
  To: ptxdist; +Cc: Bastian Stender

ptxdist adds ".ptxdist-defaultenv" if PTXCONF_BAREBOX_EXTRA_ENV is
enabled. If barebox oldconfig/nconfig/menuconfig do not modify the
configuration the barebox config from the BSP is copied without
executing the prepare stage responsible for amending
".ptxdist-defaultenv". The same happens on interrupted *config.

Steps to reproduce:

  ptxdist targetinstall barebox
  ptxdist menuconfig barebox (without modification)
  ptxdist drop barebox.compile
  ptxdist targetinstall barebox

Now CONFIG_DEFAULT_ENVIRONMENT_PATH is missing ".ptxdist-defaultenv"
leading to an unexpected environment.

Fix this by amending ".ptxdist-defaultenv" before compiling in case it
has not been amended before.

Signed-off-by: Bastian Stender <bst@pengutronix.de>
---
 rules/barebox.make | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/rules/barebox.make b/rules/barebox.make
index bdfefe8c6..f37f2f5f2 100644
--- a/rules/barebox.make
+++ b/rules/barebox.make
@@ -89,8 +89,6 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
 		else \
 			cp "$(path)" $(BAREBOX_DIR)/.ptxdist-defaultenv/; \
 		fi;)
-	@sed -i -e "s,^\(CONFIG_DEFAULT_ENVIRONMENT_PATH=.*\)\"$$,\1 .ptxdist-defaultenv\"," \
-		$(BAREBOX_DIR)/.config
 endif
 
 	@$(call touch)
@@ -101,6 +99,15 @@ endif
 
 $(STATEDIR)/barebox.compile:
 	@$(call targetinfo)
+
+ifdef PTXCONF_BAREBOX_EXTRA_ENV
+	@if test -e $(BAREBOX_CONFIG) -a \
+		$(shell grep -c -e "^CONFIG_DEFAULT_ENVIRONMENT_PATH=.*\.ptxdist-defaultenv" $(BAREBOX_DIR)/.config) -eq 0; then \
+		sed -i -e "s,^\(CONFIG_DEFAULT_ENVIRONMENT_PATH=.*\)\"$$,\1 .ptxdist-defaultenv\"," \
+			$(BAREBOX_DIR)/.config; \
+	fi
+endif
+
 	@+cd $(BAREBOX_DIR) && $(BAREBOX_PATH) $(BAREBOX_ENV) \
 		$(MAKE) $(BAREBOX_MAKEVARS)
 	@$(call touch)
-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ptxdist] [PATCH v2] barebox: fix CONFIG_DEFAULT_ENVIRONMENT_PATH on (interrupted) oldconfig/nconfig/menuconfig
  2017-09-13 16:49 [ptxdist] [PATCH v2] barebox: fix CONFIG_DEFAULT_ENVIRONMENT_PATH on (interrupted) oldconfig/nconfig/menuconfig Bastian Stender
@ 2017-09-14  6:47 ` Michael Olbrich
  2017-09-14  8:13   ` Bastian Stender
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Olbrich @ 2017-09-14  6:47 UTC (permalink / raw)
  To: ptxdist

On Wed, Sep 13, 2017 at 06:49:45PM +0200, Bastian Stender wrote:
> ptxdist adds ".ptxdist-defaultenv" if PTXCONF_BAREBOX_EXTRA_ENV is
> enabled. If barebox oldconfig/nconfig/menuconfig do not modify the
> configuration the barebox config from the BSP is copied without
> executing the prepare stage responsible for amending
> ".ptxdist-defaultenv". The same happens on interrupted *config.
> 
> Steps to reproduce:
> 
>   ptxdist targetinstall barebox
>   ptxdist menuconfig barebox (without modification)
>   ptxdist drop barebox.compile
>   ptxdist targetinstall barebox
> 
> Now CONFIG_DEFAULT_ENVIRONMENT_PATH is missing ".ptxdist-defaultenv"
> leading to an unexpected environment.
> 
> Fix this by amending ".ptxdist-defaultenv" before compiling in case it
> has not been amended before.
> 
> Signed-off-by: Bastian Stender <bst@pengutronix.de>
> ---
>  rules/barebox.make | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/rules/barebox.make b/rules/barebox.make
> index bdfefe8c6..f37f2f5f2 100644
> --- a/rules/barebox.make
> +++ b/rules/barebox.make
> @@ -89,8 +89,6 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
>  		else \
>  			cp "$(path)" $(BAREBOX_DIR)/.ptxdist-defaultenv/; \
>  		fi;)
> -	@sed -i -e "s,^\(CONFIG_DEFAULT_ENVIRONMENT_PATH=.*\)\"$$,\1 .ptxdist-defaultenv\"," \
> -		$(BAREBOX_DIR)/.config
>  endif
>  
>  	@$(call touch)
> @@ -101,6 +99,15 @@ endif
>  
>  $(STATEDIR)/barebox.compile:
>  	@$(call targetinfo)
> +
> +ifdef PTXCONF_BAREBOX_EXTRA_ENV
> +	@if test -e $(BAREBOX_CONFIG) -a \

Any reason for this check? $(BAREBOX_CONFIG) should always exist at that
point because of the dependencies.

> +		$(shell grep -c -e "^CONFIG_DEFAULT_ENVIRONMENT_PATH=.*\.ptxdist-defaultenv" $(BAREBOX_DIR)/.config) -eq 0; then \

Don't use '$(shell ...)' here. That makes the execution time a bit fuzzy.
'$$(grep ...) should work.

Michael

> +		sed -i -e "s,^\(CONFIG_DEFAULT_ENVIRONMENT_PATH=.*\)\"$$,\1 .ptxdist-defaultenv\"," \
> +			$(BAREBOX_DIR)/.config; \
> +	fi
> +endif
> +
>  	@+cd $(BAREBOX_DIR) && $(BAREBOX_PATH) $(BAREBOX_ENV) \
>  		$(MAKE) $(BAREBOX_MAKEVARS)
>  	@$(call touch)
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ptxdist] [PATCH v2] barebox: fix CONFIG_DEFAULT_ENVIRONMENT_PATH on (interrupted) oldconfig/nconfig/menuconfig
  2017-09-14  6:47 ` Michael Olbrich
@ 2017-09-14  8:13   ` Bastian Stender
  0 siblings, 0 replies; 3+ messages in thread
From: Bastian Stender @ 2017-09-14  8:13 UTC (permalink / raw)
  To: ptxdist

On 09/14/2017 08:47 AM, Michael Olbrich wrote:
> On Wed, Sep 13, 2017 at 06:49:45PM +0200, Bastian Stender wrote:
>> ptxdist adds ".ptxdist-defaultenv" if PTXCONF_BAREBOX_EXTRA_ENV is
>> enabled. If barebox oldconfig/nconfig/menuconfig do not modify the
>> configuration the barebox config from the BSP is copied without
>> executing the prepare stage responsible for amending
>> ".ptxdist-defaultenv". The same happens on interrupted *config.
>>
>> Steps to reproduce:
>>
>>    ptxdist targetinstall barebox
>>    ptxdist menuconfig barebox (without modification)
>>    ptxdist drop barebox.compile
>>    ptxdist targetinstall barebox
>>
>> Now CONFIG_DEFAULT_ENVIRONMENT_PATH is missing ".ptxdist-defaultenv"
>> leading to an unexpected environment.
>>
>> Fix this by amending ".ptxdist-defaultenv" before compiling in case it
>> has not been amended before.
>>
>> Signed-off-by: Bastian Stender <bst@pengutronix.de>
>> ---
>>   rules/barebox.make | 11 +++++++++--
>>   1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/rules/barebox.make b/rules/barebox.make
>> index bdfefe8c6..f37f2f5f2 100644
>> --- a/rules/barebox.make
>> +++ b/rules/barebox.make
>> @@ -89,8 +89,6 @@ ifdef PTXCONF_BAREBOX_EXTRA_ENV
>>   		else \
>>   			cp "$(path)" $(BAREBOX_DIR)/.ptxdist-defaultenv/; \
>>   		fi;)
>> -	@sed -i -e "s,^\(CONFIG_DEFAULT_ENVIRONMENT_PATH=.*\)\"$$,\1 .ptxdist-defaultenv\"," \
>> -		$(BAREBOX_DIR)/.config
>>   endif
>>   
>>   	@$(call touch)
>> @@ -101,6 +99,15 @@ endif
>>   
>>   $(STATEDIR)/barebox.compile:
>>   	@$(call targetinfo)
>> +
>> +ifdef PTXCONF_BAREBOX_EXTRA_ENV
>> +	@if test -e $(BAREBOX_CONFIG) -a \
> 
> Any reason for this check? $(BAREBOX_CONFIG) should always exist at that
> point because of the dependencies.

Right.

> 
>> +		$(shell grep -c -e "^CONFIG_DEFAULT_ENVIRONMENT_PATH=.*\.ptxdist-defaultenv" $(BAREBOX_DIR)/.config) -eq 0; then \
> 
> Don't use '$(shell ...)' here. That makes the execution time a bit fuzzy.
> '$$(grep ...) should work.

Okay, I'll send v3.

Bastian

-- 
Pengutronix e.K.
Industrial Linux Solutions
http://www.pengutronix.de/
Peiner Str. 6-8, 31137 Hildesheim, Germany
Amtsgericht Hildesheim, HRA 2686

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-14  8:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-13 16:49 [ptxdist] [PATCH v2] barebox: fix CONFIG_DEFAULT_ENVIRONMENT_PATH on (interrupted) oldconfig/nconfig/menuconfig Bastian Stender
2017-09-14  6:47 ` Michael Olbrich
2017-09-14  8:13   ` Bastian Stender

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox