r1949: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 5 May 2002 11:36:02 +0000 (11:36 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Sun, 5 May 2002 11:36:02 +0000 (11:36 +0000)
make-dist.sh

index 5ab5bf3a56e90ea0139808556379422ba0936c7d..bfac5c0a5c0c2efe4a13fc20b6783455d3d02724 100755 (executable)
-#!/bin/sh
-
-# Creates debian and system-independent archive files
-# Programmer: Kevin M. Rosenberg 
-
-set -e
+#!/bin/bash 
+#
+# Creates debian and upstream packages
+# Programmer: Kevin Rosenberg
+
+set -e # abort on error
+
+progname="`basename \"$0\"`"
+
+usage () {
+  cat >&2 <<EOF
+Usage: $progname [options]
+Options:
+  -t   Tag CVS tree with current version numbers
+  -d   Use dpkg-buildpackage rather than default cvs-buildpackage
+  -l   Run lintian after building
+  -h   Print this brief help
+EOF
+}
+
+# Command line
+while [ $# != 0 ]; do
+    value="`echo x\"$1\" | sed -e 's/^x-.//'`"
+    case "$1" in
+        -h)  usage; exit 0           ;;
+        -t)  opt_tag=1               ;;
+        -d)  opt_dpkg_buildpackage=1 ;;
+        -l)  opt_lintian=1           ;;
+         *)  usage; exit 0           ;;
+    esac
+    shift
+done
 
 DEBPKG=ctsim
 PKG=ctsim
-VERSION=`sed -n -e "s/${DEBPKG} (\(.*\)-[0-9]).*/\1/p" < debian/changelog  |head -1`
-TOPDIR=`basename $PWD`
+TOPDIR=`pwd`
 
+VERSION=`sed -n -e "s/${DEBPKG} (\(.*\)-[0-9]).*/\1/p" < debian/changelog  |head -1`
+DEBVERSION=`sed -n -e "s/${DEBPKG} (\(.*\)).*/\1/p" < debian/changelog  |head -1`
+PACKAGE_DIR=/usr/local/src/Packages/${DEBPKG}
 DISTDIR=${PKG}-${VERSION}
 DEBDIR=${DEBPKG}-${VERSION}
 
-if [! -f docs/${PKG}.htb -o ! -f docs/html/${PKG}_contents.html -o ! -f docs/${PKG}.pdf ]; then
+if [ -z ${opt_dpkg_buildpackage} ]; then
+  export CVSROOT=`cat CVS/Root`
+fi
+
+if [ ! -z ${opt_tag} ]; then
+  DEB_TAG=debian_version_`echo ${DEBVERSION} | tr . _`
+  UPSTREAM_TAG=upstream_version_`echo ${VERSION} | tr . _`
+  echo "(Re-)tagging with Debian tag '${DEB_TAG}'"
+  cvs -q rtag -d ${DEB_TAG} ${PKG} > /dev/null
+  cvs -q tag -F ${DEB_TAG} > /dev/null
+
+  # Retag with upstream tag if release not 0 or 1
+  if [ "`echo ${DEBVERSION} | egrep '\-0$\-1$]'`" != "" ]; then
+    echo "(Re-)tagging with Upstream tag '${UPSTREAM_TAG}'"
+    cvs -q rtag -d $UPSTREAM_TAG $PKG > /dev/null
+    cvs -q tag -F $UPSTREAM_TAG > /dev/null
+  fi
+fi
+
+if [ ! -f docs/${PKG}.htb -o ! -f docs/html/${PKG}_contents.html -o ! -f docs/${PKG}.pdf ]; then
   echo "Making documentation"
   pushd doc
   make all
   popd
 fi
 
-TAG=upstream_version_`echo $VERSION | tr . _`
-#echo "(re)tagging with release tag '$TAG'"
-#cvs -q rtag -d $TAG $PKG
-#cvs -q tag -F $TAG
-
-
-echo "Preparing for archives"
-pushd ..
+# Prepare for archive
+cd ..
 rm -f ${PKG}_${VERSION}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
 rm -rf ${DISTDIR} ${DEBDIR} ${DISTDIR}.zip
-
-echo "Making archives"
 cp -a ${TOPDIR} ${DISTDIR}
 
-# Remove junk from distribution dir
-pushd ${DISTDIR}
+echo "Cleaning distribution directory ${DISTDIR}"
+cd ${DISTDIR}
 make distclean
