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