summaryrefslogtreecommitdiffstats
path: root/sssd-nightly.sh
diff options
context:
space:
mode:
authorsgallagh <sgallagh@sssd-builder.idm.lab.bos.redhat.com>2010-10-26 11:50:45 -0400
committersgallagh <sgallagh@sssd-builder.idm.lab.bos.redhat.com>2010-10-26 11:50:45 -0400
commitbcfc69e549f0f61c223ecc8d9deed05c6ad0af5d (patch)
tree83eb1cf9a371628511c9a7c59d3c4cae731184c4 /sssd-nightly.sh
parent9e7c443341bd49ecc8becb19e5212abe079b22ba (diff)
downloadbuild_tools-master.zip
build_tools-master.tar.gz
build_tools-master.tar.xz
Updating build system for Fedora 15HEADpost-dingmaster
Uses Koji to perform the build for multiple architectures in parallel
Diffstat (limited to 'sssd-nightly.sh')
-rwxr-xr-xsssd-nightly.sh216
1 files changed, 106 insertions, 110 deletions
diff --git a/sssd-nightly.sh b/sssd-nightly.sh
index 268708e..d9b993b 100755
--- a/sssd-nightly.sh
+++ b/sssd-nightly.sh
@@ -15,34 +15,28 @@ function finish { #(exit code)
successful="unsuccessfully"
fi
- echo "Build completed $successful" | /bin/mailx -a $LOGFILE -s "SSSD automated build report for $datestamp" $recipients
+ finishtime=`date`
+
+ echo "Build completed $successful at $finishtime" | /bin/mailx -a $LOGFILE -s "SSSD automated build report for $datestamp" $recipients
exit $1
}
if [ -e "/local/sgallagh/.sssd-build.lock" ]; then
- exit -1
+ echo "Previous build still running. Is it stuck?"
+ exit 0
fi
touch /local/sgallagh/.sssd-build.lock
mkdir -p /local/sgallagh/logs
-cd /local/sgallagh
-nextversion=$1
-if [ x$nextversion == x ]; then
- nextversion=0.0.1
-fi
-datestamp=`date +%Y%m%d%H`
-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
-if [ x$3 == x ]; then
- gitbranch=$3
+
+datestamp=`date +%Y%m%d.%H%M`
+
+repodir=/local/sgallagh/repos
+mkdir -p $repodir
+
+if [ x$1 != x ]; then
+ gitbranch=$1
else
gitbranch=master
fi
@@ -52,129 +46,131 @@ LOGFILE=/local/sgallagh/logs/nightly-$datestamp.log
echo "===== BUILD STARTED AT `date` =====" >> $LOGFILE
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`
-# 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
- rm -f /local/sgallagh/.sssd-build.lock
- exit 0
- fi
-fi
+cd /local/sgallagh/sssd
+git remote update >> $LOGFILE 2>&1 || finish 95
+git reset --hard origin/$gitbranch >> $LOGFILE 2>&1 || finish 96
-echo "===== Summary of Commits =====" >> $LOGFILE
-git shortlog HEAD ^$old_commit_id >> $LOGFILE
+commit_id=`git log -1 --pretty=format:%h`
-cd /local/sgallagh/sssd-$datestamp
-prereleaseversion=".${datestamp}git${commit_id}"
-echo $nextversion > VERSION
-echo $prereleaseversion >> VERSION
-rpmversion=$nextversion-0$prereleaseversion
+fullversion=`grep "\[VERSION_NUMBER\]" version.m4`
-mv contrib/sssd.spec.in contrib/sssd.spec.in.orig && \
-sed -e "s/make %/make CFLAGS=\"-ggdb3 -O0\" %/" < contrib/sssd.spec.in.orig > contrib/sssd.spec.in
+# Try X.Y.ZZ first
+version=${fullversion:29:6}
-echo "===== CONFIGURING CODE =====" >> $LOGFILE
-autoreconf -i -f >> $LOGFILE 2>&1 || finish 1
-./configure >> $LOGFILE 2>&1 || finish 2
-make srpms >> $LOGFILE 2>&1 || finish 3
-cd rpmbuild/SRPMS
-
-echo "===== BUILDING RHEL 6 i386 =====" >> $LOGFILE
-cd /local/sgallagh/sssd-$datestamp/rpmbuild/SRPMS
-mv sssd-$rpmversion.fc11.src.rpm \
- sssd-$rpmversion.el6.src.rpm
-mock -r epel-6-i386 sssd-$rpmversion.el6.src.rpm >> $LOGFILE 2>&1 || failed=1
-if [ $failed ]; then
- cat /var/lib/mock/epel-6-i386/result/build.log >> $LOGFILE
- finish 6
+# Try X.Y.Z
+if [ "${version:5}" == "]" ]; then
+ version=${fullversion:29:5}
fi
-echo "===== BUILDING RHEL 6 x86_64 =====" >> $LOGFILE
-mock -r epel-6-x86_64 sssd-$rpmversion.el6.src.rpm >> $LOGFILE 2>&1 || failed=1
-if [ $failed ]; then
- cat /var/lib/mock/epel-6-x86_64/result/build.log >> $LOGFILE
- finish 7
+# See if the commit_id is different from the last run
+old_commit_id=`cat /local/sgallagh/.commit_$gitbranch 2> /dev/null`
+if [ x$commit_id == x$old_commit_id ]; then
+ cd /local/sgallagh && rm -Rf sssd-$datestamp
+ rm -f $LOGFILE
+ rm -f /local/sgallagh/.sssd-build.lock
+ exit 0
fi
-echo "===== CREATING RHEL 6 i586 YUM REPOSITORY ====" >> $LOGFILE
-mkdir -p $repodir/rhel6/SRPMS
-mkdir -p $repodir/rhel6/i386/DEBUGINFO
-mkdir -p $repodir/rhel6/i386/RPMS
-cp /var/lib/mock/epel-6-i386/result/sssd-$rpmversion.el6.src.rpm $repodir/rhel6/SRPMS
-cp /var/lib/mock/epel-6-i386/result/sssd-debuginfo-$rpmversion.el6.i386.rpm $repodir/rhel6/i386/DEBUGINFO
-cp /var/lib/mock/epel-6-i386/result/*.el6.i386.rpm $repodir/rhel6/i386/RPMS
-rm -f $repodir/rhel6/i386/RPMS/sssd-debuginfo-$rpmversion.el6.i386.rpm
-
-echo "===== CREATING RHEL 6 x86_86 YUM REPOSITORY ====" >> $LOGFILE
-mkdir -p $repodir/rhel6/x86_64/DEBUGINFO
-mkdir -p $repodir/rhel6/x86_64/RPMS
-cp /var/lib/mock/epel-6-x86_64/result/sssd-debuginfo-$rpmversion.el6.x86_64.rpm $repodir/rhel6/x86_64/DEBUGINFO
-cp /var/lib/mock/epel-6-i386/result/sssd-debuginfo-$rpmversion.el6.i386.rpm $repodir/rhel6/x86_64/DEBUGINFO
-cp /var/lib/mock/epel-6-x86_64/result/*.el6.x86_64.rpm $repodir/rhel6/x86_64/RPMS
-rm -f $repodir/rhel6/x86_64/RPMS/sssd-debuginfo-$rpmversion.el6.i386.rpm
-cp /var/lib/mock/epel-6-i386/result/sssd-client-$rpmversion.el6.i386.rpm $repodir/rhel6/x86_64/RPMS
-
-echo "===== Removing Source Tree =====" >> $LOGFILE
-cd /local/sgallagh && rm -Rf sssd-$datestamp
-
-#Save the commit id for the next time
-if [ x$scratch_build == x ]; then
- echo $commit_id > /local/sgallagh/.commit
-fi
+echo "===== Summary of Commits =====" >> $LOGFILE
+git shortlog --no-merges HEAD ^$old_commit_id >> $LOGFILE 2>&1
-echo "===== Cleaning old logs =====" >> $LOGFILE
-find /local/sgallagh/logs -type f -daystart -ctime +6 -name "nightly-*.log" -exec rm -f {} \;
+# Disable optimizations
+mv contrib/sssd.spec.in contrib/sssd.spec.in.orig && \
+sed -e "s/make %/make CFLAGS=\"-ggdb3 -O0\" %/" < contrib/sssd.spec.in.orig > contrib/sssd.spec.in
-echo "===== Cleaning old RPMS =====" >> $LOGFILE
-rm -f `repomanage -k2 --old /repos/rhel6`
+echo "===== CONFIGURING CODE =====" >> $LOGFILE
+mv version.m4 version.m4.orig &&
+sed -e "s/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.*\])/m4_define(\[PRERELEASE_VERSION_NUMBER\], \[.$datestamp.git`git log -1 --pretty=format:%h`\])/" < version.m4.orig > version.m4 2>> $LOGFILE
+autoreconf -if >> $LOGFILE 2>&1 || finish 1
+./configure >> $LOGFILE 2>&1 || finish 2
+make srpm >> $LOGFILE 2>&1 || finish 3
-createrepo --update -s sha1 $repodir/rhel6/SRPMS > /dev/null
+echo "===== BUILDING FEDORA 15 =====" >> $LOGFILE
+rm -Rf ${datestamp}_${gitbranch}_15
+cd /local/sgallagh
+/local/sgallagh/build_tools/koji-build.py --build_id=${datestamp}_${gitbranch}_15 \
+ /local/sgallagh/sssd/rpmbuild/SRPMS/sssd-$version-0.$datestamp.git$commit_id.el6.src.rpm >> $LOGFILE 2>&1 || finish 4
+
+echo "===== Creating Fedora 15 Repository =====" >> $LOGFILE
+mkdir -p $repodir/$gitbranch/15/SRPMS
+mkdir -p $repodir/$gitbranch/15/i386/DEBUGINFO
+mkdir -p $repodir/$gitbranch/15/i386/RPMS
+mkdir -p $repodir/$gitbranch/15/i386/logs
+mkdir -p $repodir/$gitbranch/15/x86_64/DEBUGINFO
+mkdir -p $repodir/$gitbranch/15/x86_64/RPMS
+mkdir -p $repodir/$gitbranch/15/x86_64/logs
+
+cp ${datestamp}_${gitbranch}_15/SRPMS/* \
+ $repodir/$gitbranch/15/SRPMS
+
+cp ${datestamp}_${gitbranch}_15/i386/DEBUGINFO/* \
+ $repodir/$gitbranch/15/i386/DEBUGINFO
+
+cp ${datestamp}_${gitbranch}_15/i386/RPMS/* \
+ $repodir/$gitbranch/15/i386/RPMS
+cp ${datestamp}_${gitbranch}_15/i386/RPMS/* \
+ $repodir/$gitbranch/15/x86_64/RPMS
+
+cp ${datestamp}_${gitbranch}_15/i386/logs/* \
+ $repodir/$gitbranch/15/i386/logs
+
+cp ${datestamp}_${gitbranch}_15/x86_64/DEBUGINFO/* \
+ $repodir/$gitbranch/15/x86_64/DEBUGINFO
+
+cp ${datestamp}_${gitbranch}_15/x86_64/RPMS/* \
+ $repodir/$gitbranch/15/x86_64/RPMS
+
+cp ${datestamp}_${gitbranch}_15/x86_64/logs/* \
+ $repodir/$gitbranch/15/x86_64/logs
+
+# Clean up old RPMs
+rm -f `repomanage -k4 --old $repodir/$gitbranch/15`
+
+createrepo $repodir/$gitbranch/15/SRPMS > /dev/null
if [ $? -eq 0 ]; then
- echo "RHEL6 SRPM Repo updated" >> $LOGFILE
+ echo "Fedora 15 SRPM Repo updated" >> $LOGFILE
else
- echo "RHEL6 SRPM Repo not updated" >> $LOGFILE
+ echo "Fedora 15 SRPM Repo not updated" >> $LOGFILE
fi
-createrepo --update -s sha1 $repodir/rhel6/i386/DEBUGINFO > /dev/null
+createrepo $repodir/$gitbranch/15/i386/DEBUGINFO > /dev/null
if [ $? -eq 0 ]; then
- echo "RHEL6 i386 DEBUGINFO Repo updated" >> $LOGFILE
+ echo "Fedora 15 i386/DEBUGINFO Repo updated" >> $LOGFILE
else
- echo "RHEL6 i386 DEBUGINFO Repo not updated" >> $LOGFILE
+ echo "Fedora 15 i386/DEBUGINFO Repo not updated" >> $LOGFILE
fi
-createrepo --update -s sha1 $repodir/rhel6/i386/RPMS > /dev/null
+createrepo $repodir/$gitbranch/15/i386/RPMS > /dev/null
if [ $? -eq 0 ]; then
- echo "RHEL6 i386 RPM Repo updated" >> $LOGFILE
+ echo "Fedora 15 i386/RPMS Repo updated" >> $LOGFILE
else
- echo "RHEL6 i386 RPM Repo not updated" >> $LOGFILE
+ echo "Fedora 15 i386/RPMS Repo not updated" >> $LOGFILE
fi
-createrepo --update -s sha1 $repodir/rhel6/x86_64/DEBUGINFO > /dev/null
+createrepo $repodir/$gitbranch/15/x86_64/DEBUGINFO > /dev/null
if [ $? -eq 0 ]; then
- echo "RHEL6 x86_64 DEBUGINFO Repo updated" >> $LOGFILE
+ echo "Fedora 15 x86_64/DEBUGINFO Repo updated" >> $LOGFILE
else
- echo "RHEL6 x86_64 DEBUGINFO Repo not updated" >> $LOGFILE
+ echo "Fedora 15 x86_64/DEBUGINFO Repo not updated" >> $LOGFILE
fi
-createrepo --update -s sha1 $repodir/rhel6/x86_64/RPMS > /dev/null
+createrepo $repodir/$gitbranch/15/x86_64/RPMS > /dev/null
if [ $? -eq 0 ]; then
- echo "RHEL6 x86_64 RPM Repo updated" >> $LOGFILE
+ echo "Fedora 15 x86_64/RPMS Repo updated" >> $LOGFILE
else
- echo "RHEL6 x86_64 RPM Repo not updated" >> $LOGFILE
+ echo "Fedora 15 x86_64/RPMS Repo not updated" >> $LOGFILE
fi
+echo "===== Cleaning old logs and RPMs =====" >> $LOGFILE
+find /local/sgallagh/logs -type f -daystart -ctime +6 -name "nightly-*.log" -exec rm -f {} \;
+rm -Rf /local/sgallagh/${datestamp}_${gitbranch}_15
+
+echo "===== RSYNC the repositories =====" >> $LOGFILE
+rsync -avz /local/sgallagh/repos/* sgallagh@fedorapeople.org:/srv/repos/gitsssd/sssd >> $LOGFILE 2>&1
+
+echo $commit_id > /local/sgallagh/.commit_$gitbranch
+
echo "===== BUILD CONCLUDED AT `date` =====" >> $LOGFILE
finish 0