]> git.ipfire.org Git - thirdparty/cups.git/blame - tools/makesrcdist
Bring back RPM test script, tweak makesrcdist to work.
[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"
37a8aac2 31 SIGNFILES=no
eda95e0f
MS
32else
33 # Use version from command-line
34 rev="1"
35 version=$1
36 fileversion=$1
37 fileurl="https://github.com/apple/cups/releases/download/release-$fileversion/cups-$fileversion-source.tar.gz"
37a8aac2 38 SIGNFILES=yes
eda95e0f
MS
39
40 echo Validating sources...
41 cupsversionpatch=`echo $version | awk -F. '{if (NF == 3) { print $3 } else { print "0" } }'`
42 cupsversion=`printf "2.02%02d" $cupsversionpatch`
43
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)"
47 exit 1
48 fi
49
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)"
53 exit 1
54 fi
55
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)"
59 exit 1
60 fi
61
62 temp=`head -1 README.txt | awk '{print $4}'`
63 if test "$temp" != "v$version"; then
64 echo "Still need to update version to v$version in README.txt (saw $temp)"
65 exit 1
66 fi
67
68 temp=`head -1 INSTALL.txt | awk '{print $4}'`
69 if test "$temp" != "v$version"; then
70 echo "Still need to update version to v$version in INSTALL.txt (saw $temp)"
71 exit 1
72 fi
73
74 temp=`head -4 CHANGES.txt | 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.txt (saw $temp)"
77 exit 1
78 fi
79
80 echo Creating tag for release...
3cf02fdb
MS
81 git tag -m "Tag $version" v$version
82 git push origin v$version
eda95e0f
MS
83fi
84
85fileurl=`echo $fileurl | sed -e '1,$s/\\//\\\\\\//g'`
0f2f21af 86file="cups-$fileversion-source.tar.gz"
eda95e0f
MS
87
88echo Exporting $fileversion...
89rm -rf $TMPDIR/cups-$version
90mkdir $TMPDIR/cups-$version
42e37815 91git archive --format tar HEAD | (cd $TMPDIR/cups-$version; tar xf -)
eda95e0f
MS
92
93echo Preparing files...
94cd $TMPDIR/cups-$version
95sed -e '1,$s/@CUPS_VERSION@/'$version'/' \
96 -e '1,$s/^Source:.*/Source: '$fileurl'/' \
42e37815
MS
97 <packaging/cups.spec.in \
98 >packaging/cups.spec
99rm -rf tools .gitignore
eda95e0f
MS
100cd ..
101
102echo Archiving...
0f2f21af
MS
103tar czf $file cups-$version
104
37a8aac2
MS
105if test $SIGNFILES = yes; then
106 echo Signing...
107 test -f $file.sig && rm -f $file.sig
108 gpg --detach-sign $file
109fi
eda95e0f
MS
110
111echo Removing temporary files...
6dae0424 112rm -rf cups-$version
eda95e0f
MS
113
114echo "Done - files in $TMPDIR."