2 # This script facilitates automatic nightly builds of RPM hoomd packages.
3 # To simply build a package, consider using 'make rpm' instead, or refer to
4 # the README or spec file for more information.
6 # To perform automatic package builds, this script should be invoked from cron
7 # with the following additions to crontab:
9 # 0 0 * * * $HOME/hoomd-blue/packaging/redhat_build_package.sh >> $HOME/redhat_package_build.out 2>&1
11 # If this script is invoked automatically (as via crontab) from $HOME/hoomd-blue/packaging/
12 # then updates in hoomd-blue git will take two subsequent runs to take effect.
14 # Use the -f flag to prevent the script from performing an automatic update
15 # of itself and the Makefile.
18 PATH
=/bin
:/usr
/bin
:$PATH
19 # $0 can't be relied upon to identify the name of this script...
20 ME
=redhat_build_package.sh
22 # number of RPMs to retain
24 # what architecture does rpm think we have?
25 ARCH
=`rpm --eval '%{_arch}'`
29 while getopts fv OPT $@
; do
36 echo "$0 running at "`date`
40 git checkout
${BRANCH}
44 # determine version and revision
45 HVERSION_BASE
=$
(git describe |
awk 'BEGIN { FS = "-" } ; {print $1}' | cut
-c2-)
47 HREVISION
=$
(git describe |
awk 'BEGIN { FS = "-" } ; {print $2}')
48 #set a zero revision if HREVISION is blank
49 if [ -z "${HREVISION}" ]; then
53 #check the previous version built
54 atrev
=`cat $HOME/rh_old_revsion || echo 0`
55 new_rev
=`git describe`
56 echo "Last revision built was $atrev"
57 echo "Current repository revision is $new_rev"
59 if [ "$atrev" = "$new_rev" ];then
62 echo "commence building"
63 # maybe some of this should be moved to cmake
64 mkdir
-p $HOME/nightly-build
65 cp Makefile
$HOME/nightly-build
/
66 cp -R SPECS
$HOME/nightly-build
/
67 cd $HOME/nightly-build
69 make rpm VERSION
=${HVERSION_BASE} RELEASE=${HREVISION} REFSPEC=${BRANCH} $QUIET ||
exit
70 #set the version we just built in rh_old_revsion so it won't be built again
71 echo $new_rev > $HOME/rh_old_revsion
72 #move files to be uploaded
73 destination
="devel/incoming/"`/bin/cat /etc/redhat-release | /usr/bin/awk '{print $1}' | tr '[:upper:]' '[:lower:]'`
74 rsync
-ue /usr
/bin
/ssh rpmbuild
/RPMS
/$ARCH/hoomd
*.rpm joaander@foxx.engin.umich.edu
:$destination/
78 cd $HOME/nightly-build
/rpmbuild
/RPMS
/$ARCH
79 rpmfiles
=( `ls -td hoomd*.rpm` )
80 numfiles
=${#rpmfiles[*]}
81 for (( i
=$
(( $NRPMS )); $i < $numfiles ; i
++ )); do