Thomas Vachuska | 692dcb0 | 2017-03-15 09:13:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Patches lib/BUCK file to use locally built YANG tools. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
Ray Milkey | 86d1b0a | 2017-05-16 15:15:08 -0700 | [diff] [blame^] | 6 | BVER=2.1 |
| 7 | SVER=2.2-SNAPSHOT |
Thomas Vachuska | 692dcb0 | 2017-03-15 09:13:50 -0700 | [diff] [blame] | 8 | |
| 9 | YANG_TOOLS_ROOT=~/onos-yang-tools |
| 10 | |
| 11 | rm -f $ONOS_ROOT/lib/yang/* 2>/dev/null |
| 12 | mkdir -p $ONOS_ROOT/lib/yang |
| 13 | |
| 14 | awk ' |
| 15 | BEGIN { m = 0; y = 0; } |
| 16 | /^(remote_jar|prebuilt_jar)/ { s = $0; m = 1; next; } |
| 17 | { if (m) { s = s "\n" $0; } else { print $0; } } |
| 18 | /onos-yang-.*('$BVER'|'$SVER')/ { y = 1; } |
| 19 | /^\)/ { if (m && !y) { print s; } y = 0; m = 0; } |
| 20 | ' $ONOS_ROOT/lib/BUCK > /tmp/BUCK |
| 21 | mv /tmp/BUCK $ONOS_ROOT/lib/BUCK |
| 22 | |
| 23 | for yl in $(egrep "onos-yang-.*$BVER" $ONOS_ROOT/lib/deps.json); do |
| 24 | n=$(echo $yl | cut -d\" -f2) |
| 25 | m=$(echo $yl | cut -d\" -f4) |
| 26 | j=$(find $YANG_TOOLS_ROOT -name $n-$SVER.jar) |
| 27 | s=yang/$(basename $j) |
| 28 | cp $j $ONOS_ROOT/lib/$s |
| 29 | |
| 30 | # echo $n, $m, $j |
| 31 | |
| 32 | cat <<EOF >>$ONOS_ROOT/lib/BUCK |
| 33 | prebuilt_jar ( |
| 34 | name = '$n', |
| 35 | binary_jar = '$s', |
| 36 | maven_coords = '${m#mvn:*}', |
| 37 | visibility = [ 'PUBLIC' ], |
| 38 | ) |
| 39 | |
| 40 | EOF |
| 41 | done |