public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 0/2] Fixes for BSD sed compatibility
@ 2021-02-13 10:06 Roger Pau Monne
  2021-02-13 10:06 ` [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed Roger Pau Monne
  2021-02-13 10:06 ` [PATCH 2/2] build/DTC: fix sed usage in DTC command Roger Pau Monne
  0 siblings, 2 replies; 9+ messages in thread
From: Roger Pau Monne @ 2021-02-13 10:06 UTC (permalink / raw)
  To: u-boot

Hello,

This series contain two fixes that allow me to build U-Boot with FreeBSD
sed instead of GNU sed.

Shouldn't introduce any functional change.

Thanks, Roger.

Roger Pau Monn? (2):
  scripts/check-config.sh: fix to be compatible with BSD sed
  build/DTC: fix sed usage in DTC command

 scripts/Makefile.lib    | 3 +--
 scripts/check-config.sh | 8 ++++----
 2 files changed, 5 insertions(+), 6 deletions(-)

-- 
2.30.1

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

* [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed
  2021-02-13 10:06 [PATCH 0/2] Fixes for BSD sed compatibility Roger Pau Monne
@ 2021-02-13 10:06 ` Roger Pau Monne
  2021-02-13 16:42   ` Warner Losh
                     ` (2 more replies)
  2021-02-13 10:06 ` [PATCH 2/2] build/DTC: fix sed usage in DTC command Roger Pau Monne
  1 sibling, 3 replies; 9+ messages in thread
From: Roger Pau Monne @ 2021-02-13 10:06 UTC (permalink / raw)
  To: u-boot

Fist use extended regexp in order to drop the '\' around the
parentheses which is not supported by BSD sed in regular mode.

Secondly use [[:blank:]] instead of \s, as the later is a GNU
extension.

No functional change intended.

Signed-off-by: Roger Pau Monn? <royger@FreeBSD.org>
---
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
---
 scripts/check-config.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/check-config.sh b/scripts/check-config.sh
index 583f7d0963..cc1c9a54d9 100755
--- a/scripts/check-config.sh
+++ b/scripts/check-config.sh
@@ -39,14 +39,14 @@ new_adhoc="${path}.adhoc"
 export LC_ALL=C
 export LC_COLLATE=C
 
-cat ${path} |sed -n 's/^#define \(CONFIG_[A-Za-z0-9_]*\).*/\1/p' |sort |uniq \
+cat ${path} |sed -nr 's/^#define (CONFIG_[A-Za-z0-9_]*).*/\1/p' |sort |uniq \
 	>${configs}
 
 comm -23 ${configs} ${whitelist} > ${suspects}
 
-cat `find ${srctree} -name "Kconfig*"` |sed -n \
-	-e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
-	-e 's/^\s*menuconfig \([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
+cat `find ${srctree} -name "Kconfig*"` |sed -nr \
+	-e 's/^[[:blank:]]*config *([A-Za-z0-9_]*).*$/CONFIG_\1/p' \
+	-e 's/^[[:blank:]]*menuconfig ([A-Za-z0-9_]*).*$/CONFIG_\1/p' \
 	|sort |uniq > ${ok}
 comm -23 ${suspects} ${ok} >${new_adhoc}
 if [ -s ${new_adhoc} ]; then
-- 
2.30.1

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

* [PATCH 2/2] build/DTC: fix sed usage in DTC command
  2021-02-13 10:06 [PATCH 0/2] Fixes for BSD sed compatibility Roger Pau Monne
  2021-02-13 10:06 ` [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed Roger Pau Monne
@ 2021-02-13 10:06 ` Roger Pau Monne
  2021-02-13 16:43   ` Warner Losh
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Roger Pau Monne @ 2021-02-13 10:06 UTC (permalink / raw)
  To: u-boot

Current sed usage in the DTC command relies on GNU sed specific -i
option which has a slightly different syntax for BSD sed and always
expects an extension to be provided in order to create a backup file.

Instead drop the cat concatenation done before the sed call and use
sed itself to edit and concatenate the files.

No functional change intended.

Signed-off-by: Roger Pau Monn? <royger@FreeBSD.org>
---
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
---
 scripts/Makefile.lib | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 56e9d54242..78543c6dd1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -326,8 +326,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
 		-d $(depfile).dtc.tmp $(dtc-tmp) || \
 		(echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
 		; \
-	cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \
-	sed -i "s:$(pre-tmp):$(<):" $(depfile)
+	sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
 
 $(obj)/%.dtb: $(src)/%.dts FORCE
 	$(call if_changed_dep,dtc)
-- 
2.30.1

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

* [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed
  2021-02-13 10:06 ` [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed Roger Pau Monne
@ 2021-02-13 16:42   ` Warner Losh
  2021-02-18  4:45   ` Simon Glass
  2021-02-25 13:25   ` Tom Rini
  2 siblings, 0 replies; 9+ messages in thread
From: Warner Losh @ 2021-02-13 16:42 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 13, 2021 at 3:06 AM Roger Pau Monne <royger@freebsd.org> wrote:

> Fist use extended regexp in order to drop the '\' around the
> parentheses which is not supported by BSD sed in regular mode.
>
> Secondly use [[:blank:]] instead of \s, as the later is a GNU
> extension.
>
> No functional change intended.
>
> Signed-off-by: Roger Pau Monn? <royger@FreeBSD.org>
>

Reviewed  by: Warner Losh <imp@FreeBSD.org>


> ---
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  scripts/check-config.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/check-config.sh b/scripts/check-config.sh
> index 583f7d0963..cc1c9a54d9 100755
> --- a/scripts/check-config.sh
> +++ b/scripts/check-config.sh
> @@ -39,14 +39,14 @@ new_adhoc="${path}.adhoc"
>  export LC_ALL=C
>  export LC_COLLATE=C
>
> -cat ${path} |sed -n 's/^#define \(CONFIG_[A-Za-z0-9_]*\).*/\1/p' |sort
> |uniq \
> +cat ${path} |sed -nr 's/^#define (CONFIG_[A-Za-z0-9_]*).*/\1/p' |sort
> |uniq \
>         >${configs}
>
>  comm -23 ${configs} ${whitelist} > ${suspects}
>
> -cat `find ${srctree} -name "Kconfig*"` |sed -n \
> -       -e 's/^\s*config *\([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
> -       -e 's/^\s*menuconfig \([A-Za-z0-9_]*\).*$/CONFIG_\1/p' \
> +cat `find ${srctree} -name "Kconfig*"` |sed -nr \
> +       -e 's/^[[:blank:]]*config *([A-Za-z0-9_]*).*$/CONFIG_\1/p' \
> +       -e 's/^[[:blank:]]*menuconfig ([A-Za-z0-9_]*).*$/CONFIG_\1/p' \
>         |sort |uniq > ${ok}
>  comm -23 ${suspects} ${ok} >${new_adhoc}
>  if [ -s ${new_adhoc} ]; then
> --
> 2.30.1
>
> _______________________________________________
> freebsd-uboot at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-uboot
> To unsubscribe, send any mail to "freebsd-uboot-unsubscribe at freebsd.org"
>

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

* [PATCH 2/2] build/DTC: fix sed usage in DTC command
  2021-02-13 10:06 ` [PATCH 2/2] build/DTC: fix sed usage in DTC command Roger Pau Monne
@ 2021-02-13 16:43   ` Warner Losh
  2021-02-22  9:17   ` Roger Pau Monné
  2021-02-25 13:25   ` Tom Rini
  2 siblings, 0 replies; 9+ messages in thread
From: Warner Losh @ 2021-02-13 16:43 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 13, 2021 at 3:06 AM Roger Pau Monne <royger@freebsd.org> wrote:

> Current sed usage in the DTC command relies on GNU sed specific -i
> option which has a slightly different syntax for BSD sed and always
> expects an extension to be provided in order to create a backup file.
>
> Instead drop the cat concatenation done before the sed call and use
> sed itself to edit and concatenate the files.
>
> No functional change intended.
>
> Signed-off-by: Roger Pau Monn? <royger@FreeBSD.org>
>

Reviewed by: Warner Losh <imp@FreeBSD.org>


> ---
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  scripts/Makefile.lib | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 56e9d54242..78543c6dd1 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -326,8 +326,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
>                 -d $(depfile).dtc.tmp $(dtc-tmp) || \
>                 (echo "Check $(shell pwd)/$(pre-tmp) for errors" && false)
> \
>                 ; \
> -       cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \
> -       sed -i "s:$(pre-tmp):$(<):" $(depfile)
> +       sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp >
> $(depfile)
>
>  $(obj)/%.dtb: $(src)/%.dts FORCE
>         $(call if_changed_dep,dtc)
> --
> 2.30.1
>
> _______________________________________________
> freebsd-uboot at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-uboot
> To unsubscribe, send any mail to "freebsd-uboot-unsubscribe at freebsd.org"
>

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

* [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed
  2021-02-13 10:06 ` [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed Roger Pau Monne
  2021-02-13 16:42   ` Warner Losh
@ 2021-02-18  4:45   ` Simon Glass
  2021-02-25 13:25   ` Tom Rini
  2 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2021-02-18  4:45 UTC (permalink / raw)
  To: u-boot

On Sat, 13 Feb 2021 at 03:06, Roger Pau Monne <royger@freebsd.org> wrote:
>
> Fist use extended regexp in order to drop the '\' around the
> parentheses which is not supported by BSD sed in regular mode.
>
> Secondly use [[:blank:]] instead of \s, as the later is a GNU
> extension.
>
> No functional change intended.
>
> Signed-off-by: Roger Pau Monn? <royger@FreeBSD.org>
> ---
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  scripts/check-config.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

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

* [PATCH 2/2] build/DTC: fix sed usage in DTC command
  2021-02-13 10:06 ` [PATCH 2/2] build/DTC: fix sed usage in DTC command Roger Pau Monne
  2021-02-13 16:43   ` Warner Losh
@ 2021-02-22  9:17   ` Roger Pau Monné
  2021-02-25 13:25   ` Tom Rini
  2 siblings, 0 replies; 9+ messages in thread
From: Roger Pau Monné @ 2021-02-22  9:17 UTC (permalink / raw)
  To: u-boot

Ping?

On Sat, Feb 13, 2021 at 11:06:32AM +0100, Roger Pau Monne wrote:
> Current sed usage in the DTC command relies on GNU sed specific -i
> option which has a slightly different syntax for BSD sed and always
> expects an extension to be provided in order to create a backup file.
> 
> Instead drop the cat concatenation done before the sed call and use
> sed itself to edit and concatenate the files.
> 
> No functional change intended.
> 
> Signed-off-by: Roger Pau Monn? <royger@FreeBSD.org>
> ---
> Cc: Masahiro Yamada <masahiroy@kernel.org>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Michal Simek <michal.simek@xilinx.com>
> Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  scripts/Makefile.lib | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 56e9d54242..78543c6dd1 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -326,8 +326,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
>  		-d $(depfile).dtc.tmp $(dtc-tmp) || \
>  		(echo "Check $(shell pwd)/$(pre-tmp) for errors" && false) \
>  		; \
> -	cat $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) ; \
> -	sed -i "s:$(pre-tmp):$(<):" $(depfile)
> +	sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
>  
>  $(obj)/%.dtb: $(src)/%.dts FORCE
>  	$(call if_changed_dep,dtc)
> -- 
> 2.30.1
> 

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

* [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed
  2021-02-13 10:06 ` [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed Roger Pau Monne
  2021-02-13 16:42   ` Warner Losh
  2021-02-18  4:45   ` Simon Glass
@ 2021-02-25 13:25   ` Tom Rini
  2 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-02-25 13:25 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 13, 2021 at 11:06:31AM +0100, Roger Pau Monne wrote:

> Fist use extended regexp in order to drop the '\' around the
> parentheses which is not supported by BSD sed in regular mode.
> 
> Secondly use [[:blank:]] instead of \s, as the later is a GNU
> extension.
> 
> No functional change intended.
> 
> Signed-off-by: Roger Pau Monn? <royger@FreeBSD.org>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210225/0744087c/attachment.sig>

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

* [PATCH 2/2] build/DTC: fix sed usage in DTC command
  2021-02-13 10:06 ` [PATCH 2/2] build/DTC: fix sed usage in DTC command Roger Pau Monne
  2021-02-13 16:43   ` Warner Losh
  2021-02-22  9:17   ` Roger Pau Monné
@ 2021-02-25 13:25   ` Tom Rini
  2 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2021-02-25 13:25 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 13, 2021 at 11:06:32AM +0100, Roger Pau Monne wrote:

> Current sed usage in the DTC command relies on GNU sed specific -i
> option which has a slightly different syntax for BSD sed and always
> expects an extension to be provided in order to create a backup file.
> 
> Instead drop the cat concatenation done before the sed call and use
> sed itself to edit and concatenate the files.
> 
> No functional change intended.
> 
> Signed-off-by: Roger Pau Monn? <royger@FreeBSD.org>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210225/e1460cde/attachment.sig>

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

end of thread, other threads:[~2021-02-25 13:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-13 10:06 [PATCH 0/2] Fixes for BSD sed compatibility Roger Pau Monne
2021-02-13 10:06 ` [PATCH 1/2] scripts/check-config.sh: fix to be compatible with BSD sed Roger Pau Monne
2021-02-13 16:42   ` Warner Losh
2021-02-18  4:45   ` Simon Glass
2021-02-25 13:25   ` Tom Rini
2021-02-13 10:06 ` [PATCH 2/2] build/DTC: fix sed usage in DTC command Roger Pau Monne
2021-02-13 16:43   ` Warner Losh
2021-02-22  9:17   ` Roger Pau Monné
2021-02-25 13:25   ` Tom Rini

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