+++ /dev/null
-Enable rust build, which is currently disabled in debian/rule
-with NO_RUST=true.
-
-Dependencies available in Debian: librust-byteorder-dev librust-rpassword-dev
-librust-either-dev librust-errno-dev librust-itertools-dev librust-getset-dev
-librust-uuid-dev librust-libudev-dev librust-libc-dev librust-anyhow-dev
-librust-clap-dev librust-colored-dev librust-chrono-dev librust-log-dev
-librust-atty-dev
-
-Missing dependencies: librust-gag-dev librust-parse-display-dev
-librust-bch-bindgen-dev
hack that makes bcachefs-tools work with bindgen older than 0.69.4
(which isn't in Debian yet).
* Build-depend on systemd-dev, since udev.pc has moved there.
+ * Enable Rust parts, including mount.bcachefs. (Closes: #1060256)
+ * Include the right .mk flags to get DEB_HOST_RUST_TYPE etc., and
+ export that (needed for Debian's cargo wrapper).
+ * Override CARGO, and set CARGO_HOME during installation.
+ * Run prepare-debian in dh_auto_configure, and clean up the vendor dir
+ in dh_auto_clean.
+ * Remove Cargo.lock before the build, so that we can use Debian's versions
+ of all Rust crates. Also remove it in dh_auto_clean, so that it does not
+ take a diff.
+ * revert-bindgen-changes.patch: New patch, loosen required versions
+ of Rust crates
+ - errno (0.2 -> >= 0.2, < 1; Debian has 0.4)
+ - udev (0.7 -> >= 0.7, < 1; Debian has 0.8)
+ - memoffset (0.8.0 -> 0.6; Debian has 0.6.5, so a downgrade)
+ - paste (1.0.11 -> 1.0; Debian has 1.0.8, so a downgrade)
+ - bindgen (0.69.4 -> 0.66; see revert-bindgen-changes.patch above)
+ * Add build-dependency on all relevant Rust crates, and on python3:native
+ due to use of the Cargo wrapper.
-- Steinar H. Gunderson <sesse@debian.org> Wed, 21 Feb 2024 19:32:51 +0100
Rules-Requires-Root: no
Build-Depends: debhelper-compat (= 13),
cargo,
+ python3:native,
pkg-config,
python3-docutils,
python3-pytest,
libzstd-dev,
systemd-dev,
uuid-dev,
- zlib1g-dev
+ zlib1g-dev,
+# -- Cargo.toml
+ librust-atty-0.2-dev (>= 0.2.14-~~),
+ librust-log-0.4-dev,
+ librust-log-0+std-dev,
+ librust-colored-2-dev,
+ librust-clap-4-dev (>= 4.0.32-~~),
+ librust-clap-4+derive-dev,
+ librust-clap-4+wrap-help-dev,
+ librust-clap-complete-4-dev (>= 4.3.2-~~),
+ librust-anyhow-1.0-dev,
+ librust-libc-0.2-dev,
+ librust-udev-0-dev (>= 0.7-~~),
+ librust-uuid-1-dev (>= 1.2.2-~~),
+ librust-errno-0-dev (>= 0.2),
+ librust-either-1-dev (>= 1.5),
+ librust-rpassword-7-dev,
+ librust-byteorder-1-dev (>= 1.3),
+# -- bch_bindgen/Cargo.toml
+# anyhow, uuid, byteorder are covered above
+ librust-bitfield-0-dev (>= 0.14.0-~~),
+ librust-memoffset-0.6-dev,
+ librust-bitflags-1-dev (>= 1.3.2-~~),
+ librust-paste-1.0-dev,
+ librust-pkg-config-0.3-dev,
+ librust-bindgen-0.66-dev
Homepage: https://bcachefs.org/
Vcs-Git: https://salsa.debian.org/jcc/bcachefs-tools.git
Vcs-Browser: https://salsa.debian.org/jcc/bcachefs-tools
--- /dev/null
+Index: bcachefs-tools/bch_bindgen/Cargo.toml
+===================================================================
+--- bcachefs-tools.orig/bch_bindgen/Cargo.toml
++++ bcachefs-tools/bch_bindgen/Cargo.toml
+@@ -12,11 +12,11 @@ crate-type = ["lib"]
+ anyhow = "1.0"
+ uuid = "1.2.2"
+ bitfield = "0.14.0"
+-memoffset = "0.8.0"
++memoffset = "0.6"
+ byteorder = "1.3"
+ bitflags = "1.3.2"
+-paste = "1.0.11"
++paste = "1.0"
+
+ [build-dependencies]
+ pkg-config = "0.3"
+-bindgen = "0.69.2"
++bindgen = "0.66"
+Index: bcachefs-tools/Cargo.toml
+===================================================================
+--- bcachefs-tools.orig/Cargo.toml
++++ bcachefs-tools/Cargo.toml
+@@ -16,9 +16,9 @@ clap = { version = "4.0.32", features =
+ clap_complete = "4.3.2"
+ anyhow = "1.0"
+ libc = "0.2.69"
+-udev = "0.7.0"
++udev = ">= 0.7, < 1"
+ uuid = "1.2.2"
+-errno = "0.2"
++errno = ">= 0.2, < 1"
+ either = "1.5"
+ rpassword = "7"
+ bch_bindgen = { path = "bch_bindgen" }
revert-bindgen-changes.patch
+relax-dep-versions.patch
#!/usr/bin/make -f
+include /usr/share/dpkg/architecture.mk
+include /usr/share/rustc/architecture.mk
+
+export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
+
export DEB_BUILD_MAINT_OPTIONS=hardening=+all
-# Do not build rust code (dependencies currently unmet)
-export NO_RUST=-true
+export CARGO=/usr/share/cargo/bin/cargo
+export CARGO_HOME=$(CURDIR)/debian/cargo_home
+export DEB_CARGO_CRATE=bcachefs-tools_$(DEB_VERSION_UPSTREAM)
PREFIX := /usr
ROOT_SBINDIR := /usr/sbin
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
-
ifeq ($(DEB_BUILD_ARCH),amd64)
DEB_BUILD_MAINT_OPTIONS += optimize=-lto
endif
%:
dh $@
+override_dh_auto_configure:
+ $(CARGO) prepare-debian $(CURDIR)/vendor --link-from-system
+
+override_dh_auto_build:
+ $(RM) Cargo.lock
+ dh_auto_build -- CARGO="$(CARGO)"
+
override_dh_auto_install:
dh_auto_install -- "PREFIX=$(PREFIX)" "ROOT_SBINDIR=$(ROOT_SBINDIR)"
+override_dh_auto_clean:
+ ! [ -d $(CURDIR)/vendor ] || $(RM) -r $(CURDIR)/vendor
+ ! [ -d $(CARGO_HOME) ] || $(RM) -r $(CARGO_HOME)
+ $(RM) Cargo.lock
+ dh_auto_clean
+
override_dh_auto_test: