summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-auto
blob: 6908d0133da311f466917a5ca41cbdc272362bbd (plain)
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
#!/bin/sh
# $Id$
# Public domain.  Originally written 2003, Karl Berry.
# 
# Deal with files that are automatically updated in one way or another.

PATH=/usr/local/gnu/bin:/usr/local/bin:$PATH; export PATH
umask 0

# maybe someday we'll make real options.
chicken=echo
chicken=
#
verbose=echo
verbose=false
#
config_scripts_only=false

TMPDIR=/tmp/tlua; export TMPDIR
test -d $TMPDIR || mkdir $TMPDIR
test -d $TMPDIR || { echo "$0: no directory $TMPDIR, goodbye." >&2; exit 1; }

cp="cp -fv"
mv="mv -fv"
diff="diff -U 2"

mydir=`cd \`dirname $0\` && /bin/pwd`
Master=`cd $mydir/../.. && /bin/pwd`
cd $Master || exit 1

temp=$TMPDIR/ua$$
trap "rm -f $temp*" 0 1 2 15

update_list=
add_list=

#  autogenerate README.EN from readme.html.
# 
if $config_scripts_only; then :; else
$mydir/htmltext <readme-html.dir/readme.en.html >$temp
if $diff readme-txt.dir/README.EN $temp >$temp.en.diff; then
  $verbose "  README.EN ok."
else
  $chicken $cp $temp readme-txt.dir/README.EN
  update_list="$update_list readme-txt.dir/README.EN"
fi
fi # !config_scripts_only


#  modes.mf from elsewhere on tug.org.
#
if $config_scripts_only; then :; else
modesmaster=/home/ftp/tex/modes.mf
modesslave=texmf-dist/metafont/misc/modes.mf
#
if $diff $modesslave $modesmaster >$temp.modes.diff; then
  $verbose "  $modesslave ok."
else
  $chicken $cp $modesmaster $modesslave
  update_list="$update_list $modesslave"
fi
fi # !config_scripts_only


#  texinfo.tex from elsewhere on tug.org.
#
if $config_scripts_only; then :; else
tximaster=/home/ftp/tex/texinfo.tex
txislave=texmf-dist/tex/texinfo/texinfo.tex
#
if $diff $txislave $tximaster >$temp.txi.diff; then
  $verbose "  $txislave ok."
else
  $chicken $cp $tximaster $txislave
  update_list="$update_list $txislave"
fi
fi # !config_scripts_only


#  fontname from elsewhere on tug.org.
#
if $config_scripts_only; then :; else
fontnamemaster=/home/httpd/html/fontname
fontnamedocslave=texmf-dist/doc/fonts/fontname
#
for basef in ChangeLog Makefile bitstrea.aka \
             fontname.pdf fontname.html fontname.texi; do
  fontnameslavef=$fontnamedocslave/$basef
  if $diff $fontnamemaster/$basef $fontnameslavef >$temp.$basef.diff; then
    $verbose "   $fontnameslavef ok."
  else
    $chicken $cp $fontnamemaster/$basef $fontnameslavef
    update_list="$update_list $fontnameslavef"
  fi
done

# fontname runtime files.
#
fontnamemapslave=texmf-dist/fonts/map/fontname
#
files=`cd $fontnamemaster && ls *.map`
for basef in $files; do
  test $basef = wolfram.map && continue   # obsolete for TL
  fontnamemapslavef=$fontnamemapslave/$basef
  if $diff $fontnamemaster/$basef $fontnamemapslavef >$temp.$basef.diff; then
    $verbose "   $fontnamemapslavef ok."
  else
    $chicken $cp $fontnamemaster/$basef $fontnamemapslavef
    update_list="$update_list $fontnamemapslavef"
  fi
done

fontnameencslave=texmf-dist/fonts/enc/dvips/base
#
files=`cd $fontnamemaster && ls *.enc | egrep -vw '(groff|t5|texnansi).enc'`
for basef in $files; do
  fontnameencslavef=$fontnameencslave/$basef
  if $diff $fontnameencslavef $fontnamemaster/$basef >$temp.$basef.diff; then
    $verbose "   $fontnameencslavef ok."
  else
    $chicken $cp $fontnamemaster/$basef $fontnameencslavef
    update_list="$update_list $fontnameencslavef"
  fi
done
fi # !config_scripts_only


#  config.guess/sub/etc. from elsewhere on tug.org, mirrored from GNU.
# ylwrap comes from automake; ltmain.sh comes from libtool.  For those
# two, have to manually remember to update when new versions are installed.
# 
config_masterdir=/home/ftp/dist/build-aux
#
for gnuconf in config.guess config.sub depcomp install-sh missing \
    texinfo.tex; do 
  master_conffile=$config_masterdir/$gnuconf
  local_conffile=../Build/source/build-aux/$gnuconf
  #
  if $diff $local_conffile $master_conffile >$temp.$gnuconf.diff; then
    $verbose "  $gnuconf ok."
    rm -f $temp
  else
    # updated needed. find all copies in source.
    # Build/source/utils/asymptote/gc* is not checked in (since it's not
    # unpacked in the original release), therefore we cannot commit to it.
    alldev="`find ../Build/source -name $gnuconf | grep -v asymptote/gc`"
    for f in $alldev; do
      $chicken $cp $master_conffile $f
    done
    update_list="$update_list $alldev"
    
    # in the case of config.guess, but nothing else, we also need it in
    # the installer.
    if test $gnuconf = config.guess; then
      installer_config_guess=tlpkg/installer/$gnuconf
      $chicken $cp $master_conffile $installer_config_guess
      update_list="$update_list $installer_config_guess"
    fi
  fi
