From 8a77d7a337bf9a64f4235099a932553cea5b577b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Riette?= <sebastien.riette@meteo.fr>
Date: Fri, 3 Jun 2022 12:55:09 +0200
Subject: [PATCH] Add the possibility to suppress files when preparing source
 code for a model

---
 check_commit_ial.sh                |  2 +-
 conf_tests/small_3D_np1/aro48t1.sh |  2 +-
 prep_code.sh                       | 12 +++++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/check_commit_ial.sh b/check_commit_ial.sh
index a78a2b74f..52d8b0b9c 100755
--- a/check_commit_ial.sh
+++ b/check_commit_ial.sh
@@ -14,7 +14,7 @@ set -e
 #small_3D_alt4: small_3D_alt1 + CSNOWRIMING='OLD'
 #small_3D_alt5: CCLOUD='ICE4'
 #small_3D_alt6: CMF_UPDRAFT='RAHA', CMF_CLOUD='BIGA'
-#small_3D_alt7: CMF_UPDRAFT='RHCJ', CMF_CLOUD='STAT', LOSIGMAS=.FALSE. #Needs 2 corrections in original cycle 48
+#small_3D_alt7: CMF_CLOUD='STAT', LOSIGMAS=.FALSE. #Needs 2 corrections in original cycle 48
 #small_3D_alt8: CMF_UPDRAFT='RHCJ'
 
 #The small_3D_alt8 is not included in the list of available tests because it needs to be compared against a special commit.
diff --git a/conf_tests/small_3D_np1/aro48t1.sh b/conf_tests/small_3D_np1/aro48t1.sh
index 2c1897d85..a833e9977 100755
--- a/conf_tests/small_3D_np1/aro48t1.sh
+++ b/conf_tests/small_3D_np1/aro48t1.sh
@@ -6,7 +6,7 @@
 #SBATCH -N 1
 #SBATCH -p normal256
 
-#The MYLIB varibale must contain the gmkpack pack name
+#The MYLIB variable must contain the gmkpack pack name
 #The TESTDIR variable must contain the test directory
 #Results will be stored in the local directory
 
diff --git a/prep_code.sh b/prep_code.sh
index 44529ccfc..bdb1c102f 100755
--- a/prep_code.sh
+++ b/prep_code.sh
@@ -146,7 +146,17 @@ if [ -n "${model-}" ]; then
     [ -e src/$model/$sub ] && cp -rlf src/$model/$sub . && rm -rf src/$model/$sub
   done
 
-  #cleaning
+  #Supression of unwanted files
+  if [ -f src/$model/filesToSuppress.txt ]; then
+    #Some files can be present in the common directory but are not wanted for a model export
+    #because these files are already existing elsewhere in the model source code
+    while read -r line; do
+      filename=$(echo $line | sed -e 's/^[[:space:]]*//' | sed -e 's/[[:space:]]*$//') #trim
+      [ -f "$filename" ] && rm -f "$filename"
+    done < src/$model/filesToSuppress.txt
+  fi
+
+  #Cleaning
   [ $verbose -gt 0 ] && echo "Cleaning unrelevant files"
   #multiple checks to prevent error
   if [ $from == 'git' -a ! $(git config --get remote.origin.url) == "$repository" ]; then
-- 
GitLab