Skip to content

Commit 08c2946

Browse files
authored
Merge pull request #37148 from vespa-engine/gjoranv/crypto-cli-standalone-jar-path
Package vespa-crypto-cli-standalone as RPM subpackage
2 parents acec6b4 + e946abb commit 08c2946

3 files changed

Lines changed: 60 additions & 3 deletions

File tree

dist/vespa.spec

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,24 @@ Requires: %{name}-base-libs = %{version}-%{release}
330330

331331
Vespa - The open big data serving engine - devel package
332332

333+
%package crypto-cli-standalone
334+
335+
Summary: Vespa - standalone crypto CLI
336+
337+
# Self-contained: the fat JAR bundles all provided-scope deps, so no Vespa install is required.
338+
# Mirrors the java requirement conditional in %package base, but pulls the headless runtime
339+
# instead of the full JDK since this is a runtime-only CLI.
340+
%if 0%{?amzn2023}
341+
Requires: java-17-amazon-corretto-headless
342+
%else
343+
Requires: java-%{_vespa_java_version}-openjdk-headless
344+
%endif
345+
346+
%description crypto-cli-standalone
347+
348+
The vespa-crypto-cli-standalone tool for key/secret operations (e.g. core dump
349+
resealing), runnable without a full Vespa installation.
350+
333351
%prep
334352
%if 0%{?installdir:1}
335353
%if 0%{?source_base:1}
@@ -507,6 +525,7 @@ fi
507525
%dir %{_prefix}
508526
%{_prefix}/bin
509527
%exclude %{_prefix}/bin/vespa
528+
%exclude %{_prefix}/bin/vespa-crypto-cli-standalone
510529
%exclude %{_prefix}/bin/vespa-curl
511530
%exclude %{_prefix}/bin/vespa-destination
512531
%exclude %{_prefix}/bin/vespa-fbench
@@ -767,4 +786,15 @@ fi
767786
%{_prefix}/include
768787
%{_prefix}/share/cmake
769788

789+
%files crypto-cli-standalone
790+
%if %{_defattr_is_vespa_vespa}
791+
%defattr(-,%{_vespa_user},%{_vespa_group},-)
792+
%endif
793+
%dir %{_prefix}
794+
%dir %{_prefix}/bin
795+
%{_prefix}/bin/vespa-crypto-cli-standalone
796+
%dir %{_prefix}/lib
797+
%dir %{_prefix}/lib/jars
798+
%{_prefix}/lib/jars/vespaclient-java-fat-with-provided.jar
799+
770800
%changelog

vespaclient-java/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
22
install_jar(vespaclient-java-jar-with-dependencies.jar)
3+
# Fat JAR bundling all deps (incl. provided scope), for the standalone crypto CLI (no Vespa install required)
4+
install_jar(vespaclient-java-fat-with-provided.jar)
35

46
vespa_install_script(src/main/sh/vespa-crypto-cli.sh vespa-crypto-cli bin)
7+
vespa_install_script(src/main/sh/vespa-crypto-cli-standalone.sh vespa-crypto-cli-standalone bin)
58
vespa_install_script(src/main/sh/vespa-stat.sh vespa-stat bin)
69
vespa_install_script(src/main/sh/vespa-query-profile-dump-tool.sh vespa-query-profile-dump-tool bin)
710
vespa_install_script(src/main/sh/vespa-summary-benchmark.sh vespa-summary-benchmark bin)

vespaclient-java/src/main/sh/vespa-crypto-cli-standalone.sh

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,35 @@
44
# Resolve symlink (if any) and normalize path
55
program=$(readlink -f "$0")
66
program_dir=$(dirname "$program")
7-
jarfile=$(readlink -f "$program_dir"/../../../target/vespaclient-java-fat-with-provided.jar)
87

9-
if ! test -e "$jarfile"
8+
jar_name=vespaclient-java-fat-with-provided.jar
9+
10+
# Locate the fat JAR, in priority order:
11+
# 1. $VESPA_CRYPTO_CLI_JAR, if set (explicit override)
12+
# 2. installed location, relative to this script (RPM: bin/ and lib/jars/ are siblings)
13+
# 3. target/ in the Maven build tree (local dev)
14+
jarfile=""
15+
if [ -n "$VESPA_CRYPTO_CLI_JAR" ]; then
16+
jarfile=$VESPA_CRYPTO_CLI_JAR
17+
else
18+
for candidate in \
19+
"$program_dir/../lib/jars/$jar_name" \
20+
"$program_dir/../../../target/$jar_name"
21+
do
22+
if [ -e "$candidate" ]; then
23+
jarfile=$(readlink -f "$candidate")
24+
break
25+
fi
26+
done
27+
fi
28+
29+
if [ -z "$jarfile" ] || ! test -e "$jarfile"
1030
then
11-
echo "No such file: '$jarfile'" >&2
31+
if [ -n "$VESPA_CRYPTO_CLI_JAR" ]; then
32+
echo "VESPA_CRYPTO_CLI_JAR is set to '$VESPA_CRYPTO_CLI_JAR' but no such file exists." >&2
33+
else
34+
echo "Could not locate '$jar_name'. Set VESPA_CRYPTO_CLI_JAR to its path." >&2
35+
fi
1236
exit 1
1337
fi
1438

0 commit comments

Comments
 (0)