summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-tlnet
blob: 1d974550297786519e91d08662ef424f6e4fee85 (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
#!/bin/sh -e
# Copyright 2008 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
# 
# Update a TeX Live tlnet area, with testing.

vc_id='$Id$'
unset CDPATH
unset LS_COLORS

chicken=false
critical=
recreate=
yyyy=2008

while test $# -gt 0; do
  case $1 in
  --critical) critical=--all;;
  --dry-run|-n) chicken=true;;
  --master) shift; Master=$1;;
  --recreate) recreate=--recreate;;
  --testlocation) shift; tltrybase=$1;;
  --help) echo "xxtodo. Sorry."; exit 0;;
  --version) echo "$vc_id"; exit 0;;
  --*) echo "$0: unrecognized option \`$1'." >&2
       exit 1;;
  *) tlweb=$1;;
  esac
  shift
done

test -z "$tlweb" && tlweb=/home/ftp/texlive/tlnet/$yyyy
if test -z "$Master"; then
  mydir=`dirname $0`
  Master=`cd $mydir/../.. && pwd`
fi

if test ! -r "$tlweb/tlpkg/texlive.tlpdb"; then
  echo "$0: no tlpdb in $tlweb/tlpkg, goodbye." >&2
  exit 1
fi

# Keep the default out of ~ftp/texlive/tlnet, which CTAN mirrors.
test -z "$tltrybase" \
&& tltrybase=`cd $tlweb/../.. && pwd`/tlnet-trial-`date +%y%m%d`
tltry=$tltrybase/tlsrc.try
echo "$0: Using tlweb=$tlweb"         # top level network directory, mirrored
echo "$0: Using tltry=$tltry"   # local working dir

# Save tlpdb in case of disaster.
cp --force --backup $tlweb/tlpkg/texlive.tlpdb* /tmp

# 
# Be sure we're starting the test cleanly.
rm -rf $tltrybase
mkdir -p $tltry
cp -al $tlweb/* $tltry  # assuming GNU cp

# Update packages in our working dir.
echo "$0: Updating $tltry in cow-shell..."
cd $tltry
cow-shell <<END_COW
echo "$0: Running tl-update-containers..."
$Master/tlpkg/bin/tl-update-containers -location $tltry $critical $recreate

# It is scary, but I guess we should update the installer package every
# day, partly for the sake of doc.html and partly so it actually gets
# tested.  Hopefully we don't break the Perl modules very often.
echo "$0: Running tl-update-install-pkg..."
$Master/tlpkg/bin/tl-update-install-pkg -o $tltry
END_COW


# 
# Now we have an updated tlweb in $tltry where only the changed files
# are actual files, the rest are hard links.
# Try to make a test installation.
cd $tltrybase
tltryinst=$tltrybase/tlinst.try

zcat $tltry/install-tl-unx.tar.gz | tar -xf -
cd install-tl
# create TL install profile:
echo "# texlive-profile from $0
selected_scheme scheme-full
TEXDIR $tltryinst/$yyyy
TEXDIRW $tltryinst/$yyyy
TEXMFSYSCONFIG $tltryinst/$yyyy/texmf-config
TEXMFSYSVAR $tltryinst/$yyyy/texmf-var
TEXMFLOCAL $tltryinst/texmf-local
TEXMFHOME ~/texmf
option_doc 1
option_fmt 1
option_letter 0
option_src 1
option_symlinks 0
" >texlive.profile

echo "$0: Running test install (log: `pwd`/install.log)..."
perl install-tl -location $tltry -profile texlive.profile >install.log 2>&1\
|| true # install-tl can fail, but we test the output, so don't abort.

# the following long grep command should filter away all *normal*
# installation messages.
# if there are any other messages they will end up on stdout and 
# thus be noticed.
unexpected_output=`cat install.log \
  | grep -Ev '^Automated TeX Live installation using profile' \
  | grep -Ev '^Installing from:' \
  | grep -Ev '^Platform: ' \
  | grep -Ev '^Distribution: inst' \
  | grep -Ev '^Directory for temporary files' \
  | grep -Ev '^Loading ' \
  | grep -Ev '^Installing to:' \
  | grep -Ev '^Installing ' \
  | grep -Ev '^(re-)?running mktexlsr' \
  | grep -Ev '^mktexlsr: Updating ' \
  | grep -Ev '^mktexlsr: Done' \
  | grep -Ev '^writing fmtutil.cnf data to' \
  | grep -Ev '^writing updmap.cfg to' \
  | grep -Ev '^writing language.(dat|def) data to' \
  | grep -Ev '^running updmap-sys' \
  | grep -Ev '^pre-generating all format file' \
  | grep -Ev 'running post install action for' \
  | grep -Ev '^ See \./index.html for links to documentati' \
  | grep -Ev '^ (http://tug.org/texlive/) contains any upda' \
  | grep -Ev '^ TeX Live is a joint project of the TeX user groups' \
  | grep -Ev '^ please consider supporting it by joining the group b' \
  | grep -Ev '^ list of groups is available on the web at' \
  | grep -Ev '^ Add ' \
  | grep -Ev '^ Most importantly, add ' \
  | grep -Ev '^ to your PATH for current and future sessions' \
  | grep -Ev '^ Welcome to TeX Live' \
  | grep -Ev 'install-tl: done' \
  | grep -Ev '^Logfile: ' \
  | grep -Ev '^Time used for installing ' \
  | cat`


# 
if test -z "$unexpected_output"; then
  # no unexpected output, so ship the new packages.
  cd $tltrybase
  if $chicken; then
    echo "$0: Chicken mode, not updating anything."
  else
    echo "$0: Test install ok, comparing containers."   # just a test
    (cd $tltry/archive && time /home/karl/bin/cmpcont) >/tmp/cmpcont 2>&1 || true
    
    echo "$0: Updating $tlweb from $tltry."
    rm -rf $tlweb
    mv $tltry $tlweb
    rm -rf $tltrybase
    echo "$0: Done."
  fi
  exit 0
else
  echo "$0: Test installation failed, not removing anything." >&2
  echo "$0: Remember to clean up the trial dir, please." >&2
  echo "$0: Here is the unexpected output:" >&2
  echo "$unexpected_output" >&2
  echo
  echo "$0: Full transcript file: `pwd`/install.log" >&2
  echo "$0: install-tl's complete log file: $tltryinst/$yyyy/install-tl.log" >&2
  exit 1
fi