This is an automated email from the ASF dual-hosted git repository.

emilyye pushed a commit to branch release-2.36.0
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/release-2.36.0 by this push:
     new 36a5b0f  [release-2.36.0] Move xz licenses to manual licenses for Java 
containers (#16697)
36a5b0f is described below

commit 36a5b0fc2e80b23170cb032ed27cad821ece2d92
Author: emily <[email protected]>
AuthorDate: Wed Feb 2 10:20:58 2022 -0800

    [release-2.36.0] Move xz licenses to manual licenses for Java containers 
(#16697)
---
 build.gradle.kts                                               | 6 +++++-
 sdks/java/container/license_scripts/dep_urls_java.yaml         | 7 ++++---
 sdks/java/container/license_scripts/license_script.sh          | 3 ++-
 sdks/java/container/license_scripts/manual_licenses/xz/COPYING | 8 ++++++++
 sdks/java/container/license_scripts/pull_licenses_java.py      | 9 ++++++++-
 5 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index 5ffb9f6..82cb17a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -129,7 +129,11 @@ tasks.rat {
     "**/.gitkeep",
 
     // Ignore Flutter localization .arb files (doesn't support comments)
-    "playground/frontend/lib/l10n/**/*.arb"
+    "playground/frontend/lib/l10n/**/*.arb",
+
+    // Ignore LICENSES copied onto containers
+    "sdks/java/container/license_scripts/manual_licenses",
+    "sdks/python/container/license_scripts/manual_licenses"
   )
 
   // Add .gitignore excludes to the Apache Rat exclusion list. We re-create 
the behavior
diff --git a/sdks/java/container/license_scripts/dep_urls_java.yaml 
b/sdks/java/container/license_scripts/dep_urls_java.yaml
index d505ec2..7280cc0 100644
--- a/sdks/java/container/license_scripts/dep_urls_java.yaml
+++ b/sdks/java/container/license_scripts/dep_urls_java.yaml
@@ -24,7 +24,8 @@
 #   version: # package version, it is required because license may change 
between versions.
 #     license: optional, url_to_license or "skip"
 #       # skip: don't add license for the dependency
-#       # url_to_license: a url to source code (https://...) or a local file 
(file://...)
+#       # url_to_license: a url to source code (https://...) or a local file 
(file://{}/...)
+#         where the remaining value is relative to the manual license folder
 #     notice: optional, url_to_notice
 #     type: optional, license type, ie: Apache License 2.0. Type should be 
provided if the plug in does not provide moduleLicense.
 #     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:
   '2.8':
     license: 
"https://raw.githubusercontent.com/paul-hammant/paranamer/master/LICENSE.txt";
 xz:
-  '1.5':
-    license: 
"https://git.tukaani.org/?p=xz-java.git;a=blob;f=COPYING;h=c1d404dc7a6f06a0437bf1055fedaa4a4c89d728;hb=9f1f97a26f090ffec6568c004a38c6534aa82b94";
+  '1.5': # The original repo is down. This license is taken from 
https://tukaani.org/xz/java.html.
+    license: "file://{}/xz/COPYING"
 jackson-bom:
   '2.13.0':
     license: 
"https://raw.githubusercontent.com/FasterXML/jackson-bom/master/LICENSE";
diff --git a/sdks/java/container/license_scripts/license_script.sh 
b/sdks/java/container/license_scripts/license_script.sh
index 27560bf..c2a6540 100755
--- a/sdks/java/container/license_scripts/license_script.sh
+++ b/sdks/java/container/license_scripts/license_script.sh
@@ -49,7 +49,8 @@ pip install --retries 10 -r ${SCRIPT_DIR}/requirement.txt
 # pull licenses, notices and source code
 FLAGS="--license_index=${INDEX_FILE} \
        --output_dir=${DOWNLOAD_DIR} \
-       --dep_url_yaml=${SCRIPT_DIR}/dep_urls_java.yaml "
+       --dep_url_yaml=${SCRIPT_DIR}/dep_urls_java.yaml \
+       --manual_license_path=${SCRIPT_DIR}/manual_licenses"
 
 echo "Executing ${ENV_DIR}/bin/python ${SCRIPT_DIR}/pull_licenses_java.py 
$FLAGS"
 "${ENV_DIR}/bin/python" "${SCRIPT_DIR}/pull_licenses_java.py" $FLAGS
diff --git a/sdks/java/container/license_scripts/manual_licenses/xz/COPYING 
b/sdks/java/container/license_scripts/manual_licenses/xz/COPYING
new file mode 100644
index 0000000..ef71bd4
--- /dev/null
+++ b/sdks/java/container/license_scripts/manual_licenses/xz/COPYING
@@ -0,0 +1,8 @@
+Licensing of XZ for Java
+========================
+
+    All the files in this package have been written by Lasse Collin,
+    Igor Pavlov, and/or Brett Okken. All these files have been put into
+    the public domain. You can do whatever you want with these files.
+
+    This software is provided "as is", without any warranty.
\ No newline at end of file
diff --git a/sdks/java/container/license_scripts/pull_licenses_java.py 
b/sdks/java/container/license_scripts/pull_licenses_java.py
index 696a916..8c81556 100644
--- a/sdks/java/container/license_scripts/pull_licenses_java.py
+++ b/sdks/java/container/license_scripts/pull_licenses_java.py
@@ -42,13 +42,18 @@ SOURCE_CODE_REQUIRED_LICENSES = ['lgpl', 'gpl', 'cddl', 
'mpl', 'gnu', 'mozilla p
 RETRY_NUM = 9
 THREADS = 16
 
-
 @retry(reraise=True,
        wait=wait_fixed(5),
        stop=stop_after_attempt(RETRY_NUM))
 def pull_from_url(file_name, url, dep, no_list):
     if url == 'skip':
         return
+
+    # Replace file path with absolute path to manual licenses
+    if url.startswith('file://{}'):
+        url = url.format(manual_license_path)
+        logging.info('Replaced local file URL with {url} for 
{dep}'.format(url=url, dep=dep))
+
     try:
         url_read = urlopen(url)
         with open(file_name, 'wb') as temp_write:
@@ -234,11 +239,13 @@ if __name__ == "__main__":
     parser.add_argument('--license_index', required=True)
     parser.add_argument('--output_dir', required=True)
     parser.add_argument('--dep_url_yaml', required=True)
+    parser.add_argument('--manual_license_path', required=True)
 
     args = parser.parse_args()
     license_index = args.license_index
     output_dir = args.output_dir
     dep_url_yaml = args.dep_url_yaml
+    manual_license_path = args.manual_license_path
 
     logging.getLogger().setLevel(logging.INFO)
 

Reply via email to