3 # Buildpkg script for producing RPM packages. (Does not require root access.)
4 # Buildpkg is designed to be used by both buildbot (to automate rpm production)
5 # and by J Random User (to build an rpm for kicks). The odd way of handling
6 # all optioins through environment variables is a product of buildbot.
8 # AMVER: the version of amanda we're working on. This will become part of the
9 # rpm name. AMVER must line up with the version number mentioned in the
11 # AMTARBALL: the name of the tarball which contains the source code. it must
12 # unpack into a directory named AMVER. It's easiest and safest to just
13 # let the script create a new one for you, even if it's a bit more overhead
14 # AMPKGDIR: Rpmbuild expects absolute paths, so we provide this var. It also
15 # allows you to build somewhere other than `pwd`. You probably don't want
16 # to use the system-wide location, as the script tries to blow these
20 # Not everyone will want to use the ./configure options we provide. The
21 # easiest way to change them is by editing the .spec file. This isn't so
22 # easy, unfortunately. Look at the %build section, and the %define xxxx
23 # statements immediately above it. good luck.
25 # This is useful for debugging
27 # Buildbot exports some useful env variables.
28 # Check for $AMVER. I couldn't come up with a good way to detect it.
29 if [ -z $AMVER ]; then
33 # Check for AMTARBALL variable.
34 if [ -z $AMTARBALL ]; then
35 AMTARBALL=$AMVER.tar.gz
38 # Check for AMTARBALL file, if it's not there, create it.
39 if [ ! -f ${AMTARBALL} ]; then
42 tar -cf ${AMTARBALL} -z ${AMVER} || exit 1
46 # Check for the packaging dirs.
47 if [ -z $AMPKGDIR ]; then
50 if [ ! -d ${AMPKGDIR} ]; then
51 mkdir ${AMPKGDIR} || exit 1
63 mkdir rpm/RPMS || exit 1
65 # Make a copy of the tarball with the name that rpmbuild expects
66 cp ${AMTARBALL} rpm/SOURCES/${AMVER}.tar.gz || exit 1
67 cp packaging/rpm/amanda.spec rpm/SPECS || exit 1
68 # Rpmbuild requires absolute paths. annoying. If you need to change the
69 # default value of some rpm.spec variable, just pass extra --define options.
70 # this is useful for changing %amanda_release or %amanda_version
71 rpmbuild -ba --define "_topdir ${AMPKGDIR}/rpm" \
72 ${AMPKGDIR}/rpm/SPECS/amanda.spec || exit 1
73 cp rpm/RPMS/*/*.rpm . || exit 1
74 cp rpm/SRPMS/*.rpm . || exit 1