2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2019 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
12 update_file_usage () {
13 echo "Usage: $0 <next_release_name> <release_name> <publish>"
15 echo " next_release_name: The next_release_name e.g Magnesium ."
16 echo " release_name: Name of the current release_name e.g sodium."
17 echo " publish: Set to true to publish"
20 while getopts :h: opts; do
34 next_release_name="$1"
35 Next_release="$(tr '[:lower:]' '[:upper:]' <<< "${next_release_name:0:1}")${next_release_name:1}" # Captilize Version Name
37 Release_version="$(tr '[:lower:]' '[:upper:]' <<< "${release_name:0:1}")${release_name:1}" # Captilize Version Name
38 release_branch=stable/"$2"
40 stable_release_str=stable-$release_name
42 ####################################
43 # Changes in the new stable branch #
44 ####################################
45 git checkout "$release_branch"
47 #Updating links in docs/conf.py
48 sed -i "s/latest/$stable_release_str/g" docs/conf.py
49 if [ "$publish" == "true" ]
52 git commit -s -m "Update docs/conf.py links from latest to $stable_release_str
53 Should be $stable_release_str on $release_branch."
57 ####################################
58 # Changes in the master branch #
59 ####################################
61 odl_release_str=odl-$release_name
62 next_odl_release_str=odl-$next_release_name
63 #change the odl-<release> linking to stable-<release> to odl-<next_release> linking to latest
64 sed -i "s/$odl_release_str/$next_odl_release_str/g;" docs/conf.py
65 sed -i "s/$stable_release_str/latest/g;" docs/conf.py
67 # Get the value of line with odl-<release> linking to stable-<release>
68 # for appending it to the line next to odl-<next_release> linking to latest
69 line_number_nr=$(sed -n "/$next_odl_release_str/=" docs/conf.py)
70 pattern=$line_number_nr"p"
71 odl_latest="sed -n $pattern docs/conf.py"
72 odl_latest_line_value=$($odl_latest)
73 append_odl_latest=$(echo "$odl_latest_line_value" | sed "s/latest/$stable_release_str/g; s/$next_release_name/$release_name/g" )
76 # sed -i "$line_number_nr'i'\
77 # $append_odl_latest" docs/conf.py
78 sed -i "$line_number_nr a $append_odl_latest" docs/conf.py
79 # Updating version in docs/conf.yaml
80 sed -i "s/$Release_version/$Next_release/g" docs/conf.yaml
81 # Updating version in docs/javadoc.rst
82 sed -i "s/$release_name/$next_release_name/g" docs/javadoc.rst
83 if [ "$publish" == "true" ]
85 git add docs/conf.py docs/conf.yaml docs/javadoc.rst
86 git commit -s -m "Update configuratiom files in master branch
88 In docs/conf.py , add odl-$next_release_name pointing to latest
89 and change odl-$release_name to point to stable-$release_name.
91 Change version from $Release_version to $Next_release.
93 Change links from $release_name to $next_release_name"