Skip to content

Commit 36a5b0f

Browse files
authored
[release-2.36.0] Move xz licenses to manual licenses for Java containers (#16697)
1 parent 3ccc462 commit 36a5b0f

5 files changed

Lines changed: 27 additions & 6 deletions

File tree

build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ tasks.rat {
129129
"**/.gitkeep",
130130

131131
// Ignore Flutter localization .arb files (doesn't support comments)
132-
"playground/frontend/lib/l10n/**/*.arb"
132+
"playground/frontend/lib/l10n/**/*.arb",
133+
134+
// Ignore LICENSES copied onto containers
135+
"sdks/java/container/license_scripts/manual_licenses",
136+
"sdks/python/container/license_scripts/manual_licenses"
133137
)
134138

135139
// Add .gitignore excludes to the Apache Rat exclusion list. We re-create the behavior

sdks/java/container/license_scripts/dep_urls_java.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
# version: # package version, it is required because license may change between versions.
2525
# license: optional, url_to_license or "skip"
2626
# # skip: don't add license for the dependency
27-
# # url_to_license: a url to source code (https://...) or a local file (file://...)
27+
# # url_to_license: a url to source code (https://...) or a local file (file://{}/...)
28+
# where the remaining value is relative to the manual license folder
2829
# notice: optional, url_to_notice
2930
# type: optional, license type, ie: Apache License 2.0. Type should be provided if the plug in does not provide moduleLicense.
3031
# source: optional, url_to_maven_repo. If maven artifact repo does not follow a patten of 'https://repo1.maven.org/maven2/{module}/{version}', the url should be provided.
@@ -50,8 +51,8 @@ paranamer:
5051
'2.8':
5152
license: "https://raw.githubusercontent.com/paul-hammant/paranamer/master/LICENSE.txt"
5253
xz:
53-
'1.5':
54-
license: "https://git.tukaani.org/?p=xz-java.git;a=blob;f=COPYING;h=c1d404dc7a6f06a0437bf1055fedaa4a4c89d728;hb=9f1f97a26f090ffec6568c004a38c6534aa82b94"
54+
'1.5': # The original repo is down. This license is taken from https://tukaani.org/xz/java.html.
55+
license: "file://{}/xz/COPYING"
5556
jackson-bom:
5657
'2.13.0':
5758
license: "https://raw.githubusercontent.com/FasterXML/jackson-bom/master/LICENSE"

sdks/java/container/license_scripts/license_script.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ pip install --retries 10 -r ${SCRIPT_DIR}/requirement.txt
4949
# pull licenses, notices and source code
5050
FLAGS="--license_index=${INDEX_FILE} \
5151
--output_dir=${DOWNLOAD_DIR} \
52-
--dep_url_yaml=${SCRIPT_DIR}/dep_urls_java.yaml "
52+
--dep_url_yaml=${SCRIPT_DIR}/dep_urls_java.yaml \
53+
--manual_license_path=${SCRIPT_DIR}/manual_licenses"
5354

5455
echo "Executing ${ENV_DIR}/bin/python ${SCRIPT_DIR}/pull_licenses_java.py $FLAGS"
5556
"${ENV_DIR}/bin/python" "${SCRIPT_DIR}/pull_licenses_java.py" $FLAGS
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Licensing of XZ for Java
2+
========================
3+
4+
All the files in this package have been written by Lasse Collin,
5+
Igor Pavlov, and/or Brett Okken. All these files have been put into
6+
the public domain. You can do whatever you want with these files.
7+
8+
This software is provided "as is", without any warranty.

sdks/java/container/license_scripts/pull_licenses_java.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,18 @@
4242
RETRY_NUM = 9
4343
THREADS = 16
4444

45-
4645
@retry(reraise=True,
4746
wait=wait_fixed(5),
4847
stop=stop_after_attempt(RETRY_NUM))
4948
def pull_from_url(file_name, url, dep, no_list):
5049
if url == 'skip':
5150
return
51+
52+
# Replace file path with absolute path to manual licenses
53+
if url.startswith('file://{}'):
54+
url = url.format(manual_license_path)
55+
logging.info('Replaced local file URL with {url} for {dep}'.format(url=url, dep=dep))
56+
5257
try:
5358
url_read = urlopen(url)
5459
with open(file_name, 'wb') as temp_write:
@@ -234,11 +239,13 @@ def execute(dep):
234239
parser.add_argument('--license_index', required=True)
235240
parser.add_argument('--output_dir', required=True)
236241
parser.add_argument('--dep_url_yaml', required=True)
242+
parser.add_argument('--manual_license_path', required=True)
237243

238244
args = parser.parse_args()
239245
license_index = args.license_index
240246
output_dir = args.output_dir
241247
dep_url_yaml = args.dep_url_yaml
248+
manual_license_path = args.manual_license_path
242249

243250
logging.getLogger().setLevel(logging.INFO)
244251

0 commit comments

Comments
 (0)