[PATCH 0/2] Fixes for BSD sed compatibility

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(-)

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

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@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-uboot To unsubscribe, send any mail to "freebsd-uboot-unsubscribe@freebsd.org"

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

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!

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)

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@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-uboot To unsubscribe, send any mail to "freebsd-uboot-unsubscribe@freebsd.org"

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

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!
participants (5)
-
Roger Pau Monne
-
Roger Pau Monné
-
Simon Glass
-
Tom Rini
-
Warner Losh