#!/bin/sh
#
-# "$Id: makesrcdist 7776 2008-07-22 20:46:55Z mike $"
-#
# makesrcdist - make a source distribution of CUPS.
#
+TMPDIR="${TMPDIR:=/tmp}"
+
# Make sure we are running in the right directory...
if test ! -f tools/makesrcdist; then
echo "Run this script from the top-level CUPS source directory, e.g.:"
exit 1
fi
+# See if we have local changes (other than this script...)
+if (git status | grep -v makesrcdist | grep -v testrpm | grep -q modified:); then
+ echo Local changes remain:
+ git status | grep -v makesrcdist | grep modified:
+ exit 1
+fi
+
+# Prep for snapshot or version release...
if test $# = 0; then
- echo Updating for snapshot...
- svn up
- rev=`svnversion . | sed -e '1,$s/[a-zA-Z]//g'`
- version="1.4svn"
- revision="-r$rev"
- fileversion="1.4svn-r$rev"
- fileurl="ftp://ftp.easysw.com/pub/cups/test/cups-$fileversion-source.tar."
- url="."
+ # Compute version for snapshot
+ rev=`git show --oneline | head -1 | awk '{print $1}'`
+ version="2.3git"
+ fileversion="2.3git-$rev"
+ fileurl="file://$TMPDIR/cups-${fileversion}-source.tar.gz"
+ SIGNFILES=no
else
- echo Creating tag for release...
+ # Use version from command-line
rev="1"
version=$1
- revision=""
fileversion=$1
- fileurl="ftp://ftp.easysw.com/pub/cups/$version/cups-$fileversion-source.tar."
- url="https://svn.easysw.com/public/cups/tags/release-$version"
+ fileurl="https://github.com/apple/cups/releases/download/v$fileversion/cups-${fileversion}-source.tar.gz"
+ SIGNFILES=yes
+
+ echo Validating sources...
+ cupsversionpatch=`echo $version | awk -F. '{if (NF == 3) { print $3 } else { print "0" } }'`
+ cupsversion=`printf "2.03%02d" $cupsversionpatch`
+
+ temp=`grep AC_INIT configure.ac | awk '{print $2}' | sed -e '1,$s/^\[//' -e '1,$s/\],$//'`
+ if test "$temp" != $version; then
+ echo "Still need to update version to $version in configure.ac (saw $temp)"
+ exit 1
+ fi
+
+ temp=`grep CUPS_VERSION cups/cups.h | grep -v CUPS_VERSION_ | awk '{print $4}'`
+ if test "$temp" != $cupsversion; then
+ echo "Still need to update CUPS_VERSION to $cupsversion in cups/cups.h (saw $temp)"
+ exit 1
+ fi
+
+ temp=`grep CUPS_VERSION_PATCH cups/cups.h | awk '{print $4}'`
+ if test "$temp" != $cupsversionpatch; then
+ echo "Still need to update CUPS_VERSION_PATCH to $cupsversionpatch in cups/cups.h (saw $temp)"
+ exit 1
+ fi
+
+ temp=`head -1 README.md | awk '{print $4}'`
+ if test "$temp" != "v$version"; then
+ echo "Still need to update version to v$version in README.md (saw $temp)"
+ exit 1
+ fi
+
+ temp=`head -1 INSTALL.md | awk '{print $4}'`
+ if test "$temp" != "v$version"; then
+ echo "Still need to update version to v$version in INSTALL.md (saw $temp)"
+ exit 1
+ fi
- svn copy https://svn.easysw.com/public/cups/trunk "$url" \
- -m "Tag $version" || exit 1
+ temp=`head -6 CHANGES.md | grep "Changes in" | awk '{print $4}'`
+ if test "$temp" != "v$version"; then
+ echo "Still need to add Changes in v$version in CHANGES.md (saw $temp)"
+ exit 1
+ fi
+
+ echo Creating tag for release...
+ git tag -m "Tag $version" v$version
+ git push origin v$version
fi
fileurl=`echo $fileurl | sed -e '1,$s/\\//\\\\\\//g'`
+file="cups-$fileversion-source.tar.gz"
echo Exporting $fileversion...
-rm -rf /tmp/cups-$version
-svn export $url /tmp/cups-$version
-
-echo Updating version information...
-cd /tmp/cups-$version/config-scripts
+rm -rf $TMPDIR/cups-$version
+mkdir $TMPDIR/cups-$version
+git archive --format tar HEAD | (cd $TMPDIR/cups-$version; tar xf -)
-sed -e '1,$s/^CUPS_VERSION=.*/CUPS_VERSION='$version'/' \
- -e '1,$s/^CUPS_REVISION=.*/CUPS_REVISION='$revision'/' \
- <cups-common.m4 >cups-common.m4.new
-mv cups-common.m4.new cups-common.m4
+echo Preparing files...
+cd $TMPDIR/cups-$version
+sed -e '1,$s/@CUPS_VERSION@/'$version'/' \
+ -e '1,$s/^Source:.*/Source: '$fileurl'/' \
+ <packaging/cups.spec.in \
+ >packaging/cups.spec
+rm -rf tools .gitignore
cd ..
-echo Configuring...
-autoconf -f
-rm -rf autom4te*.cache
-rm -rf standards
-rm -rf tools
-cd ..
+echo Archiving...
+tar czf $file cups-$version
-echo -n Archiving...gz
-sed -e '1,$s/@CUPS_VERSION@/'$version'/' \
- -e '1,$s/^Release:.*/Release: '$rev'/' \
- -e '1,$s/^Source:.*/Source: '$fileurl'gz/' \
- <cups-$version/packaging/cups.spec.in \
- >cups-$version/packaging/cups.spec
-tar czf cups-$fileversion-source.tar.gz cups-$version
-
-echo -n ...bz2
-sed -e '1,$s/@CUPS_VERSION@/'$version'/' \
- -e '1,$s/^Release:.*/Release: '$rev'/' \
- -e '1,$s/^Source:.*/Source: '$fileurl'bz2/' \
- <cups-$version/packaging/cups.spec.in \
- >cups-$version/packaging/cups.spec
-tar cjf cups-$fileversion-source.tar.bz2 cups-$version
-echo "..."
-
-if test -x /usr/bin/md5sum; then
- (cd /tmp; md5sum cups-$fileversion-source.tar.* | awk '{print $1, "'$fileversion' cups/'$fileversion'/" $2}')
-elif test -x /sbin/md5; then
- (cd /tmp; md5 cups-$fileversion-source.tar.* | awk '{print $4, "'$fileversion' cups/'$fileversion'/" substr($2, 2, length($2) - 2)}')
+if test $SIGNFILES = yes; then
+ echo Signing...
+ test -f $file.sig && rm -f $file.sig
+ gpg --detach-sign $file
fi
echo Removing temporary files...
rm -rf cups-$version
-echo "Done!"
-
-#
-# End of "$Id: makesrcdist 7776 2008-07-22 20:46:55Z mike $".
-#
+echo "Done - files in $TMPDIR."