summaryrefslogtreecommitdiff
path: root/dist
blob: 56e24daa09ee6fa0bd0f5688d13cc0fec56e0abd (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
#! /usr/bin/env bash

# Prepare build2 distribution.
#
# Usage: dist [-t]
#
# -t
#    Toolchain only.
#
usage="usage: $0 [-t]"

owd=`pwd`
trap "{ cd $owd; exit 1; }" ERR
set -o errtrace # Trap in functions.

function info () { echo "$*" 1>&2; }
function error () { info "$*"; exit 1; }

toolchain="libbutl build2 libbpkg bpkg"
extras="brep"

while [ $# -gt 0 ]; do
  case $1 in
    -t)
      extras=
      shift
      ;;
    *)
      error "unexpected $1"
      ;;
  esac
done

tools="$toolchain $extras"

v=`sed -e 's/^\(.*\)\.\(.*\)\..*$/\1.\2/' build2-toolchain/version`

if [ -z "$v" ]; then
  error "unable to extract version from `cat build2-toolchain/version`"
fi

# Check that everything is committed and pushed.
#
info "checking repositories..."
for t in $tools build2-toolchain; do
  git/check --master --clean --synced --submodule $t
done

# Update the development build since we use it to dist/package.
#
info "making sure everythings is up to date..."
b build2/ bpkg/

#
#
mkdir -p build2-$v

function dist()
{
  local p=$1; shift
  local pv=`cat $p/version`
  local f="$p-$pv.tar.gz"
  b "dist($p-default/)"
  rm -f build2-$v/$p-$pv.*
  cp /tmp/$f build2-$v/
  cd build2-$v
  sha256sum -b $f >$f.sha256
  cd ..
  echo build2-$v/$f
}

for t in $tools; do
  f=`dist $t`
  mkdir -p cppget.org/repository/1/queue/$t
  cp $f cppget.org/repository/1/queue/$t/
done

dist build2-toolchain

# Regenerate repository manifests.
#
cppget.org/update cppget.org/repository/1/queue

cd $owd
info "distribution in build2-$v/"