summaryrefslogtreecommitdiff
path: root/dist
blob: 9892cde7c49943d85d8860b5eb4611f533f878db (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
99
100
101
102
103
104
105
#! /usr/bin/env bash

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

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"

skip=n

while [ $# -gt 0 ]; do
  case $1 in
    -t)
      extras=
      shift
      ;;
    -s)
      skip=y
      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

if [ "$skip" != "y" ]; then

  # 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/
fi

#
#
mkdir -p build2-$v

# Can pass additional list of archives to copy.
#
function dist() # <project> [<archive>...]
{
  local p=$1; shift
  local pv=`cat $p/version`

  rm -f build2-$v/$p-$pv.*
  b "dist($p-default/)"

  local f
  local e
  for e in $* tar.gz; do
    f="$p-$pv.$e"
    cp /tmp/$f build2-$v/
    cd build2-$v
    sha256sum -b $f >$f.sha256
    cd ..
  done
  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 zip

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

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