Merge "Fix: JAVA_HOME directory detection"
authorAnil Belur <abelur@linuxfoundation.org>
Fri, 16 Sep 2022 12:20:48 +0000 (12:20 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Fri, 16 Sep 2022 12:20:48 +0000 (12:20 +0000)
jenkins-init-scripts/lf-env.sh
releasenotes/notes/submodule-update-9bd82d3c05ec4148.yaml [new file with mode: 0644]
shell/gerrit-push-patch.sh

index bd9f780..91aa80c 100644 (file)
@@ -227,12 +227,16 @@ lf-activate-venv () {
         #     1. --venv-file <path/to/file> as lf_venv
         #     2. default: "/tmp/.os_lf_venv"
         # - Create new venv when 1. and 2. is absent
-        if [ -f "$venv_file" ]; then
+        if [[ -f "$venv_file" ]]; then
             lf_venv=$(cat "$venv_file")
             echo "${FUNCNAME[0]}(): INFO: Reuse venv:$lf_venv from" \
                 "file:$venv_file"
-        elif [ ! -f "$venv_file" ]; then
-            $python -m venv "$install_args" "$lf_venv" || return 1
+        elif [[ ! -f "$venv_file" ]]; then
+            if [[ -n "$install_args" ]]; then
+                $python -m venv "$install_args" "$lf_venv" || return 1
+            else
+                $python -m venv "$lf_venv" || return 1
+            fi
             echo "${FUNCNAME[0]}(): INFO: Creating $python venv at $lf_venv"
             echo "$lf_venv" > "$venv_file"
             echo "${FUNCNAME[0]}(): INFO: Save venv in file: $venv_file"
diff --git a/releasenotes/notes/submodule-update-9bd82d3c05ec4148.yaml b/releasenotes/notes/submodule-update-9bd82d3c05ec4148.yaml
new file mode 100644 (file)
index 0000000..2a430eb
--- /dev/null
@@ -0,0 +1,19 @@
+---
+issues:
+  - |
+    git-review tries to copy commit-msg hook to submodules with incorrect
+    source file path (.git/hooks/commit-msg) and fails - the path should
+    be ../.git/hooks/commit-msg if a relative path is used since the copy
+    command is run in the submodule directory
+  - |
+    lf-activate-venv creates a virtual environment in the current working
+    directory where lf-activate-venv is run. This clutters the repository
+    and all the files for the virtual environment are added for update.
+
+fixes:
+  - |
+    Set 'core.hooksPath' with the absolute path of the top-level hooks directory
+    so that the correct source path can be used regardless of the working directory.
+  - |
+    Use the correct command depending on the $install_args value to avoid
+    creating an additional virtual environment in the current working directory.
index a1d67e6..09453f4 100644 (file)
@@ -75,4 +75,7 @@ git remote add gerrit "ssh://$GERRIT_USER@$GERRIT_HOST:29418/$PROJECT.git"
 # If the reviewers email is unset/empty then use a default
 reviewers_email=${REVIEWERS_EMAIL:-"$GERRIT_USER@$GERRIT_HOST"}
 
+# Workaround for git-review failing to copy the commit-msg hook to submodules
+git config core.hooksPath "$(git rev-parse --show-toplevel)/.git/hooks"
+
 git review --yes -t "$GERRIT_TOPIC" --reviewers "$reviewers_email"