kumquat-buildroot/support/scripts
Ricardo Martincoski e7e30455ef Makefile: offload .gitlab-ci.yml generation
GitLab has severe limitations imposed to triggers.
Using a variable in a regexp is not allowed:
|    only:
|        - /-$CI_JOB_NAME$/
|        - /-\$CI_JOB_NAME$/
|        - /-%CI_JOB_NAME%$/
Using the key 'variables' always lead to an AND with 'refs', so:
|    only:
|        refs:
|            - branches
|            - tags
|        variables:
|            - $CI_JOB_NAME == $CI_COMMIT_REF_NAME
would make the push of a tag not to trigger all jobs anymore.
Inheritance is used only for the second level of keys, so:
|.runtime_test: &runtime_test
|    only:
|        - tags
|tests.package.test_python_txaio.TestPythonPy2Txaio:
|    <<: *runtime_test
|    only:
|        - /-TestPythonPy2Txaio$/
would override the entire key 'only', making the push of a tag not to
trigger all jobs anymore.

So, in order to have a trigger per job and still allow the push of a tag
to trigger all jobs (all this in a follow up patch), the regexp for each
job must be hardcoded in the .gitlab-ci.yml and also the inherited
values for key 'only' must be repeated for every job.
This is not a big issue, .gitlab-ci.yml is already automatically
generated from a template and there will be no need to hand-editing it
when jobs are added or removed.

Since the logic to generate the yaml file from the template will become
more complex, move the commands from the main Makefile to a script.

Using Python or other advanced scripting language for that script would
be the most versatile solution, but that would bring another dependency
on the host machine, pyyaml if Python is used. So every developer that
needs to run 'make .gitlab-ci.yml' and also the docker image used in the
GitLab pipelines would need to have pyyaml pre-installed.
Instead of adding the mentioned dependency, keep using a bash script.

While moving the commands to the script:
 - mimic the behavior of the previous make target and fail on any
   command that fails, by using 'set -e';
 - break the original lines in one command per line, making the diff for
   any patch to be applied to this file to look nicer;
 - keep the script as simple as possible, without functions, just a
   script that executes from the top to bottom;
 - do not perform validations on the input parameters, any command that
   fails already makes the script to fail;
 - do not add an usage message, the script is not intended to be called
   directly.

This patch does not change functionality.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
[Thomas: make the script output on stdout rather than take the output
file name as second argument.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-12-09 21:30:24 +01:00
..
apply-patches.sh support/scripts/apply-patches.sh: do not apply patches with renames 2017-09-19 22:51:25 +02:00
br2-external support/scripts: fix shebang with bash 2017-06-08 21:43:05 +02:00
brpkgutil.py support/scripts/graph-depends: use the standard python logging module 2018-04-01 22:25:57 +02:00
check-bin-arch boot/grub2: add option to install tools 2018-11-26 20:59:33 +01:00
check-host-rpath support/scripts/check-host-rpath: split condition on two statements 2018-11-26 19:08:57 +01:00
check-kernel-headers.sh check-kernel-headers: mktemp --tmpdir not available on RedHat RHEL5 2014-09-28 20:40:57 +02:00
check-uniq-files support/scripts/check-uniq-files: remove csv module import 2018-04-25 21:19:22 +02:00
eclipse-register-toolchain eclipse-register-toolchain: toolchain is no longer installed in $(HOST_DIR)/usr 2017-07-05 16:06:27 +02:00
expunge-gconv-modules Change /bin/bash shebangs into /usr/bin/env bash 2014-10-25 01:55:37 +02:00
fix-configure-powerpc64.sh support/scripts: fix shebang with bash 2017-06-08 21:43:05 +02:00
fix-rpath support/scripts/fix-rpath: exclude /lib/firmware in the target 2018-04-12 21:15:49 +02:00
generate-gitlab-ci-yml Makefile: offload .gitlab-ci.yml generation 2018-12-09 21:30:24 +01:00
genimage.sh support/scripts/genimage.sh: show usage when invoked incorrectly 2017-12-11 20:14:39 +01:00
graph-build-time package/pkg-generic.mk: increase precision of timestamps 2018-10-10 21:30:51 +02:00
graph-depends support/scripts/graph-depends: introduce MANDATORY_DEPS array 2018-12-06 22:17:07 +01:00
hardlink-or-copy support/scripts: fix shebang with bash 2017-06-08 21:43:05 +02:00
mkmakefile support/scripts/mkmakefile: make wrapper silent by default 2018-11-02 21:23:02 +01:00
mkusers support/scripts/mkusers: preserve group members 2018-09-12 21:22:25 +02:00
pkg-stats support/scripts/pkg-stats: URL check using threads 2018-10-09 10:11:47 +02:00
pycompile.py pycompile: fix code style 2018-01-29 23:14:24 +01:00
setlocalversion setlocalversion: fix detection of hg revision for untagged versions 2017-07-03 11:40:49 +02:00
size-stats size-stats: fix code style 2018-01-29 23:14:24 +01:00