From patchwork Tue Apr 21 17:17:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 26531 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 076B1C324E for ; Tue, 21 Apr 2026 17:17:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 320FA62EFD; Tue, 21 Apr 2026 19:17:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="MhwvIr+V"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D80A62DC4 for ; Tue, 21 Apr 2026 19:17:37 +0200 (CEST) Received: from killaraus.ideasonboard.com (2001-14ba-703d-e500--2a1.rev.dnainternet.fi [IPv6:2001:14ba:703d:e500::2a1]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 261E3B5 for ; Tue, 21 Apr 2026 19:15:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1776791759; bh=CoyWmkzKih8SveyAaZXSgrHM50PmcMv3dvDZyVJVC3M=; h=From:To:Subject:Date:From; b=MhwvIr+V4Iw7bwhtmhb0ED4Wd+vUurUoR6mNOsF9W3yo4o/gKgS60B9rUaEFzK4SH Fbfa4PVAU8d2ywIF0bQqslAZeVa1tToxkKmYRGZDDKT1KoZn+DHYYV/FRVSo7vmGnx ojv3/7nh+eYWRP8rVozQ5LkJyo664+t20fY2aots= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [libcamera-ci] [PATCH v2] Add lint job to check licenses Date: Tue, 21 Apr 2026 20:17:33 +0300 Message-ID: <20260421171735.2483517-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" libcamera uses REUSE to hhelp with license compliance. Every file in the source tree is required to have a valid SPDX license identifier, directly within the file or through REUSE.toml. Add a lint job that verifies this using the reuse lint tool. We need to add SPDX license identifiers to the meson native files as they are being copied to the source tree and the reuse tool doesn't have an option to specify files to ignore. For the same reason, remove the .work/ci-config/ directory after setting up the build environment. Signed-off-by: Laurent Pinchart Reviewed-by: Barnabás Pőcze --- Changes since v1: - Report bad licenses and missing licenses --- Here's how a failed job looks like ([1]: Running reuse for test (01b5274b900ebc078a728e4ae0b0f1a9eda8b3b4) 00:04 The following files use a bad license: "meson.build" The following files use a missing license: "meson.build" "include/linux/media-bus-format.h" "include/linux/media/v4l2-isp.h" "include/linux/bcm2835-isp.h" "include/linux/dw100.h" "include/linux/v4l2-common.h" "include/linux/mali-c55-config.h" "include/linux/v4l2-subdev.h" "include/linux/media.h" "include/linux/stddef.h" "include/linux/videodev2.h" "include/linux/udmabuf.h" "include/linux/v4l2-controls.h" "include/linux/dma-buf.h" "include/linux/v4l2-mediabus.h" "include/linux/intel-ipu3.h" "include/linux/rkisp1-config.h" "include/linux/dma-heap.h" The following files are missing license information: "README.rst" [1] https://gitlab.freedesktop.org/pinchartl/libcamera/-/jobs/97932626 --- .gitlab-ci/lint-reuse.sh | 45 +++++++++++++++++++++++++++++++ .gitlab-ci/meson/libc++.native | 2 ++ .gitlab-ci/meson/libstdc++.native | 2 ++ .gitlab-ci/setup-container.sh | 2 +- gitlab-ci.yml | 15 ++++++++++- 5 files changed, 64 insertions(+), 2 deletions(-) create mode 100755 .gitlab-ci/lint-reuse.sh base-commit: 74c50b4160be981aab838f68b34f13ebd91a01c1 diff --git a/.gitlab-ci/lint-reuse.sh b/.gitlab-ci/lint-reuse.sh new file mode 100755 index 000000000000..fa08c984ad9b --- /dev/null +++ b/.gitlab-ci/lint-reuse.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: © 2026 Laurent Pinchart +# +# Verify that every file contains a valid license + +set -e + +source "$(dirname "$0")/lib.sh" + +libcamera_reuse() { + echo "Running reuse for $CI_COMMIT_REF_NAME ($CI_COMMIT_SHA)" + + local data="$(reuse lint -j | jq '.non_compliant | {bad_licenses, missing_licenses, missing_licensing_info}')" + local status=0 + local files= + + files=$(echo "$data" | jq '.bad_licenses | reduce .[] as $item ([]; . += $item) | .[]') + if [ -n "$files" ] ; then + echo "The following files use a bad license:" + echo "$files" + status=1 + fi + + files=$(echo "$data" | jq '.missing_licenses | reduce .[] as $item ([]; . += $item) | .[]') + if [ -n "$files" ] ; then + echo "The following files use a missing license:" + echo "$files" + status=1 + fi + + files=$(echo "$data" | jq '.missing_licensing_info[]') + if [ -n "$files" ] ; then + echo "The following files are missing license information:" + echo "$files" + status=1 + fi + + [ $status != 0 ] && exit 1 + + echo "All files contain license information" +} + +run libcamera_reuse diff --git a/.gitlab-ci/meson/libc++.native b/.gitlab-ci/meson/libc++.native index 9c99d5a7f8b2..c850a20b6903 100644 --- a/.gitlab-ci/meson/libc++.native +++ b/.gitlab-ci/meson/libc++.native @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: CC0-1.0 + [built-in options] cpp_args = ['-stdlib=libc++'] cpp_link_args = ['-stdlib=libc++'] diff --git a/.gitlab-ci/meson/libstdc++.native b/.gitlab-ci/meson/libstdc++.native index 3116043fc116..e7b596e76089 100644 --- a/.gitlab-ci/meson/libstdc++.native +++ b/.gitlab-ci/meson/libstdc++.native @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: CC0-1.0 + [built-in options] cpp_args = ['-stdlib=libstdc++'] cpp_link_args = ['-stdlib=libstdc++'] diff --git a/.gitlab-ci/setup-container.sh b/.gitlab-ci/setup-container.sh index 9536d89a5d8d..c7ca6426c3ab 100755 --- a/.gitlab-ci/setup-container.sh +++ b/.gitlab-ci/setup-container.sh @@ -133,7 +133,7 @@ case $FDO_DISTRIBUTION_VERSION in texlive-latex-extra ) # Tools requires by the lint jobs. - PKGS_LIBCAMERA_RUNTIME+=( clang-format python3-autopep8 shellcheck ) + PKGS_LIBCAMERA_RUNTIME+=( clang-format jq python3-autopep8 reuse shellcheck ) # libclang-rt-dev for the clang ASan runtime. PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libclang-rt-19-dev ) # For the Android camera HAL and the virtual pipeline handler. diff --git a/gitlab-ci.yml b/gitlab-ci.yml index 6679cf853c7a..9368752a0eae 100644 --- a/gitlab-ci.yml +++ b/gitlab-ci.yml @@ -74,7 +74,7 @@ include: .libcamera-ci.debian:13: variables: FDO_DISTRIBUTION_VERSION: 'trixie' - FDO_DISTRIBUTION_TAG: '2026-04-05.0' + FDO_DISTRIBUTION_TAG: '2026-04-21.0' .container-debian: extends: @@ -122,6 +122,7 @@ container-debian:13: - LIBCAMERA_CI_URL="${CI_SERVER_URL}/${CI_CONFIG_PATH/*@/}" - git clone --depth 1 --single-branch $LIBCAMERA_CI_URL .work/ci-config - mv .work/ci-config/.gitlab-ci/ $CI_PROJECT_DIR + - rm -rf .work/ci-config/ # # Build libcamera with a different compilers, using stock Debian images to @@ -305,6 +306,18 @@ build-package:debug: # Lint stage - Run checkstyle.py and check merge suitability # ------------------------------------------------------------------------------ +license: + extends: + - .fdo.distribution-image@debian + - .libcamera-ci.debian:13 + - .libcamera-ci.scripts + stage: lint + needs: + - job: container-debian:13 + artifacts: false + script: + - $CI_PROJECT_DIR/.gitlab-ci/lint-reuse.sh + lint: extends: - .fdo.distribution-image@debian