This is an automated email from the ASF dual-hosted git repository.
jerryshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 393924be59 [MINOR] fix(license): ship the binary LICENSE and NOTICE in
connector images (#13578)
393924be59 is described below
commit 393924be59ee34aff49b2443b347ab90f3c1871d
Author: Bharath Krishna <[email protected]>
AuthorDate: Tue Sep 29 21:01:17 2026 -0700
[MINOR] fix(license): ship the binary LICENSE and NOTICE in connector
images (#13578)
### What changes were proposed in this pull request?
The connector image dependency scripts now stage the `LICENSE` and
`NOTICE` that describe what each image ships, instead of the
repository-root pair.
Each image carries several variants — Spark 3.5/4.0 across Scala
2.12/2.13, Flink 1.19/1.20/2.1, five Trino version bands — and they
bundle different components, so each staged artifact gets its own
directory:
```
/licenses/<jar or band name>/LICENSE
/licenses/<jar or band name>/NOTICE
```
The shaded jars already carry that pair in `META-INF`, generated from
the resolved dependency set, and the Trino bands carry one built from
`LICENSE.trino`/`NOTICE.trino`. The scripts copy them verbatim; nothing
is parsed or authored here.
`licenses/THIRD_PARTY_LICENSES.txt` is removed from all three images,
and the Dockerfile comments and READMEs are updated to match.
### Why are the changes needed?
The images staged the repository-root `LICENSE` and `NOTICE`, which
describe the source tree rather than the jars each image ships, and
covered the gap with a hand-written summary that stated:
> This list is a summary for operator convenience and is not exhaustive.
The authoritative license and notice text for every bundled component is
carried inside the jar's META-INF directory.
An image that redistributes those jars has to declare what they bundle.
The Spark connector jar bundles Kyuubi, Caffeine and HttpComponents
among others, and the shipped `/licenses/LICENSE` named none of them.
Raised by Justin Mclean during the 1.3.1 RC3 vote review.
### Does this PR introduce _any_ user-facing change?
No API or configuration changes. The `/licenses` directory inside the
Trino, Spark and Flink connector images now holds one directory per
shipped variant instead of a single pair describing the source tree, and
`THIRD_PARTY_LICENSES.txt` is gone.
### How was this patch tested?
`bash -n` and `shellcheck -S warning` are clean on all four scripts.
Built end to end — Gradle build, the real dependency scripts, `docker
build`, then reading `/licenses` inside each container. Every artifact
was extracted back out of the built image and its licence pair compared
byte for byte against the copy staged for it: Spark 3/3, Flink 3/3,
Trino 5/5. Spark and Flink each declare 24 distinct components; no
staged file matches the source-tree `LICENSE`; no
`THIRD_PARTY_LICENSES.txt` or `.gitignore` reaches the image.
Per-variant staging is what makes this correct: a single jar does not
describe the set. The Spark 3.5_2.12 jar declares 22 components and the
Flink 1.19 jar 20, against 24 per image, so picking one would omit
third-party components including
`org.apache.kyuubi:kyuubi-spark-connector-hive_2.13`,
`io.openlineage:openlineage-sql-java` and
`org.apache.commons:commons-lang3`.
The failure paths were tested by fault injection: pointing the
extraction at a jar with no `META-INF/LICENSE` exits non-zero and stops.
Under `set -euo pipefail` a `[ -s ... ]` check placed after the
extraction would be dead code, since `unzip -p` aborts first.
---
dev/docker/build-docker.sh | 4 ++--
dev/docker/flink-connectors/Dockerfile | 5 ++---
dev/docker/flink-connectors/README.md | 12 +++++------
.../flink-connectors-dependency.sh | 23 ++++++++++++++++----
dev/docker/flink-connectors/licenses/.gitignore | 5 +++--
.../licenses/THIRD_PARTY_LICENSES.txt | 20 -----------------
dev/docker/spark-connectors/Dockerfile | 6 +++---
dev/docker/spark-connectors/README.md | 12 +++++------
dev/docker/spark-connectors/licenses/.gitignore | 5 +++--
.../licenses/THIRD_PARTY_LICENSES.txt | 21 ------------------
.../spark-connectors-dependency.sh | 23 ++++++++++++++++----
dev/docker/trino-connectors/Dockerfile | 6 +++---
dev/docker/trino-connectors/README.md | 8 +++----
dev/docker/trino-connectors/licenses/.gitignore | 5 +++--
.../licenses/THIRD_PARTY_LICENSES.txt | 24 ---------------------
.../trino-connectors-dependency.sh | 25 ++++++++++++++++++----
16 files changed, 94 insertions(+), 110 deletions(-)
diff --git a/dev/docker/build-docker.sh b/dev/docker/build-docker.sh
index 4f85738a10..2df3052371 100755
--- a/dev/docker/build-docker.sh
+++ b/dev/docker/build-docker.sh
@@ -132,8 +132,8 @@ elif [ "${component_type}" == "trino-connectors" ] || \
exit 1
fi
echo "INFO : IMAGE_VERSION=${image_version} (from gradle.properties)"
- # Build the connector jars, stage them under packages/, and copy the
- # repository-root LICENSE/NOTICE into licenses/ (done by the dependency
script).
+ # Build the connector jars, stage them under packages/, and stage each
+ # artifact's own LICENSE/NOTICE under licenses/ (done by the dependency
script).
. "${script_dir}/${component_type}/${component_type}-dependency.sh"
build_args="--build-arg IMAGE_VERSION=${image_version}"
else
diff --git a/dev/docker/flink-connectors/Dockerfile
b/dev/docker/flink-connectors/Dockerfile
index d25a430d81..a9a11439ba 100644
--- a/dev/docker/flink-connectors/Dockerfile
+++ b/dev/docker/flink-connectors/Dockerfile
@@ -22,8 +22,7 @@
# Contains the Apache Gravitino Flink connector runtime jars for every
# supported Flink version present in the source tree (Scala 2.12; Flink does
# not support Scala 2.13). The connector code is Apache-2.0; the shaded runtime
-# jar bundles third-party open source components (see
-# licenses/THIRD_PARTY_LICENSES.txt).
+# jar bundles third-party open source components (see the licenses/ directory).
# Used as a Kubernetes init-container to inject connector jars into Flink pods.
#
# The set of Flink versions is discovered at build time from the Gravitino
@@ -35,7 +34,7 @@
# Red Hat UBI / certification-oriented properties:
# - Based on UBI 10 (registry.access.redhat.com)
# - Required LABELs present
-# - /licenses directory with LICENSE, NOTICE and THIRD_PARTY_LICENSES.txt
+# - /licenses directory with a LICENSE and NOTICE per runtime variant
# - Runs as non-root user (UID 1000, GID 0) with a passwd entry
# - OpenShift arbitrary UID compatible (GID 0 group permissions)
#
==============================================================================
diff --git a/dev/docker/flink-connectors/README.md
b/dev/docker/flink-connectors/README.md
index 7df7dcfa90..68d35d708a 100644
--- a/dev/docker/flink-connectors/README.md
+++ b/dev/docker/flink-connectors/README.md
@@ -40,14 +40,14 @@ Build locally from the repository root with the shared
image build script:
```
The script builds the connector runtime jars
(`flink-connectors-dependency.sh`),
-stages the repository-root `LICENSE`/`NOTICE` into `licenses/`, injects
+stages each runtime jar's `LICENSE`/`NOTICE` into `licenses/`, injects
`IMAGE_VERSION` from `gradle.properties`, and runs the multi-arch buildx build.
This image contains open source software only. The Apache Gravitino connector
code is licensed under the Apache License 2.0; the shaded runtime jar also
-bundles third-party open source components under their own licenses. See the
-`LICENSE`, `NOTICE` and `THIRD_PARTY_LICENSES.txt` files under `/licenses` in
-the image.
+bundles third-party open source components under their own licenses. Every
+bundled component is declared under `/licenses` in the image, in one directory
+per runtime variant.
## Server compatibility
@@ -69,8 +69,8 @@ docker run --rm apache/gravitino-flink-connector:{version}
```
Each directory contains one shaded runtime JAR. Do not mix JARs from
-different Flink minor versions. `LICENSE` and `NOTICE` are in `/licenses` in
-the image.
+different Flink minor versions. Each JAR's `LICENSE` and `NOTICE` are under
+`/licenses/<jar name>` in the image.
## Install
diff --git a/dev/docker/flink-connectors/flink-connectors-dependency.sh
b/dev/docker/flink-connectors/flink-connectors-dependency.sh
index d9025668e3..5085460b87 100755
--- a/dev/docker/flink-connectors/flink-connectors-dependency.sh
+++ b/dev/docker/flink-connectors/flink-connectors-dependency.sh
@@ -98,10 +98,25 @@ if [ "${copied}" -eq 0 ]; then
exit 1
fi
-# Stage the canonical Apache-2.0 LICENSE and NOTICE from the repository root so
-# the image ships the real texts (not drifting copies committed in-tree).
-cp "${gravitino_home}/LICENSE" "${conn_dir}/licenses/LICENSE"
-cp "${gravitino_home}/NOTICE" "${conn_dir}/licenses/NOTICE"
+# /licenses must describe what the shipped jars bundle, not the source tree.
+# Each jar already carries that pair in META-INF, generated from its resolved
+# dependency set, with the per-component texts it cites alongside them inside
the
+# jar. Versions bundle different components, so each gets its own directory.
+license_jars="$(find "${conn_dir}/packages/connectors" -name '*.jar' | sort)"
+[ -n "${license_jars}" ] || { echo "ERROR: no staged jar to take licenses
from" >&2; exit 1; }
+
+# Drop earlier staging; leftovers would ship licences for jars not in the
image.
+mkdir -p "${conn_dir}/licenses"
+find "${conn_dir}/licenses" -mindepth 1 -maxdepth 1 ! -name '.gitignore' -exec
rm -rf {} +
+
+while IFS= read -r jar; do
+ dest="${conn_dir}/licenses/$(basename "${jar}" .jar)"
+ mkdir -p "${dest}"
+ unzip -p "${jar}" META-INF/LICENSE > "${dest}/LICENSE" \
+ || { echo "ERROR: ${jar} has no META-INF/LICENSE" >&2; exit 1; }
+ unzip -p "${jar}" META-INF/NOTICE > "${dest}/NOTICE" \
+ || { echo "ERROR: ${jar} has no META-INF/NOTICE" >&2; exit 1; }
+done <<< "${license_jars}"
echo ""
echo "=== Flink connectors prepared (${copied} version(s)) ==="
diff --git a/dev/docker/flink-connectors/licenses/.gitignore
b/dev/docker/flink-connectors/licenses/.gitignore
index 1ec3b21573..af64f6fa98 100644
--- a/dev/docker/flink-connectors/licenses/.gitignore
+++ b/dev/docker/flink-connectors/licenses/.gitignore
@@ -1,4 +1,5 @@
-# LICENSE and NOTICE are copied from the repository root at build time
-# by build-docker.sh / the CI workflow. Do not commit generated copies.
+# Populated at build time by flink-connectors-dependency.sh from the staged
+# runtime jars. Do not commit generated copies.
+/*/
/LICENSE
/NOTICE
diff --git a/dev/docker/flink-connectors/licenses/THIRD_PARTY_LICENSES.txt
b/dev/docker/flink-connectors/licenses/THIRD_PARTY_LICENSES.txt
deleted file mode 100644
index 461bc5f283..0000000000
--- a/dev/docker/flink-connectors/licenses/THIRD_PARTY_LICENSES.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-THIRD-PARTY SOFTWARE NOTICE — Apache Gravitino Flink Connector image
-
-This image packages the Apache Gravitino Flink connector as a shaded runtime
-jar. The shaded jar bundles third-party open source components, relocated
-under the org.apache.gravitino.shaded namespace and redistributed under their
-own licenses. They include, among others:
-
- - Google Guava / Protobuf (com.google.*) ............... Apache-2.0 /
BSD-3-Clause
- - Apache HttpComponents (org.apache.hc.*) .............. Apache-2.0
- - Jackson (com.fasterxml.jackson.*) .................... Apache-2.0
- - Caffeine (com.github.benmanes.caffeine) .............. Apache-2.0
- - Apache Gravitino Java client ......................... Apache-2.0
-
-The Apache Gravitino connector code itself is licensed under the Apache
-License, Version 2.0 (see the LICENSE and NOTICE files in this directory).
-
-This list is a summary for operator convenience and is not exhaustive. The
-authoritative license and notice text for every bundled component is carried
-inside the jar's META-INF directory. Nothing in this summary modifies the
-license terms that apply to any individual component.
diff --git a/dev/docker/spark-connectors/Dockerfile
b/dev/docker/spark-connectors/Dockerfile
index 9960924952..7c98b04072 100644
--- a/dev/docker/spark-connectors/Dockerfile
+++ b/dev/docker/spark-connectors/Dockerfile
@@ -22,7 +22,7 @@
# Contains the Apache Gravitino Spark connector runtime jars for every
# supported Spark version and Scala variant present in the source tree. The
# connector code is Apache-2.0; the shaded runtime jar bundles third-party open
-# source components (see licenses/THIRD_PARTY_LICENSES.txt).
+# source components, declared in the licenses/ directory.
# Used as a Kubernetes init-container to inject connector jars into Spark pods.
#
# The set of Spark version / Scala combinations is discovered at build time
@@ -36,7 +36,7 @@
# Red Hat UBI / certification-oriented properties:
# - Based on UBI 10 (registry.access.redhat.com)
# - Required LABELs present
-# - /licenses directory with LICENSE, NOTICE and THIRD_PARTY_LICENSES.txt
+# - /licenses directory with a LICENSE and NOTICE per runtime variant
# - Runs as non-root user (UID 1000, GID 0) with a passwd entry
# - OpenShift arbitrary UID compatible (GID 0 group permissions)
#
==============================================================================
@@ -72,7 +72,7 @@ COPY packages/connectors /connectors
# Entrypoint script for version selection
COPY --chmod=755 copy-connector.sh /copy-connector.sh
-# --- licenses directory (LICENSE + NOTICE + third-party summary) ---
+# --- licenses directory (one LICENSE + NOTICE per runtime variant) ---
COPY licenses /licenses
# --- Connector image usage documentation ---
diff --git a/dev/docker/spark-connectors/README.md
b/dev/docker/spark-connectors/README.md
index 78cafc7b61..fa9cbc849f 100644
--- a/dev/docker/spark-connectors/README.md
+++ b/dev/docker/spark-connectors/README.md
@@ -40,14 +40,14 @@ Build locally from the repository root with the shared
image build script:
```
The script builds the connector runtime jars
(`spark-connectors-dependency.sh`),
-stages the repository-root `LICENSE`/`NOTICE` into `licenses/`, injects
+stages each runtime jar's `LICENSE`/`NOTICE` into `licenses/`, injects
`IMAGE_VERSION` from `gradle.properties`, and runs the multi-arch buildx build.
This image contains open source software only. The Apache Gravitino connector
code is licensed under the Apache License 2.0; the shaded runtime jar also
-bundles third-party open source components under their own licenses. See the
-`LICENSE`, `NOTICE` and `THIRD_PARTY_LICENSES.txt` files under `/licenses` in
-the image.
+bundles third-party open source components under their own licenses. Every
+bundled component is declared under `/licenses` in the image, in one directory
+per runtime variant.
## Server compatibility
@@ -69,8 +69,8 @@ it was built from; list them with:
docker run --rm apache/gravitino-spark-connector:{version}
```
-Each directory contains one shaded runtime JAR. `LICENSE` and `NOTICE` are in
-`/licenses` in the image.
+Each directory contains one shaded runtime JAR. Its `LICENSE` and `NOTICE` are
+under `/licenses/<jar name>` in the image.
## Install
diff --git a/dev/docker/spark-connectors/licenses/.gitignore
b/dev/docker/spark-connectors/licenses/.gitignore
index 1ec3b21573..a0ef62fc63 100644
--- a/dev/docker/spark-connectors/licenses/.gitignore
+++ b/dev/docker/spark-connectors/licenses/.gitignore
@@ -1,4 +1,5 @@
-# LICENSE and NOTICE are copied from the repository root at build time
-# by build-docker.sh / the CI workflow. Do not commit generated copies.
+# Populated at build time by spark-connectors-dependency.sh from the staged
+# runtime jars. Do not commit generated copies.
+/*/
/LICENSE
/NOTICE
diff --git a/dev/docker/spark-connectors/licenses/THIRD_PARTY_LICENSES.txt
b/dev/docker/spark-connectors/licenses/THIRD_PARTY_LICENSES.txt
deleted file mode 100644
index afd2b47fa8..0000000000
--- a/dev/docker/spark-connectors/licenses/THIRD_PARTY_LICENSES.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-THIRD-PARTY SOFTWARE NOTICE — Apache Gravitino Spark Connector image
-
-This image packages the Apache Gravitino Spark connector as a shaded runtime
-jar. The shaded jar bundles third-party open source components, relocated
-under the org.apache.gravitino.shaded namespace and redistributed under their
-own licenses. They include, among others:
-
- - Google Guava / Protobuf (com.google.*) ............... Apache-2.0 /
BSD-3-Clause
- - Apache HttpComponents (org.apache.hc.*) .............. Apache-2.0
- - Jackson (com.fasterxml.jackson.*) .................... Apache-2.0
- - Caffeine (com.github.benmanes.caffeine) .............. Apache-2.0
- - Apache Kyuubi Spark connector (hive) ................. Apache-2.0
- - Apache Gravitino Java client ......................... Apache-2.0
-
-The Apache Gravitino connector code itself is licensed under the Apache
-License, Version 2.0 (see the LICENSE and NOTICE files in this directory).
-
-This list is a summary for operator convenience and is not exhaustive. The
-authoritative license and notice text for every bundled component is carried
-inside the jar's META-INF directory. Nothing in this summary modifies the
-license terms that apply to any individual component.
diff --git a/dev/docker/spark-connectors/spark-connectors-dependency.sh
b/dev/docker/spark-connectors/spark-connectors-dependency.sh
index 5021e1e942..7a8639abe5 100755
--- a/dev/docker/spark-connectors/spark-connectors-dependency.sh
+++ b/dev/docker/spark-connectors/spark-connectors-dependency.sh
@@ -177,10 +177,25 @@ if [ "${copied}" -eq 0 ]; then
exit 1
fi
-# Stage the canonical Apache-2.0 LICENSE and NOTICE from the repository root so
-# the image ships the real texts (not drifting copies committed in-tree).
-cp "${gravitino_home}/LICENSE" "${conn_dir}/licenses/LICENSE"
-cp "${gravitino_home}/NOTICE" "${conn_dir}/licenses/NOTICE"
+# /licenses must describe what the shipped jars bundle, not the source tree.
+# Each jar already carries that pair in META-INF, generated from its resolved
+# dependency set, with the per-component texts it cites alongside them inside
the
+# jar. Variants bundle different components, so each gets its own directory.
+license_jars="$(find "${conn_dir}/packages/connectors" -name '*.jar' | sort)"
+[ -n "${license_jars}" ] || { echo "ERROR: no staged jar to take licenses
from" >&2; exit 1; }
+
+# Drop earlier staging; leftovers would ship licences for jars not in the
image.
+mkdir -p "${conn_dir}/licenses"
+find "${conn_dir}/licenses" -mindepth 1 -maxdepth 1 ! -name '.gitignore' -exec
rm -rf {} +
+
+while IFS= read -r jar; do
+ dest="${conn_dir}/licenses/$(basename "${jar}" .jar)"
+ mkdir -p "${dest}"
+ unzip -p "${jar}" META-INF/LICENSE > "${dest}/LICENSE" \
+ || { echo "ERROR: ${jar} has no META-INF/LICENSE" >&2; exit 1; }
+ unzip -p "${jar}" META-INF/NOTICE > "${dest}/NOTICE" \
+ || { echo "ERROR: ${jar} has no META-INF/NOTICE" >&2; exit 1; }
+done <<< "${license_jars}"
echo ""
echo "=== Spark connectors prepared (${copied} combination(s)) ==="
diff --git a/dev/docker/trino-connectors/Dockerfile
b/dev/docker/trino-connectors/Dockerfile
index cf241f2bfd..d419caf287 100644
--- a/dev/docker/trino-connectors/Dockerfile
+++ b/dev/docker/trino-connectors/Dockerfile
@@ -23,7 +23,7 @@
# Trino/Starburst version range present in the source tree. Each band is a full
# Trino plugin directory (connector jar + its dependency jars + LICENSE +
# NOTICE + README). The connector code is Apache-2.0; the bundled dependency
-# jars are third-party open source (see licenses/THIRD_PARTY_LICENSES.txt).
+# jars are third-party open source, declared in the licenses/ directory.
# Used as a Kubernetes init-container to inject connector jars into Trino pods.
#
# The set of version ranges is discovered at build time from the Gravitino
@@ -35,7 +35,7 @@
# Red Hat UBI / certification-oriented properties:
# - Based on UBI 10 (registry.access.redhat.com)
# - Required LABELs present
-# - /licenses directory with LICENSE, NOTICE and THIRD_PARTY_LICENSES.txt
+# - /licenses directory with a LICENSE and NOTICE per version band
# - Runs as non-root user (UID 1000, GID 0) with a passwd entry
# - OpenShift arbitrary UID compatible (GID 0 group permissions)
#
==============================================================================
@@ -70,7 +70,7 @@ COPY packages/connectors /connectors
# Entrypoint script for version selection
COPY --chmod=755 copy-connector.sh /copy-connector.sh
-# --- licenses directory (LICENSE + NOTICE + third-party summary) ---
+# --- licenses directory (one LICENSE + NOTICE per version band) ---
COPY licenses /licenses
# --- Connector image usage documentation ---
diff --git a/dev/docker/trino-connectors/README.md
b/dev/docker/trino-connectors/README.md
index 1fcc9afd49..492be47c76 100644
--- a/dev/docker/trino-connectors/README.md
+++ b/dev/docker/trino-connectors/README.md
@@ -41,14 +41,14 @@ Build locally from the repository root with the shared
image build script:
```
The script builds the connector bands (`trino-connectors-dependency.sh`),
-stages the repository-root `LICENSE`/`NOTICE` into `licenses/`, injects
+stages each plugin band's `LICENSE`/`NOTICE` into `licenses/`, injects
`IMAGE_VERSION` from `gradle.properties`, and runs the multi-arch buildx build.
This image contains open source software only. The Apache Gravitino connector
code is licensed under the Apache License 2.0; each plugin band also bundles
-third-party open source dependency jars under their own licenses. See the
-`LICENSE`, `NOTICE` and `THIRD_PARTY_LICENSES.txt` files under `/licenses` in
-the image.
+third-party open source dependency jars under their own licenses. Every bundled
+component is declared under `/licenses` in the image, in one directory per
+version band.
## Server compatibility
diff --git a/dev/docker/trino-connectors/licenses/.gitignore
b/dev/docker/trino-connectors/licenses/.gitignore
index 1ec3b21573..994fcf4827 100644
--- a/dev/docker/trino-connectors/licenses/.gitignore
+++ b/dev/docker/trino-connectors/licenses/.gitignore
@@ -1,4 +1,5 @@
-# LICENSE and NOTICE are copied from the repository root at build time
-# by build-docker.sh / the CI workflow. Do not commit generated copies.
+# Populated at build time by trino-connectors-dependency.sh from the staged
+# connector bands. Do not commit generated copies.
+/*/
/LICENSE
/NOTICE
diff --git a/dev/docker/trino-connectors/licenses/THIRD_PARTY_LICENSES.txt
b/dev/docker/trino-connectors/licenses/THIRD_PARTY_LICENSES.txt
deleted file mode 100644
index 3b8cb1f550..0000000000
--- a/dev/docker/trino-connectors/licenses/THIRD_PARTY_LICENSES.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-THIRD-PARTY SOFTWARE NOTICE — Apache Gravitino Trino Connector image
-
-This image packages the Apache Gravitino Trino connector plugin. Each Trino
-version band under /connectors is a Trino plugin directory that contains the
-Gravitino connector jar together with its runtime dependency jars.
-
-Those dependency jars are third-party open source components, redistributed
-under their own licenses. They include, among others:
-
- - Airlift libraries (log, etc.) ......................... Apache-2.0
- - Google Guava ......................................... Apache-2.0
- - Apache Commons (collections4, lang3, ...) ............ Apache-2.0
- - Jackson (com.fasterxml.jackson.*) .................... Apache-2.0
- - OpenTelemetry semantic conventions ................... Apache-2.0
- - Trino JDBC client (io.trino:trino-jdbc) .............. Apache-2.0
-
-The Apache Gravitino connector jar itself is licensed under the Apache
-License, Version 2.0 (see the LICENSE and NOTICE files in this directory and
-in each plugin band directory).
-
-This list is a summary for operator convenience and is not exhaustive. The
-authoritative license and notice text for every bundled component is carried
-inside the respective jar's META-INF directory. Nothing in this summary
-modifies the license terms that apply to any individual component.
diff --git a/dev/docker/trino-connectors/trino-connectors-dependency.sh
b/dev/docker/trino-connectors/trino-connectors-dependency.sh
index 3e6f592402..f2f897eca2 100755
--- a/dev/docker/trino-connectors/trino-connectors-dependency.sh
+++ b/dev/docker/trino-connectors/trino-connectors-dependency.sh
@@ -89,10 +89,27 @@ if [ "${copied}" -eq 0 ]; then
exit 1
fi
-# Stage the canonical Apache-2.0 LICENSE and NOTICE from the repository root so
-# the image ships the real texts (not drifting copies committed in-tree).
-cp "${gravitino_home}/LICENSE" "${conn_dir}/licenses/LICENSE"
-cp "${gravitino_home}/NOTICE" "${conn_dir}/licenses/NOTICE"
+# /licenses must describe what the shipped plugin jars bundle, not the source
+# tree. Each band already carries that pair, built from LICENSE.trino and
+# NOTICE.trino, with the texts it cites in its own licenses/ directory. Bands
+# bundle different components, so each gets its own directory.
+bands="$(find "${conn_dir}/packages/connectors" -maxdepth 1 -mindepth 1 -type
d | sort)"
+[ -n "${bands}" ] || { echo "ERROR: no staged connector band to take licenses
from" >&2; exit 1; }
+
+# Drop earlier staging; leftovers would ship licences for bands not in the
image.
+mkdir -p "${conn_dir}/licenses"
+find "${conn_dir}/licenses" -mindepth 1 -maxdepth 1 ! -name '.gitignore' -exec
rm -rf {} +
+
+while IFS= read -r band; do
+ dest="${conn_dir}/licenses/$(basename "${band}")"
+ [ -s "${band}/LICENSE" ] && [ -s "${band}/NOTICE" ] || {
+ echo "ERROR: ${band} has no LICENSE or NOTICE" >&2
+ exit 1
+ }
+ mkdir -p "${dest}"
+ cp "${band}/LICENSE" "${dest}/LICENSE"
+ cp "${band}/NOTICE" "${dest}/NOTICE"
+done <<< "${bands}"
echo ""
echo "=== Trino connectors prepared (${copied} version range(s)) ==="