done


#  tlmgr and install-tl man pages autogenerated.
# Arrange to ignore date differences.
# 
if $config_scripts_only; then :; else

# return 0 if files $1 and $2 are the same except for the first lines.
# (we need to ignore the timestamps in the generation lines.)
same_except_for_th ()
{
  rm -f $TMPDIR/seft1 $TMPDIR/seft2
  sed '/^\.TH/d' <"$1" >$TMPDIR/seft1
  sed '/^\.TH/d' <"$2" >$TMPDIR/seft2
  cmp -s $TMPDIR/seft1 $TMPDIR/seft2
}

mandir=texmf/doc/man
webdir=/home/httpd/html/texlive/doc
man_update=false

for script in texmf/scripts/texlive/tlmgr.pl install-tl; do
  pod2man $script >$temp

  basescript=`basename $script .pl`
  manfile=$mandir/man1/$basescript.1

  if same_except_for_th $manfile $temp; then
    $verbose "    `basename $manfile` ok."
    rm -f $manfile.new
  else
    $chicken $mv $temp $manfile
    man_update=true

    # Update the version on the web site; since these aren't checked in, we
    # can do it unconditionally.
    # 
    pod2html="$chicken pod2html --cachedir=$TMPDIR"
    $pod2html $script >$webdir/$basescript.html
  fi
done

if test -z "$chicken" && $man_update; then
  (cd $mandir && make)  # remake pdfs, should do always but better than nothing
  update_list="$update_list $mandir"
  add_list=`svn status $mandir | sed -n 's/^\? *//p'`
fi
fi # !config_scripts_only


#  doc.html.
#
if $config_scripts_only; then :; else
$mydir/tl-update-docindex | tee $temp.doc \
| grep -v '<small>Generated' >$temp.doc.new
#
grep -v '<small>Generated' doc.html >$temp.doc.cur
if $diff $temp.doc.cur $temp.doc.new >$temp.doc.diff; then
  $verbose "  doc.html ok."
else
  $chicken $cp $temp.doc.new doc.html
  update_list="$update_list doc.html"
fi
fi # !config_scripts_only


#  texcatalogue.keywords
#
if $config_scripts_only; then :; else
cat_dump=$TMPDIR/tc.xml
rm -f $cat_dump.new
wget --quiet ftp://tug.ctan.org/ftpmaint/az/texcatalogue.xml -O $cat_dump.new \
&& test -s $cat_dump.new && mv $cat_dump.new $cat_dump
# if ftp fails, we'll reprocess the old dump, but that should be harmless.
$mydir/tl-update-keywords -input $cat_dump | tee $temp.keywords \
| grep -v '# Generated' >$temp.keywords.new
#
keywordfile=texmf/scripts/texlive/var/texcatalogue.keywords
grep -v '# Generated' $keywordfile >$temp.keywords.cur
#
if test ! -s $temp.keywords.new; then
  $verbose "  $temp.keywords.new empty, skipping."
elif $diff $temp.keywords.cur $temp.keywords.new >$temp.keywords.diff; then
  $verbose "  $keywordfile ok."
else
  $chicken $cp $temp.keywords.new $keywordfile
  update_list="$update_list $keywordfile"
fi
fi # !config_scripts_only


#  ctan mirror list from ctan.
if $config_scripts_only; then :; else
ctan_mirrors=$TMPDIR/mirrors           # incoming data from CTAN
ctan_mirmon=$TMPDIR/mirmon.state
mirrors4tl=tlpkg/installer/ctan-mirrors.pl  # massaged for TL

if wget --quiet http://ctan.org/mirrors -O $ctan_mirrors \
   && rsync rsync://comedy.dante.de/MirMon/mirmon.state $ctan_mirmon; then
  $mydir/tl-update-ctan-mirrors $ctan_mirrors $ctan_mirmon >$mirrors_4tl.new
  if $diff $mirrors4tl $mirrors4tl.new; then
    $verbose "  $mirrors4tl ok."
  else
    $chicken $cp $mirrors4tl.new $mirrors4tl
    update_list="$update_list $mirrors4tl"
  fi
else
  echo "$0: ctan mirror data not retrievable, skipping." >&2
fi
fi # !config_scripts_only


#  svn commits.
status=0
if test -z "$update_list"; then
  echo "$0: nothing to update."
else
  if test -z "$add_list"; then :; else
    test x"$chicken" = xecho || echo "$0: svn adding $add_list"
    $chicken svn add $add_list
  fi
  test x"$chicken" = xecho || echo "$0: committing $update_list"
  $chicken svn commit --force-log -m$0 $update_list
  status=$?
  test $status -ne 0 && echo "$0: *** svn commit failed, fix me." >&2    
fi

echo "$0: done `date`."
exit $status