Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -792,24 +792,18 @@ find_rpm_asset() {
_package="$3"

case "$_package" in
openshell)
_dev_name="openshell-dev-${_arch}.rpm"
_fallback_re="^openshell-[0-9].*\\.${_arch}\\.rpm$"
;;
openshell-gateway)
_dev_name="openshell-gateway-dev-${_arch}.rpm"
_fallback_re="^openshell-gateway-[0-9].*\\.${_arch}\\.rpm$"
;;
openshell-prover)
_dev_name="openshell-prover-dev-${_arch}.rpm"
_fallback_re="^openshell-prover-[0-9].*\\.${_arch}\\.rpm$"
;;
openshell|openshell-gateway|openshell-prover) ;;
*)
error "unknown RPM package selector: ${_package}"
;;
esac

awk -v dev_name="$_dev_name" -v fallback_re="$_fallback_re" '
# Build the regex inside awk: -v values have their escapes processed.
awk -v package="$_package" -v arch="$_arch" '
BEGIN {
dev_name = package "-dev-" arch ".rpm"
fallback_re = "^" package "-[0-9].*\\." arch "\\.rpm$"
}
{
name = $2
sub("^\\*", "", name)
Expand Down
26 changes: 26 additions & 0 deletions tasks/scripts/test-install-sh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,32 @@ if [ "$(find_rpm_asset "${tmpdir}/checksums" x86_64 openshell-prover)" != "opens
exit 1
fi

cat >"${tmpdir}/checksums" <<'EOF'
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa openshell-0.1.5-1xx86_64xrpm
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb openshell-0.1.5-1.x86_64.rpm
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc openshell-gateway-0.1.5-1.x86_64.rpm
EOF

# gawk warns on bad regex escapes; mawk does not. Prefer gawk when present.
rpm_path="$PATH"
if gawk_bin="$(command -v gawk)"; then
mkdir "${tmpdir}/gawk-bin"
ln -s "$gawk_bin" "${tmpdir}/gawk-bin/awk"
rpm_path="${tmpdir}/gawk-bin:${PATH}"
fi

rpm_err="${tmpdir}/rpm_err"
if [ "$(PATH="$rpm_path" find_rpm_asset "${tmpdir}/checksums" x86_64 openshell 2>"$rpm_err")" != "openshell-0.1.5-1.x86_64.rpm" ] ||
[ "$(PATH="$rpm_path" find_rpm_asset "${tmpdir}/checksums" x86_64 openshell-gateway 2>>"$rpm_err")" != "openshell-gateway-0.1.5-1.x86_64.rpm" ]; then
echo "FAIL: RPM fallback must match a literal dot" >&2
exit 1
fi
if [ -s "$rpm_err" ]; then
echo "FAIL: RPM package selection must not print to stderr" >&2
cat "$rpm_err" >&2
exit 1
fi

mock_gh_log="${tmpdir}/gh.log"
PLATFORM=linux
linux_package_method() {
Expand Down
Loading