[libvirt] [PATCH SNMP] Add automated build control script

Daniel P. Berrange berrange at redhat.com
Fri Feb 11 17:14:40 UTC 2011


* .gitignore: Ignore build directory
* autobuild.sh: Add automated build script
* autogen.sh: Helper for re-generating autotools files
* libvirt-snmp.spec.in: Add extra_release and remove
  substitution of mibdir since RPM path shouldn't change
  regardless of current configure args
---
 .gitignore           |    1 +
 autobuild.sh         |   42 ++++++++++++++++++++++++++++++++++++++++++
 autogen.sh           |   24 ++++++++++++++++++++++++
 libvirt-snmp.spec.in |    6 +++---
 4 files changed, 70 insertions(+), 3 deletions(-)
 create mode 100755 autobuild.sh
 create mode 100755 autogen.sh

diff --git a/.gitignore b/.gitignore
index 98613d5..ed2e9f7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
 *.orig
 *.rej
 *~
+/build
 /.git-module-status
 Makefile
 Makefile.in
diff --git a/autobuild.sh b/autobuild.sh
new file mode 100755
index 0000000..5eecb39
--- /dev/null
+++ b/autobuild.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+set -e
+set -v
+
+test -n "$1" && RESULTS=$1 || RESULTS=results.log
+: ${AUTOBUILD_INSTALL_ROOT=$HOME/builder}
+
+# Make things clean.
+test -f Makefile && make -k distclean || :
+
+rm -rf build
+mkdir build
+cd build
+
+MIBDIR=$AUTOBUILD_INSTALL_ROOT/share/snmp/mibs
+mkdir -p $MIBDIR
+
+../autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT \
+  --with-mibdir=$MIBDIR
+
+make
+make install
+
+make check | tee "$RESULTS"
+
+rm -f *.tar.gz
+make dist
+
+if [ -n "$AUTOBUILD_COUNTER" ]; then
+  EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
+else
+  NOW=`date +"%s"`
+  EXTRA_RELEASE=".$USER$NOW"
+fi
+
+if [ -f /usr/bin/rpmbuild ]; then
+  rpmbuild --nodeps \
+     --define "extra_release $EXTRA_RELEASE" \
+     --define "_sourcedir `pwd`" \
+     -ba --clean libvirt-snmp.spec
+fi
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..917e923
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+set -e
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=. 
+
+THEDIR=`pwd`
+cd $srcdir
+
+if test -z "$*"; then
+	echo "I am going to run ./configure with not arguments - if you "
+        echo "wish to pass any extra arguments to it, please specify them on "
+        echo "the $0 command line."
+fi
+
+autoreconf -i -f
+
+cd $THEDIR
+
+$srcdir/configure "$@" && {
+    echo 
+    echo "Now type 'make' to compile libvirt-snmp."
+}
diff --git a/libvirt-snmp.spec.in b/libvirt-snmp.spec.in
index 7ec8a3f..6082a7a 100644
--- a/libvirt-snmp.spec.in
+++ b/libvirt-snmp.spec.in
@@ -1,6 +1,6 @@
 Name:		libvirt-snmp
 Version:	@VERSION@
-Release:	1%{?dist}
+Release:	1%{?dist}%{?extra_release}
 Summary:	SNMP functionality for libvirt
 
 Group:		Development/Libraries
@@ -36,8 +36,8 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root,-)
 %{_bindir}/libvirtMib_subagent
- at MIB_DIR@/LIBVIRT-MIB.txt
-%doc
+%{_datadir}/snmp/mibs/LIBVIRT-MIB.txt
+%doc README NEWS ChangeLog AUTHORS
 
 
 
-- 
1.7.4




More information about the libvir-list mailing list