X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=packaging%2Frpm%2Fbuildpkg;h=ef6974cb85a295c37432dfdd13244358f6adf9a1;hb=refs%2Ftags%2Fupstream%2F3.3.1;hp=e76367cba9caf96b0577b0f801cac881f0b08385;hpb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;p=debian%2Famanda diff --git a/packaging/rpm/buildpkg b/packaging/rpm/buildpkg index e76367c..ef6974c 100755 --- a/packaging/rpm/buildpkg +++ b/packaging/rpm/buildpkg @@ -1,50 +1,73 @@ #!/bin/bash -# Buildpkg script for producing RPM packages. Does not require root access. + +# Buildpkg script for producing RPM packages. (Does not require root access.) +# Buildpkg is designed to be used by both buildbot (to automate rpm production) +# and by J Random User (to build an rpm for kicks). The odd way of handling +# all optioins through environment variables is a product of buildbot. +# +# AMVER: the version of amanda we're working on. This will become part of the +# rpm name. AMVER must line up with the version number mentioned in the +# .spec file. +# PKG_DIR: Rpmbuild expects absolute paths, so we provide this var. It also +# allows you to build somewhere other than `pwd`. You probably don't want +# to use the system-wide location, as the script tries to blow these +# directories away. +# +# Other Hints: +# Not everyone will want to use the ./configure options we provide. The +# easiest way to change them is by editing the .spec file. This isn't so +# easy, unfortunately. Look at the %build section, and the %define xxxx +# statements immediately above it. good luck. # This is useful for debugging -set -x -# Buildbot exports some useful env variables. -# Check for $AMVER. I couldn't come up with a good way to detect it. + set -x +# Check for $AMVER, or pull it from configure.in if [ -z $AMVER ]; then - AMVER=amanda-2.6.0 -fi -# Check for AMTARBALL variable. -if [ -z $AMTARBALL ]; then - AMTARBALL=$AMVER.tar.gz + VER=`cat FULL_VERSION` + AMVER=amanda-${VER} fi -# Check for AMTARBALL file, if it's not there, create it. -if [ ! -f ${AMTARBALL} ]; then - mkdir ${AMVER} +# Until we get package revisioning in community. +[ -f "PKG_REV" ] || echo "1" > PKG_REV + +# Substitute amanda.spec.src +/usr/bin/perl packaging/common/substitute.pl \ + packaging/rpm/amanda.spec.src packaging/rpm/amanda.spec + +PKG_TARBALL=${AMVER}.tar.gz +if [ ! -f "${PKG_TARBALL}" ]; then + mkdir ${AMVER} || exit 1 cp -Rfp * ${AMVER}/ - tar -cf ${AMTARBALL} -z ${AMVER} - rm -rf ${AMVER} + tar -cf ${PKG_TARBALL} -z ${AMVER} || exit 1 + rm -rf ${AMVER} || exit 1 fi # Check for the packaging dirs. -if [ -z $AMPKGDIR ]; then - AMPKGDIR=${PWD} +if [ -z "$PKG_DIR" ]; then + PKG_DIR=${PWD} fi -if [ ! -d ${AMPKGDIR} ]; then - mkdir ${AMPKGDIR} +if [ ! -d ${PKG_DIR} ]; then + mkdir ${PKG_DIR} || exit 1 fi -cd ${AMPKGDIR} +cd ${PKG_DIR} if [ -d rpm ]; then - rm -rf rpm + rm -rf rpm || exit 1 fi mkdir rpm mkdir rpm/SOURCES mkdir rpm/SRPMS mkdir rpm/SPECS mkdir rpm/BUILD -mkdir rpm/RPMS +mkdir rpm/RPMS || exit 1 -# Make a copy of the tarball with the name that rpmbuild expects -cp ${AMTARBALL} rpm/SOURCES/${AMVER}.tar.gz -cp packaging/rpm/amanda.spec rpm/SPECS/amanda.spec +# Make a copy of the tarball in the rpmbuild location +cp ${PKG_TARBALL} rpm/SOURCES/${PKG_TARBALL} || exit 1 +cp packaging/rpm/amanda.spec rpm/SPECS || exit 1 # Rpmbuild requires absolute paths. annoying. If you need to change the # default value of some rpm.spec variable, just pass extra --define options. # this is useful for changing %amanda_release or %amanda_version -rpmbuild -ba --define "_topdir ${AMPKGDIR}/rpm" \ - ${AMPKGDIR}/rpm/SPECS/amanda.spec +rpmbuild -ba --define "_topdir ${PKG_DIR}/rpm" \ + ${PKG_DIR}/rpm/SPECS/amanda.spec || exit 1 +cp rpm/RPMS/*/*.rpm . || exit 1 +cp rpm/SRPMS/*.rpm . || exit 1