3 # makesrcdist - make a source distribution of CUPS.
6 TMPDIR
="${TMPDIR:=/tmp}"
8 # Make sure we are running in the right directory...
9 if test ! -f tools
/makesrcdist
; then
10 echo "Run this script from the top-level CUPS source directory, e.g.:"
12 echo " tools/makesrcdist $*"
17 # See if we have local changes (other than this script...)
18 if (git status |
grep -v makesrcdist |
grep -v testrpm |
grep -q modified
:); then
19 echo Local changes remain
:
20 git status |
grep -v makesrcdist |
grep modified
:
24 # Prep for snapshot or version release...
26 # Compute version for snapshot
27 rev=`git show --oneline | head -1 | awk '{print $1}'`
29 fileversion
="2.3git-$rev"
30 fileurl
="file://$TMPDIR/cups-${fileversion}-source.tar.gz"
33 # Use version from command-line
37 fileurl
="https://github.com/apple/cups/releases/download/v$fileversion/cups-${fileversion}-source.tar.gz"
40 echo Validating sources...
41 cupsversionpatch
=`echo $version | awk -F. '{if (NF == 3) { print $3 } else { print "0" } }'`
42 cupsversion
=`printf "2.03%02d" $cupsversionpatch`
44 temp
=`grep AC_INIT configure.ac | awk '{print $2}' | sed -e '1,$s/^\[//' -e '1,$s/\],$//'`
45 if test "$temp" != $version; then
46 echo "Still need to update version to $version in configure.ac (saw $temp)"
50 temp
=`grep CUPS_VERSION cups/cups.h | grep -v CUPS_VERSION_ | awk '{print $4}'`
51 if test "$temp" != $cupsversion; then
52 echo "Still need to update CUPS_VERSION to $cupsversion in cups/cups.h (saw $temp)"
56 temp
=`grep CUPS_VERSION_PATCH cups/cups.h | awk '{print $4}'`
57 if test "$temp" != $cupsversionpatch; then
58 echo "Still need to update CUPS_VERSION_PATCH to $cupsversionpatch in cups/cups.h (saw $temp)"
62 temp
=`head -1 README.md | awk '{print $4}'`
63 if test "$temp" != "v$version"; then
64 echo "Still need to update version to v$version in README.md (saw $temp)"
68 temp
=`head -1 INSTALL.md | awk '{print $4}'`
69 if test "$temp" != "v$version"; then
70 echo "Still need to update version to v$version in INSTALL.md (saw $temp)"
74 temp
=`head -6 CHANGES.md | grep "Changes in" | awk '{print $4}'`
75 if test "$temp" != "v$version"; then
76 echo "Still need to add Changes in v$version in CHANGES.md (saw $temp)"
80 echo Creating tag
for release...
81 git tag
-m "Tag $version" v
$version
82 git push origin v
$version
85 fileurl
=`echo $fileurl | sed -e '1,$s/\\//\\\\\\//g'`
86 file="cups-$fileversion-source.tar.gz"
88 echo Exporting
$fileversion...
89 rm -rf $TMPDIR/cups-
$version
90 mkdir
$TMPDIR/cups-
$version
91 git archive
--format tar HEAD |
(cd $TMPDIR/cups-
$version; tar xf
-)
93 echo Preparing files...
94 cd $TMPDIR/cups-
$version
95 sed -e '1,$s/@CUPS_VERSION@/'$version'/' \
96 -e '1,$s/^Source:.*/Source: '$fileurl'/' \
97 <packaging
/cups.spec.
in \
99 rm -rf tools .gitignore
103 tar czf
$file cups-
$version
105 if test $SIGNFILES = yes; then
107 test -f $file.sig
&& rm -f $file.sig
108 gpg
--detach-sign $file
111 echo Removing temporary files...
114 echo "Done - files in $TMPDIR."