]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | #!/usr/bin/env bash |
2 | # | |
3 | # Licensed to the Apache Software Foundation (ASF) under one | |
4 | # or more contributor license agreements. See the NOTICE file | |
5 | # distributed with this work for additional information | |
6 | # regarding copyright ownership. The ASF licenses this file | |
7 | # to you under the Apache License, Version 2.0 (the | |
8 | # "License"); you may not use this file except in compliance | |
9 | # with the License. You may obtain a copy of the License at | |
10 | # | |
11 | # http://www.apache.org/licenses/LICENSE-2.0 | |
12 | # | |
13 | # Unless required by applicable law or agreed to in writing, | |
14 | # software distributed under the License is distributed on an | |
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
16 | # KIND, either express or implied. See the License for the | |
17 | # specific language governing permissions and limitations | |
18 | # under the License. | |
19 | # | |
20 | set -ue | |
21 | ||
22 | SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
23 | ||
24 | if [ "$#" -ne 2 ]; then | |
25 | echo "Usage: $0 <version> <next_version>" | |
26 | exit 1 | |
27 | fi | |
28 | ||
29 | : ${BUMP_DEFAULT:=1} | |
30 | : ${BUMP_VERSION_POST_TAG:=${BUMP_DEFAULT}} | |
31 | : ${BUMP_DEB_PACKAGE_NAMES:=${BUMP_DEFAULT}} | |
32 | ||
33 | . $SOURCE_DIR/utils-prepare.sh | |
34 | ||
35 | version=$1 | |
36 | next_version=$2 | |
37 | next_version_snapshot="${next_version}-SNAPSHOT" | |
38 | ||
39 | if [ ${BUMP_VERSION_POST_TAG} -gt 0 ]; then | |
40 | echo "Updating versions for ${next_version_snapshot}" | |
41 | update_versions "${version}" "${next_version}" "snapshot" | |
42 | git commit -m "[Release] Update versions for ${next_version_snapshot}" | |
43 | fi | |
44 | ||
45 | if [ ${BUMP_DEB_PACKAGE_NAMES} -gt 0 ]; then | |
46 | echo "Updating .deb package names for ${next_version}" | |
47 | so_version() { | |
48 | local version=$1 | |
49 | local major_version=$(echo $version | sed -E -e 's/^([0-9]+)\.[0-9]+\.[0-9]+$/\1/') | |
50 | local minor_version=$(echo $version | sed -E -e 's/^[0-9]+\.([0-9]+)\.[0-9]+$/\1/') | |
51 | expr ${major_version} \* 100 + ${minor_version} | |
52 | } | |
53 | deb_lib_suffix=$(so_version $version) | |
54 | next_deb_lib_suffix=$(so_version $next_version) | |
55 | if [ "${deb_lib_suffix}" != "${next_deb_lib_suffix}" ]; then | |
56 | cd $SOURCE_DIR/../tasks/linux-packages/apache-arrow | |
57 | for target in debian*/lib*${deb_lib_suffix}.install; do | |
58 | git mv \ | |
59 | ${target} \ | |
60 | $(echo $target | sed -e "s/${deb_lib_suffix}/${next_deb_lib_suffix}/") | |
61 | done | |
62 | deb_lib_suffix_substitute_pattern="s/(lib(arrow|gandiva|parquet|plasma)[-a-z]*)${deb_lib_suffix}/\\1${next_deb_lib_suffix}/g" | |
63 | sed -i.bak -E -e "${deb_lib_suffix_substitute_pattern}" debian*/control* | |
64 | rm -f debian*/control*.bak | |
65 | git add debian*/control* | |
66 | cd - | |
67 | cd $SOURCE_DIR/../tasks/ | |
68 | sed -i.bak -E -e "${deb_lib_suffix_substitute_pattern}" tasks.yml | |
69 | rm -f tasks.yml.bak | |
70 | git add tasks.yml | |
71 | cd - | |
72 | cd $SOURCE_DIR | |
73 | sed -i.bak -E -e "${deb_lib_suffix_substitute_pattern}" rat_exclude_files.txt | |
74 | rm -f rat_exclude_files.txt.bak | |
75 | git add rat_exclude_files.txt | |
76 | git commit -m "[Release] Update .deb package names for $next_version" | |
77 | cd - | |
78 | fi | |
79 | fi |