public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] build: use cargo wrapper when building package
@ 2024-06-19 14:38 Fabian Grünbichler
  2024-06-20  7:29 ` [pbs-devel] applied: " Wolfgang Bumiller
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2024-06-19 14:38 UTC (permalink / raw)
  To: pbs-devel

else we don't pick up the options set by the wrapper, which include generation
of debug symbols. until rustc 1.77, this was not needed because compiled
binaries always included a non-stripped libstd. now, without this change, the
binaries built with `cargo build --release` have no debug symbols at all
trigger a warning. fix this and include debug symbols when building a package,
like was originally intended for release package builds.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
no obvious fallout I could find, but more eyes probably don't hurt. 1.77 is not
in the repository yet, I'll upload it tomorrow..

 Makefile               |  4 ++--
 debian/rules           |  2 +-
 docs/Makefile          |  4 ++--
 pxar-bin/tests/pxar.rs | 18 +++++++++++-------
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 49575ea45..0b971f9c6 100644
--- a/Makefile
+++ b/Makefile
@@ -38,9 +38,9 @@ SUBCRATES != cargo metadata --no-deps --format-version=1 \
 
 ifeq ($(BUILD_MODE), release)
 CARGO_BUILD_ARGS += --release
-COMPILEDIR := target/release
+COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/release
 else
-COMPILEDIR := target/debug
+COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/debug
 endif
 
 ifeq ($(valgrind), yes)
diff --git a/debian/rules b/debian/rules
index 54a3c22bf..a82c3e12f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,7 +8,7 @@ include /usr/share/rustc/architecture.mk
 
 export BUILD_MODE=release
 
-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 d6c61c86e..d23796b7c 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -90,10 +90,10 @@ SPHINXBUILD   = sphinx-build
 BUILDDIR      = output
 
 ifeq ($(BUILD_MODE), release)
-COMPILEDIR := ../target/release
+COMPILEDIR := ../target/$(DEB_HOST_RUST_TYPE)/release
 SPHINXOPTS    += -t release
 else
-COMPILEDIR := ../target/debug
+COMPILEDIR := ../target/$(DEB_HOST_RUST_TYPE)/debug
 SPHINXOPTS    += -t devbuild
 endif
 
diff --git a/pxar-bin/tests/pxar.rs b/pxar-bin/tests/pxar.rs
index 321f24c31..0a4fbcad5 100644
--- a/pxar-bin/tests/pxar.rs
+++ b/pxar-bin/tests/pxar.rs
@@ -7,15 +7,17 @@ fn pxar_create_and_extract() {
     let src_dir = "../tests/catar_data/test_xattrs_src/";
     let dest_dir = "../tests/catar_data/test_xattrs_dest/";
 
+    let target_subdir = std::env::var("DEB_HOST_RUST_TYPE").unwrap_or(String::new());
+
     let exec_path = if cfg!(debug_assertions) {
-        "../target/debug/pxar"
+        format!("../target/{target_subdir}/debug/pxar")
     } else {
-        "../target/release/pxar"
+        format!("../target/{target_subdir}/release/pxar")
     };
 
     println!("run '{} create archive.pxar {}'", exec_path, src_dir);
 
-    Command::new(exec_path)
+    Command::new(&exec_path)
         .arg("create")
         .arg("./tests/archive.pxar")
         .arg(src_dir)
@@ -24,7 +26,7 @@ fn pxar_create_and_extract() {
 
     println!("run '{} extract archive.pxar {}'", exec_path, dest_dir);
 
-    Command::new(exec_path)
+    Command::new(&exec_path)
         .arg("extract")
         .arg("./tests/archive.pxar")
         .arg("--target")
@@ -81,13 +83,15 @@ fn pxar_create_and_extract() {
 
 #[test]
 fn pxar_list_with_payload_input() {
+    let target_subdir = std::env::var("DEB_HOST_RUST_TYPE").unwrap_or(String::new());
+
     let exec_path = if cfg!(debug_assertions) {
-        "../target/debug/pxar"
+        format!("../target/{target_subdir}/debug/pxar")
     } else {
-        "../target/release/pxar"
+        format!("../target/{target_subdir}/release/pxar")
     };
 
-    let output = Command::new(exec_path)
+    let output = Command::new(&exec_path)
         .args([
             "list",
             "../tests/pxar/backup-client-pxar-expected.mpxar",
-- 
2.39.2



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

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

* [pbs-devel] applied: [PATCH proxmox-backup] build: use cargo wrapper when building package
  2024-06-19 14:38 [pbs-devel] [PATCH proxmox-backup] build: use cargo wrapper when building package Fabian Grünbichler
@ 2024-06-20  7:29 ` Wolfgang Bumiller
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bumiller @ 2024-06-20  7:29 UTC (permalink / raw)
  To: Fabian Grünbichler; +Cc: pbs-devel

applied, thanks

