Package: trippy Version: 0.13.0+dfsg-1.5 I hope to update rust-maxminddb to the latest version soon, the upstream patches were easilly backported.
Unfortunately, the patch breaks the build with the old version, so uploading it will need to wait until the new maxminddb is in sid.
diff -Nru trippy-0.13.0+dfsg/debian/changelog trippy-0.13.0+dfsg/debian/changelog --- trippy-0.13.0+dfsg/debian/changelog 2026-04-25 15:24:31.000000000 +0000 +++ trippy-0.13.0+dfsg/debian/changelog 2026-05-08 12:42:06.000000000 +0000 @@ -1,3 +1,10 @@ +trippy (0.13.0+dfsg-1.6) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Add patch for maxminddb 0.28. + + -- Peter Michael Green <[email protected]> Fri, 08 May 2026 12:42:06 +0000 + trippy (0.13.0+dfsg-1.5) unstable; urgency=medium * Non-maintainer upload. diff -Nru trippy-0.13.0+dfsg/debian/control trippy-0.13.0+dfsg/debian/control --- trippy-0.13.0+dfsg/debian/control 2026-04-25 15:24:31.000000000 +0000 +++ trippy-0.13.0+dfsg/debian/control 2026-05-08 12:42:06.000000000 +0000 @@ -31,7 +31,7 @@ librust-insta-dev, librust-ipnetwork-0.21-dev, librust-itertools-dev, - librust-maxminddb-0.24-dev, + librust-maxminddb-dev (>= 0.27), librust-mockall-dev, librust-nix-dev, librust-parking-lot-dev, diff -Nru trippy-0.13.0+dfsg/debian/patches/maxminddb-0.26.patch trippy-0.13.0+dfsg/debian/patches/maxminddb-0.26.patch --- trippy-0.13.0+dfsg/debian/patches/maxminddb-0.26.patch 1970-01-01 00:00:00.000000000 +0000 +++ trippy-0.13.0+dfsg/debian/patches/maxminddb-0.26.patch 2026-05-08 12:42:06.000000000 +0000 @@ -0,0 +1,58 @@ +This patch is based on the upstream commit described below, adapted for use +in the Debian package by Peter Michael Green. + +commit 1ea177adfa923b691086cfbd16f7205fab516649 +Author: FujiApple <[email protected]> +Date: Sun May 18 17:58:40 2025 +0800 + + chore: bump `maxminddb` to 0.26.0 + +diff --git a/Cargo.toml b/Cargo.toml +index ad678a3..c036ab4 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -53,1 +53,1 @@ +-maxminddb = "0.24.0" ++maxminddb = "0.26.0" +diff --git a/crates/trippy-tui/src/geoip.rs b/crates/trippy-tui/src/geoip.rs +index 4b5957b..50034e0 100644 +--- a/crates/trippy-tui/src/geoip.rs ++++ b/crates/trippy-tui/src/geoip.rs +@@ -289,7 +289,7 @@ impl From<(maxminddb::geoip2::City<'_>, &str)> for GeoIpCity { + const FALLBACK_LOCALE: &str = "en"; + + /// Alias for a cache of `GeoIp` data. +-type Cache = RefCell<HashMap<IpAddr, Rc<GeoIpCity>>>; ++type Cache = RefCell<HashMap<IpAddr, Option<Rc<GeoIpCity>>>>; + + /// Lookup `GeoIpCity` data form an `IpAddr`. + #[derive(Debug)] +@@ -326,18 +326,20 @@ impl GeoIpLookup { + pub fn lookup(&self, addr: IpAddr) -> anyhow::Result<Option<Rc<GeoIpCity>>> { + if let Some(reader) = &self.reader { + if let Some(geo) = self.cache.borrow().get(&addr) { +- return Ok(Some(geo.clone())); ++ return Ok(geo.clone()); + } + let city_data = if reader.metadata.database_type.starts_with("ipinfo") { +- GeoIpCity::from(reader.lookup::<ipinfo::IpInfoGeoIp>(addr)?) ++ reader ++ .lookup::<ipinfo::IpInfoGeoIp>(addr)? ++ .map(GeoIpCity::from) + } else { +- GeoIpCity::from(( +- reader.lookup::<maxminddb::geoip2::City<'_>>(addr)?, +- self.locale.as_ref(), +- )) ++ reader ++ .lookup::<maxminddb::geoip2::City<'_>>(addr)? ++ .map(|city| GeoIpCity::from((city, self.locale.as_ref()))) + }; +- let geo = self.cache.borrow_mut().insert(addr, Rc::new(city_data)); +- Ok(geo) ++ let cached = city_data.map(Rc::new); ++ self.cache.borrow_mut().insert(addr, cached.clone()); ++ Ok(cached) + } else { + Ok(None) + } diff -Nru trippy-0.13.0+dfsg/debian/patches/maxminddb-0.27.patch trippy-0.13.0+dfsg/debian/patches/maxminddb-0.27.patch --- trippy-0.13.0+dfsg/debian/patches/maxminddb-0.27.patch 1970-01-01 00:00:00.000000000 +0000 +++ trippy-0.13.0+dfsg/debian/patches/maxminddb-0.27.patch 2026-05-08 12:42:06.000000000 +0000 @@ -0,0 +1,138 @@ +This patch is basedon the upstream commit described below, adapted for use +in the Debian package by Peter Michael Green. + +commit 2585b32308de9cd162af56326b463094423d094c +Author: FujiApple <[email protected]> +Date: Sun Dec 7 13:05:40 2025 +0800 + + chore: bump `maxminddb` to to `0.27.0` + +diff --git a/Cargo.toml b/Cargo.toml +index 7b03855..8acf067 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -54,1 +54,1 @@ +-maxminddb = "0.26.0" ++maxminddb = ">= 0.27.0" +diff --git a/crates/trippy-tui/src/geoip.rs b/crates/trippy-tui/src/geoip.rs +index 71fb30b..a66840c 100644 +--- a/crates/trippy-tui/src/geoip.rs ++++ b/crates/trippy-tui/src/geoip.rs +@@ -212,54 +212,21 @@ impl From<ipinfo::IpInfoGeoIp> for GeoIpCity { + + impl From<(maxminddb::geoip2::City<'_>, &str)> for GeoIpCity { + fn from((value, locale): (maxminddb::geoip2::City<'_>, &str)) -> Self { +- let city = value +- .city +- .as_ref() +- .and_then(|city| city.names.as_ref()) +- .and_then(|names| names.get(locale).or_else(|| names.get(FALLBACK_LOCALE))) +- .map(ToString::to_string); ++ let city = localized_name(&value.city.names, locale); + let subdivision = value + .subdivisions +- .as_ref() +- .and_then(|c| c.first()) +- .and_then(|c| c.names.as_ref()) +- .and_then(|names| names.get(locale).or_else(|| names.get(FALLBACK_LOCALE))) +- .map(ToString::to_string); ++ .first() ++ .and_then(|c| localized_name(&c.names, locale)); + let subdivision_code = value + .subdivisions +- .as_ref() +- .and_then(|c| c.first()) +- .and_then(|c| c.iso_code.as_ref()) +- .map(ToString::to_string); +- let country = value +- .country +- .as_ref() +- .and_then(|country| country.names.as_ref()) +- .and_then(|names| names.get(locale).or_else(|| names.get(FALLBACK_LOCALE))) +- .map(ToString::to_string); +- let country_code = value +- .country +- .as_ref() +- .and_then(|country| country.iso_code.as_ref()) +- .map(ToString::to_string); +- let continent = value +- .continent +- .as_ref() +- .and_then(|continent| continent.names.as_ref()) +- .and_then(|names| names.get(locale).or_else(|| names.get(FALLBACK_LOCALE))) +- .map(ToString::to_string); +- let latitude = value +- .location +- .as_ref() +- .and_then(|location| location.latitude); +- let longitude = value +- .location +- .as_ref() +- .and_then(|location| location.longitude); +- let accuracy_radius = value +- .location +- .as_ref() +- .and_then(|location| location.accuracy_radius); ++ .first() ++ .and_then(|c| c.iso_code.as_ref().map(ToString::to_string)); ++ let country = localized_name(&value.country.names, locale); ++ let country_code = value.country.iso_code.map(ToString::to_string); ++ let continent = localized_name(&value.continent.names, locale); ++ let latitude = value.location.latitude; ++ let longitude = value.location.longitude; ++ let accuracy_radius = value.location.accuracy_radius; + Self { + latitude, + longitude, +@@ -328,13 +295,14 @@ impl GeoIpLookup { + if let Some(geo) = self.cache.borrow().get(&addr) { + return Ok(geo.clone()); + } ++ let lookup_result = reader.lookup(addr)?; + let city_data = if reader.metadata.database_type.starts_with("ipinfo") { +- reader +- .lookup::<ipinfo::IpInfoGeoIp>(addr)? ++ lookup_result ++ .decode::<ipinfo::IpInfoGeoIp>()? + .map(GeoIpCity::from) + } else { +- reader +- .lookup::<maxminddb::geoip2::City<'_>>(addr)? ++ lookup_result ++ .decode::<maxminddb::geoip2::City<'_>>()? + .map(|city| GeoIpCity::from((city, self.locale.as_ref()))) + }; + let cached = city_data.map(Rc::new); +@@ -345,3 +313,32 @@ impl GeoIpLookup { + } + } + } ++ ++fn localized_name(names: &maxminddb::geoip2::Names<'_>, locale: &str) -> Option<String> { ++ lookup_locale(names, locale) ++ .or_else(|| lookup_locale(names, FALLBACK_LOCALE)) ++ .map(ToString::to_string) ++} ++ ++/// Map a Trippy locale code to the closest `maxminddb` locale field. ++/// ++/// - `pt*` (e.g. `pt`, `pt-BR`, `pt-PT`) use `brazilian_portuguese` ++/// - `zh*` (e.g. `zh`, `zh-TW`) use `simplified_chinese` ++/// - Other languages that are supported map directly (`en`, `de`, `es`, `fr`, `ja`, `ru`). ++fn lookup_locale<'a>(names: &maxminddb::geoip2::Names<'a>, code: &str) -> Option<&'a str> { ++ if code.starts_with("pt") { ++ names.brazilian_portuguese ++ } else if code.starts_with("zh") { ++ names.simplified_chinese ++ } else { ++ match code { ++ "de" => names.german, ++ "en" => names.english, ++ "es" => names.spanish, ++ "fr" => names.french, ++ "ja" => names.japanese, ++ "ru" => names.russian, ++ _ => None, ++ } ++ } ++} diff -Nru trippy-0.13.0+dfsg/debian/patches/series trippy-0.13.0+dfsg/debian/patches/series --- trippy-0.13.0+dfsg/debian/patches/series 2026-04-25 15:24:31.000000000 +0000 +++ trippy-0.13.0+dfsg/debian/patches/series 2026-05-08 12:42:06.000000000 +0000 @@ -5,3 +5,5 @@ disable-more-snapshot-tests.patch ratatui.patch rand.patch +maxminddb-0.26.patch +maxminddb-0.27.patch

