You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by er...@apache.org on 2026/08/12 01:41:05 UTC

(opendal) 01/02: Fix dependency check script and CI

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

erickguan pushed a commit to branch update-dependency-list
in repository https://gitbox.apache.org/repos/asf/opendal.git

commit de3b32305b9cf147acf97ecbfaa94e4237733a55
Author: Erick Guan <29...@users.noreply.github.com>
AuthorDate: Wed Aug 12 09:39:26 2026 +0800

    Fix dependency check script and CI
---
 .github/actions/setup/action.yaml |  2 +-
 deny.toml                         |  8 +++---
 scripts/constants.py              |  4 +--
 scripts/dependencies.py           | 58 +++++++++++++++++++++++++--------------
 4 files changed, 45 insertions(+), 27 deletions(-)

diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml
index addb15f583..0860bfc85a 100644
--- a/.github/actions/setup/action.yaml
+++ b/.github/actions/setup/action.yaml
@@ -147,7 +147,7 @@ runs:
       if: inputs.need-deny == 'true'
       uses: taiki-e/install-action@v2
       with:
-        tool: cargo-deny@0.14.22
+        tool: cargo-deny@0.20.2
 
     - name: Setup rocksdb on linux
       if: runner.os == 'Linux' && inputs.need-rocksdb == 'true'
diff --git a/deny.toml b/deny.toml
index 00003aa6da..f64735b5ce 100644
--- a/deny.toml
+++ b/deny.toml
@@ -21,7 +21,10 @@ allow = [
   "Apache-2.0 WITH LLVM-exception",
   "BSD-2-Clause",
   "BSD-3-Clause",
+  "BSL-1.0",
   "CC0-1.0",
+  # ASF LEGAL-732 treats CDLA-Permissive-2.0 as Category A.
+  "CDLA-Permissive-2.0",
   "ISC",
   "MIT",
   "OpenSSL",
@@ -54,13 +57,10 @@ exceptions = [
     "LGPL-3.0-only",
   ] },
 
-  # open data licenses that SHOULD be OK
+  # open data license that SHOULD be OK
   { crate = "unicode_names2", allow = [
     "Unicode-DFS-2016",
   ] },
-  { crate = "webpki-roots", allow = [
-    "CDLA-Permissive-2.0",
-  ] },
 ]
 
 # this config file is used for all crates; some of them would not encounter all the allowed licenses
diff --git a/scripts/constants.py b/scripts/constants.py
index 45b04e80ec..fec0003565 100755
--- a/scripts/constants.py
+++ b/scripts/constants.py
@@ -21,8 +21,8 @@ from pathlib import Path
 ROOT_DIR = Path(__file__).parent.parent
 
 
-def list_packages():
-    packages = ["core"]
+def list_packages() -> list[Path]:
+    packages = [Path("core")]
 
     for dir in ["integrations", "bin", "bindings"]:
         base = ROOT_DIR / dir
diff --git a/scripts/dependencies.py b/scripts/dependencies.py
index e80b8e858e..2799c1b729 100755
--- a/scripts/dependencies.py
+++ b/scripts/dependencies.py
@@ -16,45 +16,63 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import asyncio
 from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
 from pathlib import Path
 import subprocess
-from concurrent.futures import ThreadPoolExecutor
+
 from constants import PACKAGES
 
 
-def check_single_package(root):
-    if (Path(root) / "Cargo.toml").exists():
+def check_single_package(root: Path) -> None:
+    if (root / "Cargo.toml").exists():
         print(f"Checking dependencies of {root}")
-        subprocess.run(["cargo", "deny", "check", "license"], cwd=root)
+        subprocess.run(
+            ["cargo", "deny", "check", "licenses"], cwd=root, check=True
+        )
     else:
         print(f"Skipping {root} as Cargo.toml does not exist")
 
 
-def check_deps():
-    cargo_dirs = PACKAGES
-    for d in cargo_dirs:
-        check_single_package(d)
+def check_deps() -> None:
+    failures: list[Path] = []
+    for root in PACKAGES:
+        try:
+            check_single_package(root)
+        except subprocess.CalledProcessError:
+            failures.append(root)
+    if failures:
+        roots = ", ".join(str(root) for root in failures)
+        raise RuntimeError(f"dependency checks failed for: {roots}")
 
 
-def generate_single_package(root):
-    if (Path(root) / "Cargo.toml").exists():
+async def generate_single_package(root: Path) -> None:
+    if (root / "Cargo.toml").exists():
         print(f"Generating dependencies {root}")
-        result = subprocess.check_output(
-            ["cargo", "deny", "list", "-f", "tsv", "-t", "0.6"],
-            cwd=root,
-            text=True,
+        command = ["cargo", "deny", "list", "-f", "tsv", "-t", "0.6"]
+        process = await asyncio.create_subprocess_exec(
+            *command, cwd=root, stdout=asyncio.subprocess.PIPE
         )
-        with open(f"{root}/DEPENDENCIES.rust.tsv", "w") as f:
-            f.write(result)
+        stdout, _ = await process.communicate()
+        if process.returncode != 0:
+            raise subprocess.CalledProcessError(process.returncode, command)
+        (root / "DEPENDENCIES.rust.tsv").write_bytes(stdout)
     else:
         print(f"Skipping {root} as Cargo.toml does not exist")
 
 
-def generate_deps():
-    cargo_dirs = PACKAGES
-    with ThreadPoolExecutor(max_workers=4) as executor:
-        executor.map(generate_single_package, cargo_dirs)
+async def generate_all_deps() -> None:
+    results = await asyncio.gather(
+        *(generate_single_package(root) for root in PACKAGES),
+        return_exceptions=True,
+    )
+    for result in results:
+        if isinstance(result, BaseException):
+            raise result
+
+
+def generate_deps() -> None:
+    asyncio.run(generate_all_deps())
 
 
 if __name__ == "__main__":