On Wed, Jun 19, 2024 at 04:38:05PM GMT, Fabian Grünbichler wrote:
> else we don't pick up the options set by the wrapper, which include generation
> of debug symbols. until rustc 1.77, this was not needed because compiled
> binaries always included a non-stripped libstd. now, without this change, the
> binaries built with `cargo build --release` have no debug symbols at all
> trigger a warning. fix this and include debug symbols when building a package,
> like was originally intended for release package builds.
> 
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> no obvious fallout I could find, but more eyes probably don't hurt. 1.77 is not
> in the repository yet, I'll upload it tomorrow..
> 
>  Makefile               |  4 ++--
>  debian/rules           |  2 +-
>  docs/Makefile          |  4 ++--
>  pxar-bin/tests/pxar.rs | 18 +++++++++++-------
>  4 files changed, 16 insertions(+), 12 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 49575ea45..0b971f9c6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -38,9 +38,9 @@ SUBCRATES != cargo metadata --no-deps --format-version=1 \
>  
>  ifeq ($(BUILD_MODE), release)
>  CARGO_BUILD_ARGS += --release
> -COMPILEDIR := target/release
> +COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/release
>  else
> -COMPILEDIR := target/debug
> +COMPILEDIR := target/$(DEB_HOST_RUST_TYPE)/debug
>  endif
>  
>  ifeq ($(valgrind), yes)
> diff --git a/debian/rules b/debian/rules
> index 54a3c22bf..a82c3e12f 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -8,7 +8,7 @@ include /usr/share/rustc/architecture.mk
>  
>  export BUILD_MODE=release
>  
> -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 d6c61c86e..d23796b7c 100644
> --- a/docs/Makefile
> +++ b/docs/Makefile
> @@ -90,10 +90,10 @@ SPHINXBUILD   = sphinx-build
>  BUILDDIR      = output
>  
>  ifeq ($(BUILD_MODE), release)
> -COMPILEDIR := ../target/release
> +COMPILEDIR := ../target/$(DEB_HOST_RUST_TYPE)/release
>  SPHINXOPTS    += -t release
>  else
> -COMPILEDIR := ../target/debug
> +COMPILEDIR := ../target/$(DEB_HOST_RUST_TYPE)/debug
>  SPHINXOPTS    += -t devbuild
>  endif
>  
> diff --git a/pxar-bin/tests/pxar.rs b/pxar-bin/tests/pxar.rs
> index 321f24c31..0a4fbcad5 100644
> --- a/pxar-bin/tests/pxar.rs
> +++ b/pxar-bin/tests/pxar.rs
> @@ -7,15 +7,17 @@ fn pxar_create_and_extract() {
>      let src_dir = "../tests/catar_data/test_xattrs_src/";
>      let dest_dir = "../tests/catar_data/test_xattrs_dest/";
>  
> +    let target_subdir = std::env::var("DEB_HOST_RUST_TYPE").unwrap_or(String::new());
> +
>      let exec_path = if cfg!(debug_assertions) {
> -        "../target/debug/pxar"
> +        format!("../target/{target_subdir}/debug/pxar")
>      } else {
> -        "../target/release/pxar"
> +        format!("../target/{target_subdir}/release/pxar")
>      };
>  
>      println!("run '{} create archive.pxar {}'", exec_path, src_dir);
>  
> -    Command::new(exec_path)
> +    Command::new(&exec_path)
>          .arg("create")
>          .arg("./tests/archive.pxar")
>          .arg(src_dir)
> @@ -24,7 +26,7 @@ fn pxar_create_and_extract() {
>  
>      println!("run '{} extract archive.pxar {}'", exec_path, dest_dir);
>  
> -    Command::new(exec_path)
> +    Command::new(&exec_path)
>          .arg("extract")
>          .arg("./tests/archive.pxar")
>          .arg("--target")
> @@ -81,13 +83,15 @@ fn pxar_create_and_extract() {
>  
>  #[test]
>  fn pxar_list_with_payload_input() {
> +    let target_subdir = std::env::var("DEB_HOST_RUST_TYPE").unwrap_or(String::new());
> +
>      let exec_path = if cfg!(debug_assertions) {
> -        "../target/debug/pxar"
> +        format!("../target/{target_subdir}/debug/pxar")
>      } else {
> -        "../target/release/pxar"
> +        format!("../target/{target_subdir}/release/pxar")
>      };
>  
> -    let output = Command::new(exec_path)
> +    let output = Command::new(&exec_path)
>          .args([
>              "list",
>              "../tests/pxar/backup-client-pxar-expected.mpxar",
> -- 
> 2.39.2


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




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

end of thread, other threads:[~2024-06-20  7:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-19 14:38 [pbs-devel] [PATCH proxmox-backup] build: use cargo wrapper when building package Fabian Grünbichler
2024-06-20  7:29 ` [pbs-devel] applied: " Wolfgang Bumiller

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