summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-man
blob: 87ecfcc9d155484edf4294dcfdca5a21ba9d98da (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
#!/bin/sh
# $Id$
# Public domain.  Originally written 2008, Karl Berry.
# 
# This script is run by hand at the end of a release cycle to copy changed
# man pages from the temporary install tree resulting from a normal
# build to the live Master hierarchy.
# 
# For a way to undo, see kludge script ~karl/bin/tl-unman.

chicken= #echo

mydir=`cd \`dirname $0\` && pwd`
Master=`cd $mydir/../.. && pwd`
Build=`cd $Master/../Build && pwd`
Build_inst=`cd $Build/source/inst && pwd`

: ${TMPDIR=/tmp}

for sect in 1 5; do
  # existing:
  rundir=$Master/texmf-dist/doc/man/man$sect
  (cd $rundir && ls) >$TMPDIR/now

  # from a current build:
  cd $Build_inst/texmf-dist/doc/man/man$sect || exit 1
  # maintained/updated via CTAN and ctan2tl:
  rm -f pmxab.1 scor2prt.1 msxlint.1
  ls >$TMPDIR/new

  if test -n "`find -type l`"; then
    echo "$0: unexpected man symlinks in `pwd`" >&2
    echo "$0: everything should use .so; goodbye" >&2
    exit 1
  fi

  # copy files from build to runtime, if contents have changed.
  for f in *.$sect; do
    if cmp -s $f $rundir/$f; then :; else
      echo $f
      $chicken cp -pf $f $rundir/$f
    fi
  done

  # add new:
  needed=$TMPDIR/needed.$sect
  comm -13 $TMPDIR/now $TMPDIR/new >$needed
  test -s $needed && (cd $rundir && svn add `cat $needed`) 

  # do not delete, since many man pages aren't installed from the build,
  # but just in case we want to look:
  comm -23 $TMPDIR/now $TMPDIR/new | grep -v '\.pdf$' >>$TMPDIR/extraman.$sect
  #
  # and we can check against the binaries.
  if test $sect = 1; then
    bindir=$Master/bin/x86_64-linux
    for m in *; do
      f=`basename $m .1`
      if test ! -r "$bindir/$f"; then
        printf "$0: $f in man but not bin"
        (test "$f" = cweb || test "$f" = psutils) && printf " (expected)"
        echo
      fi
    done

    # for man1, generate make fragment for checking against man1/Makefile.
    (cd $rundir/.. && make so.rules >$TMPDIR/so.rules)
    echo "$0: check $TMPDIR/so.rules against `pwd`"
  fi
  
  # see what we've done:
  (cd $rundir && pwd && svn status)
done

echo "And run make in the man directory to remake pdfs..."