+sub require_cmd ($;$) {
+ my ($cmd, $maybe) = @_;
+ require PublicInbox::Spawn;
+ my $bin = PublicInbox::Spawn::which($cmd);
+ return $bin if $bin;
+ $maybe ? 0 : plan(skip_all => "$cmd missing from PATH for $0");
+}
+
+sub have_xapian_compact () {
+ require_cmd($ENV{XAPIAN_COMPACT} || 'xapian-compact', 1);
+}
+