shyjsarah commented on code in PR #79:
URL: 
https://github.com/apache/paimon-vector-index/pull/79#discussion_r3794171738


##########
tools/update_branch_version.sh:
##########
@@ -36,33 +37,38 @@ fi
 
 ###########################
 
-OLD_VERSION=${OLD_VERSION}
-NEW_VERSION=${NEW_VERSION}
-
-
-if [ -z "${OLD_VERSION}" ]; then
+if [ -z "${OLD_VERSION:-}" ]; then
        echo "OLD_VERSION is unset"
        exit 1
 fi
 
-if [ -z "${NEW_VERSION}" ]; then
+if [ -z "${NEW_VERSION:-}" ]; then
        echo "NEW_VERSION is unset"
        exit 1
 fi
 
 cd ..
 
-# For Cargo.toml and pyproject.toml, strip any -SNAPSHOT suffix (not valid in 
those ecosystems)
+# Cargo and Python use clean SemVer versions without Maven's -SNAPSHOT suffix.
+OLD_VERSION_CLEAN=$(echo "$OLD_VERSION" | sed 's/-SNAPSHOT//')
 NEW_VERSION_CLEAN=$(echo "$NEW_VERSION" | sed 's/-SNAPSHOT//')
 
-#change version in all pom files (match both exact and -SNAPSHOT suffix)
+# Change version in all pom files (match both exact and -SNAPSHOT suffix).
 find . -name 'pom.xml' -type f -exec perl -pi -e 
's#<version>'$OLD_VERSION'(-SNAPSHOT)?</version>#<version>'$NEW_VERSION'</version>#'
 {} \;
 
-#change version in Cargo.toml files
-find . -name 'Cargo.toml' -not -path '*/target/*' -type f -exec perl -pi -e 
's#^version = "'$OLD_VERSION'"#version = "'$NEW_VERSION_CLEAN'"#' {} \;
+# Change workspace package versions and version requirements for local
+# paimon-vindex path dependencies without touching unrelated dependencies.
+find . -name 'Cargo.toml' -not -path '*/target/*' -type f \
+       -exec perl -pi -e 's#^version = "'$OLD_VERSION_CLEAN'"#version = 
"'$NEW_VERSION_CLEAN'"#' {} \;
+find . -name 'Cargo.toml' -not -path '*/target/*' -type f \
+       -exec perl -pi -e 'if (/^paimon-vindex-/) { s#version = 
"'$OLD_VERSION_CLEAN'"#version = "'$NEW_VERSION_CLEAN'"# }' {} \;
+
+# Change the Python package version.
+perl -pi -e 's#^version = "'$OLD_VERSION_CLEAN'"#version = 
"'$NEW_VERSION_CLEAN'"#' python/pyproject.toml
 
-#change version in pyproject.toml
-perl -pi -e 's#^version = "'$OLD_VERSION'"#version = "'$NEW_VERSION_CLEAN'"#' 
python/pyproject.toml
+# Refresh workspace package versions in Cargo.lock while preserving the
+# already locked third-party dependency set, and reject inconsistent manifests.
+cargo check --workspace

Review Comment:
   Good point. I replaced `cargo check --workspace` with `cargo update 
--workspace` so the script refreshes only workspace package versions in 
`Cargo.lock` without compiling the workspace. I also added a regression 
assertion that the update does not create a Cargo `target` directory. The 
existing test still verifies manifest, path dependency, and lockfile version 
consistency.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to