Skip to contentSkip to conversation

Fixes for BSD sed compatibility

PATCH New Roger Pau Monne 4 participants 9 messages Feb 13, 2021 – Feb 25, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.30.1
#1 lore raw

PATCH 1/2 scripts/check-config.sh: fix to be compatible with BSD sed

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.

---
Cc: Masahiro Yamada <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Wolfgang Wallner <[email protected]>
Cc: Jan Kiszka <[email protected]>

---
 scripts/check-config.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/check-config.sh +4 -4
index 583f7d0963..cc1c9a54d9 100755
@@ -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
Signature · 1 line
2.30.1
#2 lore raw

PATCH 1/2 scripts/check-config.sh: fix to be compatible with BSD sed

Quoted 10 lines · Roger Pau Monne

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.

Reviewed by: Warner Losh <[email protected]>

Quoted 43 lines

---
Cc: Masahiro Yamada <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Wolfgang Wallner <[email protected]>
Cc: Jan Kiszka <[email protected]>

---
 scripts/check-config.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/check-config.sh +4 -4
index 583f7d0963..cc1c9a54d9 100755
@@ -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"

#3 lore raw

PATCH 1/2 scripts/check-config.sh: fix to be compatible with BSD sed

In reply to Roger Pau Monne
Quoted 16 lines · Roger Pau Monne

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.

---
Cc: Masahiro Yamada <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Wolfgang Wallner <[email protected]>
Cc: Jan Kiszka <[email protected]>

Quoted 3 lines
---
 scripts/check-config.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
#4 lore raw

PATCH 1/2 scripts/check-config.sh: fix to be compatible with BSD sed

In reply to Roger Pau Monne
Quoted 10 lines · Roger Pau Monne

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
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>
#5 lore raw

PATCH 2/2 build/DTC: fix sed usage in DTC command

In reply to Roger Pau Monne

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.

---
Cc: Masahiro Yamada <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Wolfgang Wallner <[email protected]>
Cc: Jan Kiszka <[email protected]>

---
 scripts/Makefile.lib | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/Makefile.lib +1 -2
index 56e9d54242..78543c6dd1 100644
@@ -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)
Signature · 1 line
2.30.1
#6 lore raw

PATCH 2/2 build/DTC: fix sed usage in DTC command

Quoted 11 lines · Roger Pau Monne

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.

Reviewed by: Warner Losh <[email protected]>

Quoted 34 lines

---
Cc: Masahiro Yamada <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Wolfgang Wallner <[email protected]>
Cc: Jan Kiszka <[email protected]>

---
 scripts/Makefile.lib | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/Makefile.lib +1 -2
index 56e9d54242..78543c6dd1 100644
@@ -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"

#7 lore raw

PATCH 2/2 build/DTC: fix sed usage in DTC command

In reply to Roger Pau Monne

Ping?

Quoted 37 lines · Roger Pau Monne

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.

---
Cc: Masahiro Yamada <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Wolfgang Wallner <[email protected]>
Cc: Jan Kiszka <[email protected]>

---
 scripts/Makefile.lib | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/Makefile.lib +1 -2
index 56e9d54242..78543c6dd1 100644
@@ -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)
Signature · 1 line
2.30.1
#8 lore raw

PATCH 2/2 build/DTC: fix sed usage in DTC command

In reply to Roger Pau Monne
Quoted 10 lines · Roger Pau Monne

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.

Applied to u-boot/master, thanks!

Signature · 8 lines
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>