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