From f506c0abef5ecc51fab31b7a5105a52beaf6a5a5 Mon Sep 17 00:00:00 2001 From: overweight Date: Mon, 13 Nov 2023 20:55:09 +0800 Subject: [PATCH] build: add keepgater of every crate with cargo build --- .pre-commit-config.yaml | 2 +- ci/00-pre.sh | 2 +- ci/03-build-packages.sh | 12 ++++++++++++ ci/common_function | 1 + core/sysmaster/Cargo.toml | 1 + exts/hwdb/Cargo.toml | 5 ++++- exts/random_seed/Cargo.toml | 1 + libs/basic/Cargo.toml | 12 ++++++------ libs/device/Cargo.toml | 1 + next/Cargo.toml | 18 ++++++++++++++++-- 10 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 ci/03-build-packages.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7a344b8..b9739e18 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: - id: cargo-override-set name: cargo-override-set description: unset override. - entry: bash -c 'rustup override set 1.57 || true' + entry: bash -c 'rustup override set 1.57.0 || true' language: system pass_filenames: false files: \.(rs|toml)$ diff --git a/ci/00-pre.sh b/ci/00-pre.sh index 62304e54..7a42630b 100755 --- a/ci/00-pre.sh +++ b/ci/00-pre.sh @@ -32,7 +32,7 @@ rm -rf rustlang.sh fi source "$HOME/.cargo/env" -rustup default 1.57 +rustup default $rust_vendor # Define the crate names to test crate_names=("https://github.com/rust-lang/crates.io-index" \ diff --git a/ci/03-build-packages.sh b/ci/03-build-packages.sh new file mode 100644 index 00000000..6e8aa289 --- /dev/null +++ b/ci/03-build-packages.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +source $SCRIPT_DIR/common_function + +for line in `cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | "\(.name):\(.version)"'` +do + cargo build --package $line + if [ $? -ne 0 ]; then + echo "Failed to build $line" + exit 1 + fi +done diff --git a/ci/common_function b/ci/common_function index 54f37272..2b4ac0ec 100644 --- a/ci/common_function +++ b/ci/common_function @@ -1,4 +1,5 @@ #!/usr/bin/env bash +export rust_vendor="1.57.0" function test_fasturl() { diff --git a/core/sysmaster/Cargo.toml b/core/sysmaster/Cargo.toml index 2bc2ec87..30d7d95b 100644 --- a/core/sysmaster/Cargo.toml +++ b/core/sysmaster/Cargo.toml @@ -22,6 +22,7 @@ features = [ "security", "mount", "machine", + "exec_util", "unit_name", ] optional = false diff --git a/exts/hwdb/Cargo.toml b/exts/hwdb/Cargo.toml index 698a2b2a..9e057433 100644 --- a/exts/hwdb/Cargo.toml +++ b/exts/hwdb/Cargo.toml @@ -8,5 +8,8 @@ edition = "2021" [dependencies] nix = { version = "0.24", default-features = false } log = { path = "../../libs/log", default-features = false } -clap = { version = "3.1.8", default_features = false, features = ["derive"] } +clap = { version = "3.1.8", default_features = false, features = [ + "derive", + "std", +] } hwdb = { path = "../../libs/hwdb", default-features = false } diff --git a/exts/random_seed/Cargo.toml b/exts/random_seed/Cargo.toml index a92d28e7..f97a80d6 100644 --- a/exts/random_seed/Cargo.toml +++ b/exts/random_seed/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" [dependencies] basic = { path = "../../libs/basic", default-features = false, features = [ "config", + "io", ] } libc = { version = "0.2.*", default-features = false } diff --git a/libs/basic/Cargo.toml b/libs/basic/Cargo.toml index f7c84157..bf0c4d46 100644 --- a/libs/basic/Cargo.toml +++ b/libs/basic/Cargo.toml @@ -82,9 +82,11 @@ condition = [ "nix/dir", "nix/user", ] +argv = [] config = [] cpu = [] disk = [] +exec_util = [] fd = ["stat", "nix/ioctl", "nix/socket"] file = [] fs = ["pathdiff", "rand", "nix/fs", "nix/user"] @@ -94,12 +96,14 @@ io = ["nix/poll", "nix/signal"] machine = ["nix/fs", "nix/dir", "mount", "id128", "namespace"] memory = [] mount = ["fs"] +murmurhash2 = [] namespace = ["nix/process", "nix/fs", "nix/sched", "nix/mount"] naming_scheme = ["bitflags", "nix/net"] network = ["nix/net"] os_release = [] parse = [] process = ["procfs", "nix/dir", "nix/signal"] +random = ["io"] rlimit = ["nix/resource"] security = ["nix/resource", "nix/socket"] sensors = [] @@ -107,13 +111,9 @@ show_table = [] signal = ["nix/signal"] socket = ["nix/socket", "nix/net"] stat = [] +strbuf = [] string = [] sysfs = ["nix/dir"] unistd = ["nix/user"] unit_name = [] -uuid = ["bitflags"] -murmurhash2 = [] -strbuf = [] -argv = [] -exec_util = [] -random = [] +uuid = ["bitflags", "random"] diff --git a/libs/device/Cargo.toml b/libs/device/Cargo.toml index 6af6a404..ecb9955c 100644 --- a/libs/device/Cargo.toml +++ b/libs/device/Cargo.toml @@ -12,6 +12,7 @@ basic = { path = "../basic", default-features = false, features = [ "fs", "fd", "murmurhash2", + "uuid", ] } event = { path = "../event" } log = { path = "../log" } diff --git a/next/Cargo.toml b/next/Cargo.toml index 3c84cd59..829dc829 100644 --- a/next/Cargo.toml +++ b/next/Cargo.toml @@ -10,14 +10,28 @@ name = "sysrsctl" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] async-trait = "0.1.73" -clap = { version = "4.4.4", features = ["derive"] } +clap = { version = "4.4.4", features = [ + "derive", + "std", +], default-features = false } futures = "0.3.28" futures-util = "0.3.28" notify = "6.1.1" rustix = { version = "0.38.2", features = ["fs", "process", "thread"] } serde = { version = "1.0.188", features = ["derive"] } tap = "1.0.1" -tokio = { version = "1.29.1", features = ["fs", "parking_lot", "rt-multi-thread", "rt", "io-util", "net", "signal", "time", "sync", "macros"] } +tokio = { version = "1.29.1", features = [ + "fs", + "parking_lot", + "rt-multi-thread", + "rt", + "io-util", + "net", + "signal", + "time", + "sync", + "macros", +] } tokio-stream = { version = "0.1.14", features = ["io-util", "signal", "fs"] } toml = "0.8.0" zbus = { version = "3.14.1", features = ["tokio"], default-features = false } -- Gitee