From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 98F9F1FF0C1 for ; Fri, 18 Sep 2026 16:42:15 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 1E08C2157F; Fri, 18 Sep 2026 16:42:11 +0200 (CEST) From: Hannes Laimer To: pve-devel@lists.proxmox.com Subject: [PATCH pve-cluster 01/10] buildsys: add rust workspace under src/rust Date: Fri, 18 Sep 2026 16:41:43 +0200 Message-ID: <20260918144152.575163-2-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260918144152.575163-1-h.laimer@proxmox.com> References: <20260918144152.575163-1-h.laimer@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1789742523914 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.505 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: UXYS2CZXPHEHUNMJSU7CU6O6W6BZRDP7 X-Message-ID-Hash: UXYS2CZXPHEHUNMJSU7CU6O6W6BZRDP7 X-MailFrom: h.laimer@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Add a Cargo workspace under src/rust, next to the C and Perl trees, for the Rust code that goes into pmxcfs, a server crate and a small C ABI crate. Their dependencies resolve through the Debian cargo registry as pve-rs does, and cargo hooks into the src/Makefile recursion ahead of pmxcfs so a static library built here is linked into the daemon. Signed-off-by: Hannes Laimer --- .gitignore | 2 ++ Makefile | 1 + debian/control | 16 +++++++++++++++- debian/rules | 16 ++++++++++++++++ src/Makefile | 2 +- src/rust/.cargo/config.toml | 8 ++++++++ src/rust/Cargo.toml | 22 ++++++++++++++++++++++ src/rust/Makefile | 18 ++++++++++++++++++ src/rust/pmxcfs-notify/Cargo.toml | 11 +++++++++++ src/rust/pmxcfs-notify/src/lib.rs | 1 + src/rust/rustfmt.toml | 2 ++ 11 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 src/rust/.cargo/config.toml create mode 100644 src/rust/Cargo.toml create mode 100644 src/rust/Makefile create mode 100644 src/rust/pmxcfs-notify/Cargo.toml create mode 100644 src/rust/pmxcfs-notify/src/lib.rs create mode 100644 src/rust/rustfmt.toml diff --git a/.gitignore b/.gitignore index 84bb09a..bb6e54b 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /*.dsc /*.tar* /pve-cluster-*/ +/src/rust/target/ +/src/rust/Cargo.lock diff --git a/Makefile b/Makefile index 5fa96ab..3e1c5b9 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ tidy: $(BUILDDIR): rm -rf $@ $@.tmp cp -a src $@.tmp + rm -rf $@.tmp/rust/target $@.tmp/rust/Cargo.lock cp -a debian $@.tmp/ echo "git clone git://git.proxmox.com/git/pve-cluster.git\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE mv $@.tmp $@ diff --git a/debian/control b/debian/control index 995e2d8..c3cb27a 100644 --- a/debian/control +++ b/debian/control @@ -2,8 +2,10 @@ Source: pve-cluster Section: admin Priority: optional Maintainer: Proxmox Support Team -Build-Depends: check, +Build-Depends: cargo:native, + check, debhelper-compat (= 13), + dh-cargo (>= 25), libcmap-dev (>= 0.17.1), libcorosync-common-dev, libcpg-dev (>= 2.3.4), @@ -17,11 +19,23 @@ Build-Depends: check, libquorum-dev (>= 2.3.4), librrd-dev, librrds-perl, + librust-anyhow-1+default-dev, + librust-libc-0.2+default-dev, + librust-log-0.4+default-dev, + librust-nix-0.29+default-dev, + librust-nix-0.29+event-dev, + librust-nix-0.29+poll-dev, + librust-nix-0.29+socket-dev, + librust-serde-1+default-dev, + librust-serde-1+derive-dev, + librust-serde-json-1+default-dev, libsqlite3-dev, + libstd-rust-dev, libtest-mockmodule-perl, libuuid-perl, pve-doc-generator (>= 6.0-9~), rrdcached, + rustc:native (>= 1.88), sqlite3, Standards-Version: 4.6.2 diff --git a/debian/rules b/debian/rules index 01efb49..0717d86 100755 --- a/debian/rules +++ b/debian/rules @@ -1,12 +1,28 @@ #!/usr/bin/make -f # -*- makefile -*- +include /usr/share/dpkg/pkg-info.mk +include /usr/share/rustc/architecture.mk + # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +CARGO=/usr/share/cargo/bin/cargo + +export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS +export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE +export CARGO_HOME = $(CURDIR)/debian/cargo_home + +export DEB_CARGO_CRATE=pmxcfs-notify_$(DEB_VERSION_UPSTREAM) +export DEB_CARGO_PACKAGE=pmxcfs-notify + %: dh $@ +override_dh_auto_configure: + $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system + dh_auto_configure + override_dh_installinit: override_dh_missing: diff --git a/src/Makefile b/src/Makefile index 50dd6aa..ac78c89 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,4 +1,4 @@ -SUBDIRS := PVE pmxcfs test +SUBDIRS := PVE rust pmxcfs test export LD_LIBRARY_PATH+=$(CURDIR)/PVE export PERLLIB+=$(CURDIR)/PVE diff --git a/src/rust/.cargo/config.toml b/src/rust/.cargo/config.toml new file mode 100644 index 0000000..7b442dc --- /dev/null +++ b/src/rust/.cargo/config.toml @@ -0,0 +1,8 @@ +[source] +[source.debian-packages] +directory = "/usr/share/cargo/registry" +[source.crates-io] +replace-with = "debian-packages" + +[profile.release] +debug = true diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml new file mode 100644 index 0000000..6de0ab8 --- /dev/null +++ b/src/rust/Cargo.toml @@ -0,0 +1,22 @@ +[workspace] +members = [ + "pmxcfs-notify", +] +resolver = "3" + +[workspace.package] +authors = ["Proxmox Support Team "] +edition = "2024" +license = "AGPL-3" +homepage = "https://proxmox.com" +rust-version = "1.88" + +[workspace.dependencies] +anyhow = "1.0" +libc = "0.2" +log = "0.4" +nix = { version = "0.29", features = ["event", "poll", "socket"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" + +pmxcfs-notify = { path = "pmxcfs-notify" } diff --git a/src/rust/Makefile b/src/rust/Makefile new file mode 100644 index 0000000..aba5cb9 --- /dev/null +++ b/src/rust/Makefile @@ -0,0 +1,18 @@ +all: + cargo build --release + +.PHONY: check +check: + cargo test --release + +.PHONY: fmt +fmt: + cargo fmt + +.PHONY: install +install: + +.PHONY: clean +clean: + cargo clean + rm -f Cargo.lock diff --git a/src/rust/pmxcfs-notify/Cargo.toml b/src/rust/pmxcfs-notify/Cargo.toml new file mode 100644 index 0000000..3de30b5 --- /dev/null +++ b/src/rust/pmxcfs-notify/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "pmxcfs-notify" +version = "0.1.0" +description = "Change notification socket server for pmxcfs" +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +rust-version.workspace = true + +[dependencies] diff --git a/src/rust/pmxcfs-notify/src/lib.rs b/src/rust/pmxcfs-notify/src/lib.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/rust/pmxcfs-notify/src/lib.rs @@ -0,0 +1 @@ + diff --git a/src/rust/rustfmt.toml b/src/rust/rustfmt.toml new file mode 100644 index 0000000..f3e454b --- /dev/null +++ b/src/rust/rustfmt.toml @@ -0,0 +1,2 @@ +edition = "2024" +style_edition = "2024" -- 2.47.3