build(crates): migrate crate_universe to Cargo.toml for Dependabot (#4461) Dependabot fails to evaluate Rust dependencies because the repository tracks `crates/Cargo.lock` without a `/crates/Cargo.toml` manifest. Migrate `crate_universe` from `from_specs` to `from_cargo` backed by a checked-in `crates/Cargo.toml` manifest, update `sha2` to `0.11.1` and `zip` to `~9.0.5`, repin the Cargo and Bazel lockfiles, and adapt the zipper test for `zip` 9.0's fallible `entry.name()` API. Cap `zip` below `9.1.0` and configure Dependabot to ignore `zip >= 9.1.0` updates. Newer `zip` releases add target-conditional OS dependencies that fail on `powerpc64le-unknown-linux-musl` until `rules_rust` supports `powerpc64le` platform selection.
diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1ac1f1e..b1cad6a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml
@@ -50,6 +50,16 @@ - "/crates/**/*" patterns: - "*" + ignore: + # keep-sorted start block=yes + # zip >= 9.1.0 fails on powerpc64le-unknown-linux-musl until rules_rust + # defines a powerpc64le config_setting; keep below 9.1.0 (see + # crates/Cargo.toml). Unpatched zip <= 9.0.5 advisories (reading, + # extraction, AES/legacy-decoder flaws) do not apply: crates/zipper only + # creates zips via ZipWriter (ZipArchive is test-only). + - dependency-name: "zip" + versions: [">= 9.1.0"] + # keep-sorted end - package-ecosystem: "uv" multi-ecosystem-group: "dev-only"
diff --git a/MODULE.bazel b/MODULE.bazel index 24f68a7..3227fba 100644 --- a/MODULE.bazel +++ b/MODULE.bazel
@@ -111,48 +111,15 @@ dev_dependency = TOOL_DEPS_DEV_ONLY, ) -# keep-sorted start block=yes by_regex=package\s*=\s*"([^"]+)" -rust_crates.spec( - package = "anyhow", - version = "1.0.104", -) -rust_crates.spec( - # Not used directly; it's a transitive dep of zip. zip's `deflate-flate2` - # feature enables flate2 without selecting a backend, so a top-level spec is - # needed to pick the pure-Rust `rust_backend` and avoid the C zlib backend, - # which can't cross-compile for dev/platforms. - default_features = False, - features = ["rust_backend"], - package = "flate2", - version = "1.1.10", -) -rust_crates.spec( - package = "lexopt", - version = "0.3.2", -) -rust_crates.spec( - package = "sha2", - version = "0.10.8", -) -rust_crates.spec( - # NOTE: zip 9.x added mandatory target-conditional OS deps (getrandom, nix, - # windows-sys) that fail on powerpc64le-unknown-linux-musl until rules_rust - # defines a powerpc64le @rules_rust//rust/platform config_setting. Keep on the - # latest 8.x release until rules_rust supports powerpc64le platform selection. - default_features = False, - features = ["deflate-flate2"], - package = "zip", - version = "8.6.0", -) -# keep-sorted end - # The crates must build for every platform in dev/platforms. Conditional # dependencies are resolved for these triples; rules_rust matches them by CPU # and OS, e.g. i686-unknown-linux-gnu also matches the i686-unknown-linux-musl -# platform. -rust_crates.from_specs( +# platform. Direct dependencies live in //crates:Cargo.toml so Dependabot can +# track Cargo updates and security alerts. +rust_crates.from_cargo( cargo_lockfile = "//crates:Cargo.lock", lockfile = "//crates:Cargo.Bazel.lock", + manifests = ["//crates:Cargo.toml"], supported_platform_triples = [ "aarch64-apple-darwin", "aarch64-pc-windows-msvc",
diff --git a/crates/Cargo.Bazel.lock b/crates/Cargo.Bazel.lock index 1f3a917..dc3c029 100644 --- a/crates/Cargo.Bazel.lock +++ b/crates/Cargo.Bazel.lock
@@ -1,5 +1,5 @@ { - "checksum": "7f9a06aa6df743d20963095d0fe2ee50cbe1bac5ffd344c8b29c7e2851576f07", + "checksum": "bfd96f7f72752644dc2fe47b6acdae808884857b765d1a28115a0f4004754152", "crates": { "adler2 2.0.1": { "name": "adler2", @@ -116,14 +116,53 @@ ], "license_file": "LICENSE-APACHE" }, - "block-buffer 0.10.4": { + "bitflags 2.13.2": { + "name": "bitflags", + "version": "2.13.2", + "package_url": "https://github.com/bitflags/bitflags", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/bitflags/2.13.2/download", + "sha256": "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + } + }, + "targets": [ + { + "Library": { + "crate_name": "bitflags", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": true, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "bitflags", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2021", + "version": "2.13.2" + }, + "license": "MIT OR Apache-2.0", + "license_ids": [ + "Apache-2.0", + "MIT" + ], + "license_file": "LICENSE-APACHE" + }, + "block-buffer 0.12.1": { "name": "block-buffer", - "version": "0.10.4", + "version": "0.12.1", "package_url": "https://github.com/RustCrypto/utils", "repository": { "Http": { - "url": "https://static.crates.io/crates/block-buffer/0.10.4/download", - "sha256": "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" + "url": "https://static.crates.io/crates/block-buffer/0.12.1/download", + "sha256": "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" } }, "targets": [ @@ -148,14 +187,14 @@ "deps": { "common": [ { - "id": "generic-array 0.14.7", - "target": "generic_array" + "id": "hybrid-array 0.4.15", + "target": "hybrid_array" } ], "selects": {} }, - "edition": "2018", - "version": "0.10.4" + "edition": "2024", + "version": "0.12.1" }, "license": "MIT OR Apache-2.0", "license_ids": [ @@ -203,14 +242,91 @@ ], "license_file": "LICENSE-APACHE" }, - "cpufeatures 0.2.17": { + "cfg_aliases 0.2.2": { + "name": "cfg_aliases", + "version": "0.2.2", + "package_url": "https://github.com/katharostech/cfg_aliases", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/cfg_aliases/0.2.2/download", + "sha256": "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + } + }, + "targets": [ + { + "Library": { + "crate_name": "cfg_aliases", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": true, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "cfg_aliases", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2018", + "version": "0.2.2" + }, + "license": "MIT", + "license_ids": [ + "MIT" + ], + "license_file": "LICENSE" + }, + "const-oid 0.10.2": { + "name": "const-oid", + "version": "0.10.2", + "package_url": "https://github.com/RustCrypto/formats", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/const-oid/0.10.2/download", + "sha256": "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + } + }, + "targets": [ + { + "Library": { + "crate_name": "const_oid", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": true, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "const_oid", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2024", + "version": "0.10.2" + }, + "license": "Apache-2.0 OR MIT", + "license_ids": [ + "Apache-2.0", + "MIT" + ], + "license_file": "LICENSE-APACHE" + }, + "cpufeatures 0.3.1": { "name": "cpufeatures", - "version": "0.2.17", + "version": "0.3.1", "package_url": "https://github.com/RustCrypto/utils", "repository": { "Http": { - "url": "https://static.crates.io/crates/cpufeatures/0.2.17/download", - "sha256": "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" + "url": "https://static.crates.io/crates/cpufeatures/0.3.1/download", + "sha256": "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" } }, "targets": [ @@ -235,7 +351,7 @@ "deps": { "common": [], "selects": { - "aarch64-linux-android": [ + "cfg(all(target_arch = \"aarch64\", target_os = \"android\"))": [ { "id": "libc 0.2.191", "target": "libc" @@ -261,8 +377,8 @@ ] } }, - "edition": "2018", - "version": "0.2.17" + "edition": "2024", + "version": "0.3.1" }, "license": "MIT OR Apache-2.0", "license_ids": [ @@ -355,14 +471,14 @@ ], "license_file": "LICENSE-APACHE" }, - "crypto-common 0.1.7": { + "crypto-common 0.2.2": { "name": "crypto-common", - "version": "0.1.7", + "version": "0.2.2", "package_url": "https://github.com/RustCrypto/traits", "repository": { "Http": { - "url": "https://static.crates.io/crates/crypto-common/0.1.7/download", - "sha256": "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" + "url": "https://static.crates.io/crates/crypto-common/0.2.2/download", + "sha256": "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" } }, "targets": [ @@ -384,27 +500,17 @@ "compile_data_glob": [ "**" ], - "crate_features": { - "common": [ - "std" - ], - "selects": {} - }, "deps": { "common": [ { - "id": "generic-array 0.14.7", - "target": "generic_array" - }, - { - "id": "typenum 1.20.1", - "target": "typenum" + "id": "hybrid-array 0.4.15", + "target": "hybrid_array" } ], "selects": {} }, - "edition": "2018", - "version": "0.1.7" + "edition": "2024", + "version": "0.2.2" }, "license": "MIT OR Apache-2.0", "license_ids": [ @@ -413,14 +519,14 @@ ], "license_file": "LICENSE-APACHE" }, - "digest 0.10.7": { + "digest 0.11.3": { "name": "digest", - "version": "0.10.7", + "version": "0.11.3", "package_url": "https://github.com/RustCrypto/traits", "repository": { "Http": { - "url": "https://static.crates.io/crates/digest/0.10.7/download", - "sha256": "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" + "url": "https://static.crates.io/crates/digest/0.11.3/download", + "sha256": "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" } }, "targets": [ @@ -445,28 +551,32 @@ "crate_features": { "common": [ "alloc", - "block-buffer", - "core-api", + "block-api", "default", - "std" + "oid" ], "selects": {} }, "deps": { "common": [ { - "id": "block-buffer 0.10.4", + "id": "block-buffer 0.12.1", "target": "block_buffer" }, { - "id": "crypto-common 0.1.7", - "target": "crypto_common" + "id": "const-oid 0.10.2", + "target": "const_oid" + }, + { + "id": "crypto-common 0.2.2", + "target": "crypto_common", + "alias": "common" } ], "selects": {} }, - "edition": "2018", - "version": "0.10.7" + "edition": "2024", + "version": "0.11.3" }, "license": "MIT OR Apache-2.0", "license_ids": [ @@ -475,62 +585,6 @@ ], "license_file": "LICENSE-APACHE" }, - "direct-cargo-bazel-deps 0.0.1": { - "name": "direct-cargo-bazel-deps", - "version": "0.0.1", - "package_url": null, - "repository": null, - "targets": [ - { - "Library": { - "crate_name": "direct_cargo_bazel_deps", - "crate_root": ".direct_cargo_bazel_deps.rs", - "srcs": { - "allow_empty": true, - "include": [ - "**/*.rs" - ] - } - } - } - ], - "library_target_name": "direct_cargo_bazel_deps", - "common_attrs": { - "compile_data_glob": [ - "**" - ], - "deps": { - "common": [ - { - "id": "anyhow 1.0.104", - "target": "anyhow" - }, - { - "id": "flate2 1.1.11", - "target": "flate2" - }, - { - "id": "lexopt 0.3.2", - "target": "lexopt" - }, - { - "id": "sha2 0.10.9", - "target": "sha2" - }, - { - "id": "zip 8.6.0", - "target": "zip" - } - ], - "selects": {} - }, - "edition": "2018", - "version": "0.0.1" - }, - "license": null, - "license_ids": [], - "license_file": null - }, "equivalent 1.0.3": { "name": "equivalent", "version": "1.0.3", @@ -602,7 +656,9 @@ "crate_features": { "common": [ "any_impl", + "default", "miniz_oxide", + "runtime_detection", "rust_backend" ], "selects": {} @@ -630,97 +686,6 @@ ], "license_file": "LICENSE-APACHE" }, - "generic-array 0.14.7": { - "name": "generic-array", - "version": "0.14.7", - "package_url": "https://github.com/fizyk20/generic-array.git", - "repository": { - "Http": { - "url": "https://static.crates.io/crates/generic-array/0.14.7/download", - "sha256": "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" - } - }, - "targets": [ - { - "Library": { - "crate_name": "generic_array", - "crate_root": "src/lib.rs", - "srcs": { - "allow_empty": true, - "include": [ - "**/*.rs" - ] - } - } - }, - { - "BuildScript": { - "crate_name": "build_script_build", - "crate_root": "build.rs", - "srcs": { - "allow_empty": true, - "include": [ - "**/*.rs" - ] - } - } - } - ], - "library_target_name": "generic_array", - "common_attrs": { - "compile_data_glob": [ - "**" - ], - "crate_features": { - "common": [ - "more_lengths" - ], - "selects": {} - }, - "deps": { - "common": [ - { - "id": "typenum 1.20.1", - "target": "typenum" - } - ], - "selects": {} - }, - "extra_deps": { - "common": [ - ":build_script_build" - ], - "selects": {} - }, - "edition": "2015", - "version": "0.14.7" - }, - "build_script_attrs": { - "compile_data_glob": [ - "**" - ], - "compile_data_glob_excludes": [ - "**/*.rs" - ], - "data_glob": [ - "**" - ], - "deps": { - "common": [ - { - "id": "version_check 0.9.5", - "target": "version_check" - } - ], - "selects": {} - } - }, - "license": "MIT", - "license_ids": [ - "MIT" - ], - "license_file": "LICENSE" - }, "hashbrown 0.17.1": { "name": "hashbrown", "version": "0.17.1", @@ -760,6 +725,54 @@ ], "license_file": "LICENSE-APACHE" }, + "hybrid-array 0.4.15": { + "name": "hybrid-array", + "version": "0.4.15", + "package_url": "https://github.com/RustCrypto/hybrid-array", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/hybrid-array/0.4.15/download", + "sha256": "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" + } + }, + "targets": [ + { + "Library": { + "crate_name": "hybrid_array", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": true, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "hybrid_array", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "typenum 1.20.1", + "target": "typenum" + } + ], + "selects": {} + }, + "edition": "2024", + "version": "0.4.15" + }, + "license": "MIT OR Apache-2.0", + "license_ids": [ + "Apache-2.0", + "MIT" + ], + "license_file": "LICENSE-APACHE" + }, "indexmap 2.14.2": { "name": "indexmap", "version": "2.14.2", @@ -898,6 +911,21 @@ "compile_data_glob": [ "**" ], + "crate_features": { + "common": [], + "selects": { + "aarch64-apple-darwin": [ + "default", + "extra_traits", + "std" + ], + "x86_64-apple-darwin": [ + "default", + "extra_traits", + "std" + ] + } + }, "extra_deps": { "common": [ ":build_script_build" @@ -1034,14 +1062,169 @@ ], "license_file": "LICENSE" }, - "sha2 0.10.9": { + "nix 0.31.3": { + "name": "nix", + "version": "0.31.3", + "package_url": "https://github.com/nix-rust/nix", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/nix/0.31.3/download", + "sha256": "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" + } + }, + "targets": [ + { + "Library": { + "crate_name": "nix", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": true, + "include": [ + "**/*.rs" + ] + } + } + }, + { + "BuildScript": { + "crate_name": "build_script_build", + "crate_root": "build.rs", + "srcs": { + "allow_empty": true, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "nix", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "crate_features": { + "common": [ + "fs" + ], + "selects": {} + }, + "deps": { + "common": [ + { + "id": "bitflags 2.13.2", + "target": "bitflags" + }, + { + "id": "cfg-if 1.0.5", + "target": "cfg_if" + }, + { + "id": "libc 0.2.191", + "target": "libc" + } + ], + "selects": {} + }, + "extra_deps": { + "common": [ + ":build_script_build" + ], + "selects": {} + }, + "edition": "2021", + "version": "0.31.3" + }, + "build_script_attrs": { + "compile_data_glob": [ + "**" + ], + "compile_data_glob_excludes": [ + "**/*.rs" + ], + "data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "cfg_aliases 0.2.2", + "target": "cfg_aliases" + } + ], + "selects": {} + } + }, + "license": "MIT", + "license_ids": [ + "MIT" + ], + "license_file": "LICENSE" + }, + "rules_python_crates 0.0.1": { + "name": "rules_python_crates", + "version": "0.0.1", + "package_url": null, + "repository": null, + "targets": [ + { + "Library": { + "crate_name": "rules_python_crates", + "crate_root": "shrubbery/src/lib.rs", + "srcs": { + "allow_empty": true, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "rules_python_crates", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "deps": { + "common": [ + { + "id": "anyhow 1.0.104", + "target": "anyhow" + }, + { + "id": "flate2 1.1.11", + "target": "flate2" + }, + { + "id": "lexopt 0.3.2", + "target": "lexopt" + }, + { + "id": "sha2 0.11.1", + "target": "sha2" + }, + { + "id": "zip 9.0.5", + "target": "zip" + } + ], + "selects": {} + }, + "edition": "2024", + "version": "0.0.1" + }, + "license": null, + "license_ids": [], + "license_file": null + }, + "sha2 0.11.1": { "name": "sha2", - "version": "0.10.9", + "version": "0.11.1", "package_url": "https://github.com/RustCrypto/hashes", "repository": { "Http": { - "url": "https://static.crates.io/crates/sha2/0.10.9/download", - "sha256": "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" + "url": "https://static.crates.io/crates/sha2/0.11.1/download", + "sha256": "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" } }, "targets": [ @@ -1065,8 +1248,9 @@ ], "crate_features": { "common": [ + "alloc", "default", - "std" + "oid" ], "selects": {} }, @@ -1077,21 +1261,21 @@ "target": "cfg_if" }, { - "id": "digest 0.10.7", + "id": "digest 0.11.3", "target": "digest" } ], "selects": { "cfg(any(target_arch = \"aarch64\", target_arch = \"x86_64\", target_arch = \"x86\"))": [ { - "id": "cpufeatures 0.2.17", + "id": "cpufeatures 0.3.1", "target": "cpufeatures" } ] } }, - "edition": "2018", - "version": "0.10.9" + "edition": "2024", + "version": "0.11.1" }, "license": "MIT OR Apache-2.0", "license_ids": [ @@ -1213,6 +1397,12 @@ "compile_data_glob": [ "**" ], + "crate_features": { + "common": [ + "const-generics" + ], + "selects": {} + }, "edition": "2018", "version": "1.20.1" }, @@ -1223,53 +1413,14 @@ ], "license_file": "LICENSE" }, - "version_check 0.9.5": { - "name": "version_check", - "version": "0.9.5", - "package_url": "https://github.com/SergioBenitez/version_check", - "repository": { - "Http": { - "url": "https://static.crates.io/crates/version_check/0.9.5/download", - "sha256": "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - } - }, - "targets": [ - { - "Library": { - "crate_name": "version_check", - "crate_root": "src/lib.rs", - "srcs": { - "allow_empty": true, - "include": [ - "**/*.rs" - ] - } - } - } - ], - "library_target_name": "version_check", - "common_attrs": { - "compile_data_glob": [ - "**" - ], - "edition": "2015", - "version": "0.9.5" - }, - "license": "MIT/Apache-2.0", - "license_ids": [ - "Apache-2.0", - "MIT" - ], - "license_file": "LICENSE-APACHE" - }, - "zip 8.6.0": { + "zip 9.0.5": { "name": "zip", - "version": "8.6.0", + "version": "9.0.5", "package_url": "https://github.com/zip-rs/zip2", "repository": { "Http": { - "url": "https://static.crates.io/crates/zip/8.6.0/download", - "sha256": "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b" + "url": "https://static.crates.io/crates/zip/9.0.5/download", + "sha256": "6e04976da629d3b04204ba8105b396a193af8ad2583b2c79bfb3ab8af580a11e" } }, "targets": [ @@ -1321,27 +1472,71 @@ "target": "typed_path" } ], - "selects": {} + "selects": { + "cfg(any(target_os = \"macos\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\"))": [ + { + "id": "nix 0.31.3", + "target": "nix" + } + ] + } }, "edition": "2024", - "version": "8.6.0" + "version": "9.0.5" }, "license": "MIT", "license_ids": [ "MIT" ], "license_file": "LICENSE" + }, + "zlib-rs 0.6.8": { + "name": "zlib-rs", + "version": "0.6.8", + "package_url": "https://github.com/trifectatechfoundation/zlib-rs", + "repository": { + "Http": { + "url": "https://static.crates.io/crates/zlib-rs/0.6.8/download", + "sha256": "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + } + }, + "targets": [ + { + "Library": { + "crate_name": "zlib_rs", + "crate_root": "src/lib.rs", + "srcs": { + "allow_empty": true, + "include": [ + "**/*.rs" + ] + } + } + } + ], + "library_target_name": "zlib_rs", + "common_attrs": { + "compile_data_glob": [ + "**" + ], + "edition": "2021", + "version": "0.6.8" + }, + "license": "Zlib", + "license_ids": [ + "Zlib" + ], + "license_file": "LICENSE" } }, "binary_crates": [], "workspace_members": { - "direct-cargo-bazel-deps 0.0.1": "" + "rules_python_crates 0.0.1": "crates" }, "conditions": { "aarch64-apple-darwin": [ "aarch64-apple-darwin" ], - "aarch64-linux-android": [], "aarch64-pc-windows-msvc": [ "aarch64-pc-windows-msvc" ], @@ -1351,6 +1546,7 @@ "armv7-unknown-linux-gnueabi": [ "armv7-unknown-linux-gnueabi" ], + "cfg(all(target_arch = \"aarch64\", target_os = \"android\"))": [], "cfg(all(target_arch = \"aarch64\", target_os = \"linux\"))": [ "aarch64-unknown-linux-gnu" ], @@ -1368,6 +1564,10 @@ "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu" ], + "cfg(any(target_os = \"macos\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\", target_os = \"dragonfly\"))": [ + "aarch64-apple-darwin", + "x86_64-apple-darwin" + ], "i686-pc-windows-msvc": [ "i686-pc-windows-msvc" ], @@ -1391,8 +1591,8 @@ "anyhow 1.0.104", "flate2 1.1.11", "lexopt 0.3.2", - "sha2 0.10.9", - "zip 8.6.0" + "sha2 0.11.1", + "zip 9.0.5" ], "direct_dev_deps": [], "unused_patches": []
diff --git a/crates/Cargo.lock b/crates/Cargo.lock index 4454b52..a79004f 100644 --- a/crates/Cargo.lock +++ b/crates/Cargo.lock
@@ -15,12 +15,18 @@ checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" [[package]] -name = "block-buffer" -version = "0.10.4" +name = "bitflags" +version = "2.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" dependencies = [ - "generic-array", + "hybrid-array", ] [[package]] @@ -30,10 +36,22 @@ checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" [[package]] -name = "cpufeatures" -version = "0.2.17" +name = "cfg_aliases" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" dependencies = [ "libc", ] @@ -49,36 +67,25 @@ [[package]] name = "crypto-common" -version = "0.1.7" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" dependencies = [ - "generic-array", - "typenum", + "hybrid-array", ] [[package]] name = "digest" -version = "0.10.7" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ "block-buffer", + "const-oid", "crypto-common", ] [[package]] -name = "direct-cargo-bazel-deps" -version = "0.0.1" -dependencies = [ - "anyhow", - "flate2", - "lexopt", - "sha2", - "zip", -] - -[[package]] name = "equivalent" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -92,16 +99,7 @@ dependencies = [ "crc32fast", "miniz_oxide", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", + "zlib-rs", ] [[package]] @@ -111,6 +109,15 @@ checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" [[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] name = "indexmap" version = "2.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -149,10 +156,33 @@ ] [[package]] -name = "sha2" -version = "0.10.9" +name = "nix" +version = "0.31.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "rules_python_crates" +version = "0.0.1" +dependencies = [ + "anyhow", + "flate2", + "lexopt", + "sha2", + "zip", +] + +[[package]] +name = "sha2" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d7069beb7d6ac7b9acd1039986e73443f24234f41074da099d6f994ac9ad19" dependencies = [ "cfg-if", "cpufeatures", @@ -178,20 +208,21 @@ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" [[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] name = "zip" -version = "8.6.0" +version = "9.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b" +checksum = "6e04976da629d3b04204ba8105b396a193af8ad2583b2c79bfb3ab8af580a11e" dependencies = [ "crc32fast", "flate2", "indexmap", "memchr", + "nix", "typed-path", ] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
diff --git a/crates/Cargo.toml b/crates/Cargo.toml new file mode 100644 index 0000000..991f833 --- /dev/null +++ b/crates/Cargo.toml
@@ -0,0 +1,30 @@ +[package] +name = "rules_python_crates" +version = "0.0.1" +edition = "2024" +publish = false + +# Cargo and Dependabot require at least one target in the manifest. Point [lib] +# at shrubbery/src/lib.rs to satisfy that check; this package only exists to +# declare third-party crates for rules_rust's crate_universe (see +# MODULE.bazel), so direct `cargo check`/`cargo build` is unsupported and actual +# Rust targets are built with Bazel under //crates/... +[lib] +path = "shrubbery/src/lib.rs" + +[dependencies] +# keep-sorted start +anyhow = "1.0.104" +# Transitive dep of zip: zip's `deflate-flate2` leaves the backend unset, so a +# top-level pin keeps flate2 on its default pure-Rust backend. +flate2 = "1.1.11" +lexopt = "0.3.2" +sha2 = "0.11.1" +# Disable default features (C zstd-sys bindings plus unused compression, +# encryption, and time subsystems) and enable only `deflate-flate2`. +# NOTE: Keep below 9.1.0; zip >= 9.1.0 adds mandatory target-conditional OS deps +# (getrandom, windows-sys, libc) that fail on powerpc64le-unknown-linux-musl +# until rules_rust defines a powerpc64le @rules_rust//rust/platform +# config_setting. +zip = { version = "~9.0.5", default-features = false, features = ["deflate-flate2"] } +# keep-sorted end
diff --git a/crates/zipper/src/lib.rs b/crates/zipper/src/lib.rs index 7fd5828..b3a847f 100644 --- a/crates/zipper/src/lib.rs +++ b/crates/zipper/src/lib.rs
@@ -11,7 +11,7 @@ use anyhow::{Context, Result, bail}; use zip::write::SimpleFileOptions; -use zip::{CompressionMethod, DateTime, ZIP64_BYTES_THR, ZipWriter}; +use zip::{CompressionMethod, DateTime, System, ZIP64_BYTES_THR, ZipWriter}; /// `BufWriter` capacity for the output zip. /// @@ -346,8 +346,11 @@ const FIXED_TIMESTAMP: DateTime = DateTime::DEFAULT; fn file_options(compress_level: u32, unix_mode: u32) -> SimpleFileOptions { + // Use `System::Unix` (matching `tools/zipapp/zipper.py`'s `create_system = 3`) so + // `zip` preserves `unix_permissions` on Windows too instead of synthesizing DOS modes. let options = SimpleFileOptions::default() .last_modified_time(FIXED_TIMESTAMP) + .system(System::Unix) .unix_permissions(unix_mode); if compress_level == 0 { options.compression_method(CompressionMethod::Stored) @@ -359,9 +362,11 @@ } /// Options for symlink entries. `add_symlink` already sets `0o777 | S_IFLNK` and always stores -/// symlinks uncompressed, so only the timestamp needs fixing. +/// symlinks uncompressed, so only the timestamp and system need fixing. fn symlink_options() -> SimpleFileOptions { - SimpleFileOptions::default().last_modified_time(FIXED_TIMESTAMP) + SimpleFileOptions::default() + .last_modified_time(FIXED_TIMESTAMP) + .system(System::Unix) } fn write_entry<W: Write + Seek>(
diff --git a/tests/zipper/zipper_test.rs b/tests/zipper/zipper_test.rs index 755ac9e..877d4be 100644 --- a/tests/zipper/zipper_test.rs +++ b/tests/zipper/zipper_test.rs
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicUsize, Ordering}; -use zip::{CompressionMethod, DateTime, ZipArchive}; +use zip::{CompressionMethod, DateTime, System, ZipArchive}; use zipper_lib::{Cli, ZipOptions, create_zip, parse_args, relative_path}; static TEST_COUNTER: AtomicUsize = AtomicUsize::new(0); @@ -22,15 +22,16 @@ entry .read_to_end(&mut data) .expect("zip entry data should be readable"); + let name = entry.name().expect("zip entry name should be valid"); assert_eq!( data.len() as u64, entry.size(), - "uncompressed size mismatch for {}", - entry.name() + "uncompressed size mismatch for {name}", ); entries.push(ParsedZipEntry { - name: entry.name().to_string(), + name: name.into_owned(), + system: entry.system(), compression: entry.compression(), last_modified: entry.last_modified(), compress_size: entry.compressed_size(), @@ -95,6 +96,7 @@ assert_eq!(by_name["file1.txt"].text(), "content1"); assert!(!by_name["file1.txt"].is_symlink); + assert_eq!(by_name["file1.txt"].system, System::Unix); assert_eq!(by_name["runfiles/my_ws/foo/bar.txt"].text(), "content1"); assert!(!by_name["runfiles/my_ws/foo/bar.txt"].is_symlink); @@ -104,6 +106,7 @@ assert_eq!(by_name["runfiles/my_ws/empty_file"].text(), ""); assert!(!by_name["runfiles/my_ws/empty_file"].is_symlink); + assert_eq!(by_name["runfiles/my_ws/empty_file"].system, System::Unix); assert_eq!( by_name["runfiles/my_ws/empty_file"] .unix_mode @@ -797,6 +800,7 @@ struct ParsedZipEntry { /// Entry path inside the zip archive, relative to the zip root. name: String, + system: System, compression: CompressionMethod, last_modified: Option<DateTime>, compress_size: u64,