#! /usr/bin/env bash # Manage build2 toolchain version. # # Usage: etc/version # usage="usage: etc/version" # No max, always >=. # # NOTE: also update in 'bdep new'? # NOTE: also update in libbuild2-? # NOTE: if upgrade is supported, should be previous release version. # build2_min=0.16.0 bpkg_min=0.16.0 ver=0.18.0-a.0.z #ver=0.17.0 mods=(libbutl libbutl.bash libbpkg libbbot bpkg bpkg-util build2) #odb_ver=2.5.0-b.28.z odb_ver=2.5.0-b.27 odb_mods=(libodb libodb-pgsql) # Note: now only in brep. #xml_ver=1.1.0-b.10.z xml_ver=1.1.0-b.10 xml_mods=(libstudxml) # !!! NOTE: libcmark version constraint in brep is updated manually. all=(libbutl libbutl.bash build2 libbpkg bpkg bpkg-util bdep bdep-util libbbot bbot brep build2-toolchain msvc-linux openssl-agent buildos) # In manifests for alpha/beta we use an exact match. For snapshots -- snapshot # range. Otherwise an X.Y.* range. # function constraint () # { local mj mn pt ab pr r mj="$(echo "$1" | sed -re 's/([^.]+)\..*/\1/')" mn="$(echo "$1" | sed -re 's/[^.]+\.([^.]+)\..*/\1/')" pt="$(echo "$1" | sed -re 's/[^.]+\.[^.]+\.([^.-]+).*/\1/')" ab="$(echo "$1" | sed -n -re 's/[^.]+\.[^.]+\.[^.-]+-([ab]).*/\1/p')" pr="$(echo "$1" | sed -n -re 's/[^.]+\.[^.]+\.[^.-]+-[ab]\.([^.+]+).*/\1/p')" if [ -n "$ab" ]; then if [[ $1 == *.z ]]; then r="[$mj.$mn.$pt-$ab.$pr.1 $mj.$mn.$pt-$ab.$(($pr+1)))" else r="^$1" fi else #r="[$mj.$mn.0 $mj.$(($mn+1)).0-); $mj.$mn.X" r="^$mj.$mn.$pt" fi echo "$r" } dep="$(constraint "$ver")" odb_dep="$(constraint "$odb_ver")" xml_dep="$(constraint "$xml_ver")" function process () # { # Manifest. # sed -i -re "s/^(version:).*/\1 $ver/" manifest sed -i -re "s/^(depends: \* build2) .*/\1 >= $build2_min/" manifest sed -i -re "s/^(depends: \* bpkg) .*/\1 >= $bpkg_min/" manifest local m for m in "${mods[@]}"; do sed -i -re "s/^(depends: $m) .*/\1 $dep/" manifest done for m in "${odb_mods[@]}"; do sed -i -re "s/^(depends: $m) .*/\1 $odb_dep/" manifest done for m in "${xml_mods[@]}"; do sed -i -re "s/^(depends: $m) .*/\1 $xml_dep/" manifest done # cli.sh # if [ -f doc/cli.sh ]; then sed -i -re "s/^version=.*/version=$ver/" doc/cli.sh fi } for m in "${all[@]}"; do cd "$m" process cd .. done