gitlab-ci: introduce main() in generating script
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 6 Sep 2020 20:12:20 +0000 (22:12 +0200)
committerYann E. MORIN <yann.morin.1998@free.fr>
Wed, 9 Sep 2020 07:24:16 +0000 (09:24 +0200)
This script is currently very crude, but we're going to extend it, at
which point it will be nicer to have functions, local variables, et al.

Introduce a main() in preparation of those future evolutions.

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Romain Naour <romain.naour@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
support/scripts/generate-gitlab-ci-yml

index 5cef1146e25fc93723f8c2189c57797d8a62022d..51f7de21ddd325560772b4b4bc009c298315f98f 100755 (executable)
@@ -2,16 +2,20 @@
 set -e
 set -o pipefail
 
-input="${1}"
+main() {
+    local template="${1}"
 
-cat "${input}"
+    cat "${template}"
 
-(
-    cd configs
-    LC_ALL=C ls -1 *_defconfig
-) \
+    (
+        cd configs
+        LC_ALL=C ls -1 *_defconfig
+    ) \
     | sed -r -e 's/^(.+)$/\1: { extends: .defconfig }\n\1_check: { extends: .defconfig_check }/'
 
-./support/testing/run-tests -l 2>&1 \
+    ./support/testing/run-tests -l 2>&1 \
     | sed -r -e '/^test_run \((.*)\).*/!d; s//\1: { extends: .runtime_test }/' \
     | LC_ALL=C sort
+}
+
+main "${@}"