[go: up one dir, main page]

Menu

[b48fe1]: / archive.sh  Maximize  Restore  History

Download this file

209 lines (184 with data), 5.3 kB

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