Drop chcat/chtail/chgrep symlink entrypoints; ship chlog subcommands only
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful

The RPM's /usr/bin/chcat conflicts with SELinux's
policycoreutils-python-utils on Fedora. Per Ben: remove the symlink
entrypoints entirely and ship only the chlog binary with cat/tail/grep
subcommands.

- Remove chcat/chtail/chgrep symlinks and their completions from
  nfpm.yaml, build-rpm.sh and the Makefile
- Remove the argv[0] dispatch in main.go; subcommands are unchanged
- Update the completion test to cover chlog only
- Update README usage to chlog cat|tail|grep
This commit is contained in:
2026-08-23 21:39:17 +10:00
parent dfd4efd782
commit ee2f270abc
8 changed files with 60 additions and 145 deletions
+6 -14
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
#
# Package the (already built) chlog binary into an RPM with nfpm, bundling
# chcat/chtail/chgrep symlinks and generated bash/zsh/fish shell completions.
# generated bash/zsh/fish shell completions.
# Usage: scripts/build-rpm.sh [version] (version defaults to $CI_COMMIT_TAG)
#
set -euo pipefail
@@ -12,7 +12,6 @@ cd "${ROOT_DIR}"
VERSION="${1:-${CI_COMMIT_TAG:-0.0.0-dev}}"
VERSION="${VERSION#v}" # strip a leading v
BINARY="chlog"
NAMES=(chlog chcat chtail chgrep)
DIST="dist"
if [ ! -f "${DIST}/${BINARY}" ]; then
@@ -20,26 +19,19 @@ if [ ! -f "${DIST}/${BINARY}" ]; then
exit 1
fi
for l in chcat chtail chgrep; do
ln -sf "${BINARY}" "${DIST}/${l}"
done
# Generate shell completions per entrypoint name so they always match the
# shipped flags/subcommands (each name dispatches to its own command tree).
# Generate shell completions so they always match the shipped flags/subcommands.
COMP_DIR="${DIST}/completions"
mkdir -p "${COMP_DIR}"
for b in "${NAMES[@]}"; do
"./${DIST}/${b}" completion bash >"${COMP_DIR}/${b}.bash"
"./${DIST}/${b}" completion zsh >"${COMP_DIR}/_${b}"
"./${DIST}/${b}" completion fish >"${COMP_DIR}/${b}.fish"
done
"./${DIST}/${BINARY}" completion bash >"${COMP_DIR}/${BINARY}.bash"
"./${DIST}/${BINARY}" completion zsh >"${COMP_DIR}/_${BINARY}"
"./${DIST}/${BINARY}" completion fish >"${COMP_DIR}/${BINARY}.fish"
export PACKAGE_NAME="clickhouse-tools"
export PACKAGE_VERSION="${VERSION}"
export PACKAGE_RELEASE="1"
export PACKAGE_ARCH="amd64"
export PACKAGE_PLATFORM="linux"
export PACKAGE_DESCRIPTION="CLI tools for the ClickHouse log store: chlog with chcat (print), chtail (follow) and chgrep (search) entrypoints"
export PACKAGE_DESCRIPTION="CLI tools for the ClickHouse log store: chlog with cat (print), tail (follow) and grep (search) subcommands"
export PACKAGE_MAINTAINER="Ben Vincent <ben@unkin.net>"
export PACKAGE_HOMEPAGE="https://git.unkin.net/unkin/clickhouse-tools"
export PACKAGE_LICENSE="MIT"