public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox-offline-mirror 1/2] build: use cargo wrapper
@ 2024-07-10 10:42 Fabian Grünbichler
  2024-07-10 10:42 ` [pve-devel] [PATCH proxmox-offline-mirror 2/2] build: execute dh-cargo-built-using Fabian Grünbichler
  0 siblings, 1 reply; 4+ messages in thread
From: Fabian Grünbichler @ 2024-07-10 10:42 UTC (permalink / raw)
  To: pve-devel

for package builds to ensure all common flags are actually set.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 Makefile      | 9 +++++++--
 debian/rules  | 4 ++--
 docs/Makefile | 4 ++--
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index c652bda..ab23b73 100644
--- a/Makefile
+++ b/Makefile
@@ -19,10 +19,15 @@ DEBS = $(DEB) $(HELPER_DEB) $(DBG_DEB) $(HELPER_DBG_DEB) $(DOC_DEB)
 ifeq ($(BUILD_MODE), release)
 CARGO_BUILD_ARGS += --release
 COMPILEDIR := target/release
+else ifeq ($(BUILD_MODE), release-deb)
+CARGO_BUILD_ARGS += --release
+COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/release
 else
 COMPILEDIR := target/debug
 endif
 
+CARGO ?= cargo
+
 USR_BIN := \
 	proxmox-offline-mirror \
 	proxmox-offline-mirror-helper
@@ -34,7 +39,7 @@ all: cargo-build $(SUBDIRS)
 
 .PHONY: cargo-build
 cargo-build:
-	cargo build $(CARGO_BUILD_ARGS)
+	$(CARGO) build $(CARGO_BUILD_ARGS)
 
 .PHONY: $(SUBDIRS)
 $(SUBDIRS): cargo-build
@@ -98,7 +103,7 @@ distclean: clean
 
 .PHONY: clean
 clean:
-	cargo clean
+	$(CARGO) clean
 	rm -f *.deb *.build *.buildinfo *.changes *.dsc rust-$(PACKAGE)*.tar*
 	rm -rf $(PACKAGE)-[0-9]*/
 	find . -name '*~' -exec rm {} ';'
diff --git a/debian/rules b/debian/rules
index 58b733f..9729be1 100644
--- a/debian/rules
+++ b/debian/rules
@@ -3,9 +3,9 @@
 include /usr/share/dpkg/pkg-info.mk
 include /usr/share/rustc/architecture.mk
 
-export BUILD_MODE=release
+export BUILD_MODE=release-deb
 
-CARGO=/usr/share/cargo/bin/cargo
+export CARGO=/usr/share/cargo/bin/cargo
 
 export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
 export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
diff --git a/docs/Makefile b/docs/Makefile
index 973355a..fa52867 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -21,10 +21,10 @@ SPHINXBUILD   = sphinx-build
 BUILDDIR      = output
 
 ifeq ($(BUILD_MODE), release)
-COMPILEDIR := ../target/release
+COMPILEDIR := ../target/$release
 SPHINXOPTS    += -t release
 else ifeq ($(BUILD_MODE), release-deb)
-COMPILEDIR := ../target/$(DEB_TARGET_GNU_CPU)-unknown-$(DEB_TARGET_GNU_SYSTEM)/release
+COMPILEDIR := ../target/$(DEB_HOST_RUST_TYPE)/release
 SPHINXOPTS    += -t release
 else
 COMPILEDIR := ../target/debug
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH proxmox-offline-mirror 2/2] build: execute dh-cargo-built-using
  2024-07-10 10:42 [pve-devel] [PATCH proxmox-offline-mirror 1/2] build: use cargo wrapper Fabian Grünbichler
@ 2024-07-10 10:42 ` Fabian Grünbichler
  2024-07-10 11:03   ` Fabian Grünbichler
  0 siblings, 1 reply; 4+ messages in thread
From: Fabian Grünbichler @ 2024-07-10 10:42 UTC (permalink / raw)
  To: pve-devel

while it is pending a bug fix at the moment to properly pick up all
dependencies, this ensures the X-Cargo-Built-Using (and soon,
Static-Built-Using) substvars are actually filled with contents, and allow to
find out which rustc version and dependency versions were used to build a
particular binary package.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 debian/rules | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/debian/rules b/debian/rules
index 9729be1..badace9 100644
--- a/debian/rules
+++ b/debian/rules
@@ -30,6 +30,9 @@ override_dh_auto_test:
 	# skip for now to avoid additional debug builds - no tests anyway
 	# dh_auto_test -- test --all
 
+execute_after_dh_auto_install:
+	/usr/share/cargo/bin/dh-cargo-built-using $(DEB_CARGO_PACKAGE)
+
 override_dh_missing:
 	dh_missing --fail-missing
 
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH proxmox-offline-mirror 2/2] build: execute dh-cargo-built-using
  2024-07-10 10:42 ` [pve-devel] [PATCH proxmox-offline-mirror 2/2] build: execute dh-cargo-built-using Fabian Grünbichler
