[Debian-med-packaging] Bug#1119017: sourmash: Fails to build with rust-twox-hash 2.1.2
Peter Green
plugwash at debian.org
Sat Jan 24 07:04:42 GMT 2026
tags 1119017 +patch
thanks
>
> based on twox-hash upstream's changelog, 2.x is a complete rewrite with a
> lot of interface changes, so it likely is best to ask sourmash's upstream
> whether they are planning on migrating any time soon. if not, somebody
> needs to either do this migration in Debian and try to upstream it, or
> we'd need to re-introduce twox-hash 1.x as a separate source package..
I just took a look at this figuring "it's a hash function, how complex
can the API be" and indeed it was relatively simple. There were two
main changes of relavence.
1. The type names had changed slightly.
2. The 128 bit xxhash 3 no longer implements the hasher trait "as that
trait requires a 64-bit result while this computes a 128-bit result.".
xxhash 1.x simply truncated the result, so I wrote a wrapper for
xxhash 2.x that did the same.
While I was in there I also relaxed a couple of other dependencies to
accomodate upcoming crate updates, and removed the downgrade of
thiserror.
There is also an issue building the package with ipython 9 (currently in
experimental), It seems a module was moved out to a seperate package which
is currently in NEW
( https://ftp-master.debian.org/new/ipython-pygments-lexers_1.1.1-1.html )
Finally, I'm seeing a testsuite failure, it looks like the formatting
of some error message has changed slightly, someone more familiar with
python than my can look into that.
-------------- next part --------------
diff -Nru sourmash-4.9.4/debian/changelog sourmash-4.9.4/debian/changelog
--- sourmash-4.9.4/debian/changelog 2025-10-12 18:30:00.000000000 +0000
+++ sourmash-4.9.4/debian/changelog 2026-01-24 05:08:09.000000000 +0000
@@ -1,3 +1,11 @@
+sourmash (4.9.4-4.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Use thiserror 2, thiserror 1 is legacy.
+ * Relax cargo dependencies on itertools, md5 and roaring.
+
+ -- Peter Michael Green <plugwash at debian.org> Sat, 24 Jan 2026 05:08:09 +0000
+
sourmash (4.9.4-4) unstable; urgency=medium
* Team upload.
diff -Nru sourmash-4.9.4/debian/control sourmash-4.9.4/debian/control
--- sourmash-4.9.4/debian/control 2025-10-12 16:00:00.000000000 +0000
+++ sourmash-4.9.4/debian/control 2026-01-24 05:08:09.000000000 +0000
@@ -47,7 +47,8 @@
librust-serde-json-dev,
librust-statrs-dev,
librust-streaming-stats-dev,
- librust-twox-hash-dev,
+ librust-thiserror-dev,
+ librust-twox-hash-2-dev,
librust-typed-builder-dev,
librust-vec-collections-dev,
librust-chrono-dev,
diff -Nru sourmash-4.9.4/debian/patches/series sourmash-4.9.4/debian/patches/series
--- sourmash-4.9.4/debian/patches/series 2025-10-12 16:00:00.000000000 +0000
+++ sourmash-4.9.4/debian/patches/series 2026-01-24 05:08:09.000000000 +0000
@@ -2,3 +2,4 @@
soften-deps
older-md5
tests-no-timeout
+twox-hash-2
diff -Nru sourmash-4.9.4/debian/patches/soften-deps sourmash-4.9.4/debian/patches/soften-deps
--- sourmash-4.9.4/debian/patches/soften-deps 2025-10-12 16:02:00.000000000 +0000
+++ sourmash-4.9.4/debian/patches/soften-deps 2026-01-24 05:08:09.000000000 +0000
@@ -2,9 +2,11 @@
Author: Peter Michael Greem <plugwash at debian.org>
Description: soften some dependencies to match what is packaged in Debian
Forwarded: not-needed
---- sourmash.orig/src/core/Cargo.toml
-+++ sourmash/src/core/Cargo.toml
-@@ -31,43 +31,40 @@
+Index: sourmash-4.9.4/src/core/Cargo.toml
+===================================================================
+--- sourmash-4.9.4.orig/src/core/Cargo.toml
++++ sourmash-4.9.4/src/core/Cargo.toml
+@@ -31,29 +31,27 @@ byteorder = "1.4.3"
camino = { version = "1.1.10", features = ["serde1"] }
cfg-if = "1.0"
counter = "0.6.0"
@@ -17,11 +19,11 @@
-itertools = "0.14.0"
+getset = "0.1"
+histogram = "0.11"
-+itertools = "0.13"
++itertools = ">= 0.13"
log = "0.4.27"
-md5 = "0.8.0"
-memmap2 = "0.9.7"
-+md5 = "0.7"
++md5 = ">= 0.7"
+memmap2 = "0.9"
murmurhash3 = "0.0.5"
-needletail = { version = "0.6.3", default-features = false }
@@ -41,17 +43,16 @@
-rkyv = { version = "0.7.45", optional = true }
-roaring = "0.11.0"
+rkyv = { version = "0.8", optional = true }
-+roaring = "0.10"
++roaring = ">= 0.10"
roots = "0.0.8"
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.141"
- statrs = "0.18.0"
+@@ -61,13 +59,12 @@ statrs = "0.18.0"
streaming-stats = "0.2.3"
--thiserror = "2.0"
-+thiserror = "1"
+ thiserror = "2.0"
twox-hash = "1.6.0"
-typed-builder = "0.20.0"
-+typed-builder = "0.21"
++typed-builder = ">= 0.21"
vec-collections = "0.4.3"
[dev-dependencies]
@@ -63,7 +64,7 @@
tempfile = "3.20.0"
[[bench]]
-@@ -93,26 +90,9 @@
+@@ -93,26 +90,9 @@ skip_feature_sets = [
["branchwater", "parallel"], # branchwater implies parallel
]
diff -Nru sourmash-4.9.4/debian/patches/twox-hash-2 sourmash-4.9.4/debian/patches/twox-hash-2
--- sourmash-4.9.4/debian/patches/twox-hash-2 1970-01-01 00:00:00.000000000 +0000
+++ sourmash-4.9.4/debian/patches/twox-hash-2 2026-01-24 05:08:09.000000000 +0000
@@ -0,0 +1,68 @@
+Index: sourmash-4.9.4/src/core/Cargo.toml
+===================================================================
+--- sourmash-4.9.4.orig/src/core/Cargo.toml
++++ sourmash-4.9.4/src/core/Cargo.toml
+@@ -58,7 +58,7 @@ serde_json = "1.0.141"
+ statrs = "0.18.0"
+ streaming-stats = "0.2.3"
+ thiserror = "2.0"
+-twox-hash = "1.6.0"
++twox-hash = "2"
+ typed-builder = ">= 0.21"
+ vec-collections = "0.4.3"
+
+Index: sourmash-4.9.4/src/core/src/encodings.rs
+===================================================================
+--- sourmash-4.9.4.orig/src/core/src/encodings.rs
++++ sourmash-4.9.4/src/core/src/encodings.rs
+@@ -470,7 +470,7 @@ impl Colors {
+ }
+
+ fn compute_color(idxs: &IdxTracker) -> Color {
+- let s = BuildHasherDefault::<twox_hash::Xxh3Hash128>::default();
++ let s = BuildHasherDefault::<crate::Xxh3Hash128>::default();
+ s.hash_one(&idxs.0)
+ }
+
+Index: sourmash-4.9.4/src/core/src/index/revindex/disk_revindex.rs
+===================================================================
+--- sourmash-4.9.4.orig/src/core/src/index/revindex/disk_revindex.rs
++++ sourmash-4.9.4/src/core/src/index/revindex/disk_revindex.rs
+@@ -36,7 +36,7 @@ const VERSION: &str = "version";
+ const PROCESSED: &str = "processed";
+
+ fn compute_color(idxs: &Datasets) -> Color {
+- let s = BuildHasherDefault::<twox_hash::Xxh3Hash128>::default();
++ let s = BuildHasherDefault::<crate::Xxh3Hash128>::default();
+ s.hash_one(idxs)
+ }
+
+Index: sourmash-4.9.4/src/core/src/lib.rs
+===================================================================
+--- sourmash-4.9.4.orig/src/core/src/lib.rs
++++ sourmash-4.9.4/src/core/src/lib.rs
+@@ -40,6 +40,24 @@ pub mod storage;
+ use cfg_if::cfg_if;
+ use murmurhash3::murmurhash3_x64_128;
+
++//compatibility struct to support twox_hash version 2
++#[derive(Default)]
++struct Xxh3Hash128(twox_hash::XxHash3_128);
++
++impl std::hash::Hasher for Xxh3Hash128 {
++ #[inline(always)]
++ fn finish(&self) -> u64 {
++ // this truncates the 128-bit value to 64-bits,
++ // which reflects what xxhash 1.x did.
++ self.0.finish_128() as u64
++ }
++
++ #[inline(always)]
++ fn write(&mut self, bytes: &[u8]) {
++ self.0.write(bytes)
++ }
++}
++
+ cfg_if! {
+ if #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] {
+ // Explicitly keeping emscripten and wasi out of this
More information about the Debian-med-packaging
mailing list