all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-cluster 01/12] buildsys: add rust workspace under src/rust
Date: Thu, 22 Oct 2026 16:21:54 +0200	[thread overview]
Message-ID: <20261022142205.930536-2-h.laimer@proxmox.com> (raw)
In-Reply-To: <20261022142205.930536-1-h.laimer@proxmox.com>

Add a Cargo workspace under src/rust to hold Rust code for pmxcfs. Its
only member is an empty crate for the change notification socket
server. Crates come from the Debian cargo registry as in pve-rs. The
package build picks the Debian cargo wrapper and a release build in
d/rules, as in proxmox-backup. A plain make in the tree uses the cargo
in PATH and builds in debug mode. The workspace stays in the
src/Makefile recursion so that make check runs its tests and make
clean removes its target directory.

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 .gitignore                        |  2 ++
 Makefile                          |  1 +
 debian/control                    | 22 +++++++++++++++++++++-
 debian/rules                      | 17 +++++++++++++++++
 src/Makefile                      |  2 +-
 src/defines.mk                    | 11 +++++++++++
 src/rust/.cargo/config.toml       |  8 ++++++++
 src/rust/Cargo.toml               | 23 +++++++++++++++++++++++
 src/rust/Makefile                 | 20 ++++++++++++++++++++
 src/rust/pmxcfs-notify/Cargo.toml | 11 +++++++++++
 src/rust/pmxcfs-notify/src/lib.rs |  1 +
 src/rust/rustfmt.toml             |  2 ++
 12 files changed, 118 insertions(+), 2 deletions(-)
 create mode 100644 src/defines.mk
 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..db858b6 100644
--- a/debian/control
+++ b/debian/control
@@ -2,8 +2,10 @@ Source: pve-cluster
 Section: admin
 Priority: optional
 Maintainer: Proxmox Support Team <support@proxmox.com>
-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,29 @@ 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+fs-dev,
+               librust-nix-0.29+socket-dev,
+               librust-serde-1+default-dev,
+               librust-serde-1+derive-dev,
+               librust-serde-json-1+default-dev,
+               librust-tokio-1+default-dev,
+               librust-tokio-1+io-util-dev,
+               librust-tokio-1+macros-dev,
+               librust-tokio-1+net-dev,
+               librust-tokio-1+rt-dev,
+               librust-tokio-1+sync-dev,
+               librust-tokio-1+time-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..f4d8905 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,12 +1,29 @@
 #!/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
 
+export CARGO=/usr/share/cargo/bin/cargo
+export BUILD_MODE=release
+
+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/defines.mk b/src/defines.mk
new file mode 100644
index 0000000..f539f5d
--- /dev/null
+++ b/src/defines.mk
@@ -0,0 +1,11 @@
+include /usr/share/rustc/architecture.mk
+
+CARGO ?= cargo
+
+ifeq ($(BUILD_MODE), release)
+CARGO_BUILD_ARGS += --release --target $(DEB_HOST_RUST_TYPE)
+RUST_COMPILE_DIR := target/$(DEB_HOST_RUST_TYPE)/release
+else
+CARGO_BUILD_ARGS += --target $(DEB_HOST_RUST_TYPE)
+RUST_COMPILE_DIR := target/$(DEB_HOST_RUST_TYPE)/debug
+endif
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..8cf928e
--- /dev/null
+++ b/src/rust/Cargo.toml
@@ -0,0 +1,23 @@
+[workspace]
+members = [
+    "pmxcfs-notify",
+]
+resolver = "3"
+
+[workspace.package]
+authors = ["Proxmox Support Team <support@proxmox.com>"]
+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 = ["fs", "socket"] }
+serde = { version = "1.0", features = ["derive"] }
+serde_json = "1.0"
+tokio = { version = "1", features = ["io-util", "macros", "net", "rt", "sync", "time"] }
+
+pmxcfs-notify = { path = "pmxcfs-notify" }
diff --git a/src/rust/Makefile b/src/rust/Makefile
new file mode 100644
index 0000000..be2701a
--- /dev/null
+++ b/src/rust/Makefile
@@ -0,0 +1,20 @@
+include ../defines.mk
+
+all:
+	$(CARGO) build $(CARGO_BUILD_ARGS)
+
+.PHONY: check
+check:
+	$(CARGO) test $(CARGO_BUILD_ARGS)
+
+.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





  reply	other threads:[~2026-10-22 14:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 14:21 [PATCH cluster 00/12] pmxcfs: add a change notification socket Hannes Laimer
2026-10-22 14:21 ` Hannes Laimer [this message]
2026-10-22 14:21 ` [PATCH pve-cluster 02/12] rust: notify: add path templates with placeholder capture Hannes Laimer
2026-10-22 14:21 ` [PATCH pve-cluster 03/12] rust: notify: add the wire protocol Hannes Laimer
2026-10-22 14:21 ` [PATCH pve-cluster 04/12] rust: notify: add subscription matching Hannes Laimer
2026-10-22 14:21 ` [PATCH pve-cluster 05/12] rust: notify: add the socket server Hannes Laimer
2026-10-22 14:21 ` [PATCH pve-cluster 06/12] rust: ffi: add C ABI staticlib for pmxcfs Hannes Laimer
2026-10-22 14:22 ` [PATCH pve-cluster 07/12] pmxcfs: memdb: add change notification hook Hannes Laimer
2026-10-22 14:22 ` [PATCH pve-cluster 08/12] buildsys: link pmxcfs against the rust notify staticlib Hannes Laimer
2026-10-22 14:22 ` [PATCH pve-cluster 09/12] pmxcfs: notify: emit change events over the notification socket Hannes Laimer
2026-10-22 14:22 ` [PATCH pve-cluster 10/12] cfs: add perl client for the change " Hannes Laimer
2026-10-22 14:22 ` [PATCH pve-cluster 11/12] cfs: add hook registry for change notification consumers Hannes Laimer
2026-10-22 14:22 ` [PATCH pve-cluster 12/12] cfs: add runner executing cluster change hooks in children Hannes Laimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261022142205.930536-2-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal