From patchwork Wed Jan 18 11:36:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 6438 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4NxkHS4bh1z43VW for ; Wed, 18 Jan 2023 11:36:36 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4NxkHR3sZjzwh; Wed, 18 Jan 2023 11:36:35 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4NxkHR1MHKz30Gp; Wed, 18 Jan 2023 11:36:35 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4NxkHP2bGNz2yjs for ; Wed, 18 Jan 2023 11:36:33 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "michael.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4NxkHN489kzR8; Wed, 18 Jan 2023 11:36:32 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4NxkHN32lNzVc6g; Wed, 18 Jan 2023 11:36:32 +0000 (UTC) From: Michael Tremer 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 Message-Id: <20230118113628.3309496-1-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" 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 Acked-by: Peter Müller --- 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; \