-
Notifications
You must be signed in to change notification settings - Fork 2
/
pack
executable file
·451 lines (377 loc) · 11.2 KB
/
pack
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
#! /bin/sh
#
#=============================
# script to pack a release
#
# cd /tmp; svn co [-r BRANCH] https://svn.code.sf.net/p/healpix/code/trunk Healpix_[VERSION]
# or
# ./getit
#
# cd /tmp/Healpix_[VERSION]
# ./pack
#
#=============================
. hpxconfig_functions.sh
updateVersion () {
# date string
reldate=`date +%Y-%m-%d` # eg 2009-08-31
shortdate=`date +%Y%b%d` # eg 2009Jul31
# temporary file
tmpfile="./tmpfile"
# versions number
current=`grep -v '#' ./Version`
version=${current}
echoLn "Enter version number [$current] "
read answer
[ "x$answer" != "x" ] && version="$answer"
#verstex=`echo $version | sed "s|\.|\\\\\\_|g"`
verstex=`echo $version | sed "s|\.|\\\\\\\\\\\\\\\\\\\\\\\\\\\_|g"`
echo $version $verstex $reldate
# update configure script
infile='./configure'
echoBlu "editing ${infile}"
cat $infile |\
sed "s|^HPXVERSION=.*|HPXVERSION=${version}|g" >\
$tmpfile
mv $tmpfile $infile
chmod u+x ${infile}
# update INSTALL
infile='./INSTALL'
echoBlu "editing ${infile}"
cat $infile |\
sed "s|_HPV_|$version|g" >\
$tmpfile
mv $tmpfile $infile
# update Makefile.in
infile='./Makefile.in'
echoBlu "editing ${infile}"
cat $infile |\
sed "s|_HPV_|$version|g" >\
$tmpfile
mv $tmpfile $infile
# update main directory Version file
infile='./Version'
echoBlu "editing ${infile}"
cat $infile |\
sed "s|$current|$version|g" >\
$tmpfile
mv $tmpfile $infile
# update IDL init_healpix file
infile='./src/idl/misc/init_healpix.pro'
echoBlu "editing ${infile}"
cat $infile |\
sed "s|version =.*$|version = '$version'|g" |\
sed "s|date =.*$|date = '$reldate'|g" >\
$tmpfile
mv $tmpfile $infile
# update doc/Tex/hpxversion.tex file
infile='./doc/Tex/hpxversion.tex'
echoBlu "editing ${infile}"
cat $infile |\
sed "s|newcommand{\\\\hpxversion}.*$|newcommand{\\\\hpxversion}{$version}|g" |\
sed "s|newcommand{\\\\hpxverstex}.*$|newcommand{\\\\hpxverstex}{$verstex}|g" >\
$tmpfile
mv $tmpfile $infile
cat $infile
# update F90 healpix_types file (2009-07-01)
infile='./src/f90/mod/healpix_types.F90'
echoBlu "editing ${infile}"
cat $infile |\
sed "s|healpix_version =.*$|healpix_version = '$version'|g" >\
$tmpfile
mv $tmpfile $infile
# update sourceforge URL of code sources
infile='doc/TeX/healpix_src_url.tex'
echoBlu "editing ${infile}"
cat $infile |\
sed "s|/HEAD/|/$revision/|g" >\
$tmpfile
mv $tmpfile $infile
# update C++ code version
infile='src/cxx/cxxsupport/announce.cc'
echoBlu "editing ${infile}"
cat $infile | sed "s|#define VERSION .*$|#define VERSION \"$version\"|g" > $tmpfile
#cat $infile | sed "s|string version =.*$|string version =\"$version\";|g" > $tmpfile
mv $tmpfile $infile
grep VERSION $infile
# infile='src/cxx/autotools/configure.ac'
infile='src/cxx/configure.ac'
# echoBlu "editing ${infile}" #skip edition of configure.ac for 3.81
# cat $infile | sed "s|AC_INIT.*|AC_INIT([healpix_cxx], [$version])|g" > $tmpfile
# mv $tmpfile $infile
grep VERSION $infile
infile='src/cxx/README.compilation'
echoBlu "editing ${infile}"
cat $infile | sed "s|^Starting with release ?.??,|Starting with release 3.30,|" > $tmpfile
mv $tmpfile $infile
grep release $infile
# update C++ Doxygen files
echoBlu "editing src/cxx/docsrc/*.dox files"
for p in src/cxx/docsrc/*.dox ; do
cat $p |\
sed "s|PROJECT_NUMBER.*$|PROJECT_NUMBER = $version|g" > $tmpfile
mv $tmpfile $p
done
grep PROJECT_NUMBER src/cxx/docsrc/*.dox
# update test/*.par files (2013-09)
echo "editing test/*.par files"
inlist=`find test -name \*.par`
outstring="# HEALPix $version"
suff="bk"
for file in $inlist ; do
ls -l $file
sed -i ${suff} "s|^# HEALPix.*$|$outstring|" ${file}
sed -i ${suff} "s|^# Healpix.*$|$outstring|" ${file}
grep "$outstring" $file
\rm ${file}${suff}
done
# run ~/healpix_private/extra/scripts/update_examples.sh
# update test/README file (2014-01)
file='test/README'
echoBlu "editing $file file"
outstring="test data for HEALPix $version"
sed -i ${suff} "s|test data for HEALPix.*$|$outstring|" ${file}
grep "$outstring" $file
\rm ${file}${suff}
}
gettingHealpy(){
HPY_VERSION=1.12.5
hpy_repo="https://pypi.python.org/packages/source/h/healpy"
wrkdir=/tmp
cd ${wrkdir}
wget ${hpy_repo}/healpy-${HPY_VERSION}.tar.gz --no-check-certificate -O healpy-${HPY_VERSION}.tar.gz
tar -xvzpf healpy-${HPY_VERSION}.tar.gz
\rm -rf healpy
mv healpy-${HPY_VERSION} healpy
cd ${wrkdir}/healpy
# filein='setup.py' # done in ./configure
# fileout='setup2.py'
# cat ${filein} | sed "s|'--disable-shared',|'--disable-shared', '--disable-dependency-tracking',|g" > ${fileout}
# grep -H 'disable' ${filein}
# grep -H 'disable' ${fileout}
cd healpixsubmodule/src/cxx/autotools
# chmod ugo+x install-sh # done in 1.9.0
# replace hard sources by links to C++ directory, if not already done
if [ ! -s cxx ] ; then
\ln -sf ../../../../../cxx .
for dir in Healpix_cxx c_utils cxxsupport libfftpack libsharp ; do
echo "Creating link for ${dir}"
\rm -r ${dir}
\ln -sf cxx/${dir} .
done
fi
cd ${here}
mv ${wrkdir}/healpy src
}
#=======================================
NO_COLOR='\x1b[0m'
RED_COLOR='\x1b[31;01m'
GREEN_COLOR='\x1b[32;11m'
YELLOW_COLOR='\x1b[33;11m'
BLUE_COLOR='\x1b[34;11m'
MAGENTA_COLOR='\x1b[35;11m'
CYAN_COLOR='\x1b[36;11m'
echoBlu (){
echo "${BLUE_COLOR}$1${NO_COLOR}"
}
echoGrn (){
echo "${GREEN_COLOR}$1${NO_COLOR}"
}
echoRed (){
echo "${RED_COLOR}$1${NO_COLOR}"
}
#---------------
tstart=`date`
revision=`svnversion . | sed "s|[A-Z]*||g"`
echo "Revision=${revision}"
setTopDefaults
echo "This script will destroy several files and subdirectories"
echoLn "Are you sure you want to proceed ? (no/yes) [no] "
read answer
if [ "$answer" != "yes" ]; then
echo "Exiting."
exit 0
fi
here=`\pwd`
do_split=0
# echo "Do you want to split the produced tar files (for HFI DPC)"
# echoLn "[NO/yes] "
# read answer
# [ "$answer" == "yes" ] && do_split=1
#echoGrn "getting healpy (python) directory"
#gettingHealpy
echoRed "removing CVS directories..."
find . -type d -name CVS -exec \rm -rf {} \;
echoRed "removing SVN directories..."
find . -type d -name .svn -exec \rm -rf {} \;
OS=`uname -s`
updateVersion
sleep 10
mkdir -p doc/html
mkdir -p doc/pdf
mkdir -p doc/epub
echoGrn "installing java Documentation"
cd src/java
ant docs || exit
#cp -pr healpixdocs ${here}/doc/html/java
cp -pr doc ${here}/doc/html/java || exit
\rm -r dist reports build # re-instated 2010-02-22
\rm -r META-INF
ant clean
cd $here
#cp -pr src/java/healpixdocs doc/html/java
#\rm -r src/java/healpixdocs/* # re-instated 2010-02-22
echoRed "in libsharp..." # Healpix 3.60 and more
cd src/common_libraries/libsharp
autoreconf -i
cd $here
echoRed "cleaning up C++..."
cd src/cxx
autoreconf -i # Healpix 3.60 and more
cd docsrc
doxygen cxxsupport.dox
mv htmldoc cxxsupport
doxygen Healpix_cxx.dox
mv htmldoc Healpix_cxx
\rm *.dox
\rm *.tag # ??? double check ???
\rm footer.html
ln -s index_code.html index_cxx.html
ln -s index_code.html index_cxx.htm
cd $here
mv src/cxx/docsrc/* doc/html
rmdir src/cxx/docsrc
# export HEALPIX_TARGET=generic_gcc # Healpix 3.50 and before
# make doc || exit
# cd $here
# # rm -r src/cxx/doc
# mv src/cxx/doc/index.html src/cxx/doc/index_cxx.htm
# cp src/cxx/doc/index_cxx.htm src/cxx/doc/index_cxx.html
# mv src/cxx/doc/* doc/html
# rmdir src/cxx/doc
# cd src/cxx
# [ -r Makefile ] && make tidy
# \rm -rf ${HEALPIX_TARGET}
# \rm -rf build.${HEALPIX_TARGET}
#\rm -rf config/config.healpy # remove config.healpy (2011-01-31)
cd $here
oldwebsite="public_html_healpix"
newwebsite="healpix-dynamicPages"
docautodir=${newwebsite}
echoRed "remove old and new web sites"
[ -d ${oldwebsite} ] && \rm -rf ${oldwebsite}
[ -d ${newwebsite} ] && \rm -rf ${newwebsite}
echoRed "removing change logs..."
find . -name ChangeLog -exec \rm -f {} \;
echoRed "generating documentations"
# recreate directory receiving doc from doc/TeX/Makefile
mkdir -p ${docautodir}/pdf
mkdir -p ${docautodir}/html
mkdir -p ${docautodir}/epub
\rm -f ${docautodir}/pdf/*
\rm -f ${docautodir}/html/*
\rm -f ${docautodir}/epub/*
cd doc/TeX
ln -s ../../${docautodir}/pdf .
ln -s ../../${docautodir}/html .
ln -s ../../${docautodir}/epub .
make crossref || exit
make crossref || exit
make crosshtml > /dev/null || exit
make epub || exit
cd $here
echoGrn "dealing with Ximview doc"
mkdir -p doc/html/ximview
cp -p src/idl/ximview/docs/* doc/html/ximview/
echoRed "removing doc/TeX and doc/*.txt..."
\rm -rf doc/TeX
\rm -f doc/*.txt
mv ${docautodir}/html/* doc/html
mv ${docautodir}/pdf/* doc/pdf
mv ${docautodir}/epub/H* doc/epub
\rm -rf ${docautodir}/
\rm -rf DONE.txt TODO Bugs.txt
\rm -rf include bin lib
echoRed "copy favicons material"
mkdir -p doc/html/images/favicons
cp -p doc/www/htdocs/images/favicons/* doc/html/images/favicons/
echoRed "removing web site material ..."
\rm -rf doc/www
echoRed "removing non-releasable programs..."
for p in quad_ring; do
echo " $p..."
\rm -rf src/f90/$p
sed 's/'$p' *//' Makefile.in > Makefile.save
mv Makefile.save Makefile.in
done
[ -d extra ] && \rm -rf extra
# # update copyright date in header
# cd ${here}
# updateCopyrightDate
# cd ${here}
# updateHEALPixWebSite
# cd ${here}
# cf : hand_editions.sh
p='gpl_header'
echoRed "removing $p directory..."
[ -d ${p} ] && \rm -rf ${p}
echoRed "removing C++ make_release..."
\rm -rf src/cxx/autotools/make_release
\rm -rf src/cxx/make_release # 2014-12-04
echoRed "removing java make_release..."
\rm -rf src/java/make_release
echoRed "removing C make_release..."
\rm -rf src/C/make_release
for p in getit hand_editions.sh; do
echo "removing ${p} ..."
\rm -f $p
done
echoRed "removing myself..."
\rm -f $0
echoBlu "--------------------"
echoBlu $version $reldate
echoBlu "--------------------"
relsuf="${version}_${shortdate}"
tar_package="Healpix_${relsuf}.tar.gz"
zip_package="Healpix_${relsuf}.zip"
rnfile="Healpix_${relsuf}.ReleaseNotes.txt"
#tar_opts="-cvzpf"
tar_opts="-czpf"
zip_opts="-r"
echoBlu "creating tar package ../${tar_package}"
cd ..
\rm -f ${tar_package}
tar ${tar_opts} ${tar_package} `basename ${here}`
cd ${here}
echoBlu "creating zip package ../${zip_package}"
cd ..
\rm -f ${zip_package}
zip ${zip_opts} ${zip_package} `basename ${here}`
cd ${here}
if [ $do_split == 1 ] ; then
echo "splitting tar file"
tar ${tar_opts} "../Hpx_java.tar.gz" src/java
\rm -rf src/java
tar ${tar_opts} "../Hpx_test.tar.gz" test
\rm -rf test
tar ${tar_opts} "../Hpx_doc.tar.gz" doc
\rm -rf doc
tar ${tar_opts} "../Hpx_data.tar.gz" data
\rm -rf data
cd ..
tar ${tar_opts} "Healpix_src_${relsuf}.tar.gz" `basename ${here}`
cd ${here}
fi
cd ..
\rm -f ${rnfile}
echo "https://sourceforge.net/projects/healpix" > ${rnfile}
allsums ${tar_package} >> ${rnfile}
allsums ${zip_package} >> ${rnfile}
echo "sources: https://healpix.sourceforge.io/src/${version}/" >> ${rnfile}
echo "SVN url: svn://svn.code.sf.net/p/healpix/code/branches/" >> ${rnfile}
echo "SVN revision: ${revision}" >> ${rnfile}
cat $rnfile
cd ${here}
tend=`date`
echo "$tstart ... $tend"
exit