| Message ID | 20260421171735.2483517-1-laurent.pinchart@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Hi 2026. 04. 21. 19:17 keltezéssel, Laurent Pinchart írta: > 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 <laurent.pinchart@ideasonboard.com> > --- > 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 > > 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 <laurent.pinchart@ideasonboard.com> > +# > +# 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) | .[]') Which version of `reuse` do you use? For me both `bad_licenses` and `missing_licenses` are just a list of license names, without any info about the files. ... It seems this is a `reuse` regression: https://codeberg.org/fsfe/reuse-tool/issues/1357 > + 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 > > base-commit: 74c50b4160be981aab838f68b34f13ebd91a01c1
On Wed, Apr 22, 2026 at 10:04:57AM +0200, Barnabás Pőcze wrote: > 2026. 04. 21. 19:17 keltezéssel, Laurent Pinchart írta: > > 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 <laurent.pinchart@ideasonboard.com> > > --- > > 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 > > > > 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 <laurent.pinchart@ideasonboard.com> > > +# > > +# 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) | .[]') > > Which version of `reuse` do you use? For me both `bad_licenses` and `missing_licenses` are just a list > of license names, without any info about the files. I'm using v5.0.2, and so does Trixie. > ... > > It seems this is a `reuse` regression: https://codeberg.org/fsfe/reuse-tool/issues/1357 :-/ Hopefully that's going to be fixed before it affects us. > > + 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 > > > > base-commit: 74c50b4160be981aab838f68b34f13ebd91a01c1
2026. 04. 22. 11:07 keltezéssel, Laurent Pinchart írta: > On Wed, Apr 22, 2026 at 10:04:57AM +0200, Barnabás Pőcze wrote: >> 2026. 04. 21. 19:17 keltezéssel, Laurent Pinchart írta: >>> 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 <laurent.pinchart@ideasonboard.com> >>> --- >>> 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 >>> >>> 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 <laurent.pinchart@ideasonboard.com> >>> +# >>> +# 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:" I'd change this to "The following licenses are not valid SPDX licenses:" because as far as I can see `bad_licenses` considers files under `LICENSE/`, and this is what `reuse lint --plain` prints. >>> + echo "$files" >>> + status=1 >>> + fi >>> + >>> + files=$(echo "$data" | jq '.missing_licenses | reduce .[] as $item ([]; . += $item) | .[]') >> >> Which version of `reuse` do you use? For me both `bad_licenses` and `missing_licenses` are just a list >> of license names, without any info about the files. > > I'm using v5.0.2, and so does Trixie. > >> ... >> >> It seems this is a `reuse` regression: https://codeberg.org/fsfe/reuse-tool/issues/1357 > > :-/ Hopefully that's going to be fixed before it affects us. > >>> + if [ -n "$files" ] ; then >>> + echo "The following files use a missing license:" It's not immediately clear that this considers files that use licenses that are not found in the `LICENSE/` directory, so maybe: "The following files use a missing license (not present in `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 In any case Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> >>> 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 >>> >>> base-commit: 74c50b4160be981aab838f68b34f13ebd91a01c1 >
2026. 04. 22. 11:24 keltezéssel, Barnabás Pőcze írta: > 2026. 04. 22. 11:07 keltezéssel, Laurent Pinchart írta: >> On Wed, Apr 22, 2026 at 10:04:57AM +0200, Barnabás Pőcze wrote: >>> 2026. 04. 21. 19:17 keltezéssel, Laurent Pinchart írta: >>>> 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 <laurent.pinchart@ideasonboard.com> >>>> --- >>>> 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 >>>> >>>> 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 <laurent.pinchart@ideasonboard.com> >>>> +# >>>> +# 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:" > > I'd change this to "The following licenses are not valid SPDX licenses:" > because as far as I can see `bad_licenses` considers files under `LICENSE/`, -> LICENSES/ > and this is what `reuse lint --plain` prints. > > >>>> + echo "$files" >>>> + status=1 >>>> + fi >>>> + >>>> + files=$(echo "$data" | jq '.missing_licenses | reduce .[] as $item ([]; . += $item) | .[]') >>> >>> Which version of `reuse` do you use? For me both `bad_licenses` and `missing_licenses` are just a list >>> of license names, without any info about the files. >> >> I'm using v5.0.2, and so does Trixie. >> >>> ... >>> >>> It seems this is a `reuse` regression: https://codeberg.org/fsfe/reuse-tool/issues/1357 >> >> :-/ Hopefully that's going to be fixed before it affects us. >> >>>> + if [ -n "$files" ] ; then >>>> + echo "The following files use a missing license:" > > It's not immediately clear that this considers files that use licenses > that are not found in the `LICENSE/` directory, so maybe: -> LICENSES/ > > "The following files use a missing license (not present in `LICENSE/`):" -> LICENSES/ > > >>>> + 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 > > In any case > > Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > > >>>> 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 >>>> >>>> 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 <laurent.pinchart@ideasonboard.com> +# +# 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
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 <laurent.pinchart@ideasonboard.com> --- 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