]> git.ipfire.org Git - thirdparty/sarg.git/blame - archive.sh
Rename configure.in as configure.ac
[thirdparty/sarg.git] / archive.sh
CommitLineData
6937c365
FM
1#!/bin/sh
2
3Sources="."
4Target=".."
5
f23af6b9 6# check version number in every file
0885571a 7Version=$(sed -n -e 's/^SET(sarg_VERSION \([0-9]\))/\1/p' "$Sources/CMakeLists.txt")
6937c365 8if [ -z "$Version" ] ; then
d75b03b6 9 echo "No version found in CMakeLists.txt"
6937c365
FM
10 exit 1
11fi
0885571a 12Revision=$(sed -n -e 's/^SET(sarg_REVISION "\([0-9][0-9]*.*\)")/\1/p' "$Sources/CMakeLists.txt")
6937c365 13if [ -z "$Revision" ] ; then
d75b03b6 14 echo "No revision found in CMakeLists.txt"
6937c365
FM
15 exit 1
16fi
17Version="$Version.$Revision"
18
164ef212 19VersionCheck=$(sed -n -e 's/^AC_INIT(\[sarg\],\[\([0-9][0-9]*\.[0-9][0-9]*.*\)\])/\1/p' "$Sources/configure.in")
d75b03b6
FM
20if [ -z "$VersionCheck" ] ; then
21 echo "No version found in configure.in"
22 exit 1
23fi
6937c365
FM
24if [ "x$Version" != "x$VersionCheck" ] ; then
25 echo "CMakeLists and configure doesn't refer to the same version"
26 exit 1
27fi
28
164ef212
FM
29if [ ! -f "$Sources/configure" ] ; then
30 echo "Configure script not created"
31 exit 1
32fi
33
34ConfigureCheck=$(sed -n -e "s/^PACKAGE_VERSION='\([0-9][0-9]*\.[0-9][0-9]*.*\)'/\1/p" "$Sources/configure")
35if [ "x$Version" != "x$ConfigureCheck" ] ; then
36 echo "Configure script not updated"
37 echo "Run autoreconf"
38 exit 1
39fi
40
38ab941b
FM
41# Check release date
42ReleaseDate=$(sed -n -e 's/^SET(sarg_BUILDDATE "\([A-Z][a-z][a-z]-[0-3][0-9]-2[0-1][0-9][0-9]\)")/\1/p' "$Sources/CMakeLists.txt")
43if [ -z "$ReleaseDate" ] ; then
44 echo "No release date found or release date is invalide in CMakeLists.txt"
45 exit 1
46fi
47
48ReleaseDateCheck=$(sed -n -e 's/^#define VERSION PACKAGE_VERSION" \([A-Z][a-z][a-z]-[0-3][0-9]-2[0-1][0-9][0-9]\)"/\1/p' "$Sources/include/info.h")
49if [ -z "$ReleaseDateCheck" ] ; then
50 echo "No release date found or release date is invalide in include/info.h"
51 exit 1
52fi
53if [ "x$ReleaseDate" != "x$ReleaseDateCheck" ] ; then
54 echo "CMakeLists and include/info.h doesn't refer to the same release date"
55 exit 1
56fi
57
c07b849e
FM
58# make sure the ChangeLog has been updated
59LogEntry=$(sed -n -e "1,5{;/^$ReleaseDate Version $Version$/p;}" $Sources/ChangeLog)
60if [ -z "$LogEntry" ] ; then
61 echo "ChangeLog not up to date"
62 echo "It should contain an entry for \"$ReleaseDate Version $Version\""
63 exit 1
64fi
65
f23af6b9
FM
66# update the po files
67if ( ! make update-po ) ; then
68 echo "Failed to update the po files"
69 exit 1
70fi
71
72# is the git repository dirty?
73if [[ $(git diff --shortstat 2> /dev/null) != "" ]] ; then
74 echo "Git repository is dirty"
75 exit 1
76fi
77
78# check the working tree
79if ( ! git diff-files --quiet ) ; then
80 echo "Uncommitted changes in working tree"
81 exit 1
82fi
83
84# check the index for uncommitted changes
85if ( ! git diff-index --quiet --cached HEAD ) ; then
86 echo "Uncommitted changes in the index"
87 exit 1
88fi
89
90# check for untracked files
91Untracked="$(git ls-files --exclude-standard --others)"
92if [[ -n "$Untracked" ]] ; then
93 echo "Untracked files in directory"
94 echo "$Untracked"
95 exit 1
96fi
97
98# is the git tag set?
b777a758
FM
99# a valid tag can be v2.3.3 or v2.3.3_da to indicate version 2.3.3 with the Danish translation
100GitVersion=$(git describe | sed -e 's/^\(v[0-9][0-9.]*\)_.*/\1/')
101if [[ "$GitVersion" != "v$Version" ]] ; then
f23af6b9 102 echo "Git tag not set for version $Version. Use command:"
b777a758 103 echo "git tag -a \"v$Version\" -m \"v$Version\""
f23af6b9
FM
104 exit 1
105fi
106
107# prepare the archive
6937c365
FM
108SargList="$Target/sarglist.txt.unsort"
109SortList="$Target/sarglist.txt"
aee4b2ef 110DirList="$Target/sargdir.txt"
6937c365 111ExcludeList="$Target/sargexclude.txt"
aee4b2ef 112ArchiveFile="$Target/sarg-$Version.tar"
6937c365
FM
113
114SedSources=$(echo "$Sources" | sed -e 's/\./\\./')
115ls $Sources/*.c | sed -e "s/^$SedSources\///" > $SargList
116ls $Sources/include/*.h | sed -e "s/^$SedSources\///" >> $SargList
117ls $Sources/po/*.{po,gmo,pot} | sed -e "s/^$SedSources\///" >> $SargList
118
119echo "
120config.h
2879b2cb 121ABOUT-NLS
6937c365
FM
122aclocal.m4
123BETA-TESTERS
124ChangeLog
125CMakeLists.txt
6937c365
FM
126configure.in
127CONTRIBUTORS
128COPYING
129css.tpl
130DONATIONS
131Doxyfile
132exclude_codes
133htaccess
134LICENSE
135Makefile.in
2879b2cb 136PROGRAMMERS
6937c365
FM
137README
138README_cmake
139sarg.1
140sarg.conf
2879b2cb 141sarg_htaccess
6937c365
FM
142user_limit_block
143cfgaux
144documentation
145fonts
146images
147include/config.h.in
148sarg-php
a91a1f21 149sarg_manpage.xml
6937c365
FM
150po/remove-potcdate.sin
151po/Makefile.in.in
152po/POTFILES.in
153po/quot.sed
154po/Rules-quot
155po/insert-header.sin
156po/ChangeLog
157po/LINGUAS
158po/en@quot.header
159po/en@boldquot.header
160po/boldquot.sed
161po/Makevars
162sorttable/sorttable.js
163" >> $SargList
164
aee4b2ef
FM
165[ -f "$DirList" ] && rm "$DirList"
166cat $SargList | while read file
167do
168 [ -z "$file" ] && continue
169 if [ -f "$file" ] ; then
170 echo "$file" >> "$DirList"
171 elif [ -d "$file" ] ; then
172 find "$file" -type f >> "$DirList"
173 else
174 echo "Unknown file type $file"
175 exit 1
176 fi
177done
178rm "$SargList"
179
180sort -u "$DirList" | sed -e '/^$/d' > "$SortList"
181rm "$DirList"
6937c365
FM
182
183echo "
184*/.svn
185*/.git
186*~
187*.o
188.gitignore
189" > "$ExcludeList"
190
1a9bd13a 191tar cf "$ArchiveFile" -C "$Sources" --files-from="$SortList" --exclude-from="$ExcludeList" --no-recursion --transform="s,^,sarg-$Version/," --owner root --group root --mode 644
aee4b2ef
FM
192tar rf "$ArchiveFile" -C "$Sources" "configure" --exclude-from="$ExcludeList" --transform="s,^,sarg-$Version/," --owner root --group root --mode 755
193gzip -f "$ArchiveFile"
194CompressFile="$ArchiveFile.gz"
6937c365
FM
195
196md5sum $CompressFile > "$Target/sarg-$Version.md5sum"
197echo "md5sum:"
198cat "$Target/sarg-$Version.md5sum"
199
200sha1sum $CompressFile > "$Target/sarg-$Version.sha1sum"
201echo "sha1sum:"
202cat "$Target/sarg-$Version.sha1sum"
203
204sha256sum $CompressFile > "$Target/sarg-$Version.sha256sum"
205echo "sha256sum:"
206cat "$Target/sarg-$Version.sha256sum"