@@ -22,6 +22,11 @@ CARGO := /usr/share/cargo/bin/cargo
2222DH_CARGO_VENDORED_SOURCES := /usr/share/cargo/bin/dh-cargo-vendored-sources
2323export CARGO_VENDOR_DIR = vendor_rust
2424
25+ # Needed for Rust configure/build/test stages
26+ export DEB_HOST_GNU_TYPE
27+ export DEB_HOST_RUST_TYPE
28+ export CARGO_HOME = $(CURDIR ) /debian/cargo_home
29+
2530% :
2631 dh $@ --buildsystem=golang --with=golang,apport
2732
@@ -36,7 +41,7 @@ override_dh_auto_clean:
3641 # This results in cargo failing to compile, since the files (which are listed in the checksums) are not there anymore.
3742 # For those crates, we need to replace their checksum with a more general one that only lists the crate checksum, instead of each file.
3843 if [ ! -d $(CARGO_VENDOR_DIR)/ ]; then \
39- $(CARGO) vendor $(CARGO_VENDOR_DIR); \
44+ CARGO_HOME=$(HOME)/.cargo $(CARGO) vendor $(CARGO_VENDOR_DIR); \
4045 [ ! -e $(DH_CARGO_VENDORED_SOURCES) ] || $(DH_CARGO_VENDORED_SOURCES); \
4146 \
4247 [ -e /usr/bin/jq ] || (echo "jq is required to run this script. Try installing it with 'sudo apt install jq'" && exit 1); \
@@ -56,8 +61,7 @@ override_dh_auto_configure:
5661 dh_auto_configure
5762
5863 [ ! -e $(DH_CARGO_VENDORED_SOURCES) ] || $(DH_CARGO_VENDORED_SOURCES)
59- DEB_HOST_GNU_TYPE=$(DEB_HOST_GNU_TYPE) DEB_HOST_RUST_TYPE=$(DEB_HOST_RUST_TYPE) \
60- CARGO_HOME=$(CURDIR)/debian/cargo_home DEB_CARGO_CRATE=nss_$(shell dpkg-parsechangelog --show-field Version) \
64+ DEB_CARGO_CRATE=nss_$(shell dpkg-parsechangelog --show-field Version) \
6165 RUSTFLAGS="--cfg=rustix_use_libc" \
6266 $(CARGO) prepare-debian $(CARGO_VENDOR_DIR)
6367
@@ -66,10 +70,7 @@ override_dh_auto_build:
6670 go generate -x ./pam
6771
6872 # Build the NSS library
69- DEB_HOST_GNU_TYPE=$(DEB_HOST_GNU_TYPE) \
70- DEB_HOST_RUST_TYPE=$(DEB_HOST_RUST_TYPE) \
71- CARGO_HOME=$(CURDIR)/debian/cargo_home \
72- $(CARGO) build --release
73+ $(CARGO) build --release
7374
7475 # Build the CLI
7576 DH_GOLANG_BUILDPKG=github.com/ubuntu/authd/cmd/authd dh_auto_build
@@ -78,11 +79,7 @@ override_dh_auto_test:
7879 # We need to specify these Rust related variables to the Go tests in order to build the NSS lib
7980 # with the cargo wrapper in the integration tests in order to force cargo to use vendored deps
8081 # instead of querying crates.io for them.
81- DEB_HOST_GNU_TYPE=$(DEB_HOST_GNU_TYPE ) \
82- DEB_HOST_RUST_TYPE=$(DEB_HOST_RUST_TYPE ) \
83- CARGO_HOME=$(CURDIR ) /debian/cargo_home \
84- CARGO_PATH=$(CARGO ) \
85- dh_auto_test
82+ CARGO_PATH=$(CARGO ) dh_auto_test
8683
8784override_dh_auto_install :
8885 dh_auto_install -- --no-source
0 commit comments