From 9cae895ef49c3f7bb3598d6178ca7051c42653e2 Mon Sep 17 00:00:00 2001 From: hamzy Date: Fri, 29 Apr 2011 21:29:56 +0000 Subject: [PATCH] rpmbuild now also builds at ~/rpmbuild. Detect where rpmbuild's root is by querying the %_topdir variable. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9438 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- makeclientrpm | 21 ++++++++++------ makenbrootrpm | 25 ++++++++++++------- makeperlxcatrpm | 26 +++++++++++++------- makeserverrpm | 48 +++++++++++++++++++++---------------- makexcatrpm | 64 +++++++++++++++++++++++++++---------------------- makexcatsnrpm | 55 ++++++++++++++++++++++++------------------ 6 files changed, 143 insertions(+), 96 deletions(-) diff --git a/makeclientrpm b/makeclientrpm index fab72e0ea..e6223cd61 100755 --- a/makeclientrpm +++ b/makeclientrpm @@ -24,15 +24,22 @@ then rpm -ba xCAT-client/xCAT-client.spec #rpm -ta $source/SOURCES/xCAT-client-$VER.tar.gz else - if [ -f /etc/redhat-release ] + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" set -x - tar --exclude=.svn -czhf /usr/src/$pkg/SOURCES/xCAT-client-$VER.tar.gz xCAT-client - rm -f /usr/src/$pkg/SRPMS/xCAT-client-$VER*rpm /usr/src/$pkg/RPMS/noarch/xCAT-client-$VER*rpm - rpmbuild -ta /usr/src/$pkg/SOURCES/xCAT-client-$VER.tar.gz + tar --exclude=.svn -czhf $RPMROOT/SOURCES/xCAT-client-$VER.tar.gz xCAT-client + rm -f $RPMROOT/SRPMS/xCAT-client-$VER*rpm $RPMROOT/RPMS/noarch/xCAT-client-$VER*rpm + rpmbuild -ta $RPMROOT/SOURCES/xCAT-client-$VER.tar.gz fi diff --git a/makenbrootrpm b/makenbrootrpm index a4e7bdcb2..e86153e74 100755 --- a/makenbrootrpm +++ b/makenbrootrpm @@ -1,16 +1,23 @@ #!/bin/sh VER=`cat Version` -if [ -f /etc/redhat-release ] +rpmbuild --version > /dev/null +if [ $? -gt 0 ] then - pkg="redhat" -else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi +RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` +if [ $? -gt 0 ] +then + echo "Could not determine rpmbuild's root" + exit 1 +fi +echo "The location for rpm building is ${RPMROOT}" cd `dirname $0`/xCAT-nbroot -tar --exclude .svn -czvf /usr/src/$pkg/SOURCES/xcat-nbrootoverlay.tar.gz -C overlay/ . -#mv -f *.gz /usr/src/$pkg/SOURCES -cp LICENSE.html /usr/src/$pkg/BUILD -cp xcat-core-nbroot.spec /usr/src/$pkg/SOURCES +tar --exclude .svn -czvf $RPMROOT/SOURCES/xcat-nbrootoverlay.tar.gz -C overlay/ . +#mv -f *.gz $RPMROOT/SOURCES +cp LICENSE.html $RPMROOT/BUILD +cp xcat-core-nbroot.spec $RPMROOT/SOURCES cd - -rm -f /usr/src/$pkg/SRPMS/xCAT-nbroot-$VER*rpm /usr/src/$pkg/RPMS/*/xCAT-nbroot-$VER*rpm +rm -f $RPMROOT/SRPMS/xCAT-nbroot-$VER*rpm $RPMROOT/RPMS/*/xCAT-nbroot-$VER*rpm rpmbuild -ba xCAT-nbroot/xcat-core-nbroot.spec --target $1 diff --git a/makeperlxcatrpm b/makeperlxcatrpm index 59a8f48d9..83956b812 100755 --- a/makeperlxcatrpm +++ b/makeperlxcatrpm @@ -26,19 +26,27 @@ then rpm -ba perl-xCAT/perl-xCAT.spec #rpm -ta $source/SOURCES/perl-xCAT-$VER.tar.gz else - if [ -f /etc/redhat-release ] + + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" set -x - svn info > perl-xCAT/.svninfo - tar --exclude .svn -czhf /usr/src/$pkg/SOURCES/perl-xCAT-$VER.tar.gz perl-xCAT; - rm perl-xCAT/.svninfo - rm -f /usr/src/$pkg/SRPMS/perl-xCAT-$VER*rpm /usr/src/$pkg/RPMS/noarch/perl-xCAT-$VER*rpm - rpmbuild -ta /usr/src/$pkg/SOURCES/perl-xCAT-$VER.tar.gz + svn info > perl-xCAT/.svninfo + tar --exclude .svn -czhf $RPMROOT/SOURCES/perl-xCAT-$VER.tar.gz perl-xCAT; + rm perl-xCAT/.svninfo + rm -f $RPMROOT/SRPMS/perl-xCAT-$VER*rpm $RPMROOT/RPMS/noarch/perl-xCAT-$VER*rpm + rpmbuild -ta $RPMROOT/SOURCES/perl-xCAT-$VER.tar.gz fi diff --git a/makeserverrpm b/makeserverrpm index 6f8a529dd..3a295f0a5 100755 --- a/makeserverrpm +++ b/makeserverrpm @@ -7,32 +7,40 @@ if [ "$OSNAME" = "AIX" ] then #echo '.svn' > /tmp/xcat-excludes - #tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar xCAT-server - #gzip -f /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar - #cd ./xCAT-server - #rm -f /opt/freeware/src/packages/SRPMS/xCAT-server-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm - #rpm -ba xCAT-server.spec - #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm + #tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar xCAT-server + #gzip -f /opt/freeware/src/packages/SOURCES/xCAT-server-$VER.tar + #cd ./xCAT-server + #rm -f /opt/freeware/src/packages/SRPMS/xCAT-server-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm + #rpm -ba xCAT-server.spec + #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-server-$VER*rpm - source=/opt/freeware/src/packages + source=/opt/freeware/src/packages echo '.svn' > /tmp/xcat-excludes - tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-server-$VER.tar xCAT-server - gzip -f $source/SOURCES/xCAT-server-$VER.tar - rm -f $source/SRPMS/xCAT-server-$VER*rpm $source/RPMS/ppc/xCAT-server-$VER*rpm - rpm -ba xCAT-server/xCAT-server.spec - #rpm -ta $source/SOURCES/xCAT-server-$VER.tar.gz + tar -X /tmp/xcat-excludes -cf $source/SOURCES/xCAT-server-$VER.tar xCAT-server + gzip -f $source/SOURCES/xCAT-server-$VER.tar + rm -f $source/SRPMS/xCAT-server-$VER*rpm $source/RPMS/ppc/xCAT-server-$VER*rpm + rpm -ba xCAT-server/xCAT-server.spec + #rpm -ta $source/SOURCES/xCAT-server-$VER.tar.gz else - if [ -f /etc/redhat-release ] + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" + + tar --exclude .svn -czf $RPMROOT/SOURCES/xCAT-server-$VER.tar.gz xCAT-server + rm -f $RPMROOT/SRPMS/xCAT-server-$VER*rpm $RPMROOT/RPMS/noarch/xCAT-server-$VER*rpm + rpmbuild -ta $RPMROOT/SOURCES/xCAT-server-$VER.tar.gz + #rpm -Uvh $RPMROOT/RPMS/noarch/xCAT-server-$VER*rpm - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/xCAT-server-$VER.tar.gz xCAT-server - rm -f /usr/src/$pkg/SRPMS/xCAT-server-$VER*rpm /usr/src/$pkg/RPMS/noarch/xCAT-server-$VER*rpm - rpmbuild -ta /usr/src/$pkg/SOURCES/xCAT-server-$VER.tar.gz - #rpm -Uvh /usr/src/$pkg/RPMS/noarch/xCAT-server-$VER*rpm fi diff --git a/makexcatrpm b/makexcatrpm index 2692a06c8..8220fa2fd 100755 --- a/makexcatrpm +++ b/makexcatrpm @@ -6,45 +6,53 @@ VER=`cat Version` if [ "$OSNAME" = "AIX" ] then - cd `dirname $0`/xCAT - echo '.svn' > /tmp/xcat-excludes - echo 'upflag' >> /tmp/xcat-excludes + cd `dirname $0`/xCAT + echo '.svn' > /tmp/xcat-excludes + echo 'upflag' >> /tmp/xcat-excludes - tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/postscripts.tar postscripts LICENSE.html - gzip -f /opt/freeware/src/packages/SOURCES/postscripts.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/postscripts.tar postscripts LICENSE.html + gzip -f /opt/freeware/src/packages/SOURCES/postscripts.tar - tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/templates.tar templates - gzip -f /opt/freeware/src/packages/SOURCES/templates.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/templates.tar templates + gzip -f /opt/freeware/src/packages/SOURCES/templates.tar - cp xcat.conf /opt/freeware/src/packages/SOURCES - cp xCATMN /opt/freeware/src/packages/SOURCES + cp xcat.conf /opt/freeware/src/packages/SOURCES + cp xCATMN /opt/freeware/src/packages/SOURCES - rm -f /opt/freeware/src/packages/SRPMS/xCAT-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm - cd - + rm -f /opt/freeware/src/packages/SRPMS/xCAT-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm + cd - - rpm -ba xCAT/xCAT.spec - #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm + rpm -ba xCAT/xCAT.spec + #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCAT-$VER*rpm else - if [ -f /etc/redhat-release ] + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" cd `dirname $0`/xCAT - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/postscripts.tar.gz postscripts LICENSE.html - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/prescripts.tar.gz prescripts - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/templates.tar.gz templates - cp xcat.conf /usr/src/$pkg/SOURCES - cp xCATMN /usr/src/$pkg/SOURCES + tar --exclude .svn -czf $RPMROOT/SOURCES/postscripts.tar.gz postscripts LICENSE.html + tar --exclude .svn -czf $RPMROOT/SOURCES/prescripts.tar.gz prescripts + tar --exclude .svn -czf $RPMROOT/SOURCES/templates.tar.gz templates + cp xcat.conf $RPMROOT/SOURCES + cp xCATMN $RPMROOT/SOURCES cd - - rm -f /usr/src/$pkg/SRPMS/xCAT-$VER*rpm /usr/src/$pkg/RPMS/*/xCAT-$VER*rpm - if [ ! -z "$1" ]; then - rpmbuild -ba xCAT/xCAT.spec --target $1 - else - rpmbuild -ba xCAT/xCAT.spec - fi + rm -f $RPMROOT/SRPMS/xCAT-$VER*rpm $RPMROOT/RPMS/*/xCAT-$VER*rpm + if [ ! -z "$1" ]; then + rpmbuild -ba xCAT/xCAT.spec --target $1 + else + rpmbuild -ba xCAT/xCAT.spec + fi + fi diff --git a/makexcatsnrpm b/makexcatsnrpm index c75886d53..50341f04f 100755 --- a/makexcatsnrpm +++ b/makexcatsnrpm @@ -5,41 +5,50 @@ VER=`cat Version` if [ "$OSNAME" = "AIX" ] then - cd `dirname $0`/xCATsn - echo '.svn' > /tmp/xcat-excludes + + cd `dirname $0`/xCATsn + echo '.svn' > /tmp/xcat-excludes echo 'upflag' >> /tmp/xcat-excludes - tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/license.tar LICENSE.html - gzip -f /opt/freeware/src/packages/SOURCES/license.tar + tar -X /tmp/xcat-excludes -cf /opt/freeware/src/packages/SOURCES/license.tar LICENSE.html + gzip -f /opt/freeware/src/packages/SOURCES/license.tar -# cp xcat.conf /opt/freeware/src/packages/SOURCES -# cp xCATSN /usr/src/$pkg/SOURCES + #cp xcat.conf /opt/freeware/src/packages/SOURCES + #cp xCATSN /usr/src/$pkg/SOURCES cp xCATSN /opt/freeware/src/packages/SOURCES - rm -f /opt/freeware/src/packages/SRPMS/xCATsn-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm - cd - + rm -f /opt/freeware/src/packages/SRPMS/xCATsn-$VER*rpm /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm + cd - - rpm -ba xCATsn/xCATsn.spec - #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm + rpm -ba xCATsn/xCATsn.spec + #rpm -Uvh /opt/freeware/src/packages/RPMS/ppc/xCATsn-$VER*rpm else - if [ -f /etc/redhat-release ] + rpmbuild --version > /dev/null + if [ $? -gt 0 ] then - pkg="redhat" - else - pkg="packages" + echo "Error: Is rpmbuild installed and working?" + exit 1 fi + RPMROOT=`rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec` + if [ $? -gt 0 ] + then + echo "Could not determine rpmbuild's root" + exit 1 + fi + echo "The location for rpm building is ${RPMROOT}" cd `dirname $0`/xCATsn - tar --exclude .svn -czf /usr/src/$pkg/SOURCES/license.tar.gz LICENSE.html - cp xcat.conf /usr/src/$pkg/SOURCES - cp xCATSN /usr/src/$pkg/SOURCES - rm -f /usr/src/$pkg/SRPMS/xCATsn-$VER*rpm /usr/src/$pkg/RPMS/*/xCATsn-$VER*rpm + tar --exclude .svn -czf $RPMROOT/SOURCES/license.tar.gz LICENSE.html + cp xcat.conf $RPMROOT/SOURCES + cp xCATSN $RPMROOT/SOURCES + rm -f $RPMROOT/SRPMS/xCATsn-$VER*rpm $RPMROOT/RPMS/*/xCATsn-$VER*rpm cd - - if [ ! -z "$1" ]; then - rpmbuild -ba xCATsn/xCATsn.spec --target $1 - else - rpmbuild -ba xCATsn/xCATsn.spec - fi + if [ ! -z "$1" ]; then + rpmbuild -ba xCATsn/xCATsn.spec --target $1 + else + rpmbuild -ba xCATsn/xCATsn.spec + fi + fi