From 15c5695e170f3c38888a50bcec7cbc72ebfed5cf Mon Sep 17 00:00:00 2001 From: peefy Date: Sun, 18 Feb 2024 10:08:58 +0800 Subject: [PATCH 1/2] chore: deprecated rust-crypto crate and use md5 Signed-off-by: peefy --- kclvm/Cargo.lock | 170 ++++++++++++++++++-------------------- kclvm/config/Cargo.toml | 2 +- kclvm/config/src/cache.rs | 7 +- 3 files changed, 84 insertions(+), 95 deletions(-) diff --git a/kclvm/Cargo.lock b/kclvm/Cargo.lock index 3350ec3a7..0ee609cab 100644 --- a/kclvm/Cargo.lock +++ b/kclvm/Cargo.lock @@ -243,13 +243,25 @@ dependencies = [ "typenum", ] +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array 0.12.4", +] + [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -258,7 +270,16 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array", + "generic-array 0.14.7", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", ] [[package]] @@ -278,6 +299,18 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.4.0" @@ -648,7 +681,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array", + "generic-array 0.14.7", "typenum", ] @@ -692,13 +725,22 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", +] + [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -956,12 +998,6 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ab85b9b05e3978cc9a9cf8fea7f01b494e1a09ed3037e16ba39edc7a29eb61a" -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "futures" version = "0.3.28" @@ -1051,12 +1087,6 @@ dependencies = [ "slab", ] -[[package]] -name = "gcc" -version = "0.3.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" - [[package]] name = "generational-arena" version = "0.2.9" @@ -1066,6 +1096,15 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -1196,7 +1235,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" dependencies = [ "bitmaps", - "rand_core 0.6.4", + "rand_core", "rand_xoshiro", "sized-chunks", "typenum", @@ -1601,10 +1640,10 @@ dependencies = [ "kclvm-ast", "kclvm-utils", "kclvm-version", + "md-5 0.8.0", "pathdiff", "pcre2", "ron", - "rust-crypto", "serde", "serde_json", "serde_yaml 0.9.25", @@ -2046,6 +2085,17 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" +[[package]] +name = "md-5" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "opaque-debug 0.2.3", +] + [[package]] name = "md-5" version = "0.10.5" @@ -2209,6 +2259,12 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + [[package]] name = "opaque-debug" version = "0.3.0" @@ -2348,7 +2404,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d43f3220d96e0080cc9ea234978ccd80d904eafb17be31bb0f76daaea6493082" dependencies = [ "phf_shared", - "rand 0.8.5", + "rand", ] [[package]] @@ -2679,29 +2735,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "rand" -version = "0.3.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" -dependencies = [ - "libc", - "rand 0.4.6", -] - -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.8.5" @@ -2710,7 +2743,7 @@ checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -2720,24 +2753,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.4", + "rand_core", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.6.4" @@ -2753,7 +2771,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" dependencies = [ - "rand_core 0.6.4", + "rand_core", ] [[package]] @@ -2778,15 +2796,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -2872,19 +2881,6 @@ dependencies = [ "str_indices", ] -[[package]] -name = "rust-crypto" -version = "0.2.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" -dependencies = [ - "gcc", - "libc", - "rand 0.3.23", - "rustc-serialize", - "time 0.1.45", -] - [[package]] name = "rustc-demangle" version = "0.1.23" @@ -2942,12 +2938,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" - [[package]] name = "rustc_data_structures" version = "0.0.1" @@ -2999,7 +2989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee78969130992735ace193e2c463da2bddd275e90e648871198312a7aed7baf" dependencies = [ "cfg-if 0.1.10", - "md-5", + "md-5 0.10.5", "rustc_data_structures", "scoped-tls", "sha-1", @@ -3277,7 +3267,7 @@ dependencies = [ "cfg-if 1.0.0", "cpufeatures", "digest 0.9.0", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] diff --git a/kclvm/config/Cargo.toml b/kclvm/config/Cargo.toml index 6447eba84..200fbf79f 100644 --- a/kclvm/config/Cargo.toml +++ b/kclvm/config/Cargo.toml @@ -14,7 +14,6 @@ ahash = "0.7.2" toml = "0.5.8" ron = "0.7.0" chrono = "0.4.19" -rust-crypto = "0.2.36" glob = "0.3.0" fslock = "0.2.1" pathdiff = "0.2.1" @@ -25,3 +24,4 @@ kclvm-utils = {path = "../utils"} kclvm-ast = {path = "../ast"} dirs = "5.0.0" pcre2 = "0.2.4" +md-5 = "0.8.0" diff --git a/kclvm/config/src/cache.rs b/kclvm/config/src/cache.rs index c7ae46bcc..f83e6e391 100644 --- a/kclvm/config/src/cache.rs +++ b/kclvm/config/src/cache.rs @@ -2,10 +2,9 @@ extern crate chrono; use super::modfile::KCL_FILE_SUFFIX; use anyhow::Result; -use crypto::digest::Digest; -use crypto::md5::Md5; use fslock::LockFile; use kclvm_utils::pkgpath::{parse_external_pkg_name, rm_external_pkg_name}; +use md5::{Digest, Md5}; use serde::{de::DeserializeOwned, Serialize}; use std::collections::HashMap; use std::error; @@ -21,7 +20,7 @@ const CACHE_INFO_FILENAME: &str = "info"; const KCL_SUFFIX_PATTERN: &str = "*.k"; pub const KCL_CACHE_PATH_ENV_VAR: &str = "KCL_CACHE_PATH"; -pub type CacheInfo = String; +pub type CacheInfo = Vec; pub type Cache = HashMap; #[allow(dead_code)] @@ -237,7 +236,7 @@ fn get_cache_info(path_str: &str) -> CacheInfo { md5.input(buf.as_slice()); } } - md5.result_str() + md5.result().to_vec() } pub fn get_pkg_realpath_from_pkgpath(root: &str, pkgpath: &str) -> String { From df30582e9e40433d6929a90e771a318d1beb105d Mon Sep 17 00:00:00 2001 From: peefy Date: Sun, 18 Feb 2024 10:20:42 +0800 Subject: [PATCH 2/2] chore: add compiler base on in CI Signed-off-by: peefy --- .github/workflows/test_compiler_base.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_compiler_base.yaml b/.github/workflows/test_compiler_base.yaml index ee2a6e6a9..0e8fa2ffe 100644 --- a/.github/workflows/test_compiler_base.yaml +++ b/.github/workflows/test_compiler_base.yaml @@ -1,5 +1,12 @@ name: build-and-test-compiler-base -on: ["push", "pull_request"] +on: + push: + paths: + - 'compiler_base/**' + pull_request: + paths: + - 'compiler_base/**' + jobs: check-fmt: name: Test