Radek Krejci | 4a2c755 | 2016-02-22 15:09:35 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | ABI_MON=abi-monitor |
| 3 | ABI_TRK=abi-tracker |
| 4 | |
| 5 | which $ABI_MON > /dev/null || exit 1 |
| 6 | which $ABI_TRK > /dev/null || exit 1 |
| 7 | |
| 8 | if test -n "$2"; then |
| 9 | VER1="$1" |
| 10 | VER2="$2" |
| 11 | elif test -n "$1"; then |
| 12 | if test "$1" = "help" -o "$1" = "-h" -o "$1" = "--help"; then |
| 13 | echo Usage: |
| 14 | echo \t$0 [number of last versions] |
| 15 | echo \t$0 [version1] [version2] |
| 16 | exit 0 |
| 17 | fi |
| 18 | LIMIT="-limit $1" |
| 19 | l=$1 |
| 20 | fi |
| 21 | |
| 22 | if [ -e gitrepo ]; then |
| 23 | cd gitrepo |
| 24 | git pull |
| 25 | cd - |
| 26 | else |
| 27 | git clone https://github.com/CESNET/libnetconf2.git gitrepo |
| 28 | fi |
| 29 | test -e packages || mkdir packages |
| 30 | test -e src/libnetconf2 || mkdir -p src/libnetconf2 |
| 31 | rm -rf src/libnetconf2/* |
| 32 | |
| 33 | cd gitrepo |
| 34 | git checkout devel |
| 35 | VERSIONS=`git log --grep=VERSION --oneline | sed 's/ .* /_/'` |
| 36 | cd - |
| 37 | for i in $VERSIONS; do |
| 38 | if test "$l" = "0"; then |
| 39 | rm -rf abi_dump/libnetconf2/${i//*_} |
| 40 | rm -rf installed/libnetconf2/${i//*_} |
| 41 | else |
| 42 | test -n "$l" && l=$(($l-1)) |
| 43 | if test -n "$VER1"; then |
| 44 | if test "$VER1" != "${i//*_}" -a "$VER2" != "${i//*_}"; then |
| 45 | rm -rf abi_dump/libnetconf2/${i//*_} |
| 46 | rm -rf installed/libnetconf2/${i//*_} |
| 47 | continue |
| 48 | fi |
| 49 | fi |
| 50 | if test ! -f packages/libnetconf2-${i//*_}.tgz; then |
| 51 | cd gitrepo |
| 52 | git checkout ${i//_*} |
| 53 | cd - |
| 54 | tar -czf packages/libnetconf2-${i//*_}.tgz gitrepo |
| 55 | fi |
| 56 | cp packages/libnetconf2-${i//*_}.tgz src/libnetconf2/ |
| 57 | fi |
| 58 | done |
| 59 | |
| 60 | cp libnetconf2.json libnetconf2.aux |
| 61 | abi-monitor -get -build $LIMIT libnetconf2.aux |
| 62 | abi-tracker -build libnetconf2.aux |
| 63 | rm -rf libnetconf2.aux |
| 64 | |