3 # Creates debian and upstream packages
4 # Programmer: Kevin Rosenberg
6 set -e # abort on error
8 progname="`basename \"$0\"`"
12 Usage: $progname [options]
14 -t Tag CVS tree with current version numbers
15 -d Use dpkg-buildpackage rather than default cvs-buildpackage
16 -l Run lintian after building
17 -h Print this brief help
23 value="`echo x\"$1\" | sed -e 's/^x-.//'`"
27 -d) opt_dpkg_buildpackage=1 ;;
38 VERSION=`sed -n -e "s/${DEBPKG} (\(.*\)-[0-9]).*/\1/p" < debian/changelog |head -1`
39 DEBVERSION=`sed -n -e "s/${DEBPKG} (\(.*\)).*/\1/p" < debian/changelog |head -1`
40 PACKAGE_DIR=/usr/local/src/Packages/${DEBPKG}
41 DISTDIR=${PKG}-${VERSION}
42 DEBDIR=${DEBPKG}-${VERSION}
44 if [ -z ${opt_dpkg_buildpackage} ]; then
45 export CVSROOT=`cat CVS/Root`
48 if [ ! -z ${opt_tag} ]; then
49 DEB_TAG=debian_version_`echo ${DEBVERSION} | tr . _`
50 UPSTREAM_TAG=upstream_version_`echo ${VERSION} | tr . _`
51 echo "(Re-)tagging with Debian tag '${DEB_TAG}'"
52 cvs -q rtag -d ${DEB_TAG} ${PKG} > /dev/null
53 cvs -q tag -F ${DEB_TAG} > /dev/null
55 # Retag with upstream tag if release not 0 or 1
56 if [ "`echo ${DEBVERSION} | egrep '\-0$\-1$]'`" != "" ]; then
57 echo "(Re-)tagging with Upstream tag '${UPSTREAM_TAG}'"
58 cvs -q rtag -d $UPSTREAM_TAG $PKG > /dev/null
59 cvs -q tag -F $UPSTREAM_TAG > /dev/null
63 if [ ! -f docs/${PKG}.htb -o ! -f docs/html/${PKG}_contents.html -o ! -f docs/${PKG}.pdf ]; then
64 echo "Making documentation"
72 rm -f ${PKG}_${VERSION}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
73 rm -rf ${DISTDIR} ${DEBDIR} ${DISTDIR}.zip
74 cp -a ${TOPDIR} ${DISTDIR}
76 echo "Cleaning distribution directory ${DISTDIR}"
79 rm -f upload.sh make-dist.sh make-doc.sh cvsbp-prepare
80 rm -f `find . -type f -name .cvsignore`
81 rm -rf `find . -type d -name CVS`
82 rm -f `find . -type f -name '*~' -or -name '#*' -or -name '#*#' -or -name '.#*'`
83 rm -f `find doc -type f -name \*.tex -or -name \*.aux -or \
84 -name \*.log -or -name \*.out -or -name \*.dvi`
85 rm -rf images doc stamp-h.in build-stamp configure-stamp autom4te.cache
88 echo "Creating upstream archives"
89 rm -rf ${DISTDIR}/debian
90 GZIP=-9 tar czf ${DISTDIR}.tar.gz ${DISTDIR}
92 if [ "${DISTDIR}" != "${DEBDIR}" ]; then
93 cp -a ${DISTDIR} ${DEBDIR}
95 cp -a ${DISTDIR} ${DEBDIR}-copy
98 unix2dos `find ${DISTDIR} -type f -and -name '*.c' -or -name '*.h' -or \
99 -name '*.cpp' -or -name '*.sh' -or -name '*.in' -or \
100 -name 'Makefile*' -or -name ChangeLog -or -name COPYRIGHT -or -name TODO -or \
101 -name README -or -name INSTALL -or -name NEWS -or -name '*.tex' -or \
102 -name '*.hhc' -or -name '*.hhk' -or -name '*.hpj' -or -name '*.ini' -or \
103 -name COPYING* -or -name catalog`
104 zip -rq ${DISTDIR}.zip ${DISTDIR}
107 if [ "${DISTDIR}" == "${DEBDIR}" ]; then
108 mv ${DEBDIR}-copy ${DEBDIR}
110 GZIP=-9 tar czf ${DEBPKG}_${VERSION}.orig.tar.gz ${DEBDIR}
112 cp -a ${TOPDIR}/debian ${DEBDIR}
113 rm -f ${DEBDIR}/debian/.cvsignore
114 rm -rf ${DEBDIR}/debian/CVS
116 echo "Building Debian files"
117 if [ -z ${opt_dpkg_buildpackage} ]; then
119 cvs-buildpackage -rfakeroot -kkevin@rosenberg.net -H${TOPDIR}/cvsbp-prepare -tC -i.pdf ${DEBPKG}
123 dpkg-buildpackage -rfakeroot -kkevin@rosenberg.net
125 mv -f ${DEBPKG}_${VERSION}* ${PACKAGE_DIR}
129 echo "Moving upstream archives to ${PACKAGE_DIR}"
130 mkdir -p /usr/local/src/Packages/${DEBPKG}
131 mv -f ${DISTDIR}.zip ${DISTDIR}.tar.gz ${PACKAGE_DIR}
133 if [ ! -z ${opt_lintian} ]; then
134 pushd ${PACKAGE_DIR} > /dev/null
135 lintian ${DEBPKG}_${DEBVERSION}_*.changes