summaryrefslogtreecommitdiff
path: root/scripts/bundle-otp
blob: ce5bc4757222050b7826a3a0ea57cfabb350a5d1 (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
#!/bin/bash

set -e

GIT_TAG="$1"
ERL_TOP=${ERL_TOP:-$PWD}

OTP_META_FILE=$ERL_TOP/artifacts/${GIT_TAG}.0-bundle.txt
OTP_FILE=$ERL_TOP/artifacts/${GIT_TAG}.0-bundle.tar.gz

REPOSITORIES="otp,$GIT_TAG corba,.*"

if [ ! -d $ERL_TOP/artifacts ]; then
    mkdir $ERL_TOP/artifacts
fi

mkdir bundle

## Turn off * expansion, needed for the .* regexp to work
set -f

for repo in $REPOSITORIES; do
    OLD_IFS=$IFS
    IFS=','
    set -- $repo
    IFS=$OLD_IFS
    cd $ERL_TOP/bundle/
    git clone https://github.com/erlang/$1 $1
    cd $1
    echo $1 $2
    TAG=`git tag -l | grep -P "^$2$" | sort -V | tail -1`
    git checkout $TAG
    SHA=`git rev-parse --verify HEAD`
    rm -rf .git
    echo "$1 $TAG $SHA" >> $OTP_META_FILE
done

## Turn on * expansion
set +f

cd $ERL_TOP/bundle/
tar czf $OTP_FILE *

exit 0