3 # Creates upstream packages
4 # Programmer: Kevin Rosenberg
6 set -e # abort on error
9 progname="`basename \"$0\"`"
12 Usage: $progname [options]
13 Creates upstream archives
15 -t Tag CVS tree with current version numbers
16 -c Commit all files to CVS server
17 -h Print this brief help
23 value="`echo x\"$1\" | sed -e 's/^x-.//'`"
37 VERSION=`sed -n -e "s/${DEBPKG} (\(.*\)-[0-9.]).*/\1/p" < debian/changelog |head -1`
39 PACKAGE_DIR=/usr/local/src/Packages/${DEBPKG}
40 DISTDIR=${PKG}-${VERSION}
41 DEBDIR=${DEBPKG}-${VERSION}
43 if [ -f ${PACKAGE_DIR}/${DEBPKG}_${VERSION}.orig.tar.gz ]; then
44 echo "File ${PACKAGE_DIR}/${DEBPKG}_${VERSION}.orig.tar.gz already exists."
45 echo -n "Are you sure that you want to create a new upstream archive? (y/N): "
49 *) echo "Not building"
55 if [ ! -z ${opt_commit} ]; then
56 echo "Committing to CVS server"
57 cvs commit -m "Committing for ${VERSION}"
60 if [ ! -z ${opt_tag} ]; then
61 UPSTREAM_TAG=upstream_version_`echo ${VERSION} | tr . _`
62 echo "(Re-)tagging with Upstream tag '${UPSTREAM_TAG}'"
63 cvs -q rtag -d $UPSTREAM_TAG $PKG > /dev/null
64 cvs -q tag -F $UPSTREAM_TAG > /dev/null
68 if [ ! -f docs/${PKG}.htb -o ! -f docs/html/${PKG}_contents.html -o ! -f docs/${PKG}.pdf ]; then
69 echo "Making documentation"
75 rm -f ${PKG}_${VERSION}.tar.gz ${DEBPKG}_${VERSION}.orig.tar.gz
76 rm -rf ${DISTDIR} ${DEBDIR} ${DISTDIR}.zip
77 cp -a ${TOPDIR} ${DISTDIR}
79 echo "Cleaning distribution directory ${DISTDIR}"
81 rm -f upload.sh make-debian.sh make-upstream.sh cvsbp-prepare.sh make-doc.sh
82 rm -f `find . -type f -name .cvsignore`
83 rm -rf `find . -type d -name CVS -or -name .deps`
84 rm -f `find . -type f -name '*~' -or -name '.#*' -or -name '#*#' -or -name ".*~" -or -name "*.o" -or -name "*.a"`
85 rm -f `find doc -type f -name \*.tex -or -name \*.aux -or \
86 -name \*.log -or -name \*.out -or -name \*.dvi`
87 rm -rf images doc stamp-h.in build-stamp stamp-h configure-stamp autom4te.cache do-autoconf config.log config.status config.h
90 echo "Creating upstream archives"
91 rm -rf ${DISTDIR}/debian
92 GZIP=-9 tar czf ${DISTDIR}.tar.gz ${DISTDIR}
94 if [ "${DISTDIR}" != "${DEBDIR}" ]; then
95 cp -a ${DISTDIR} ${DEBDIR}
97 cp -a ${DISTDIR} ${DEBDIR}-copy
100 unix2dos `find ${DISTDIR} -type f -and -name '*.c' -or -name '*.h' -or \
101 -name '*.cpp' -or -name '*.sh' -or -name '*.in' -or \
102 -name 'Makefile*' -or -name ChangeLog -or -name COPYRIGHT -or -name TODO -or \
103 -name README -or -name INSTALL -or -name NEWS -or -name '*.tex' -or \
104 -name '*.hhc' -or -name '*.hhk' -or -name '*.hpj' -or -name '*.ini' -or \
105 -name COPYING* -or -name catalog`
106 zip -rq ${DISTDIR}.zip ${DISTDIR}
109 if [ "${DISTDIR}" == "${DEBDIR}" ]; then
110 mv ${DEBDIR}-copy ${DEBDIR}
112 GZIP=-9 tar czf ${DEBPKG}_${VERSION}.orig.tar.gz ${DEBDIR}
114 cp -a ${TOPDIR}/debian ${DEBDIR}
115 rm -f ${DEBDIR}/debian/.cvsignore
116 rm -rf ${DEBDIR}/debian/CVS
120 echo "Moving upstream archives to ${PACKAGE_DIR}"
121 mkdir -p /usr/local/src/Packages/${DEBPKG}
122 rm -f ${PACKAGE_DIR}/${DISTDIR}.zip ${PACKAGE_DIR}/${DEBPKG}_${VERSION}.orig.tar.gz
123 mv ${DISTDIR}.zip ${DEBPKG}_${VERSION}.orig.tar.gz ${DISTDIR}.tar.gz ${PACKAGE_DIR}