diff --git a/dev/archery/archery/utils/lint.py b/dev/archery/archery/utils/lint.py index 489f741b6d0..48131856402 100644 --- a/dev/archery/archery/utils/lint.py +++ b/dev/archery/archery/utils/lint.py @@ -189,7 +189,8 @@ def python_linter(src, fix=False): "python/pyarrow/**/*.pxd", "python/pyarrow/**/*.pxi", "python/examples/**/*.py", - "dev/archery/**/*.py"] + "dev/archery/**/*.py", + "dev/release/**/*.py"] files = [setup_py] for pattern in patterns: files += list(map(str, Path(src.path).glob(pattern))) diff --git a/dev/release/01-prepare-test.rb b/dev/release/01-prepare-test.rb index cb8e688a86f..a040bc9d2a0 100644 --- a/dev/release/01-prepare-test.rb +++ b/dev/release/01-prepare-test.rb @@ -190,6 +190,21 @@ def test_version_pre_tag "+ url \"https://www.apache.org/dyn/closer.lua?path=arrow/arrow-#{@release_version}/apache-arrow-#{@release_version}.tar.gz\""], ], }, + { + path: "docs/source/_static/versions.json", + hunks: [ + [ + "- \"name\": \"#{@release_compatible_version} (dev)\",", + "+ \"name\": \"#{@next_compatible_version} (dev)\",", + "- \"name\": \"#{@previous_compatible_version} (stable)\",", + "+ \"name\": \"#{@release_compatible_version} (stable)\",", + "+ {", + "+ \"name\": \"#{@previous_compatible_version}\",", + "+ \"version\": \"#{@previous_compatible_version}/\"", + "+ },", + ] + ] + }, { path: "js/package.json", hunks: [ @@ -225,6 +240,20 @@ def test_version_pre_tag "+\# arrow #{@release_version}"], ], }, + { + path: "r/pkgdown/assets/versions.json", + hunks: [ + [ "- \"name\": \"#{@previous_version}.9000 (dev)\",", + "+ \"name\": \"#{@release_version}.9000 (dev)\",", + "- \"name\": \"#{@previous_version} (release)\",", + "+ \"name\": \"#{@release_version} (release)\",", + "+ {", + "+ \"name\": \"#{@previous_version}\",", + "+ \"version\": \"#{@previous_compatible_version}/\"", + "+ }," + ] + ] + } ] Dir.glob("java/**/pom.xml") do |path| diff --git a/dev/release/test-helper.rb b/dev/release/test-helper.rb index 61a4ae013ae..c836ac65a61 100644 --- a/dev/release/test-helper.rb +++ b/dev/release/test-helper.rb @@ -78,13 +78,16 @@ def detect_versions @snapshot_version = cpp_cmake_lists.read[/ARROW_VERSION "(.+?)"/, 1] @snapshot_major_version = @snapshot_version.split(".")[0] @release_version = @snapshot_version.gsub(/-SNAPSHOT\z/, "") + @release_compatible_version = @release_version.split(".")[0, 2].join(".") @so_version = compute_so_version(@release_version) @next_version = @release_version.gsub(/\A\d+/) {|major| major.succ} @next_major_version = @next_version.split(".")[0] + @next_compatible_version = @next_version.split(".")[0, 2].join(".") @next_snapshot_version = "#{@next_version}-SNAPSHOT" @next_so_version = compute_so_version(@next_version) r_description = top_dir + "r" + "DESCRIPTION" @previous_version = r_description.read[/^Version: (.+?)\.9000$/, 1] + @previous_compatible_version = @previous_version.split(".")[0, 2].join(".") end def compute_so_version(version) diff --git a/dev/release/utils-prepare.sh b/dev/release/utils-prepare.sh index ffb8b0df21e..297cedfec5d 100644 --- a/dev/release/utils-prepare.sh +++ b/dev/release/utils-prepare.sh @@ -155,4 +155,15 @@ update_versions() { find . -name "*.bak" -exec rm {} \; git add . popd + + case ${type} in + release) + pushd "${ARROW_DIR}" + ${PYTHON:-python3} "dev/release/utils-update-docs-versions.py" . "${version}" "${r_version}" + git add r/pkgdown/assets/versions.json + git add docs/source/_static/versions.json + popd + ;; + esac + } diff --git a/dev/release/utils-update-docs-versions.py b/dev/release/utils-update-docs-versions.py new file mode 100644 index 00000000000..7ac0e605674 --- /dev/null +++ b/dev/release/utils-update-docs-versions.py @@ -0,0 +1,68 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import json +import sys + +dir_path = sys.argv[1] +version = sys.argv[2] +r_version = sys.argv[3] + +main_versions_path = dir_path + "/docs/source/_static/versions.json" +r_versions_path = dir_path + "/r/pkgdown/assets/versions.json" + +# Update main docs version script + +with open(main_versions_path) as json_file: + old_versions = json.load(json_file) + +split_version = version.split(".") +major_minor = split_version[0] + "." + split_version[1] +dev_version = str(int(split_version[0]) + 1) + ".0" +previous_major_minor = old_versions[1]["name"].split(" ")[0] + +# Create new versions +new_versions = [ + {'name': dev_version + " (dev)", 'version': 'dev/'}, + {'name': major_minor + " (stable)", 'version': ''}, + {'name': previous_major_minor, 'version': f'{previous_major_minor}/'}, + *old_versions[2:], +] +with open(main_versions_path, 'w') as json_file: + json.dump(new_versions, json_file, indent=4) + json_file.write("\n") + +# Update R package version script + +with open(r_versions_path) as json_file: + old_r_versions = json.load(json_file) + +# update release to oldrel +old_r_versions[1]["name"] = old_r_versions[1]["name"].split(" ")[0] +old_rel_split = old_r_versions[1]["name"].split(".") +old_r_versions[1]["version"] = old_rel_split[0] + "." + old_rel_split[1] + "/" + +# update dev to release +old_r_versions[0]["name"] = r_version + " (release)" +old_r_versions[0]["version"] = "" + +# add new dev version +new_r_version = [{'name': r_version + ".9000" + " (dev)", 'version': 'dev/'}] +new_r_version.extend(old_r_versions) +with open(r_versions_path, 'w') as json_file: + json.dump(new_r_version, json_file, indent=4) + json_file.write("\n") diff --git a/docs/source/_static/versions.json b/docs/source/_static/versions.json index d364cfe2714..37bfcf24091 100644 --- a/docs/source/_static/versions.json +++ b/docs/source/_static/versions.json @@ -1,4 +1,8 @@ [ + { + "name": "7.0 (dev)", + "version": "dev/" + }, { "name": "6.0 (stable)", "version": "" @@ -23,4 +27,4 @@ "name": "1.0", "version": "1.0/" } -] \ No newline at end of file +]