create rpm packages on a debian machine
This gave me a bit of an headache … Why on earth rpmbuild does not
simply respect environment variables nor have a command line option to
specify the TEMPDIR used to build the package or simply look for a
simple configuration file in the local directory ? From command line
you can only specify —buildroot . For everything else you must
specify a global file called .rpmmacros
(not .rpmrc !) and
write the new defaults there. This must be either in your home, or in
/etc (other other rpm specific paths). Anyway … enough for this
rant. This is the hack to create a local build environment :
#!/bin/bash
RPMBUILD=`pwd`/rpmbuild
RPMMACROS="$HOME/.rpmmacros"
if [ -f $RPMMACROS ] ; then
cp $RPMMACROS $RPMMACROS~
fi
echo "%_topdir $RPMBUILD" > $RPMMACROS
echo "%_tmppath $RPMBUILD/tmp" >> $RPMMACROS
echo "%_rpmdir `pwd`/RPMS" >> $RPMMACROS
echo "%mkrel(c:) %(echo mdv20010)" >> $RPMMACROS
mkdir -p rpmbuild/{SRPMS,BUILD,RPMS,SPECS,tmp}
The mkrel
part is something else that is needed if you want to
build a package that resemble a mandriva package … The rpm package
in debian does not include this macro by default.
I’m using the rpmbuild part of the rpm package on debian sid (RPM version 4.7.2).