[Po4a-devel]My package build script

Martin Quinson martin.quinson@loria.fr
Sun, 6 Mar 2005 13:02:23 +0100


--s8J8qjRpxLkp1Gun
Content-Type: multipart/mixed; boundary="0+35XlDF45POFHfm"
Content-Disposition: inline


--0+35XlDF45POFHfm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Nekral asked for the script I use to build the package. Here it is. It
relies on the fact that you are in a "po4a" directory, and that there is a
"po4a-cvs" directory in it.

It'll build the tarball in the cvs dir, open it along the cvs dir, put the
debian in there and build the package.

It's far from being perfect, but it's what I use.

HTH, Mt.

--0+35XlDF45POFHfm
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=Makefile
Content-Transfer-Encoding: quoted-printable

PKG=3D$(shell pwd |xargs basename)
DEBDIR=3D$(shell if [ -e $(PKG)-cvs/debian/changelog ] ; then echo $(PKG)-c=
vs/debian ; else echo debian ; fi)
VER=3D$(shell dpkg-parsechangelog -l$(DEBDIR)/changelog |grep Version|sed -=
e 's/Version: //')
UP_VER=3D$(shell echo $(VER)|sed 's/-.*$$//')
DEB_VER=3D$(shell echo $(VER)|sed 's/^[^-]*-//')

deb: stamp-open stamp-debdir $(PKG)_$(UP_VER).orig.tar.gz
	@echo XXXXXXXXXXX Build the deb
	cd $(PKG)-$(UP_VER) && dpkg-buildpackage -rfakeroot -uc -us

debsign: stamp-open stamp-debdir $(PKG)_$(UP_VER).orig.tar.gz
	@echo XXXXXXXXXXX Build the deb
	cd $(PKG)-$(UP_VER) && dpkg-buildpackage -rfakeroot

$(PKG)-$(UP_VER): stamp-open

stamp-open: $(PKG)-$(UP_VER).tar.gz
	@echo XXXXXXXXXXX Open the tarball
	rm -rf $(PKG)-$(UP_VER)
	tar xfz $(PKG)-$(UP_VER).tar.gz
	touch stamp-open
=09
stamp-debdir: FORCE
	@echo XXXXXXXXXXX Put the debian dir in position
	rm -rf $(PKG)-$(UP_VER)/debian
	cp -r $(DEBDIR) $(PKG)-$(UP_VER)/debian
	find $(PKG)-$(UP_VER)/debian -name CVS | xargs rm -rf
	find $(PKG)-$(UP_VER)/debian -name .cvsignore | xargs rm -rf
	touch stamp-debdir
=09
$(PKG)_$(UP_VER).orig.tar.gz: $(PKG)-$(UP_VER).tar.gz
	@echo XXXXXXXXXXX Copy the orig.tar.gz
	cp $(PKG)-$(UP_VER).tar.gz $(PKG)_$(UP_VER).orig.tar.gz

$(PKG)-$(UP_VER).tar.gz:=20
	@echo XXXXXXXXXXX Rebuild the tarball		=09
	cd $(PKG)-cvs ; [ -e Makefile ] || ./bootstrap=20
	cd $(PKG)-cvs && make dist && mv $(PKG)-$(UP_VER).tar.gz ..

FORCE:

clean-dsc: FORCE
	@echo XXXXXXXXXXX Clean the old versions
	@while [ `ls *.dsc |wc -l` -gt 1 -o `ls *.changes |wc -l` -gt 1 ] ; do \
	  if [ `ls *.changes |wc -l` -gt 1 ] ; then \
	    echo "XXX Cleanup binaries";ls;\
	    changes=3D`ls *.changes|head -1`; \
            list=3D`grep-dctrl -s Files -n . $$changes|\
	          sed 's/^ *//'|\
	          cut -d' ' -f5|\
	          egrep -v '\.dsc$$'`;\
	    rm -i $$list $$changes; \
	  fi; \
	  \
	  if [ `ls *.dsc |wc -l` -gt 1 ] ; then \
	    echo "XXX Cleanup source";ls;\
	    dsc=3D`ls *.dsc|head -1`; \
            list=3D`grep-dctrl -s Files -n . $$dsc|\
	          sed 's/^ *//'|\
	          cut -d' ' -f3|\
	          egrep -v '\.orig.tar.gz$$'`; \
	    rm -i $$list $$dsc; \
	  fi; \
	done

clean: clean-dsc
	@echo XXXXXXXXXXX Clean the stamps
	rm -rf stamp-*

=2EPHONY: FORCE

--0+35XlDF45POFHfm--

--s8J8qjRpxLkp1Gun
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCKvFPIiC/MeFF8zQRAuO3AKCbYdsMWVZqcKuUu5PA8lHWSNCq4gCcDa6D
kI3VBtNy/InX7+9ReX8MEJs=
=fQgK
-----END PGP SIGNATURE-----

--s8J8qjRpxLkp1Gun--