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