summaryrefslogtreecommitdiff
path: root/Build/tools/update-auto
blob: 24a98a46c327bdf5fa9d6b8a9ef1f6330be40562 (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
#!/bin/sh
# $Id$
# Public domain.  Originally written 2003, Karl Berry.
# 
# Deal with files that are automatically updated in one way or another.
# New files need to be added manually, doesn't happen often enough.

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

chicken=echo
chicken=
cp="cp -fv"
diff="diff -U 2"

tools=`cd \`dirname $0\` && /bin/pwd`

# most stuff is in Master.
Master=`cd $tools/../../Master && /bin/pwd`
cd $Master || exit 1

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

update_list=

#  autogenerate README.EN from readme.html.
# 
$tools/htmltext <readme.en.html >$temp
if $diff README.EN $temp >$temp.en.diff; then
  echo "  README.EN ok."
else
  echo "will update README.EN."
  $chicken $cp $temp README.EN
  update_list="$update_list README.EN"
fi


#  English FAQ from ctan mirror on tug.org.
#
faqmaster=/home/ftp/tex-archive/help/uk-tex-faq
faqslave=texmf-doc/doc/english/FAQ-en
for f in $faqmaster/*; do
  # ignore some of the generated files
  echo $f | egrep '(tar.gz|dvi|ps|letterfaq.pdf)$' >/dev/null \
  && continue

  basef=`basename $f`
  faqslavef=$faqslave/$basef
  if $diff $faqslavef $f >$temp.$basef.diff; then
    echo "    $faqslavef ok."
  else
    $chicken $cp $f $faqslavef
    update_list="$update_list $faqslavef"
  fi
done
# for now, don't bother auto-updating the html files.


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


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


#  fontname from elsewhere on tug.org.
#
fontnamemaster=/home/httpd/html/fontname
fontnamedocslave=texmf-dist/doc/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
    echo "   $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
    echo "   $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).enc'`
for basef in $files; do
  fontnameencslavef=$fontnameencslave/$basef
  if $diff $fontnameencslavef $fontnamemaster/$basef >$temp.$basef.diff; then
    echo "   $fontnameencslavef ok."
  else
    $chicken $cp $fontnamemaster/$basef $fontnameencslavef
    update_list="$update_list $fontnameencslavef"
  fi
done
 

#  config.{guess,sub} from GNU.
# 
for gnuconf in config.guess config.sub; do
  url="http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/$gnuconf?rev=HEAD&content-type=text/plain"
  wget -O $temp $url >$temp.2 2>&1
  if test ! -s $temp; then
    echo "$0: skipping, could not retrieve $gnuconf:" >&2
    cat $temp.2
    continue
  fi
  if $diff $gnuconf $temp >$temp.$gnuconf.diff; then
    echo "  $gnuconf ok."
  else
    $chicken $cp $temp $gnuconf
    update_list="$update_list $gnuconf"

    # find all copies in source.
    alldev="`find ../Build/source -name $gnuconf`"
    for f in $alldev; do
      $chicken $cp $gnuconf $f
    done
    update_list="$update_list $alldev"
  fi
done


#  doc.html.
#
$tools/mkdocindex | 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
  echo "  doc.html ok."
else
  $chicken cp -v $temp.doc.new doc.html
  update_list="$update_list doc.html"
fi


if test -z "$update_list"; then
  echo "$0: nothing to update."
else
  test x"$chicken" != xecho && echo "$0: committing $update_list"
  $chicken svn commit --force-log -m$0 $update_list
fi

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