[pve-devel] [PATCH proxmox-rrd-migration-tool v4 3/3] add debian packaging

Lukas Wagner l.wagner at proxmox.com
Mon Jul 28 16:36:01 CEST 2025


On Sat Jul 26, 2025 at 3:05 AM CEST, Aaron Lauterer wrote:
> based on the termproxy packaging. Nothing fancy so far.
>
> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
> ---
>
> Notes:
>     I added the links to the repos even though they don't exist yet. So if
>     the package and repo name is to change. make sure to adapt those :)
>
>  Cargo.toml           |  4 +-
>  Makefile             | 89 ++++++++++++++++++++++++++++++++++++++++++++
>  debian/changelog     |  5 +++
>  debian/control       | 27 ++++++++++++++
>  debian/copyright     | 19 ++++++++++
>  debian/docs          |  1 +
>  debian/links         |  1 +
>  debian/rules         | 30 +++++++++++++++
>  debian/source/format |  1 +
>  9 files changed, 175 insertions(+), 2 deletions(-)
>  create mode 100644 Makefile
>  create mode 100644 debian/changelog
>  create mode 100644 debian/control
>  create mode 100644 debian/copyright
>  create mode 100644 debian/docs
>  create mode 100644 debian/links
>  create mode 100755 debian/rules
>  create mode 100644 debian/source/format
>
> diff --git a/Cargo.toml b/Cargo.toml
> index a24b79c..e2d49a9 100644
> --- a/Cargo.toml
> +++ b/Cargo.toml
> @@ -1,6 +1,6 @@
>  [package]
> -name = "proxmox_rrd_migration_8-9"
> -version = "0.1.0"
> +name = "proxmox-rrd-migration-tool"
> +version = "1.0.0"
>  edition = "2021"
>  authors = [
>      "Aaron Lauterer <a.lauterer at proxmox.com>",
> diff --git a/Makefile b/Makefile
> new file mode 100644
> index 0000000..abce415
> --- /dev/null
> +++ b/Makefile
> @@ -0,0 +1,89 @@
> +include /usr/share/dpkg/default.mk
> +
> +PACKAGE="proxmox-rrd-migration-tool"
> +CRATENAME="proxmox-rrd-migration-tool"
> +
> +BUILDDIR ?= $(PACKAGE)-$(DEB_VERSION_UPSTREAM)
> +ORIG_SRC_TAR=$(PACKAGE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
> +
> +DEB=$(PACKAGE)_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
> +DBG_DEB=$(PACKAGE)-dbgsym_$(DEB_VERSION)_$(DEB_HOST_ARCH).deb
> +DSC=$(PACKAGE)_$(DEB_VERSION).dsc
> +
> +CARGO ?= cargo
> +ifeq ($(BUILD_MODE), release)
> +CARGO_BUILD_ARGS += --release
> +COMPILEDIR := target/release
> +else
> +COMPILEDIR := target/debug
> +endif
> +
> +PREFIX = /usr
> +LIBEXECDIR = $(PREFIX)/libexec
> +PROXMOX_LIBEXECDIR = $(LIBEXECDIR)/proxmox
> +
> +PROXMOX_RRD_MIGRATION_TOOL_BIN := $(addprefix $(COMPILEDIR)/,proxmox-rrd-migration-tool)
> +
> +all:
> +
> +install: $(PROXMOX_RRD_MIGRATION_TOOL_BIN)
> +	install -dm755 $(DESTDIR)$(PROXMOX_LIBEXECDIR)
> +	install -m755 $(PROXMOX_RRD_MIGRATION_TOOL_BIN) $(DESTDIR)$(PROXMOX_LIBEXECDIR)/
> +
> +$(PROXMOX_RRD_MIGRATION_TOOL_BIN): .do-cargo-build
> +.do-cargo-build:
> +	$(CARGO) build $(CARGO_BUILD_ARGS)
> +	touch .do-cargo-build
> +
> +
> +.PHONY: cargo-build
> +cargo-build: .do-cargo-build
> +
> +$(BUILDDIR):
> +	rm -rf $@ $@.tmp
> +	mkdir $@.tmp
> +	cp -a debian/ src/ Makefile Cargo.toml wrapper.h build.rs $@.tmp
> +	echo "git clone git://git.proxmox.com/git/proxmox-rrd-migration-tool.git\\ngit checkout $$(git rev-parse HEAD)" \
> +	    > $@.tmp/debian/SOURCE
> +	mv $@.tmp $@
> +
> +
> +$(ORIG_SRC_TAR): $(BUILDDIR)
> +	tar czf $(ORIG_SRC_TAR) --exclude="$(BUILDDIR)/debian" $(BUILDDIR)
> +
> +.PHONY: deb
> +deb: $(DEB)
> +$(DEB) $(DBG_DEB) &: $(BUILDDIR)
> +	cd $(BUILDDIR); dpkg-buildpackage -b -uc -us
> +	lintian $(DEB)
> +	@echo $(DEB)
> +
> +.PHONY: dsc
> +dsc:
> +	rm -rf $(DSC) $(BUILDDIR)
> +	$(MAKE) $(DSC)
> +	lintian $(DSC)
> +
> +$(DSC): $(BUILDDIR) $(ORIG_SRC_TAR)
> +	cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d
> +
> +sbuild: $(DSC)
> +	sbuild $(DSC)
> +
> +.PHONY: upload
> +upload: UPLOAD_DIST ?= $(DEB_DISTRIBUTION)
> +upload: $(DEB) $(DBG_DEB)
> +	tar cf - $(DEB) $(DBG_DEB) |ssh -X repoman at repo.proxmox.com -- upload --product pve --dist $(UPLOAD_DIST) --arch $(DEB_HOST_ARCH)
> +
> +.PHONY: clean distclean
> +distclean: clean
> +clean:
> +	$(CARGO) clean
> +	rm -rf $(PACKAGE)-[0-9]*/ build/
> +	rm -f *.deb *.changes *.dsc *.tar.* *.buildinfo *.build .do-cargo-build
> +	rm -rf tmp_tests
> +	rm -rf target
> +
> +.PHONY: dinstall
> +dinstall: deb
> +	dpkg -i $(DEB)
> diff --git a/debian/changelog b/debian/changelog
> new file mode 100644
> index 0000000..b82648a
> --- /dev/null
> +++ b/debian/changelog
> @@ -0,0 +1,5 @@
> +proxmox-rrd-migration-tool (1.0.0) unstable; urgency=medium
> +
> +  * Initial release.
> +
> + -- Proxmox Support Team <support at proxmox.com>  Mon, 21 Jul 2025 13:56:37 +0200
> diff --git a/debian/control b/debian/control
> new file mode 100644
> index 0000000..8f26878
> --- /dev/null
> +++ b/debian/control
> @@ -0,0 +1,27 @@
> +Source: proxmox-rrd-migration-tool
> +Section: admin
> +Priority: optional
> +Build-Depends: cargo:native,
> +               debhelper-compat (= 13),
> +               dh-cargo (>= 25),
> +               librust-anyhow-1+default-dev,
> +               librust-bindgen-dev,
> +               librust-libc-0.2+default-dev (>= 0.2.107-~~),
> +               librust-pico-args-0.5+default-dev,
> +               librust-pkg-config-dev,
> +               librust-proxmox-async-dev,
> +               libstd-rust-dev,
> +               rustc:native,

This seems to be missing the pretty-assertions dependency, although I'm
not super sure how we handle test-only, 'dev-dependencies' in
d/control, so maybe this is correct after all...

> +Maintainer: Proxmox Support Team <support at proxmox.com>
> +Standards-Version: 4.6.1
> +Vcs-Git: git://git.proxmox.com/git/proxmox-rrd-migration-tool.git
> +Vcs-Browser: https://git.proxmox.com/?p=proxmox-rrd-migration-tool.git;a=summary
> +Homepage: https://www.proxmox.com
> +Rules-Requires-Root: no
> +
> +Package: proxmox-rrd-migration-tool
> +Architecture: any
> +Multi-Arch: allowed
> +Depends: ${misc:Depends}, ${shlibs:Depends},
> +Description: Tool to migrate RRD data on Proxmox VE hosts from pre version 8
> +  to new version 9 files.
> diff --git a/debian/copyright b/debian/copyright
> new file mode 100644
> index 0000000..451848c
> --- /dev/null
> +++ b/debian/copyright
> @@ -0,0 +1,19 @@
> +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
> +Source: https://git.proxmox.com/git/proxmox-rrd-migration-tool.git;a=summary
> +
> +Files:
> + *
> +Copyright: 2017 - 2025 Proxmox Server Solutions GmbH <support at proxmox.com>
> +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 <https://www.gnu.org/licenses/>.
> diff --git a/debian/docs b/debian/docs
> new file mode 100644
> index 0000000..8696672
> --- /dev/null
> +++ b/debian/docs
> @@ -0,0 +1 @@
> +debian/SOURCE
> diff --git a/debian/links b/debian/links
> new file mode 100644
> index 0000000..9e59b57
> --- /dev/null
> +++ b/debian/links
> @@ -0,0 +1 @@
> +usr/libexec/proxmox/proxmox-rrd-migration-tool usr/bin/proxmox-rrd-migration-tool

As far as I understand this is a tool that should be called directly by
a user, right? In that case I'd not add the symlink but alter the
Makefile so that it installs it to /usr/bin/ right away.


> diff --git a/debian/rules b/debian/rules
> new file mode 100755
> index 0000000..ec264eb
> --- /dev/null
> +++ b/debian/rules
> @@ -0,0 +1,30 @@
> +#!/usr/bin/make -f
> +# See debhelper(7) (uncomment to enable)
> +# output every command that modifies files on the build system.
> +DH_VERBOSE = 1
> +
> +include /usr/share/dpkg/pkg-info.mk
> +include /usr/share/rustc/architecture.mk
> +
> +export BUILD_MODE=release
> +
> +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=proxmox-rrd-migration-tool_$(DEB_VERSION_UPSTREAM)
> +export DEB_CARGO_PACKAGE=proxmox-rrd-migration-tool
> +
> +%:
> +	dh $@
> +
> +override_dh_auto_configure:
> +	@perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \
> +	    die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml
> +	$(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
> +	dh_auto_configure
> +
> +override_dh_missing:
> +	dh_missing --fail-missing
> 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)





More information about the pve-devel mailing list