From e979f6d523449c336f6900a96082b8d5a3143f59 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Wed, 14 Oct 2026 16:21:26 -0600 Subject: [PATCH] rust: inherit common package metadata from workspace --- .github/workflows/builds.yml | 4 ++-- .github/workflows/rust-checks.yml | 2 +- rust/Cargo.toml.in | 14 ++++++++++---- rust/derive/Cargo.toml.in | 7 ++++--- rust/ffi/Cargo.toml.in | 7 ++++--- rust/htp/Cargo.toml.in | 5 +++-- rust/suricatactl/Cargo.toml.in | 7 ++++--- rust/suricatasc/Cargo.toml.in | 7 ++++--- rust/sys/Cargo.toml.in | 7 ++++--- 9 files changed, 36 insertions(+), 24 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index f0c454874a..a9ad630fcf 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -3137,7 +3137,7 @@ jobs: name: prep path: prep - name: Install Rust - run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $(grep rust-version rust/Cargo.toml.in|sed 's/\"//g'|awk '{print $3}') -y + run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $(awk -F '"' '/^rust-version *=/ { print $2 }' rust/Cargo.toml.in) -y - run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - uses: ./.github/actions/install-cbindgen - run: tar xf prep/suricata-update.tar.gz @@ -3431,7 +3431,7 @@ jobs: name: prep path: prep - name: Install Rust - run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $(grep rust-version rust/Cargo.toml.in|sed 's/\"//g'|awk '{print $3}') -y + run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $(awk -F '"' '/^rust-version *=/ { print $2 }' rust/Cargo.toml.in) -y - run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - uses: ./.github/actions/install-cbindgen - run: tar xf prep/suricata-update.tar.gz diff --git a/.github/workflows/rust-checks.yml b/.github/workflows/rust-checks.yml index 3368245029..d246316fce 100644 --- a/.github/workflows/rust-checks.yml +++ b/.github/workflows/rust-checks.yml @@ -152,7 +152,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 - name: Install Minimum Supported Rust Version run: | - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $(awk -F '"' '/rust-version/ { print $2 }' rust/Cargo.toml.in) + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $(awk -F '"' '/^rust-version *=/ { print $2 }' rust/Cargo.toml.in) echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: Configure Suricata run: | diff --git a/rust/Cargo.toml.in b/rust/Cargo.toml.in index 6bab634a8f..4813d756a6 100644 --- a/rust/Cargo.toml.in +++ b/rust/Cargo.toml.in @@ -1,10 +1,10 @@ [package] name = "suricata" -version = "@PACKAGE_VERSION@" -license = "GPL-2.0-only" +version.workspace = true +license.workspace = true description = "Suricata Rust components" -edition = "2021" -rust-version = "1.85.0" +edition.workspace = true +rust-version.workspace = true [workspace] members = [ @@ -23,6 +23,12 @@ default-members = [ "suricatasc", ] +[workspace.package] +version = "@PACKAGE_VERSION@" +license = "GPL-2.0-only" +edition = "2021" +rust-version = "1.85.0" + [lib] crate-type = ["staticlib", "rlib"] name = "suricata" diff --git a/rust/derive/Cargo.toml.in b/rust/derive/Cargo.toml.in index 0dcf924581..d3019219be 100644 --- a/rust/derive/Cargo.toml.in +++ b/rust/derive/Cargo.toml.in @@ -1,9 +1,10 @@ [package] name = "suricata-derive" -version = "@PACKAGE_VERSION@" -license = "GPL-2.0-only" +version.workspace = true +license.workspace = true description = "Derive macros for Suricata" -edition = "2021" +edition.workspace = true +rust-version.workspace = true [lib] diff --git a/rust/ffi/Cargo.toml.in b/rust/ffi/Cargo.toml.in index 579cd3be93..b34fee378c 100644 --- a/rust/ffi/Cargo.toml.in +++ b/rust/ffi/Cargo.toml.in @@ -1,8 +1,9 @@ [package] name = "suricata-ffi" -version = "@PACKAGE_VERSION@" -edition = "2021" -license = "GPL-2.0-only" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true description = "Nice wrappers around Suricata C interface" [dependencies] diff --git a/rust/htp/Cargo.toml.in b/rust/htp/Cargo.toml.in index 820fc38d98..0f9f20ce1d 100644 --- a/rust/htp/Cargo.toml.in +++ b/rust/htp/Cargo.toml.in @@ -1,7 +1,8 @@ [package] name = "suricata-htp" -version = "@PACKAGE_VERSION@" -edition = "2021" +version.workspace = true +edition.workspace = true +rust-version.workspace = true autobins = false license-file = "LICENSE" description = "Security Aware HTP Protocol parsing library" diff --git a/rust/suricatactl/Cargo.toml.in b/rust/suricatactl/Cargo.toml.in index 7ea5a9d118..f3c364acc4 100644 --- a/rust/suricatactl/Cargo.toml.in +++ b/rust/suricatactl/Cargo.toml.in @@ -1,8 +1,9 @@ [package] name = "suricatactl" -version = "@PACKAGE_VERSION@" -edition = "2021" -license = "GPL-2.0-only" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true description = "Suricata control tools" [[bin]] diff --git a/rust/suricatasc/Cargo.toml.in b/rust/suricatasc/Cargo.toml.in index 84ebe29e2e..05a8dc5c96 100644 --- a/rust/suricatasc/Cargo.toml.in +++ b/rust/suricatasc/Cargo.toml.in @@ -1,8 +1,9 @@ [package] name = "suricatasc" -version = "@PACKAGE_VERSION@" -edition = "2021" -license = "GPL-2.0-only" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true description = "Suricata socket control program" readme = "README.md" diff --git a/rust/sys/Cargo.toml.in b/rust/sys/Cargo.toml.in index 518fe36db9..f280debcf4 100644 --- a/rust/sys/Cargo.toml.in +++ b/rust/sys/Cargo.toml.in @@ -1,6 +1,7 @@ [package] name = "suricata-sys" -version = "@PACKAGE_VERSION@" -edition = "2021" -license = "GPL-2.0-only" +version.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true description = "Bindings to Suricata C interface"