+rm -f upload.sh make-dist.sh cvsbp-prepare 
 rm -f `find . -type f -name .cvsignore`
 rm -rf `find . -type d -name CVS`
-rm -f `find . -type f -name '*~' -or -name '.*~' -or \
-   -name '.#*' -or -name '#*#' -or -name '*.fig' -or -name '*.psd'`
-rm -rf images copy make-dist.sh make-doc.sh doc stamp-h.in build-stamp \
-    configure-stamp 
-popd
+rm -f `find . -type f -name '*~' -or -name '#*'  -or -name '#*#'` -or -name '.#*'
+rm -f `find doc -type f -name \*.tex -or -name \*.aux -or \
+  -name \*.log -or -name \*.out -or -name \*.dvi`
+rm -rf images doc stamp-h.in build-stamp configure-stamp autom4te.cache
+cd ..
 
-# Create original distribution archives
+echo "Creating upstream archives"
 rm -rf ${DISTDIR}/debian
 GZIP=-9 tar czf ${DISTDIR}.tar.gz ${DISTDIR}
 
+if [ "${DISTDIR}" != "${DEBDIR}" ]; then 
+  cp -a ${DISTDIR} ${DEBDIR}
+else
+  cp -a ${DISTDIR} ${DEBDIR}-copy
+fi
+GZIP=-9 tar czf ${DEBPKG}_${VERSION}.orig.tar.gz ${DEBDIR}
+
 unix2dos `find ${DISTDIR} -type f -and -name '*.c' -or -name '*.h' -or \
   -name '*.cpp' -or -name '*.sh' -or -name '*.in' -or \
   -name 'Makefile*' -or -name ChangeLog -or -name COPYRIGHT -or -name TODO -or \
@@ -58,26 +105,41 @@ unix2dos `find ${DISTDIR} -type f -and -name '*.c' -or -name '*.h' -or \
 zip -rq ${DISTDIR}.zip ${DISTDIR}
 
 rm -rf ${DISTDIR}
-
-tar xzf ${DISTDIR}.tar.gz 
-cp ${DISTDIR}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
-
-if [ "${DISTDIR}" != "${DEBDIR}" ]; then
-  mv ${DISTDIR} ${DEBDIR}
+if [ "${DISTDIR}" == "${DEBDIR}" ]; then 
+  mv ${DEBDIR}-copy ${DEBDIR}
 fi
+
 cp -a ${TOPDIR}/debian ${DEBDIR}
+rm -f ${DEBDIR}/debian/.cvsignore 
+rm -rf ${DEBDIR}/debian/CVS
 
-echo "Building Debian packages"
 
-pushd ${DEBDIR}
-dpkg-buildpackage -rfakeroot -kkevin@b9.com  #-tc -b
-popd
-rm -r ${DEBDIR}
+echo "Moving upstream archives to ${PACKAGE_DIR}"
+mkdir -p /usr/local/src/Packages/${DEBPKG}
+rm -f ${PACKAGE_DIR}/${DISTDIR}.zip ${PACKAGE_DIR}/${DEBPKG}_${VERSION}.orig.tar.gz
+mv ${DISTDIR}.zip ${DEBPKG}_${VERSION}.orig.tar.gz ${DISTDIR}.tar.gz ${PACKAGE_DIR}
+
+echo "Building Debian files"
+if [ -z ${opt_dpkg_buildpackage} ]; then
+  cd ${TOPDIR}
+  cvs-buildpackage -rfakeroot -kkevin@rosenberg.net -H${TOPDIR}/cvsbp-prepare -tC -i.pdf ${DEBPKG}
+  cd ..
+else
+  cd ${DEBDIR}
+  dpkg-buildpackage -rfakeroot -kkevin@rosenberg.net 
+  cd ..
+  mv ${DEBPKG}_${VERSION}* ${PACKAGE_DIR}
+fi
+rm -rf ${DEBDIR}
 
-lintian ${DEBPKG}_${VERSION}-*.changes
+if [ ! -z ${opt_lintian} ]; then
+  pushd ${PACKAGE_DIR} > /dev/null
+  lintian ${DEBPKG}_${DEBVERSION}_*.changes
+  popd > /dev/null
+fi
 
-mkdir -p /usr/local/src/Packages/${DEBPKG}
-mv ${DEBPKG}_${VERSION}* /usr/local/src/Packages/${DEBPKG}
+cd ${TOPDIR}
 
-popd
 exit 0
+
+