]> git.ipfire.org Git - thirdparty/cups.git/blame - tools/makesrcdist
Remove source directory.
[thirdparty/cups.git] / tools / makesrcdist
CommitLineData
eda95e0f
MS
1#!/bin/sh
2#
3# makesrcdist - make a source distribution of CUPS.
4#
5
6TMPDIR="${TMPDIR:=/tmp}"
7
8# Make sure we are running in the right directory...
9if test ! -f tools/makesrcdist; then
10 echo "Run this script from the top-level CUPS source directory, e.g.:"
11 echo ""
12 echo " tools/makesrcdist $*"
13 echo ""
14 exit 1
15fi
16
17# See if we have local changes (other than this script...)
18if (git status | grep -v makesrcdist | grep -q modified:); then
19 echo Local changes remain:
20 git status | grep -v makesrcdist | grep modified:
21 exit 1
22fi
23
24# Prep for snapshot or version release...
25if test $# = 0; then
26 # Compute version for snapshot
27 rev=`git show --oneline | head -1 | awk '{print $1}'`
28 version="2.2git"
29 fileversion="2.2git-$rev"
30 fileurl="file://$TMPDIR/cups-$fileversion.tar.gz"
31else
32 # Use version from command-line
33 rev="1"
34 version=$1
35 fileversion=$1
36 fileurl="https://github.com/apple/cups/releases/download/release-$fileversion/cups-$fileversion-source.tar.gz"
37
38 echo Validating sources...
39 cupsversionpatch=`echo $version | awk -F. '{if (NF == 3) { print $3 } else { print "0" } }'`
40 cupsversion=`printf "2.02%02d" $cupsversionpatch`
41
42 temp=`grep AC_INIT configure.ac | awk '{print $2}' | sed -e '1,$s/^\[//' -e '1,$s/\],$//'`
43 if test "$temp" != $version; then
44 echo "Still need to update version to $version in configure.ac (saw $temp)"
45 exit 1
46 fi
47
48 temp=`grep CUPS_VERSION cups/cups.h | grep -v CUPS_VERSION_ | awk '{print $4}'`
49 if test "$temp" != $cupsversion; then
50 echo "Still need to update CUPS_VERSION to $cupsversion in cups/cups.h (saw $temp)"
51 exit 1
52 fi
53
54 temp=`grep CUPS_VERSION_PATCH cups/cups.h | awk '{print $4}'`
55 if test "$temp" != $cupsversionpatch; then
56 echo "Still need to update CUPS_VERSION_PATCH to $cupsversionpatch in cups/cups.h (saw $temp)"
57 exit 1
58 fi
59
60 temp=`head -1 README.txt | awk '{print $4}'`
61 if test "$temp" != "v$version"; then
62 echo "Still need to update version to v$version in README.txt (saw $temp)"
63 exit 1
64 fi
65
66 temp=`head -1 INSTALL.txt | awk '{print $4}'`
67 if test "$temp" != "v$version"; then
68 echo "Still need to update version to v$version in INSTALL.txt (saw $temp)"
69 exit 1
70 fi
71
72 temp=`head -4 CHANGES.txt | grep "CHANGES IN" | awk '{print $4}'`
73 if test "$temp" != "V$version"; then
74 echo "Still need to add CHANGES IN V$version in CHANGES.txt (saw $temp)"
75 exit 1
76 fi
77
78 echo Creating tag for release...
3cf02fdb
MS
79 git tag -m "Tag $version" v$version
80 git push origin v$version
eda95e0f
MS
81fi
82
83fileurl=`echo $fileurl | sed -e '1,$s/\\//\\\\\\//g'`
84
85echo Exporting $fileversion...
86rm -rf $TMPDIR/cups-$version
87mkdir $TMPDIR/cups-$version
42e37815 88git archive --format tar HEAD | (cd $TMPDIR/cups-$version; tar xf -)
eda95e0f
MS
89
90echo Preparing files...
91cd $TMPDIR/cups-$version
92sed -e '1,$s/@CUPS_VERSION@/'$version'/' \
93 -e '1,$s/^Source:.*/Source: '$fileurl'/' \
42e37815
MS
94 <packaging/cups.spec.in \
95 >packaging/cups.spec
96rm -rf tools .gitignore
eda95e0f
MS
97cd ..
98
99echo Archiving...
100tar czf cups-$fileversion-source.tar.gz cups-$version
101
102echo Removing temporary files...
6dae0424 103rm -rf cups-$version
eda95e0f
MS
104
105echo "Done - files in $TMPDIR."