Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

fix(versioning): treat empty beta variables and an empty --named as given

Raystormsaab590966896
diff --git a/dylib/tests/versioncheck.sh b/dylib/tests/versioncheck.sh
index 04d03ac..230ff87 100644
--- a/dylib/tests/versioncheck.sh
+++ b/dylib/tests/versioncheck.sh
@@ -166,6 +166,10 @@ done
# A missing number fails, whatever else is set.
expect_refused "no beta number, build given" stamp BRIDGEPLAY_BETA_BUILD=50 check
expect_refused "no beta number, planned given" stamp BRIDGEPLAY_BETA_PLANNED=0.8.0 check
+# Empty values count as set: a wrapper that exports them empty must not get a stable build.
+expect_refused "empty beta build, no beta number" stamp BRIDGEPLAY_BETA_BUILD= check
+expect_refused "empty planned, no beta number" stamp BRIDGEPLAY_BETA_PLANNED= check
+expect_refused "both empty, no beta number" stamp BRIDGEPLAY_BETA_BUILD= BRIDGEPLAY_BETA_PLANNED= check
# The build number is given, a positive integer and above the committed build.
expect_refused "no beta build" stamp BRIDGEPLAY_BETA=1 check
@@ -267,6 +271,7 @@ expect_refused "named differs from the patch" bump patch --named 0.8.0
expect_same "a refused bump leaves version.h alone" "$work/version.h.orig" "$bumpfx/dylib/version.h"
expect_refused "named differs from the minor" bump minor --named 0.7.3
expect_refused "named is malformed" bump patch --named 0.7.3-beta.1
+expect_refused "named is empty" bump patch --named "" --highest-build 50
expect_refused "no part" bump
expect_refused "unknown part" bump beta
diff --git a/scripts/bump-version.sh b/scripts/bump-version.sh
index 01a6491..cea1da9 100755
--- a/scripts/bump-version.sh
+++ b/scripts/bump-version.sh
@@ -51,6 +51,7 @@ while [ $# -gt 0 ]; do
;;
--named)
[ $# -ge 2 ] || usage
+ is_semver "$2" || { echo "==> --named wants X.Y.Z, got '$2'" >&2; exit 1; }
named=$2
shift 2
;;
@@ -72,9 +73,6 @@ fi
if [ -n "$highest" ]; then
is_posint "$highest" || die "--highest-build wants a positive integer, got '$highest'"
fi
-if [ -n "$named" ]; then
- is_semver "$named" || die "--named wants X.Y.Z, got '$named'"
-fi
next=$(semver_next "$part" "$version")
[ -z "$named" ] || [ "$named" = "$next" ] \
diff --git a/scripts/stamp-beta.sh b/scripts/stamp-beta.sh
index e7e990f..b6a18e0 100755
--- a/scripts/stamp-beta.sh
+++ b/scripts/stamp-beta.sh
@@ -62,7 +62,7 @@ if [ -n "${BRIDGEPLAY_BETA+set}" ]; then
version=$planned-beta.$BRIDGEPLAY_BETA
build=$beta_build
channel=beta
-elif [ -n "${BRIDGEPLAY_BETA_BUILD:-}" ] || [ -n "${BRIDGEPLAY_BETA_PLANNED:-}" ]; then
+elif [ -n "${BRIDGEPLAY_BETA_BUILD+set}" ] || [ -n "${BRIDGEPLAY_BETA_PLANNED+set}" ]; then
die "BRIDGEPLAY_BETA_BUILD or BRIDGEPLAY_BETA_PLANNED is set without BRIDGEPLAY_BETA (the beta number N)"
fi