From 272f4d753fb1edb295985395be2620af5f66e59c Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Wed, 31 May 2023 09:11:25 +0200
Subject: [PATCH] Fix issue where modifying certain wrapper files would cause
 failure

The issue was that `git status --porcelain` formats its output in such
a way that `make` no longer passes the variables correctly. The solution
is simply to no longer pass the `git status` data.

Note that the git status data already was not that sufficient in terms
of recognising what changes had been made, since all it provided was
information as to which files had been modified, not how they had been
modified.
---
 CHANGELOG.md                      | 2 ++
 configure/E3/CONFIG_E3_MAKEFILE   | 2 --
 require-ess/tools/driver.makefile | 8 +-------
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index d5eed113..12ddf28b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Bugfixes
 
 * Fixed an issue where .template and .substitutions files with the same name would build incorrectly
+* Fixed an issue where filenames with spaces in them that had been modified
+in the wrapper would cause all of the module `make` commands to fail.
 
 ### Other changes
 
diff --git a/configure/E3/CONFIG_E3_MAKEFILE b/configure/E3/CONFIG_E3_MAKEFILE
index f0832ef0..7eaa0fca 100644
--- a/configure/E3/CONFIG_E3_MAKEFILE
+++ b/configure/E3/CONFIG_E3_MAKEFILE
@@ -14,11 +14,9 @@ ifeq ($(shell git status > /dev/null 2>&1; echo $$?),0)
 GIT_REMOTE_NAME := $(shell git remote | head -n 1)
 
 E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += $(E3_MODULE_NAME)_E3_GIT_DESC="$(shell git rev-parse HEAD 2> /dev/null || echo 'Not a git repository')"
-E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += $(E3_MODULE_NAME)_E3_GIT_STATUS="[ $(shell git status --porcelain | sed 's/^/\\\\\\\"/' | sed 's/$$/\\\\\\\", /')]"
 E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += $(E3_MODULE_NAME)_E3_GIT_URL="$(shell git config --get remote.$(GIT_REMOTE_NAME).url 2> /dev/null | sed 's%^https://[^@]*@%https://%')"
 else
 E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += $(E3_MODULE_NAME)_E3_GIT_DESC=
-E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += $(E3_MODULE_NAME)_E3_GIT_STATUS=
 E3_REQUIRE_MAKEFILE_INPUT_OPTIONS += $(E3_MODULE_NAME)_E3_GIT_URL=
 endif
 
diff --git a/require-ess/tools/driver.makefile b/require-ess/tools/driver.makefile
index 25bd11ee..2a73786a 100644
--- a/require-ess/tools/driver.makefile
+++ b/require-ess/tools/driver.makefile
@@ -428,14 +428,10 @@ export BINS
 VLIBS = $(VENDOR_LIBS) $(foreach x,$(VAR_EXTENSIONS),$(VENDOR_LIBS_$x))
 export VLIBS
 
-# These variables are written into a .yaml file in the installed module directory to keep track of
+# This variable is written into a .yaml file in the installed module directory to keep track of
 # metadata for which module was compiled.
-
 ${PRJ}_GIT_DESC := $(shell git rev-parse HEAD 2> /dev/null)
 export ${PRJ}_GIT_DESC
-# The formatting here is just to make sure this is properly parseable .yaml data
-${PRJ}_GIT_STATUS := [ $(shell git status --porcelain 2> /dev/null | grep -v "\.Makefile" | sed 's/^/\\\"/' | sed 's/$$/\\\", /')]
-export ${PRJ}_GIT_STATUS
 
 else # in O.*
 ## RUN 3
@@ -726,9 +722,7 @@ ${REGISTRYFILE}: ${MODULEDBD}
 ${METAFILE}:
 	@echo "wrapper_url: '$(${PRJ}_E3_GIT_URL)'" > $@
 	@echo "wrapper_git_desc: '$(${PRJ}_E3_GIT_DESC)'" >> $@
-	@echo "wrapper_diffs: $(${PRJ}_E3_GIT_STATUS)" >> $@
 	@echo "module_git_desc: '$(${PRJ}_GIT_DESC)'" >> $@
-	@echo "module_diffs: $(${PRJ}_GIT_STATUS)" >> $@
 
 define DEP_PARSER
 s%$(E3_SITEMODS_PATH)/*\([^/]*\)/\([^/]*\)/.*%\1 \2%p; \
-- 
GitLab