1#!/bin/bash 2 3# toplevel rsync destination for www targets (without trailing slash) 4: ${RSYNC_DEST:=root@www.clusterlabs.org:/var/www/html} 5 6UPLOAD=0 7if [ $1 = "-u" ]; then 8 UPLOAD=1; shift 9fi 10 11PACKAGE=$1; shift 12 13function tag() { 14 if [[ $1 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} ]]; then 15 echo Pacemaker-$1 16 else 17 echo $1 18 fi 19} 20 21function version() { 22 echo $1 | sed s:.*-:: 23} 24 25function extract() { 26 27 DUMP=1 28 TAG=$1 29 VERSION=$2 30 31 if [ $VERSION = HEAD ]; then 32 rm -rf abi_dumps/$PACKAGE/${PACKAGE}_$VERSION.abi.tar.gz 33 34 elif [ -f abi_dumps/$PACKAGE/${PACKAGE}_$VERSION.abi.tar.gz ]; then 35 return 36 fi 37 38 echo "Building ABI dump for $*" 39 BUILD_ROOT=.ABI-build 40 41 rm -rf $BUILD_ROOT 42 git archive --prefix $BUILD_ROOT/ $TAG | tar xv 43 44 BUILD_ROOT=`pwd`/$BUILD_ROOT 45 DESC=$BUILD_ROOT/$VERSION.xml 46 47 sed -i.sed 's: doc::' $BUILD_ROOT/Makefile.am 48 sed -i.sed 's: debian::' $BUILD_ROOT/Makefile.am 49 50 cat<<EOF>$DESC 51<?xml version="1.0" encoding="utf-8"?> 52<descriptor> 53<version> 54 $VERSION 55</version> 56<headers> 57 $BUILD_ROOT/root/usr/include/pacemaker/crm 58</headers> 59<libs> 60EOF 61 62 ( cd $BUILD_ROOT && ./autogen.sh ) 63 ( cd $BUILD_ROOT && ./configure --disable-fatal-warnings ) 64 make -C $BUILD_ROOT V=0 DESTDIR=${BUILD_ROOT}/root install 65 if [ $? != 0 ]; then 66 echo "Build for $TAG failed. Repair, populate <libs/> and re-run: " 67 echo " abi-compliance-checker -l $PACKAGE -dump_abi $DESC" 68 echo "" 69 echo "To find libraries after building:" 70 echo " find $BUILD_ROOT/root -name "*.so" -print" 71 72 else 73 find $BUILD_ROOT/root -name "*.so" -print >> $DESC 74 fi 75 76 cat<<EOF>>$DESC 77</libs> 78</descriptor> 79EOF 80 81 if [ $DUMP = 1 ]; then 82 abi-compliance-checker -l $PACKAGE -dump_abi $DESC 83 rm -rf $BUILD_ROOT 84 else 85 exit 1 86 fi 87} 88 89for arg in $*; do 90 T=`tag $arg` 91 V=`version $T` 92 extract $T $V 93done 94 95if [ $# = 2 ]; then 96 V1=`version $1` 97 V2=`version $2` 98 99 abi-compliance-checker -l ${PACKAGE} \ 100 -d1 abi_dumps/${PACKAGE}/${PACKAGE}_${V1}.abi.tar.gz \ 101 -d2 abi_dumps/${PACKAGE}/${PACKAGE}_${V2}.abi.tar.gz 102 103 if [ $UPLOAD = 1 -a -d compat_reports/pacemaker/${V1}_to_${V2} ]; then 104 rsync -azxlSD --progress compat_reports/pacemaker/${V1}_to_${V2} ${RSYNC_DEST}/${PACKAGE}/abi/ 105 fi 106fi 107