interpreters/berry: Normalize CRLF before patching#3567
Conversation
Berry's downloaded default/berry.c uses CRLF line endings, while the local NuttX patch is stored with LF line endings. Fresh Linux and CMake builds fail when patch sees the different line endings. Normalize the downloaded source file before applying the patch in both Make and CMake fetch paths. Signed-off-by: Frederick Blais <fred_blais5@hotmail.com>
|
Hi @xiaoxiang781216, Is this related to any recent changes? |
|
@xiaoxiang781216 there are two places where the old symbol still used: |
| $(Q) unzip -q -o $(BERRY_ARCHIVE) | ||
| $(call DELDIR, $(BERRY_UNPACK)) | ||
| $(Q) mv berry-$(BERRY_COMMIT_ID) $(BERRY_UNPACK) | ||
| $(Q) python3 $(BERRY_FIX_CRLF) $(BERRY_MAIN) |
There was a problem hiding this comment.
but why not patch to \r\n version, or upstream the patch (convert '\r\n' to '\n' in berry.c) to the community.
There was a problem hiding this comment.
I already upstreamed the Berry-side change here: berry-lang/berry#539. That PR is approved, but it has not been merged yet.
For this NuttX apps PR, I normalized the downloaded default/berry.c before applying the existing patch because the current pinned Berry archive still contains CRLF line endings, while the NuttX patch is LF. This keeps the patch file in the normal NuttX text format and makes both Make and CMake fetch paths apply it reliably.
If you prefer, I can switch this PR to a CRLF-formatted patch instead. Once berry-lang/berry#539 is merged, I can also update the pinned Berry commit and remove the local NuttX patch entirely.
here is the fix: #3568 |
Berry upstream stores
default/berry.cwith CRLF line endings, while the local NuttX patch is LF. Fresh Make and CMake builds can therefore fail before Berry is compiled because GNU patch rejects the hunks as line-ending mismatches.Normalize the downloaded Berry
default/berry.cbefore applying the existing NuttX patch in both Make and CMake fetch paths.Tested:
fix-crlf.py+patch -l -p1applies and updatesOS_NAME/optvalue../tools/configure.sh -a ../apps sim:berry && make olddefconfig && make -j8berry -vprintsBerry 1.1.0;berry -e print(40+2)prints42../tools/testbuild.sh -m -C -N -x -j 8 -a ../apps -t /tmp/nuttx_current_berry /tmp/berry-cmake-testlist.dattools/checkpatch.sh -c -u -m -g origin/master..HEAD/dev/cu.usbmodem101: flashedesp32c3-devkit:usbconsolewith Berry enabled;berry -vprintsBerry 1.1.0;berry -e print(40+2)prints42.Signed-off-by: Frederick Blais fred_blais5@hotmail.com