public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 1/3] Config: Support rootfiles with spaces in filenames
Date: Wed, 18 Jan 2023 11:36:26 +0000	[thread overview]
Message-ID: <20230118113628.3309496-1-michael.tremer@ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 2346 bytes --]

Our build scripts can't handle any spaces in filenames. This is being
fixed by this patch with only a slightly changed set of shell commands.

Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
---
 lfs/Config | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/lfs/Config b/lfs/Config
index 1d02e969c..2b2e9f569 100644
--- a/lfs/Config
+++ b/lfs/Config
@@ -294,9 +294,8 @@ define POSTBUILD
 	@rm -rf $(GOPATH) /root/.cargo
 	@$(FIND_FILES) > $(DIR_SRC)/lsalrnew
 	@diff $(DIR_SRC)/lsalr $(DIR_SRC)/lsalrnew | grep '^> ' | sed 's/^> //' > $(TARGET)_diff
-	@cp -f $(DIR_SRC)/lsalrnew $(DIR_SRC)/lsalr
-	@rm -f $(DIR_SRC)/lsalrnew
-	sed -i -e 's+.\/++' $(TARGET)_diff
+	@mv -f $(DIR_SRC)/lsalrnew $(DIR_SRC)/lsalr
+	@sed -i -e 's+.\/++' $(TARGET)_diff
 	# compare roofile ( same name as lfs script) with the list of installed files
 	# special cases
 	# - if the corresponding rootfile is not found, touch $(TARGET)_missing_rootfile
@@ -305,7 +304,7 @@ define POSTBUILD
 	# ROOTFILE : reference of include/exclude files
 	# $(TARGET)_rootfile : ROOTFILE with KVER replacement
 	# $(TARGET) : log result with {commented|include|added} files
-	if [ -s "$(TARGET)_diff" ]; then \
+	@if [ -s "$(TARGET)_diff" ]; then \
 		LFS_SCRIPT=$(firstword $(MAKEFILE_LIST))$(KCFG); \
 		echo $(LFS_SCRIPT); \
 		ROOTFILE=$$(find -L $(DIR_SRC)/config/rootfiles/{common,packages}/{$(BUILD_ARCH),} -maxdepth 1 -type f -name $$LFS_SCRIPT 2>/dev/null | head -1); \
@@ -315,13 +314,13 @@ define POSTBUILD
 			echo "error $$LFS_SCRIPT not found in config/rootfiles"; \
 		fi; \
 		sed -e "s/BUILDTARGET/$(BUILDTARGET)/g" -e "s/KVER/$(KVER)/g" -e "s/xxxMACHINExxx/$(BUILD_ARCH)/g" $$ROOTFILE > $(TARGET)_rootfile; \
-		for line in `cat $(TARGET)_diff`; do \
+		while read -r line; do \
 			if grep -qG "^#$$line$$" $(TARGET)_rootfile; then echo "#$$line" >> $(TARGET); \
 			elif grep -qG "^$$line$$" $(TARGET)_rootfile ; then echo "$$line" >> $(TARGET); \
 			else echo "+$$line" >> $(TARGET); \
 			fi; \
-		done; \
-		for line in `grep -v "^#" $(TARGET)_rootfile`; do \
+		done < $(TARGET)_diff; \
+		grep -v "^#" $(TARGET)_rootfile | while read -r line; do \
 			if ! grep -qG "^$$line$$" $(TARGET)_diff ; then echo "-$$line" >> $(TARGET); \
 			fi; \
 		done; \
-- 
2.30.2


             reply	other threads:[~2023-01-18 11:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-18 11:36 Michael Tremer [this message]
2023-01-18 11:36 ` [PATCH 2/3] linux-firmware: Drop hack to remove " Michael Tremer
2023-01-18 23:25   ` Peter Müller
2023-01-18 11:36 ` [PATCH 3/3] rootfiles: Remove further spaces Michael Tremer
2023-01-18 23:26   ` Peter Müller
2023-01-18 23:25 ` [PATCH 1/3] Config: Support rootfiles with spaces in filenames Peter Müller

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=20230118113628.3309496-1-michael.tremer@ipfire.org \
    --to=michael.tremer@ipfire.org \
    --cc=development@lists.ipfire.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