@ 2024-07-10 11:03   ` Fabian Grünbichler
  2024-07-10 11:57     ` Fabian Grünbichler
  0 siblings, 1 reply; 4+ messages in thread
From: Fabian Grünbichler @ 2024-07-10 11:03 UTC (permalink / raw)
  To: Proxmox VE development discussion

On July 10, 2024 12:42 pm, Fabian Grünbichler wrote:
> while it is pending a bug fix at the moment to properly pick up all
> dependencies, this ensures the X-Cargo-Built-Using (and soon,
> Static-Built-Using) substvars are actually filled with contents, and allow to
> find out which rustc version and dependency versions were used to build a
> particular binary package.

correction: it's not dh-cargo that's broken, somehow when running plain
`make deb` our top-level cargo config is still preferred over the one
generate by the cargo wrapper, and thus the crates are picked up
directly from /usr/share/cargo/registry instead of via the symlinks in
debian/cargo_registry like dh-cargo-built-using expects..

a build in a clean env via source package/sbuild works as expected. I'll
try to debug this further!

> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
>  debian/rules | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/debian/rules b/debian/rules
> index 9729be1..badace9 100644
> --- a/debian/rules
> +++ b/debian/rules
> @@ -30,6 +30,9 @@ override_dh_auto_test:
>  	# skip for now to avoid additional debug builds - no tests anyway
>  	# dh_auto_test -- test --all
>  
> +execute_after_dh_auto_install:
> +	/usr/share/cargo/bin/dh-cargo-built-using $(DEB_CARGO_PACKAGE)
> +
>  override_dh_missing:
>  	dh_missing --fail-missing
>  
> -- 
> 2.39.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH proxmox-offline-mirror 2/2] build: execute dh-cargo-built-using
  2024-07-10 11:03   ` Fabian Grünbichler
@ 2024-07-10 11:57     ` Fabian Grünbichler
  0 siblings, 0 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2024-07-10 11:57 UTC (permalink / raw)
  To: Proxmox VE development discussion

On July 10, 2024 1:03 pm, Fabian Grünbichler wrote:
> On July 10, 2024 12:42 pm, Fabian Grünbichler wrote:
>> while it is pending a bug fix at the moment to properly pick up all
>> dependencies, this ensures the X-Cargo-Built-Using (and soon,
>> Static-Built-Using) substvars are actually filled with contents, and allow to
>> find out which rustc version and dependency versions were used to build a
>> particular binary package.
> 
> correction: it's not dh-cargo that's broken, somehow when running plain
> `make deb` our top-level cargo config is still preferred over the one
> generate by the cargo wrapper, and thus the crates are picked up
> directly from /usr/share/cargo/registry instead of via the symlinks in
> debian/cargo_registry like dh-cargo-built-using expects..
> 
> a build in a clean env via source package/sbuild works as expected. I'll
> try to debug this further!

found the culprit, sent v2 ;)


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-10 11:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-10 10:42 [pve-devel] [PATCH proxmox-offline-mirror 1/2] build: use cargo wrapper Fabian Grünbichler
2024-07-10 10:42 ` [pve-devel] [PATCH proxmox-offline-mirror 2/2] build: execute dh-cargo-built-using Fabian Grünbichler
2024-07-10 11:03   ` Fabian Grünbichler
2024-07-10 11:57     ` Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal