You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ra...@apache.org on 2023/06/15 09:51:02 UTC

[arrow] branch main updated: GH-36082: [Release] Do nothing deb bump minor/patch version by post-11-bump-versions.sh on main (#36083)

This is an automated email from the ASF dual-hosted git repository.

raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 95972cca1f GH-36082: [Release] Do nothing deb bump minor/patch version by post-11-bump-versions.sh on main (#36083)
95972cca1f is described below

commit 95972cca1f65179b63a9fe5262d1092547e3d137
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Thu Jun 15 18:50:56 2023 +0900

    GH-36082: [Release] Do nothing deb bump minor/patch version by post-11-bump-versions.sh on main (#36083)
    
    ### Rationale for this change
    
    It's needed on a maintenance branch but not needed on main.
    
    ### What changes are included in this PR?
    
    Add the current branch check whether main or not.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    No.
    * Closes: #36082
    
    Authored-by: Sutou Kouhei <ko...@clear-code.com>
    Signed-off-by: Raúl Cumplido <ra...@gmail.com>
---
 dev/release/post-11-bump-versions-test.rb | 67 +++++++++++++++++++++----------
 dev/release/post-11-bump-versions.sh      |  7 +++-
 2 files changed, 52 insertions(+), 22 deletions(-)

diff --git a/dev/release/post-11-bump-versions-test.rb b/dev/release/post-11-bump-versions-test.rb
index b030323531..79d17e84eb 100644
--- a/dev/release/post-11-bump-versions-test.rb
+++ b/dev/release/post-11-bump-versions-test.rb
@@ -38,6 +38,10 @@ class PostBumpVersionsTest < Test::Unit::TestCase
     end
   end
 
+  def bump_type
+    (data || {})[:bump_type]
+  end
+
   def bump_versions(*targets)
     if targets.last.is_a?(Hash)
       additional_env = targets.pop
@@ -49,10 +53,25 @@ class PostBumpVersionsTest < Test::Unit::TestCase
       env["BUMP_#{target}"] = "1"
     end
     env = env.merge(additional_env)
-    sh(env,
-       "dev/release/post-11-bump-versions.sh",
-       @release_version,
-       @next_version)
+    case bump_type
+    when :minor_on_main, :patch_on_main
+      previous_version_components = @previous_version.split(".")
+      case bump_type
+      when :minor_on_main
+        previous_version_components[1].succ!
+      when :patch_on_main
+        previous_version_components[2].succ!
+      end
+      sh(env,
+         "dev/release/post-11-bump-versions.sh",
+         previous_version_components.join("."),
+         @release_version)
+    else
+      sh(env,
+         "dev/release/post-11-bump-versions.sh",
+         @release_version,
+         @next_version)
+    end
   end
 
   data(:release_type, [:major, :minor, :patch])
@@ -295,9 +314,11 @@ class PostBumpVersionsTest < Test::Unit::TestCase
                  "Output:\n#{stdout}")
   end
 
+  data(:bump_type, [nil, :minor_on_main, :patch_on_main])
   def test_deb_package_names
+    current_commit = git_current_commit
     stdout = bump_versions("DEB_PACKAGE_NAMES")
-    changes = parse_patch(git("log", "-n", "1", "-p"))
+    changes = parse_patch(git("log", "-p", "#{current_commit}.."))
     sampled_changes = changes.collect do |change|
       first_hunk = change[:hunks][0]
       first_removed_line = first_hunk.find { |line| line.start_with?("-") }
@@ -307,22 +328,26 @@ class PostBumpVersionsTest < Test::Unit::TestCase
         path: change[:path],
       }
     end
-    expected_changes = [
-      {
-        sampled_diff: [
-          "-Package: libarrow#{@so_version}",
-          "+Package: libarrow#{@next_so_version}",
-        ],
-        path: "dev/tasks/linux-packages/apache-arrow/debian/control.in",
-      },
-      {
-        sampled_diff: [
-          "-      - libarrow-acero#{@so_version}-dbgsym_{no_rc_version}-1_[a-z0-9]+.d?deb",
-          "+      - libarrow-acero#{@next_so_version}-dbgsym_{no_rc_version}-1_[a-z0-9]+.d?deb",
-        ],
-        path: "dev/tasks/tasks.yml",
-      },
-    ]
+    if bump_type.nil?
+      expected_changes = [
+        {
+          sampled_diff: [
+            "-Package: libarrow#{@so_version}",
+            "+Package: libarrow#{@next_so_version}",
+          ],
+          path: "dev/tasks/linux-packages/apache-arrow/debian/control.in",
+        },
+        {
+          sampled_diff: [
+            "-      - libarrow-acero#{@so_version}-dbgsym_{no_rc_version}-1_[a-z0-9]+.d?deb",
+            "+      - libarrow-acero#{@next_so_version}-dbgsym_{no_rc_version}-1_[a-z0-9]+.d?deb",
+          ],
+          path: "dev/tasks/tasks.yml",
+        },
+      ]
+    else
+      expected_changes = []
+    end
     assert_equal(expected_changes, sampled_changes, "Output:\n#{stdout}")
   end
 
diff --git a/dev/release/post-11-bump-versions.sh b/dev/release/post-11-bump-versions.sh
index 4d263cbfd5..93eb15e092 100755
--- a/dev/release/post-11-bump-versions.sh
+++ b/dev/release/post-11-bump-versions.sh
@@ -41,6 +41,10 @@ version=$1
 next_version=$2
 next_version_snapshot="${next_version}-SNAPSHOT"
 
+current_version=$(grep ARROW_VERSION "${SOURCE_DIR}/../../cpp/CMakeLists.txt" | \
+                    head -n1 | \
+                    grep -E -o '([0-9]+\.[0-9]+\.[0-9]+)')
+
 case "${version}" in
   *.0.0)
     is_major_release=1
@@ -63,7 +67,8 @@ if [ ${BUMP_VERSION_POST_TAG} -gt 0 ]; then
   git commit -m "MINOR: [Release] Update versions for ${next_version_snapshot}"
 fi
 
-if [ ${BUMP_DEB_PACKAGE_NAMES} -gt 0 ]; then
+if [ ${BUMP_DEB_PACKAGE_NAMES} -gt 0 ] && \
+     [ "${next_version}" != "${current_version}" ]; then
   echo "Updating .deb package names for ${next_version}"
   so_version() {
     local version=$1