1# Upgrade the version number of ZenLib
2
3function btask.UpgradeVersion.run () {
4
5    if [ $(b.opt.get_opt --source-path) ]; then
6        ZL_source=$(sanitize_arg $(b.opt.get_opt --source-path))
7    else
8        if [ $(b.opt.get_opt --repo-url) ]; then
9            RepoURL=$(sanitize_arg $(b.opt.get_opt --repo-url))
10        else
11            RepoURL="git://github.com/MediaArea/ZenLib/"
12        fi
13        getSource /tmp $RepoURL
14        ZL_source=/tmp/ZenLib
15    fi
16
17    echo
18    echo "Passage for version with dots..."
19    index=0
20    ZL_files[((index++))]="Project/GNU/libzen.dsc"
21    ZL_files[((index++))]="Project/GNU/libzen.spec"
22    ZL_files[((index++))]="Project/Solaris/mkpkg"
23    ZL_files[((index++))]="debian/changelog"
24    ZL_files[((index++))]="debian/control"
25    ZL_files[((index++))]="Project/GNU/Library/configure.ac"
26
27    # Replace old version by new version
28    for ZL_file in ${ZL_files[@]}
29    do
30        echo "${ZL_source}/${ZL_file}"
31        updateFile $Version_old_dot $Version_new "${ZL_source}/${ZL_file}"
32    done
33
34    echo
35    echo "Replace major/minor/patch in ${ZL_source}/Project/CMake/CMakeLists.txt"
36    updateFile "set(ZenLib_MAJOR_VERSION \"$Version_old_major\")" \
37        "set(ZenLib_MAJOR_VERSION \"$Version_new_major\")" \
38        "${ZL_source}/Project/CMake/CMakeLists.txt"
39    updateFile "set(ZenLib_MINOR_VERSION \"$Version_old_minor\")" \
40        "set(ZenLib_MINOR_VERSION \"$Version_new_minor\")" \
41        "${ZL_source}/Project/CMake/CMakeLists.txt"
42    updateFile "set(ZenLib_PATCH_VERSION \"$Version_old_patch\")" \
43        "set(ZenLib_PATCH_VERSION \"$Version_new_patch\")" \
44        "${ZL_source}/Project/CMake/CMakeLists.txt"
45
46    unset -v ZL_files index ZL_source
47}
48