From f54619d1667d9cc1741419ed83c5f5c124d4604d Mon Sep 17 00:00:00 2001 From: Philippe Schenker Date: Fri, 19 Feb 2021 10:04:17 +0100 Subject: Add license checking in CI --- .gitlab-ci.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e70af0..a4b2919 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,22 +1,22 @@ -variables: -# uncomment for the pipeline debug purpose - CI_DEBUG_TRACE: "true" - CI_IMAGE: gitlab.int.toradex.com:4567/philippe.schenker/linux-toradex/ci-kernel-builder:gcc9 - DOCKER_HOST: tcp://docker:2375 - DOCKER_DRIVER: overlay2 - DOCKER_TLS_CERTDIR: "" - stages: - - empty-stub + - check-license -prepare_kernel: - stage: empty-stub - image: $CI_IMAGE +check-license_job: + stage: check-license variables: - GIT_STRATEGY: fetch - GIT_DEPTH: "1" - script: | - echo "Just return true. For now it is too tough to implement a real overlay checking." - echo "It depends on possibly unmerged changes in the corresponding branch of linux kernel." - true + EXPECTED_LIC_STR: "SPDX-License-Identifier: GPL-2.0-or-later OR MIT" + script: + - cd $CI_PROJECT_DIR/overlays + - | + for DTO in $(ls *dts) + do + head -n 1 $DTO | \ + grep -q "${EXPECTED_LIC_STR}" || \ + ERRMSG="${ERRMSG}License mssing, wrong or not on 1st line: ${DTO} \n" + done + if [ "${ERRMSG}" ] + then + echo -ne $ERRMSG + exit -1 + fi -- cgit v1.2.3