ovirt-node 2.2.0 release
[ovirt-node.git] / autobuild.sh
blob28981938e6069bc6e20441ae5ff92188150fa9dc
1 #!/bin/sh
2 #oVirt node autobuild script
4 # Copyright (C) 2008 Red Hat, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; version 2 of the License.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 # MA 02110-1301, USA. A copy of the GNU General Public License is
19 # also available at http://www.gnu.org/copyleft/gpl.html.
21 echo "Running oVirt Node Autobuild"
23 set -e
24 set -v
26 if grep -q "DISTCVS Specfile" ovirt-node.spec; then
27 cp ovirt-node.spec distcvs.ovirt-node.spec
30 test -f Makefile && make -k distclean || :
32 OVIRT_CACHE_DIR=${AUTOBUILD_SOURCE_ROOT}/../ovirt-cache
33 OVIRT_LOCAL_REPO=file://${AUTOBUILD_PACKAGE_ROOT}/rpm/RPMS
34 export OVIRT_LOCAL_REPO OVIRT_CACHE_DIR
36 ./autogen.sh --prefix=$AUTOBUILD_INSTALL_ROOT --with-image-minimizer
37 make
38 make install
40 if [ -e distcvs.ovirt-node.spec ]; then
41 mv distcvs.ovirt-node.spec ovirt-node.spec
44 rm -f *.tar.gz
45 make dist
47 if [ -f /usr/bin/rpmbuild ]; then
48 if [ -n "$AUTOBUILD_COUNTER" ]; then
49 EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER"
50 else
51 NOW=`date +"%s"`
52 EXTRA_RELEASE=".$USER$NOW"
54 rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz
57 # regenerate repo so iso uses new ovirt-node rpms
58 createrepo -d ${AUTOBUILD_PACKAGE_ROOT}/rpm/RPMS
60 cd recipe
61 make ovirt-node-image.iso
63 if ! ls *.iso 2>/dev/null >/dev/null; then
64 echo "ISO not created"
65 exit 1
69 #copy iso back to main directory for autotest.sh
70 ln -nf *iso .. ||:
72 #Don't error out if this doesn't work.
73 set +e
74 TMPDIR=$(mktemp -d)
75 sudo mount -o loop *iso $TMPDIR
76 cp $TMPDIR/isolinux/manifest-srpm.txt ..
77 cp $TMPDIR/isolinux/manifest-rpm.txt ..
78 cp $TMPDIR/isolinux/manifest-file.txt.bz2 ..
79 sudo umount $TMPDIR
80 rmdir $TMPDIR
82 cd ..
83 echo "======================================================" > ovirt-node-image.mini-manifest
84 echo "Package info in ovirt-node-image.iso" >> ovirt-node-image.mini-manifest
85 echo "======================================================" >> ovirt-node-image.mini-manifest
86 egrep '^kernel|kvm|^ovirt-node|libvirt' manifest-srpm.txt | \
87 sed 's/\.src\.rpm//' >> ovirt-node-image.mini-manifest
89 # Add additional information to mini-manifest
90 # Check size of iso and report in mini-manifest
91 echo "======================================================" >> ovirt-node-image.mini-manifest
92 size=$(ls -l ovirt-node-image.iso | awk '{print $5}')
93 human_size=$(ls -lh ovirt-node-image.iso | awk '{print $5}')
94 echo " Iso Size: $size ($human_size)" >> ovirt-node-image.mini-manifest
96 html_location=/var/www/html/builder/$(basename $(dirname ${AUTOBUILD_SOURCE_ROOT}))
97 old_size=""
98 old_human_size=""
99 if [ -e ${html_location}/artifacts/${AUTOBUILD_MODULE}/ovirt-node-image.iso ]; then
100 old_size=$(ls -l ${html_location}/artifacts/${AUTOBUILD_MODULE}/ovirt-node-image.iso | awk '{print $5}')
101 old_human_size=$(ls -lh ${html_location}/artifacts/${AUTOBUILD_MODULE}/ovirt-node-image.iso | awk '{print $5}')
102 let size_diff=(size-old_size)/1024
103 echo "Old Iso Size: $old_size ($old_human_size) delta[kB] $size_diff" >> ovirt-node-image.mini-manifest
104 else
105 echo "No old iso found for compairson">> ovirt-node-image.mini-manifest
107 # md5 and sha256sums
108 echo "MD5SUM: $(md5sum ovirt-node-image.iso |awk '{print $1}')" >> ovirt-node-image.mini-manifest
109 echo "SHA256SUM: $(sha256sum ovirt-node-image.iso |awk '{print $1}')" >> ovirt-node-image.mini-manifest
111 echo "======================================================" >> ovirt-node-image.mini-manifest
112 echo "livecd-tools version: $(rpm -qa livecd-tools)" >> ovirt-node-image.mini-manifest