summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-10-12 13:17:01 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-10-12 13:17:01 -0400
commitfd4dbf1c1138b06e7f6a2a3d53a20837cd6c2437 (patch)
tree1f60eab09a10ab38a19ce9831ea9494a94addbbe
parent8b43028bf74afde117219b11a835b0e274fe6830 (diff)
downloadbuild_tools-fd4dbf1c1138b06e7f6a2a3d53a20837cd6c2437.zip
build_tools-fd4dbf1c1138b06e7f6a2a3d53a20837cd6c2437.tar.gz
build_tools-fd4dbf1c1138b06e7f6a2a3d53a20837cd6c2437.tar.xz
Support scratch builds
-rwxr-xr-xsssd-nightly.sh127
1 files changed, 77 insertions, 50 deletions
diff --git a/sssd-nightly.sh b/sssd-nightly.sh
index c2c4c8f..5e64b90 100755
--- a/sssd-nightly.sh
+++ b/sssd-nightly.sh
@@ -1,4 +1,8 @@
+#!/bin/bash
+
function finish { #(exit code)
+ rm -f /local/sgallagh/.sssd-build.lock
+
if [ x$scratch_build != x ]; then
exit $1
fi
@@ -15,6 +19,12 @@ function finish { #(exit code)
exit $1
}
+if [ -e "/local/sgallagh/.sssd-build.lock" ]; then
+ exit -1
+fi
+
+touch /local/sgallagh/.sssd-build.lock
+
mkdir -p /local/sgallagh/logs
cd /local/sgallagh
nextversion=$1
@@ -26,12 +36,20 @@ today=`date +%Y%m%d`
git_repo=$2
if [ x$git_repo == x ]; then
git_repo=git://git.fedorahosted.org/sssd.git
+ repodir=/local/sgallagh/repos
+else
scratch_build=1
+ repodir=/local/sgallagh/repos/scratch
fi
+gitbranch=$3
+
LOGFILE=/local/sgallagh/logs/nightly-$datestamp.log
echo "===== BUILD STARTED AT `date` =====" > $LOGFILE
+echo "===== Cleaning old logs =====" > $LOGFILE
+find /local/sgallagh/logs -type f -daystart -ctime +6 -name "nightly-*.log" -exec rm -f {} \; || finish 96
+
echo "===== Cleaning old RPMS =====" > $LOGFILE
find /local/sgallagh/repos/f11 -type f -daystart -ctime +6 -name "sssd-*" -exec rm -f {} \; || finish 98
find /local/sgallagh/repos/rhel5 -type f -daystart -ctime +6 -name "sssd-*" -exec rm -f {} \; || finish 99
@@ -40,17 +58,24 @@ echo "===== CHECKING OUT CODE =====" >> $LOGFILE
rm -Rf sssd-$datestamp #Remove an incomplete previous run
git clone $git_repo sssd-$datestamp >> $LOGFILE 2>&1
cd sssd-$datestamp
-
+if [ x$gitbranch != x ]; then
+ git branch $gitbranch origin/$gitbranch >> $LOGFILE 2>&1 || finish 96
+ git checkout $gitbranch >> $LOGFILE 2>&1 || finish 97
+fi
commit_id=`git log -1 --pretty=format:%h`
-# See if the commit_id is different from the last run
-old_commit_id=`cat /local/sgallagh/.commit`
-if [ x$commit_id == x$old_commit_id ]; then
- cd /local/sgallagh && rm -Rf sssd-$datestamp
- rm -f $LOGFILE
- exit 0
+# If this is a scratch build, always run it
+if [ x$scratch_build == x ]; then
+ # See if the commit_id is different from the last run
+ old_commit_id=`cat /local/sgallagh/.commit`
+ if [ x$commit_id == x$old_commit_id ]; then
+ cd /local/sgallagh && rm -Rf sssd-$datestamp
+ rm -f $LOGFILE
+ exit 0
+ fi
fi
+cd /local/sgallagh/sssd-$datestamp
prereleaseversion=".${datestamp}git${commit_id}"
echo $nextversion > VERSION
echo $prereleaseversion >> VERSION
@@ -73,15 +98,15 @@ mock -r fedora-11-x86_64 sssd-$rpmversion.fc11.src.rpm >> $LOGFILE 2>&1 || \
(cat /var/lib/mock/fedora-11-x86_64/result/build.log >> $LOGFILE ; finish 5)
echo "===== CREATING FEDORA 11 i586 YUM REPOSITORY ====" >> $LOGFILE
-mkdir -p /local/sgallagh/repos/f11/SRPMS
-mkdir -p /local/sgallagh/repos/f11/i386/DEBUGINFO
-mkdir -p /local/sgallagh/repos/f11/i386/RPMS
-cp /var/lib/mock/fedora-11-i386/result/sssd-$rpmversion.fc11.src.rpm /local/sgallagh/repos/f11/SRPMS
-cp /var/lib/mock/fedora-11-i386/result/sssd-debuginfo-$rpmversion.fc11.i586.rpm /local/sgallagh/repos/f11/i386/DEBUGINFO
-cp /var/lib/mock/fedora-11-i386/result/sssd-$rpmversion.fc11.i586.rpm /local/sgallagh/repos/f11/i386/RPMS
-cp /var/lib/mock/fedora-11-i386/result/sssd-client-$rpmversion.fc11.i586.rpm /local/sgallagh/repos/f11/i386/RPMS
-
-createrepo /local/sgallagh/repos/f11/SRPMS > /dev/null
+mkdir -p $repodir/f11/SRPMS
+mkdir -p $repodir/f11/i386/DEBUGINFO
+mkdir -p $repodir/f11/i386/RPMS
+cp /var/lib/mock/fedora-11-i386/result/sssd-$rpmversion.fc11.src.rpm $repodir/f11/SRPMS
+cp /var/lib/mock/fedora-11-i386/result/sssd-debuginfo-$rpmversion.fc11.i586.rpm $repodir/f11/i386/DEBUGINFO
+cp /var/lib/mock/fedora-11-i386/result/sssd-$rpmversion.fc11.i586.rpm $repodir/f11/i386/RPMS
+cp /var/lib/mock/fedora-11-i386/result/sssd-client-$rpmversion.fc11.i586.rpm $repodir/f11/i386/RPMS
+
+createrepo $repodir/f11/SRPMS > /dev/null
if [ $? -eq 0 ]; then
echo "Fedora 11 SRPM Repo updated" >> $LOGFILE
else
@@ -89,14 +114,14 @@ else
fi
-createrepo /local/sgallagh/repos/f11/i386/DEBUGINFO > /dev/null
+createrepo $repodir/f11/i386/DEBUGINFO > /dev/null
if [ $? -eq 0 ]; then
echo "Fedora 11 i386 DEBUGINFO Repo updated" >> $LOGFILE
else
echo "Fedora 11 i386 DEBUGINFO Repo not updated" >> $LOGFILE
fi
-createrepo /local/sgallagh/repos/f11/i386/RPMS > /dev/null
+createrepo $repodir/f11/i386/RPMS > /dev/null
if [ $? -eq 0 ]; then
echo "Fedora 11 i386 RPM Repo updated" >> $LOGFILE
else
@@ -104,22 +129,22 @@ else
fi
echo "===== CREATING FEDORA 11 x86_64 YUM REPOSITORY ====" >> $LOGFILE
-mkdir -p /local/sgallagh/repos/f11/x86_64/DEBUGINFO
-mkdir -p /local/sgallagh/repos/f11/x86_64/RPMS
-cp /var/lib/mock/fedora-11-x86_64/result/sssd-debuginfo-$rpmversion.fc11.x86_64.rpm /local/sgallagh/repos/f11/x86_64/DEBUGINFO
-cp /var/lib/mock/fedora-11-i386/result/sssd-debuginfo-$rpmversion.fc11.i586.rpm /local/sgallagh/repos/f11/x86_64/DEBUGINFO
-cp /var/lib/mock/fedora-11-x86_64/result/sssd-$rpmversion.fc11.x86_64.rpm /local/sgallagh/repos/f11/x86_64/RPMS
-cp /var/lib/mock/fedora-11-x86_64/result/sssd-client-$rpmversion.fc11.x86_64.rpm /local/sgallagh/repos/f11/x86_64/RPMS
-cp /var/lib/mock/fedora-11-i386/result/sssd-client-$rpmversion.fc11.i586.rpm /local/sgallagh/repos/f11/x86_64/RPMS
-
-createrepo /local/sgallagh/repos/f11/x86_64/DEBUGINFO > /dev/null
+mkdir -p $repodir/f11/x86_64/DEBUGINFO
+mkdir -p $repodir/f11/x86_64/RPMS
+cp /var/lib/mock/fedora-11-x86_64/result/sssd-debuginfo-$rpmversion.fc11.x86_64.rpm $repodir/f11/x86_64/DEBUGINFO
+cp /var/lib/mock/fedora-11-i386/result/sssd-debuginfo-$rpmversion.fc11.i586.rpm $repodir/f11/x86_64/DEBUGINFO
+cp /var/lib/mock/fedora-11-x86_64/result/sssd-$rpmversion.fc11.x86_64.rpm $repodir/f11/x86_64/RPMS
+cp /var/lib/mock/fedora-11-x86_64/result/sssd-client-$rpmversion.fc11.x86_64.rpm $repodir/f11/x86_64/RPMS
+cp /var/lib/mock/fedora-11-i386/result/sssd-client-$rpmversion.fc11.i586.rpm $repodir/f11/x86_64/RPMS
+
+createrepo $repodir/f11/x86_64/DEBUGINFO > /dev/null
if [ $? -eq 0 ]; then
echo "Fedora 11 x86_64 DEBUGINFO Repo updated" >> $LOGFILE
else
echo "Fedora 11 x86_64 DEBUGINFO Repo not updated" >> $LOGFILE
fi
-createrepo /local/sgallagh/repos/f11/x86_64/RPMS > /dev/null
+createrepo $repodir/f11/x86_64/RPMS > /dev/null
if [ $? -eq 0 ]; then
echo "Fedora 11 x86_64 RPM Repo updated" >> $LOGFILE
else
@@ -137,29 +162,29 @@ mock -r epel-5-x86_64 sssd-$rpmversion.el5.src.rpm >> $LOGFILE 2>&1 || \
(cat /var/lib/mock/epel-5-x86_64/result/build.log >> $LOGFILE ; finish 7)
echo "===== CREATING RHEL 5 i586 YUM REPOSITORY ====" >> $LOGFILE
-mkdir -p /local/sgallagh/repos/rhel5/SRPMS
-mkdir -p /local/sgallagh/repos/rhel5/i386/DEBUGINFO
-mkdir -p /local/sgallagh/repos/rhel5/i386/RPMS
-cp /var/lib/mock/epel-5-i386/result/sssd-$rpmversion.el5.src.rpm /local/sgallagh/repos/rhel5/SRPMS
-cp /var/lib/mock/epel-5-i386/result/sssd-debuginfo-$rpmversion.el5.i386.rpm /local/sgallagh/repos/rhel5/i386/DEBUGINFO
-cp /var/lib/mock/epel-5-i386/result/sssd-$rpmversion.el5.i386.rpm /local/sgallagh/repos/rhel5/i386/RPMS
-cp /var/lib/mock/epel-5-i386/result/sssd-client-$rpmversion.el5.i386.rpm /local/sgallagh/repos/rhel5/i386/RPMS
-
-createrepo -s sha1 /local/sgallagh/repos/rhel5/SRPMS > /dev/null
+mkdir -p $repodir/rhel5/SRPMS
+mkdir -p $repodir/rhel5/i386/DEBUGINFO
+mkdir -p $repodir/rhel5/i386/RPMS
+cp /var/lib/mock/epel-5-i386/result/sssd-$rpmversion.el5.src.rpm $repodir/rhel5/SRPMS
+cp /var/lib/mock/epel-5-i386/result/sssd-debuginfo-$rpmversion.el5.i386.rpm $repodir/rhel5/i386/DEBUGINFO
+cp /var/lib/mock/epel-5-i386/result/sssd-$rpmversion.el5.i386.rpm $repodir/rhel5/i386/RPMS
+cp /var/lib/mock/epel-5-i386/result/sssd-client-$rpmversion.el5.i386.rpm $repodir/rhel5/i386/RPMS
+
+createrepo -s sha1 $repodir/rhel5/SRPMS > /dev/null
if [ $? -eq 0 ]; then
echo "RHEL5 SRPM Repo updated" >> $LOGFILE
else
echo "RHEL5 SRPM Repo not updated" >> $LOGFILE
fi
-createrepo -s sha1 /local/sgallagh/repos/rhel5/i386/DEBUGINFO > /dev/null
+createrepo -s sha1 $repodir/rhel5/i386/DEBUGINFO > /dev/null
if [ $? -eq 0 ]; then
echo "RHEL5 i386 DEBUGINFO Repo updated" >> $LOGFILE
else
echo "RHEL5 i386 DEBUGINFO Repo not updated" >> $LOGFILE
fi
-createrepo -s sha1 /local/sgallagh/repos/rhel5/i386/RPMS > /dev/null
+createrepo -s sha1 $repodir/rhel5/i386/RPMS > /dev/null
if [ $? -eq 0 ]; then
echo "RHEL5 i386 RPM Repo updated" >> $LOGFILE
else
@@ -167,22 +192,22 @@ else
fi
echo "===== CREATING RHEL 5 x86_86 YUM REPOSITORY ====" >> $LOGFILE
-mkdir -p /local/sgallagh/repos/rhel5/x86_64/DEBUGINFO
-mkdir -p /local/sgallagh/repos/rhel5/x86_64/RPMS
-cp /var/lib/mock/epel-5-x86_64/result/sssd-debuginfo-$rpmversion.el5.x86_64.rpm /local/sgallagh/repos/rhel5/x86_64/DEBUGINFO
-cp /var/lib/mock/epel-5-i386/result/sssd-debuginfo-$rpmversion.el5.i386.rpm /local/sgallagh/repos/rhel5/x86_64/DEBUGINFO
-cp /var/lib/mock/epel-5-x86_64/result/sssd-$rpmversion.el5.x86_64.rpm /local/sgallagh/repos/rhel5/x86_64/RPMS
-cp /var/lib/mock/epel-5-x86_64/result/sssd-client-$rpmversion.el5.x86_64.rpm /local/sgallagh/repos/rhel5/x86_64/RPMS
-cp /var/lib/mock/epel-5-i386/result/sssd-client-$rpmversion.el5.i386.rpm /local/sgallagh/repos/rhel5/x86_64/RPMS
-
-createrepo -s sha1 /local/sgallagh/repos/rhel5/x86_64/DEBUGINFO > /dev/null
+mkdir -p $repodir/rhel5/x86_64/DEBUGINFO
+mkdir -p $repodir/rhel5/x86_64/RPMS
+cp /var/lib/mock/epel-5-x86_64/result/sssd-debuginfo-$rpmversion.el5.x86_64.rpm $repodir/rhel5/x86_64/DEBUGINFO
+cp /var/lib/mock/epel-5-i386/result/sssd-debuginfo-$rpmversion.el5.i386.rpm $repodir/rhel5/x86_64/DEBUGINFO
+cp /var/lib/mock/epel-5-x86_64/result/sssd-$rpmversion.el5.x86_64.rpm $repodir/rhel5/x86_64/RPMS
+cp /var/lib/mock/epel-5-x86_64/result/sssd-client-$rpmversion.el5.x86_64.rpm $repodir/rhel5/x86_64/RPMS
+cp /var/lib/mock/epel-5-i386/result/sssd-client-$rpmversion.el5.i386.rpm $repodir/rhel5/x86_64/RPMS
+
+createrepo -s sha1 $repodir/rhel5/x86_64/DEBUGINFO > /dev/null
if [ $? -eq 0 ]; then
echo "RHEL5 x86_64 DEBUGINFO Repo updated" >> $LOGFILE
else
echo "RHEL5 x86_64 DEBUGINFO Repo not updated" >> $LOGFILE
fi
-createrepo -s sha1 /local/sgallagh/repos/rhel5/x86_64/RPMS > /dev/null
+createrepo -s sha1 $repodir/rhel5/x86_64/RPMS > /dev/null
if [ $? -eq 0 ]; then
echo "RHEL5 x86_64 RPM Repo updated" >> $LOGFILE
else
@@ -193,7 +218,9 @@ echo "===== Removing Source Tree =====" >> $LOGFILE
cd /local/sgallagh && rm -Rf sssd-$datestamp
#Save the commit id for the next time
-echo $commit_id > /local/sgallagh/.commit
+if [ x$scratch_build == x ]; then
+ echo $commit_id > /local/sgallagh/.commit
+fi
echo "===== BUILD CONCLUDED AT `date` =====" >> $LOGFILE