-
Notifications
You must be signed in to change notification settings - Fork 5
/
manage.sh
executable file
·302 lines (255 loc) · 12.6 KB
/
manage.sh
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
#/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $DIR/../../../manageUtils.sh
sfProject videlibri
VIDELIBRIBASE=$HGROOT/programs/internet/VideLibri
function pushhg(){
PUBLICHG=$HGROOT/../videlibrixidelpublichg
if [[ -e $PUBLICHG ]]; then
syncHg $VIDELIBRIBASE/_hg.filemap $HGROOT $PUBLICHG
$PUBLICHG/makebadge.sh
fi
}
INTVERSION=`grep versionNumber:integer $VIDELIBRIBASE/applicationconfig.pas | grep -oE "[0-9]+" `;
VERSION=`echo "scale=3;$INTVERSION/1000" | bc`;
VERSION=`export LC_NUMERIC=C; printf "%1.3f\n" $VERSION`;
case "$1" in
hg)
pushhg
cd $VIDELIBRIBASE/_meta/version/
webUpload version.xml changelog.xml /updates/
;;
mirror)
(cd _meta/tests; ./unittests.sh) || exit;
pushhg
(cd $HGROOT/components/pascal; ./manage.internettools.sh mirror; ./manage.synapse.sh mirror; ./manage.synapse.sh mirror; ./manage.rcmdline.sh mirror; )
SF_PROJECT=
mirroredProject videlibri
GITLAB_PROJECT=
syncHg $VIDELIBRIBASE/_hg.standalone.filemap
;;
linux32)
rm videlibri
lazCompileLinux32 bookWatch
cp videlibri videlibri.unstripped.linux32
strip --strip-all videlibri
./_meta/build.deb.sh
fileUpload videlibri_$VERSION-1_i386.deb "/VideLibri/VideLibri\ $VERSION/"
webUpload videlibri_$VERSION-1_i386.deb /updates/videlibri-linux32.deb
;;
linux64)
rm videlibri
lazCompileLinux64 bookWatch
cp videlibri videlibri.unstripped.linux64
strip --strip-all videlibri
./_meta/build.deb.sh
fileUpload videlibri_$VERSION-1_amd64.deb "/VideLibri/VideLibri\ $VERSION/"
webUpload videlibri_$VERSION-1_amd64.deb /updates/videlibri-linux64.deb
;;
win32)
rm videlibri.exe
lazCompileWin32 bookWatch
cp $VIDELIBRIBASE/videlibri.exe $VIDELIBRIBASE/videlibri.unstripped.exe
strip --strip-all $VIDELIBRIBASE/videlibri.exe
cd $VIDELIBRIBASE #innosetup does not understand absolute linux paths
sed _meta/installer/videlibri.iss -i -Ee "s/^( *AppVer(Name|sion)=[^0-9]*)[^\r]*(\r)?\$/\1$VERSION\3/"
if [ ! -f _meta/installer/openssl/cacert.pem ]; then curl https://curl.se/ca/cacert.pem > _meta/installer/openssl/cacert.pem; fi
wine ~/.wine/drive_c/programs/programming/InnoSetup/Compil32.exe _meta/installer/videlibri.iss
cd $VIDELIBRIBASE/Output
fileUpload videlibri-setup.exe "/VideLibri/VideLibri\ $VERSION/"
webUpload videlibri-setup.exe /updates/
;;
android)
cd android
ANDROIDVERSION=$(xidel android/AndroidManifest.xml -e "/manifest/@*:versionCode")
if [[ "$ANDROIDVERSION" != "$INTVERSION" ]]; then
echo Android version mismatch $ANDROIDVERSION != $INTVERSION;
sed -Ee '0,/RE/s/android:versionCode *= *["][0-9]+["]/android:versionCode="'"$INTVERSION"'"/' -i android/AndroidManifest.xml
sed -Ee '0,/RE/s/android:versionName *= *["][0-9.]+["]/android:versionName="'"$VERSION"'"/' -i android/AndroidManifest.xml
head android/AndroidManifest.xml
#read;
fi
ANDROIDVERSION=$(xidel android/AndroidManifest.xml -e "/manifest/@*:versionCode")
if [[ "$ANDROIDVERSION" != "$INTVERSION" ]]; then echo Android version mismatch "$ANDROIDVERSION" != "$INTVERSION"; read; vim android/AndroidManifest.xml; fi
ANDROIDVERSION=$(xidel android/AndroidManifest.xml -e "/manifest/@*:versionName")
if [[ "$ANDROIDVERSION" != "$VERSION" ]]; then echo Android version mismatch "$ANDROIDVERSION" != "$VERSION" ; read; vim android/AndroidManifest.xml; fi
ANDROIDVERSION=$(xidel android/AndroidManifest.xml -e "/manifest/@*:versionCode")
if [[ "$ANDROIDVERSION" != "$INTVERSION" ]]; then echo Android version mismatch; read; exit; fi
ANDROIDVERSION=$(xidel android/AndroidManifest.xml -e "/manifest/@*:versionName")
if [[ "$ANDROIDVERSION" != "$VERSION" ]]; then echo Android version mismatch; read; exit; fi
./manage.sh clean
./manage.sh build release
./manage.sh symbols
cp android/build/outputs/apk/release/android-release.apk /tmp/videlibri_$VERSION-release.apk
cd /tmp
fileUpload videlibri_$VERSION-release.apk "/VideLibri/VideLibri\ $VERSION/"
(cd ~/opt/fdroidmy/; ./publish.sh)
;;
downloadTable)
URL=http://sourceforge.net/projects/videlibri/files/VideLibri/VideLibri%20$VERSION/
PROJNAME=VideLibri
~/hg/programs/internet/xidel/xidel $URL --extract-exclude=pname,url --dot-notation=on --extract-kind=xquery \
-e "declare variable \$pname := '$PROJNAME'; ()" \
-e "declare variable \$url := '$URL'; ()" \
-e 'xquery version "3.1-xidel";
declare variable $lang := 2;
declare function verboseName($n){ concat (
if (contains($n, "win") or contains($n, ".exe")) then "Windows: "
else if (contains($n, "linux")) then "Universal Linux: "
else if (contains($n, ".deb")) then "Debian/Ubuntu: "
else if (contains($n, ".apk")) then "Android: "
else if (contains($n, "src")) then ("Source:", "Quellcode:")[$lang]
else "",
if (contains($n, "32") or contains($n, "386")) then "32 Bit"
else if (contains($n, "64"))then "64 Bit"
else "" )
};
declare function T($s){ $s[$lang] };
<div>
{ T((x"The following {$pname} downloads are available on the ",x"Es gibt die folgenden {$pname}-Downloads auf der ")) }
<a href="{$url}">{T(("sourceforge download page", "SourceForge-Downloadseite"))}</a>:
<br/><br/>
<table class="downloadTable">
<tr><th>{("Operating System", "Betriebsystem")[$lang]}</th><th>{("Filename", "Dateiname")[$lang]}</th><th>{("Size", "Dateigröße")[$lang]}</th></tr>
{ for $link in match(<TABLE id="files_list"><t:loop><TR class="file">
<TH>{{link := {{"verboseName": verboseName(.),
"name": data(.),
"href": if (a/@href) then a/@href else $url || . || "/download"
}} }}</TH>
<td/><td>{{($link).size := .}}</td></TR></t:loop></TABLE>, /).link
order by $link?verboseName descending
return <tr><td>{$link?verboseName}</td><td>
<a href="{($link).href}">{($link).name}</a></td><td>{($link).size/text()}</td></tr>}</table></div>' --printed-node-format xml > $VIDELIBRIBASE/_meta/sfsite/downloadTable.html
cat $VIDELIBRIBASE/_meta/sfsite/downloadTable.html
(cd _meta/sfsite; rm _publish/downloads.html; make )
;;
libraries.list)
export LANG=C.UTF-8
LIBS=$(ls data/libraries/*.xml | grep -oE "[^_]+_[^_]+.xml" | sort | xargs -I{} find data/libraries/ -name "*{}" -maxdepth 1 | sort | uniq)
grep -oE "[^/]*$" <<<"$LIBS" | sed -e 's/\.xml$//' | comm -23 - <(sort data/libraries/libraries.dead) > data/libraries/libraries.list
;;
create-common-interface)
xidel interface.pretty --module interface-generator-pretty-to-xml.xqm -e 'serialize(igp:make($raw), {"indent": true()})' | tee interface.xml
xidel interface.xml --module interface-generator.xqm -e '"//This file has been generated automatically. Do not edit it, do not read it.", "//Refer to the interface.pretty file", ig:pascal-make(/)' | tee commoninterface.pas
xidel interface.xml --module interface-generator.xqm -e '"//This file has been generated automatically. Do not edit it, do not read it.", "//Refer to the interface.pretty file", ig:kotlin-make(/)' | tee android/android/src/de/benibela/videlibri/jni/CommonInterface.kt
xidel interface.xml --module interface-generator.xqm -e 'ig:code-to-add-manually(/)'
# xidel interface.xml --module interface-generator.xqm -e 'ig:pascal-kotlin-make-bridge(/)'
#android/android/src/de/benibela/videlibri/PreferenceSeekBar.kt
;;
changelog)
sed -e 's/<stable *value="[0-9]*"/<stable value="'$INTVERSION'"/' -i $VIDELIBRIBASE/_meta/version/version.xml;
CHANGELOGVERSION=$(grep version= _meta/version/changelog.xml | head -2 | tail -1 | grep -oE '[0-9]+' | head -1)
if [[ "$CHANGELOGVERSION" != "$INTVERSION" ]]; then
sed '/<download/d' -i _meta/version/changelog.xml
sed '/changelog *prog/a\
'"<build version=\"$INTVERSION\" date=\"$(date +%Y-%m-%d)\">"'\
<download url="http://videlibri.sourceforge.net/updates/videlibri-setup.exe" platform="WINDOWS" execute=""$DOWNLOAD" /SP- /noicons "/dir=$OLDPATH" " restart="true"/>\
<download url="http://videlibri.sourceforge.net/updates/videlibri-linux32.deb" platform="LINUX32" execute=""/>\
<download url="http://videlibri.sourceforge.net/updates/videlibri-linux64.deb" platform="LINUX64" execute=""/>\
<change></change>\
<change></change>\
<fix></fix>\
<fix></fix>\
<fix></fix>\
<add></add>\
<add></add>\
<add></add>\
</build>' -i _meta/version/changelog.xml
fi
function xmledit(){
fn=$1
vim $fn
until xmllint $fn > /dev/null; do
echo ------------Invalid XML---------------
read
vim $fn
echo editing done
done
}
xmledit $VIDELIBRIBASE/_meta/version/version.xml
xmledit $VIDELIBRIBASE/_meta/version/changelog.xml
export fastlane=fastlane/metadata/android
xidel ./_meta/version/changelog.xml --variable fastlane -e '
for $version in //build
let $filename := x"{$fastlane}/de/changelogs/{$version/@version}.txt"
where not(file:exists($filename))
return $version!(file:write-text($filename, join((.//fix|.//add|.//change)!concat("* ", .), $line-ending))) '
while [[ $( stat $fastlane/de/changelogs/$INTVERSION.txt -c %s ) > 500 ]]; do
echo changelog too big;
stat $fastlane/de/changelogs/$INTVERSION.txt -c %s
vim $fastlane/de/changelogs/$INTVERSION.txt
done
if [[ ! -f $fastlane/en-US/changelogs/$INTVERSION.txt ]]; then
cp $fastlane/de/changelogs/$INTVERSION.txt $fastlane/en-US/changelogs/$INTVERSION.txt
vim $fastlane/en-US/changelogs/$INTVERSION.txt
fi
while [[ $( stat $fastlane/en-US/changelogs/$INTVERSION.txt -c %s ) > 500 ]]; do
echo changelog too big;
stat $fastlane/en-US/changelogs/$INTVERSION.txt -c %s
vim $fastlane/en-US/changelogs/$INTVERSION.txt
done
hg add $fastlane/*/changelogs/*
./manage.sh web
;;
web)
cd $VIDELIBRIBASE/_meta/sfsite
./maketable.sh
make
cd ../version/
rsync -av -e ssh version.xml changelog.xml "benibela,[email protected]:/home/project-web/videlibri/htdocs/updates"
;;
script)
$VIDELIBRIBASE/_meta/sfsite
cp /home/firefox/.mozilla/firefox/bpg2hcdr.default/gm_scripts/Webscraper/Webscraper.user.js script.user.js
rsync -av -e ssh script.user.js "benibela,[email protected]:/home/project-web/videlibri/htdocs/"
;;
help)
wine "/home/theo/.wine/drive_c/Programme/HTML Help Workshop/hhc.exe" _meta/help/videlibri.hhp
mv _meta/videlibri.chm data/
cd _meta/help
webUpload *.css *.gif *.html /help/
;;
colorize-icons)
function greeny { convert "$1" -modulate 100,100,133 "$2"; }
function reddy { convert "$1" -modulate 100,100,68 "$2"; }
greeny data/yellow48.png data/green48.png
reddy data/yellow48.png data/red48.png
greeny android/android/res/drawable-hdpi/icon.png android/android/res/drawable-hdpi/icong.png
reddy android/android/res/drawable-hdpi/icon.png android/android/res/drawable-hdpi/iconr.png
greeny android/android/res/drawable-xhdpi/icon.png android/android/res/drawable-xhdpi/icong.png
reddy android/android/res/drawable-xhdpi/icon.png android/android/res/drawable-xhdpi/iconr.png
;;
defaults)
setFileDefaults VideLibri/VideLibri%20$VERSION/
;;
src)
#pushhg
SRCDIR=/tmp/videlibri-$VERSION-src
rm -R $SRCDIR
cp -r $PUBLICHG $SRCDIR
cd /tmp
rm -Rvf $SRCDIR/programs/internet/xidel $SRCDIR/programs/internet/sourceforgeresponder/
cp $VIDELIBRIBASE/applicationconfig.pas $SRCDIR/programs/internet/VideLibri/
cp $VIDELIBRIBASE/_meta/version/* $SRCDIR/programs/internet/VideLibri/_meta/version/
cp $VIDELIBRIBASE/android/android/AndroidManifest.xml $SRCDIR/programs/internet/VideLibri/android/android/
tar -cvzf /tmp/videlibri-$VERSION.src.tar.gz --exclude=.hg videlibri-$VERSION-src
fileUpload videlibri-$VERSION.src.tar.gz "/VideLibri/VideLibri\ $VERSION/"
;;
release)
./manage.sh changelog
rm ~/hg/components/pascal/lib/*/*.o ~/hg/components/pascal/lib/*/*.ppu ~/hg/components/pascal/*.ppu ~/hg/components/pascal/data/*.ppu lib/*/*.ppu
./manage.sh linux64
./manage.sh win32
./manage.sh linux32
./manage.sh android
./manage.sh src
echo Sleeping because SF is slow to show the downloads
sleep 240
./manage.sh downloadTable
echo do not forget to close the commit window
thg commit
./manage.sh defaults
# hg tag "VIDELIBRI $VERSION"
# ./manage.sh mirror
;;
esac