From d6f3e1f5f2fcb38d8feb5ad90574a057ae805486 Mon Sep 17 00:00:00 2001 From: Drew Newberry Date: Sat, 19 Sep 2026 18:55:33 -0700 Subject: [PATCH] fix(packaging): keep SPDX comments out of Debian control (#3483) Signed-off-by: Drew Newberry --- deploy/deb/control.in | 3 --- deploy/deb/control.in.license | 2 ++ scripts/update_license_headers.py | 5 +++-- tasks/scripts/test-packaging-assets.sh | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 deploy/deb/control.in.license diff --git a/deploy/deb/control.in b/deploy/deb/control.in index 27887c56cd..e0975d4d4d 100644 --- a/deploy/deb/control.in +++ b/deploy/deb/control.in @@ -1,6 +1,3 @@ -# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - Package: openshell Version: @VERSION@ Architecture: @ARCH@ diff --git a/deploy/deb/control.in.license b/deploy/deb/control.in.license new file mode 100644 index 0000000000..817df24424 --- /dev/null +++ b/deploy/deb/control.in.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +SPDX-License-Identifier: Apache-2.0 diff --git a/scripts/update_license_headers.py b/scripts/update_license_headers.py index 49a76f4f34..43746f2495 100755 --- a/scripts/update_license_headers.py +++ b/scripts/update_license_headers.py @@ -60,9 +60,10 @@ "scripts/bin/openshell": "#", } -# Strict JSON does not support comments. Keep SPDX data in REUSE-compatible -# sidecars so these files remain valid inputs to their consumers. +# Some consumer formats do not support comments. Keep SPDX data in +# REUSE-compatible sidecars so these files remain valid inputs. SIDECAR_LICENSE_FILES: set[str] = { + "deploy/deb/control.in", "scripts/keycloak-realm.json", "sdk/conformance/oauth-client-credentials.json", "sdk/typescript/biome.json", diff --git a/tasks/scripts/test-packaging-assets.sh b/tasks/scripts/test-packaging-assets.sh index 02ecdb007f..fb6424ff06 100755 --- a/tasks/scripts/test-packaging-assets.sh +++ b/tasks/scripts/test-packaging-assets.sh @@ -38,11 +38,25 @@ assert_file_exists() { } service="${ROOT}/deploy/deb/openshell-gateway.service" +control="${ROOT}/deploy/deb/control.in" spec="${ROOT}/openshell.spec" assert_file_exists "$service" +assert_file_exists "$control" assert_file_exists "$spec" +# Debian control files are RFC822-style metadata. Older dpkg-deb releases +# reject comment lines as malformed fields, so keep SPDX metadata in the +# adjacent .license sidecar instead of emitting it into DEBIAN/control. +if grep -Eq '^[[:space:]]*#' "$control"; then + echo "FAIL: Debian control template contains a comment field" >&2 + exit 1 +fi +if [[ $(sed -n '/[^[:space:]]/ { p; q; }' "$control") != "Package: openshell" ]]; then + echo "FAIL: Debian control template must begin with the Package field" >&2 + exit 1 +fi + assert_contains \ "$service" \ 'Environment=OPENSHELL_LOCAL_TLS_DIR=%h/.local/state/openshell/tls'