]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Enable Rust parts, including mount.bcachefs.
authorSteinar H. Gunderson <sesse@debian.org>
Tue, 13 Feb 2024 21:01:33 +0000 (22:01 +0100)
committerSteinar H. Gunderson <sesse@debian.org>
Wed, 21 Feb 2024 18:36:13 +0000 (19:36 +0100)
debian/README.todo [deleted file]
debian/changelog
debian/control
debian/patches/relax-dep-versions.patch [new file with mode: 0644]
debian/patches/series
debian/rules

diff --git a/debian/README.todo b/debian/README.todo
deleted file mode 100644 (file)
index 93db89a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-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
index 7007b3c4d2ae1acb076433615c0ee84d62919c5a..8a4202d87f443c32076cddeeaf66f7c94dcee0a0 100644 (file)
@@ -8,6 +8,24 @@ bcachefs-tools (1:1.6.3-0.1) UNRELEASED; urgency=medium
       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
 
index edcb9237fa8ada1874fec703d2b2b1443b985728..9023256331c4a21853e2afe6f2ac33b4a82365d7 100644 (file)
@@ -6,6 +6,7 @@ Standards-Version: 4.6.1
 Rules-Requires-Root: no
 Build-Depends: debhelper-compat (= 13),
                cargo,
+               python3:native,
                pkg-config,
                python3-docutils,
                python3-pytest,
@@ -21,7 +22,32 @@ Build-Depends: debhelper-compat (= 13),
                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
diff --git a/debian/patches/relax-dep-versions.patch b/debian/patches/relax-dep-versions.patch
new file mode 100644 (file)
index 0000000..26dc19f
--- /dev/null
@@ -0,0 +1,35 @@
+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" }
index 242cf6b703fe9b5a3179de7bb8887d5dcc1dabfe..5af4f9541b7cc3bd39d98b16c1be5c87140ba080 100644 (file)
@@ -1 +1,2 @@
 revert-bindgen-changes.patch
+relax-dep-versions.patch
index fd523507ca0a417387107635177daaccc694a8bf..177294571ca59f4c27e968fb93a17ac9525faf6e 100755 (executable)
@@ -1,15 +1,20 @@
 #!/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
@@ -17,7 +22,20 @@ 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: