]> git.ipfire.org Git - thirdparty/cups.git/blob - tools/makesrcdist
Fix builds without PPD support.
[thirdparty/cups.git] / tools / makesrcdist
1 #!/bin/sh
2 #
3 # makesrcdist - make a source distribution of CUPS.
4 #
5
6 TMPDIR="${TMPDIR:=/tmp}"
7
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.:"
11 echo ""
12 echo " tools/makesrcdist $*"
13 echo ""
14 exit 1
15 fi
16
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:
21 exit 1
22 fi
23
24 # Prep for snapshot or version release...
25 if test $# = 0; then
26 # Compute version for snapshot
27 rev=`git show --oneline | head -1 | awk '{print $1}'`
28 version="2.3git"
29 fileversion="2.3git-$rev"
30 fileurl="file://$TMPDIR/cups-${fileversion}-source.tar.gz"
31 SIGNFILES=no
32 else
33 # Use version from command-line
34 rev="1"
35 version=$1
36 fileversion=$1
37 fileurl="https://github.com/apple/cups/releases/download/v$fileversion/cups-${fileversion}-source.tar.gz"
38 SIGNFILES=yes
39
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`
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.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)"
65 exit 1
66 fi
67
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)"
71 exit 1
72 fi
73
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)"
77 exit 1
78 fi
79
80 echo Creating tag for release...
81 git tag -m "Tag $version" v$version
82 git push origin v$version
83 fi
84
85 fileurl=`echo $fileurl | sed -e '1,$s/\\//\\\\\\//g'`
86 file="cups-$fileversion-source.tar.gz"
87
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 -)
92
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 \
98 >packaging/cups.spec
99 rm -rf tools .gitignore
100 cd ..
101
102 echo Archiving...
103 tar czf $file cups-$version
104
105 if test $SIGNFILES = yes; then
106 echo Signing...
107 test -f $file.sig && rm -f $file.sig
108 gpg --detach-sign -u security@cups.org $file
109 fi
110
111 echo Removing temporary files...
112 rm -rf cups-$version
113
114 echo "Done - files in $TMPDIR."