mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: barebox@lists.infradead.org
Cc: Ian Abbott <abbotti@mev.co.uk>
Subject: [PATCH v2] scripts: socfpga_import_preloader: Translate DOS line endings
Date: Thu, 15 Jun 2023 16:57:38 +0100	[thread overview]
Message-ID: <20230615155738.39998-1-abbotti@mev.co.uk> (raw)
In-Reply-To: <20230615135526.30878-1-abbotti@mev.co.uk>

If the handoff files were generated on a Windows system, they will have
DOS line endings.  The `indent` program (with the options used by the
script) does a lousy job tidying up those files, leaving ASCII CR
characters embedded in the lines.  This is particularly bad for array
initializers that have one value per line, because they all end up on a
single line with embedded ASCII CR characters between each value.

Add an initial `sed` command to `copy_source()` to match and remove an
ASCII CR character from the end of each input line.

Also output a message before running `unifdef` and fix the spelling of
"paths" in one of the other messages.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
v2: Corrected tabs in echoed output.
---
 scripts/socfpga_import_preloader | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/socfpga_import_preloader b/scripts/socfpga_import_preloader
index bd54e1b913..26a8556b1a 100755
--- a/scripts/socfpga_import_preloader
+++ b/scripts/socfpga_import_preloader
@@ -79,6 +79,10 @@ copy_source() {
 
 	cp $src $tgt
 
+	echo "	Translating DOS line endings..."
+	sed -i "s/`echo -e '\r'`$//" $tgt
+
+	echo "	Fixing conditional compilation..."
 	unifdef -D HCX_COMPAT_MODE=1 -D ENABLE_INST_ROM_WRITE=1 $tgt -o $tgt
 
 	echo "	Fixing extern/static keywords..."
@@ -99,7 +103,7 @@ copy_source() {
 	sed -i 's/alt_8/int8_t/g' $tgt
 	sed -i 's/#include "alt_types.h"//g' $tgt
 
-	echo "	Fixing include pathes..."
+	echo "	Fixing include paths..."
 	# Fix include pathes
 	sed -i 's/#include <iocsr_config_cyclone5.h>/#include <mach\/cyclone5-scan-manager.h>/g' $tgt
 	sed -i 's/#include <pinmux_config.h>/#include <common.h>/g' $tgt
-- 
2.39.2




  parent reply	other threads:[~2023-06-15 15:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 13:55 [PATCH] " Ian Abbott
2023-06-15 15:49 ` Ian Abbott
2023-06-15 15:57 ` Ian Abbott [this message]
2023-06-16  6:41   ` [PATCH v2] " Sascha Hauer
2023-06-16  9:19     ` Ian Abbott
2023-06-16 10:30       ` Sascha Hauer
2023-06-16 10:36         ` Ahmad Fatoum
2023-06-16 11:31           ` Sascha Hauer
2023-06-16 11:33             ` Sascha Hauer
2023-06-16 12:02         ` Ian Abbott
2023-06-16 12:31   ` [PATCH v3] " Ian Abbott
2023-06-16 12:35     ` Ahmad Fatoum
2023-06-21  9:34     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230615155738.39998-1-abbotti@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox