building rpms out of git

My friend Michael Soulier writes at:

I find the need to wrap up content into a tar.gz so that I can build it really dumb. It wasn’t always like this… with the DEBIAN version the rpm command, I can actually just do:

rpmbuild -vv --define="_topdir $(RPMTOPDIR)" --define="Version $(VERSION)" -bb pt-vnc-connector.spec

and produce an RPM directly from my source directory… This no longer works with RHEL4/FC8/Centos5 versions of RPM, which I find funny. I was looking at porting the debian RPM package to RPM…

So, I build my RPMs under Debian Etch/Lenny!

Michael also writes:

git clone . /var/tmp/$fullname || exit 1 rm -rf /var/tmp/$fullname/.git* dest=$HOME/rpms/SOURCES/${fullname}.tar.gz rm -f $dest tar -C /var/tmp -zcvf $dest $fullname && rm -rf /var/tmp/$fullname

which I think can be replaced with:

git-archive --format=tar --prefix=$fullname/ . | gzip >$HOME/rpms/SOURCES/${fullname}.tar.gz