1# Upgrade the version number of MediaInfoLib
2
3function btask.UpgradeVersion.run () {
4
5    if [ $(b.opt.get_opt --source-path) ]; then
6        MIL_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/MediaInfoLib/"
12        fi
13        getSource /tmp $RepoURL
14        MIL_source=/tmp/MediaInfoLib
15    fi
16
17    echo
18    echo "Passage for version with dots..."
19    index=0
20    MIL_files[((index++))]="Source/MediaInfo/MediaInfo_Config.cpp"
21    MIL_files[((index++))]="Project/GNU/libmediainfo.dsc"
22    MIL_files[((index++))]="Project/GNU/libmediainfo.spec"
23    MIL_files[((index++))]="Project/Solaris/mkpkg"
24    MIL_files[((index++))]="debian/changelog"
25    MIL_files[((index++))]="debian/control"
26    MIL_files[((index++))]="Project/GNU/Library/configure.ac"
27    MIL_files[((index++))]="Source/Install/MediaInfo_DLL_Windows_i386.nsi"
28    MIL_files[((index++))]="Source/Install/MediaInfo_DLL_Windows_x64.nsi"
29    MIL_files[((index++))]="Project/MSVC2005/DLL/MediaInfo.rc"
30    MIL_files[((index++))]="Project/MSVC2012/Dll/MediaInfo.rc"
31    MIL_files[((index++))]="Project/MSVC2012/Example/HowToUse.rc"
32    MIL_files[((index++))]="Project/MSVC2012/ShellExtension/MediaInfoShellExt.rc"
33    MIL_files[((index++))]="Project/MSVC2010/Dll/MediaInfo.rc"
34    MIL_files[((index++))]="Project/MSVC2010/Example/HowToUse.rc"
35    MIL_files[((index++))]="Project/MSVC2010/ShellExtension/MediaInfoShellExt.rc"
36    MIL_files[((index++))]="Project/MSVC2008/Dll/MediaInfo.rc"
37    MIL_files[((index++))]="Project/MSVC2008/Example/HowToUse.rc"
38    MIL_files[((index++))]="Project/MSVC2008/ShellExtension/MediaInfoShellExt.rc"
39    MIL_files[((index++))]="Project/MSVC2013/Dll/MediaInfo.rc"
40    MIL_files[((index++))]="Project/MSVC2013/Example/HowToUse.rc"
41    MIL_files[((index++))]="Project/MSVC2013/ShellExtension/MediaInfoShellExt.rc"
42
43    # Replace old version by new version
44    for MIL_file in ${MIL_files[@]}
45    do
46        echo "${MIL_source}/${MIL_file}"
47        updateFile $Version_old_dot $Version_new "${MIL_source}/${MIL_file}"
48    done
49    unset -v MIL_files
50
51    echo
52    echo "Passage for version with commas..."
53    index=0
54    MIL_files[((index++))]="Project/MSVC2005/DLL/MediaInfo.rc"
55    MIL_files[((index++))]="Project/MSVC2012/Dll/MediaInfo.rc"
56    MIL_files[((index++))]="Project/MSVC2012/Example/HowToUse.rc"
57    MIL_files[((index++))]="Project/MSVC2012/ShellExtension/MediaInfoShellExt.rc"
58    MIL_files[((index++))]="Project/MSVC2010/Dll/MediaInfo.rc"
59    MIL_files[((index++))]="Project/MSVC2010/Example/HowToUse.rc"
60    MIL_files[((index++))]="Project/MSVC2010/ShellExtension/MediaInfoShellExt.rc"
61    MIL_files[((index++))]="Project/MSVC2008/Dll/MediaInfo.rc"
62    MIL_files[((index++))]="Project/MSVC2008/Example/HowToUse.rc"
63    MIL_files[((index++))]="Project/MSVC2008/ShellExtension/MediaInfoShellExt.rc"
64    MIL_files[((index++))]="Project/MSVC2013/Dll/MediaInfo.rc"
65    MIL_files[((index++))]="Project/MSVC2013/Example/HowToUse.rc"
66    MIL_files[((index++))]="Project/MSVC2013/ShellExtension/MediaInfoShellExt.rc"
67
68    # Replace old version by new version
69    for MIL_file in ${MIL_files[@]}
70    do
71        echo "${MIL_source}/${MIL_file}"
72        updateFile $Version_old_comma $Version_new_comma "${MIL_source}/${MIL_file}"
73    done
74
75    echo
76    echo "Replace major/minor/patch in ${MIL_source}/Project/CMake/CMakeLists.txt"
77    updateFile "set(MediaInfoLib_MAJOR_VERSION $Version_old_major)" \
78        "set(MediaInfoLib_MAJOR_VERSION $Version_new_major)" \
79        "${MIL_source}/Project/CMake/CMakeLists.txt"
80    updateFile "set(MediaInfoLib_MINOR_VERSION $Version_old_minor)" \
81        "set(MediaInfoLib_MINOR_VERSION $Version_new_minor)" \
82        "${MIL_source}/Project/CMake/CMakeLists.txt"
83    updateFile "set(MediaInfoLib_PATCH_VERSION $Version_old_patch)" \
84        "set(MediaInfoLib_PATCH_VERSION $Version_new_patch)" \
85        "${MIL_source}/Project/CMake/CMakeLists.txt"
86
87    unset -v MIL_files index MIL_source
88}
89