]> git.ipfire.org Git - thirdparty/cups.git/blob - tools/makesrcdist
Update distribution script to use new SVN repo location.
[thirdparty/cups.git] / tools / makesrcdist
1 #!/bin/sh
2 #
3 # "$Id: makesrcdist 7776 2008-07-22 20:46:55Z mike $"
4 #
5 # makesrcdist - make a source distribution of CUPS.
6 #
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 if (svn st | grep -v makesrcdist | grep -qv '^\?'); then
18 echo Local changes remain:
19 svn st | grep -v makesrcdist | grep -v '^\?'
20 exit 1
21 fi
22
23 if test $# = 0; then
24 echo Updating for snapshot...
25 svn up
26
27 # Compute version for snapshot
28 rev=`svn info . | grep Revision: | awk '{print $2}'`
29 version="1.7svn"
30 revision="-r$rev"
31 fileversion="1.7svn-r$rev"
32 fileurl="http://www.cups.org/software/test/cups-$fileversion-source.tar."
33 url="."
34 else
35 # Use version from command-line
36 rev="1"
37 version=$1
38 revision=""
39 fileversion=$1
40 fileurl="http://www.cups.org/software/$version/cups-$fileversion-source.tar."
41 url="svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-$version"
42
43 echo Validating sources...
44 cupsversionpatch=`echo $version | awk -F. '{if (NF == 3) { print $3 } else { print "0" } }'`
45 cupsversion=`printf "1.07%02d" $cupsversionpatch`
46
47 temp=`grep CUPS_VERSION cups/cups.h | grep -v CUPS_VERSION_ | awk '{print $4}'`
48 if test "$temp" != $cupsversion; then
49 echo "Still need to update CUPS_VERSION to $cupsversion in cups/cups.h (saw $temp)"
50 exit 1
51 fi
52
53 temp=`grep CUPS_VERSION_PATCH cups/cups.h | awk '{print $4}'`
54 if test "$temp" != $cupsversionpatch; then
55 echo "Still need to update CUPS_VERSION_PATCH to $cupsversionpatch in cups/cups.h (saw $temp)"
56 exit 1
57 fi
58
59 temp=`head -1 README.txt | awk '{print $4}'`
60 if test "$temp" != "v$version"; then
61 echo "Still need to update version to v$version in README.txt (saw $temp)"
62 exit 1
63 fi
64
65 temp=`head -1 INSTALL.txt | awk '{print $4}'`
66 if test "$temp" != "v$version"; then
67 echo "Still need to update version to v$version in INSTALL.txt (saw $temp)"
68 exit 1
69 fi
70
71 temp=`head -4 CHANGES.txt | grep "CHANGES IN" | awk '{print $4}'`
72 if test "$temp" != "V$version"; then
73 echo "Still need to add CHANGES IN V$version in CHANGES.txt (saw $temp)"
74 exit 1
75 fi
76
77 echo Creating tag for release...
78 svn copy svn+ssh://src.apple.com/svn/cups/cups.org/trunk "$url" \
79 -m "Tag $version" || exit 1
80 fi
81
82 fileurl=`echo $fileurl | sed -e '1,$s/\\//\\\\\\//g'`
83
84 echo Exporting $fileversion...
85 rm -rf /tmp/cups-$version
86 svn export $url /tmp/cups-$version
87
88 echo Updating version information...
89 cd /tmp/cups-$version/config-scripts
90
91 sed -e '1,$s/^CUPS_VERSION=.*/CUPS_VERSION='$version'/' \
92 -e '1,$s/^CUPS_REVISION=.*/CUPS_REVISION='$revision'/' \
93 <cups-common.m4 >cups-common.m4.new
94 mv cups-common.m4.new cups-common.m4
95 cd ..
96
97 echo Configuring...
98 autoconf -f
99 rm -rf autom4te*.cache
100 rm -rf tools
101 cd ..
102
103 echo -n Archiving...gz
104 sed -e '1,$s/@CUPS_VERSION@/'$version'/' \
105 -e '1,$s/^Release:.*/Release: '$rev'/' \
106 -e '1,$s/^Source:.*/Source: '$fileurl'gz/' \
107 <cups-$version/packaging/cups.spec.in \
108 >cups-$version/packaging/cups.spec
109 tar czf cups-$fileversion-source.tar.gz cups-$version
110
111 echo -n ...bz2
112 sed -e '1,$s/@CUPS_VERSION@/'$version'/' \
113 -e '1,$s/^Release:.*/Release: '$rev'/' \
114 -e '1,$s/^Source:.*/Source: '$fileurl'bz2/' \
115 <cups-$version/packaging/cups.spec.in \
116 >cups-$version/packaging/cups.spec
117 tar cjf cups-$fileversion-source.tar.bz2 cups-$version
118 echo "..."
119
120 if test -x /usr/bin/md5sum; then
121 (cd /tmp; md5sum cups-$fileversion-source.tar.* | awk '{print $1, "'$fileversion' '$fileversion'/" $2}')
122 elif test -x /sbin/md5; then
123 (cd /tmp; md5 cups-$fileversion-source.tar.* | awk '{print $4, "'$fileversion' '$fileversion'/" substr($2, 2, length($2) - 2)}')
124 fi
125
126 echo Removing temporary files...
127 rm -rf cups-$version
128
129 echo "Done."
130
131 #
132 # End of "$Id: makesrcdist 7776 2008-07-22 20:46:55Z mike $".
133 #