From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 078E91FF0A7 for ; Wed, 02 Sep 2026 14:33:21 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 7F47E2126A; Wed, 02 Sep 2026 14:33:05 +0200 (CEST) From: Hannes Laimer To: pve-devel@lists.proxmox.com Subject: [PATCH proxmox-ebpf 3/3] debian: package the crate as a rust library Date: Wed, 2 Sep 2026 14:32:29 +0200 Message-ID: <20260902123229.638967-4-h.laimer@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260902123229.638967-1-h.laimer@proxmox.com> References: <20260902123229.638967-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: 1788352352693 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.543 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) KAM_SHORT 0.001 Use of a URL Shortener for very short URL POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: LQVGZVPV3HXNOHTGJ42WOPKY4MZCRWQR X-Message-ID-Hash: LQVGZVPV3HXNOHTGJ42WOPKY4MZCRWQR 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: Through debcargo with the overlay in debian/, like we do for the other rust crates. The BPF programs are compiled by the build script, so building against the crate pulls in clang and the libbpf headers as well. Signed-off-by: Hannes Laimer --- .gitignore | 1 + Cargo.toml | 7 ++++++ Makefile | 48 ++++++++++++++++++++++++++++++++++++++++ build.rs | 5 +++++ debian/changelog | 5 +++++ debian/control | 52 ++++++++++++++++++++++++++++++++++++++++++++ debian/copyright | 18 +++++++++++++++ debian/debcargo.toml | 13 +++++++++++ debian/source/format | 1 + 9 files changed, 150 insertions(+) create mode 100644 Makefile create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/debcargo.toml create mode 100644 debian/source/format diff --git a/.gitignore b/.gitignore index 3cb8cae..574dcbd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ Cargo.lock *.changes *.tar.?z /proxmox-ebpf-[0-9]*/ +/build diff --git a/Cargo.toml b/Cargo.toml index 27010c4..a87bb2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,14 @@ [package] name = "proxmox-ebpf" version = "0.1.0" +description = "Proxmox VE eBPF" +authors = ["Proxmox Support Team "] edition = "2024" +rust-version = "1.85" +license = "AGPL-3" +homepage = "https://proxmox.com" + +exclude = ["build", "debian"] [features] # When enabled, BPF programs compile with -DBPF_DEBUG so their DBG() macros diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3650a9d --- /dev/null +++ b/Makefile @@ -0,0 +1,48 @@ +include /usr/share/dpkg/pkg-info.mk + +CRATE := proxmox-ebpf +BUILDDIR ?= build +CARGO ?= cargo + +DSC := $(BUILDDIR)/rust-$(CRATE)_$(DEB_VERSION).dsc + +all: cargo-build + +.PHONY: cargo-build +cargo-build: + $(CARGO) build --all-features + +.PHONY: check test +check test: + $(CARGO) test --all-features + +# the generated control is copied back so the checked-in one stays current +$(BUILDDIR)/$(CRATE): Cargo.toml build.rs src include tests debian + rm -rf $@ + mkdir -p $(BUILDDIR) + echo system > $(BUILDDIR)/rust-toolchain + rm -f debian/control + debcargo package \ + --config $(CURDIR)/debian/debcargo.toml \ + --changelog-ready \ + --no-overlay-write-back \ + --directory $(CURDIR)/$@ \ + $(CRATE) \ + $(DEB_VERSION_UPSTREAM) + rm -f $@/debian/source/format.debcargo.hint + cp $@/debian/control debian/control + +.PHONY: deb +deb: $(BUILDDIR)/$(CRATE) + cd $(BUILDDIR)/$(CRATE); dpkg-buildpackage -b -uc -us + lintian $(BUILDDIR)/*.deb + +.PHONY: dsc +dsc: $(BUILDDIR)/$(CRATE) + cd $(BUILDDIR)/$(CRATE); dpkg-buildpackage -S -us -uc -d + lintian $(DSC) + +.PHONY: clean +clean: + $(CARGO) clean + rm -rf $(BUILDDIR) diff --git a/build.rs b/build.rs index e62be72..9d3d92f 100644 --- a/build.rs +++ b/build.rs @@ -73,6 +73,11 @@ fn main() { ); println!("cargo:rustc-link-search=native={}", out_dir.display()); println!("cargo:rustc-link-lib=static=bpf_native"); + // dh-cargo wants every static library in the build declared, this one is from our own sources + println!( + "dh-cargo:deb-built-using=bpf_native=0={}", + manifest_dir.display() + ); } // native build against the shim headers, so tests call the program as a plain function diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..71e3394 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +rust-proxmox-ebpf (0.1.0) trixie; urgency=medium + + * Initial release. + + -- Proxmox Support Team Wed, 02 Sep 2026 10:00:00 +0200 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..d1400c6 --- /dev/null +++ b/debian/control @@ -0,0 +1,52 @@ +Source: rust-proxmox-ebpf +Section: rust +Priority: optional +Build-Depends: debhelper-compat (= 13), + dh-sequence-cargo +Build-Depends-Arch: cargo:native , + rustc:native (>= 1.85) , + libstd-rust-dev , + librust-anyhow-1+default-dev , + librust-aya-0.13+default-dev , + librust-log-0.4+default-dev , + librust-nix-0.29+default-dev , + librust-nix-0.29+fs-dev , + librust-nix-0.29+net-dev , + clang , + libbpf-dev , + linux-libc-dev +Maintainer: Proxmox Support Team +Standards-Version: 4.7.2 +Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/proxmox-ebpf] +Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/proxmox-ebpf +Homepage: https://proxmox.com +X-Cargo-Crate: proxmox-ebpf + +Package: librust-proxmox-ebpf-dev +Architecture: any +Multi-Arch: same +Depends: + ${misc:Depends}, + librust-anyhow-1+default-dev, + librust-aya-0.13+default-dev, + librust-log-0.4+default-dev, + librust-nix-0.29+default-dev, + librust-nix-0.29+fs-dev, + librust-nix-0.29+net-dev, + clang, + libbpf-dev, + linux-libc-dev +Provides: + librust-proxmox-ebpf+bpf-debug-dev (= ${binary:Version}), + librust-proxmox-ebpf+default-dev (= ${binary:Version}), + librust-proxmox-ebpf-0-dev (= ${binary:Version}), + librust-proxmox-ebpf-0+bpf-debug-dev (= ${binary:Version}), + librust-proxmox-ebpf-0+default-dev (= ${binary:Version}), + librust-proxmox-ebpf-0.1-dev (= ${binary:Version}), + librust-proxmox-ebpf-0.1+bpf-debug-dev (= ${binary:Version}), + librust-proxmox-ebpf-0.1+default-dev (= ${binary:Version}), + librust-proxmox-ebpf-0.1.0-dev (= ${binary:Version}), + librust-proxmox-ebpf-0.1.0+bpf-debug-dev (= ${binary:Version}), + librust-proxmox-ebpf-0.1.0+default-dev (= ${binary:Version}) +Description: Proxmox VE eBPF - Rust source code + Source code for Debianized Rust crate "proxmox-ebpf" diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..01138fa --- /dev/null +++ b/debian/copyright @@ -0,0 +1,18 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ + +Files: + * +Copyright: 2026 Proxmox Server Solutions GmbH +License: AGPL-3.0-or-later + This program is free software: you can redistribute it and/or modify it under + the terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) any + later version. + . + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more + details. + . + You should have received a copy of the GNU Affero General Public License along + with this program. If not, see . diff --git a/debian/debcargo.toml b/debian/debcargo.toml new file mode 100644 index 0000000..38f95f4 --- /dev/null +++ b/debian/debcargo.toml @@ -0,0 +1,13 @@ +overlay = "." +crate_src_path = ".." +maintainer = "Proxmox Support Team " + +# the BPF programs are C sources of this crate, not vendored code +whitelist = ["src/*/bpf/*.c"] + +[source] +#vcs_git = "git://git.proxmox.com/git/proxmox-ebpf.git" +#vcs_browser = "https://git.proxmox.com/?p=proxmox-ebpf.git" + +[packages.lib] +depends = ["clang", "libbpf-dev", "linux-libc-dev"] diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) -- 2.47.3