summaryrefslogtreecommitdiff
path: root/version
blob: bc8b00044765cdbfce53e989cd79214b3e6f0ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /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-<module>?
#
build2_min=0.14.0-
bpkg_min=0.14.0-

ver=0.15.0-a.0.z
#ver=0.15.0
mods=(libstd-modules libbutl libbutl.bash libbpkg libbbot bpkg bpkg-util build2)

odb_ver=2.5.0-b.22.z
#odb_ver=2.5.0-b.23
odb_mods=(libodb libodb-sqlite libodb-pgsql)

#xml_ver=1.1.0-b.10.z
xml_ver=1.1.0-b.10
xml_mods=(libstudxml)

# !!! NOTE: libpkg-config version constraint in build2 is updated manually.
# !!! NOTE: libcmark version constraint in brep is updated manually.
# !!! NOTE: libsqlite3 version in bpkg.

all=(libstd-modules 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 () # <ver>
{
  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