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
|
#!/bin/sh
# $Id$
# Public domain. Originally written 2005, Karl Berry.
#
# Initial attempt at pushing a ctan directory into TL.
# See ./README for a bit more info.
#
# Basic usage: ctan2tl TLPKGNAME
# --place to include final `place' invocation (repository adds/removes).
# --no-ctan if already have files in ../cdbuild/raw/PKG.
# Unlikely to work without GNU utilities.
#
# This does not actually commit anything to the repository. Without
# --place, it doesn't even create any files in the repository outside of
# cdbuild/{raw,cooked}.
mydir=`cd \`dirname $0\` && pwd` # Build/tools
raw=$mydir/../cdbuild/raw
test -d $raw || mkdir $raw
cd $raw || exit 1
if test "x$1" = x--place; then
place_chicken=
shift
else
place_chicken=-n
fi
if test "x$1" = x--no-ctan; then
copy_from_ctan=false
shift
else
copy_from_ctan=true
fi
pkg=$1
if test -z "$pkg"; then
echo "$0: no TL package name specified." >&2
exit 1
fi
ctan_dir1=`tlpkginfo --ctan-dir $pkg`
if test -z "$ctan_dir1"; then
echo "$0: can't find CTAN directory for $pkg." >&2
exit 1
fi
echo "$0: ctan dir for $1 is $ctan_dir1"
if $copy_from_ctan; then
# annoyingly, tugboat plain and tugboat latex are stored in two
# different places on ctan. we'll assume we're invoked with the latex
# dir, and now arrange to also copy in the plain stuff to a `plain'
# subdirectory, which ctan2tds.pl has a further special case to handle.
#
if test "$pkg" = tugboat; then
ctan_dir2=`echo $ctan_dir1 | sed s/latex/plain/`
destdir2=$pkg/plain
fi
# remove whatever old stuff we might have.
rm -rf $pkg
if test "$pkg" = genmisc; then
# do not copy subdirs, symlinks, or any files but .sty and .tex
# (that is, no patch.doc or pmat.zip).
mkdir -p $pkg
cp -p \
`find $ctan_dir1/* '(' -type d -o -type l ')' -prune -o \
'(' -name '*.sty' -o -name *.tex ')' -print` \
$pkg
elif test "$pkg" = rsc; then
# single bst file.
mkdir -p $pkg
cp -p $ctan_dir1 $pkg
else
# normal case (/. to deref symlinks, e.g., arabtex)
cp -pr $ctan_dir1/. $pkg
# second ctan directory (e.g., tugboat).
if test -n "$ctan_dir2"; then
cp -r $ctan_dir2 $destdir2
fi
fi
fi # end of copying from CTAN.
#
printf "\n ctan2tds\n"
rm -rf ../cooked/$pkg
test -d ../cooked || mkdir ../cooked
../ctan2tds.pl $pkg || exit 1
cd ../cooked || exit 1
printf "\n\f cooked\n"
find -depth -type d | xargs rmdir 2>/dev/null
find $pkg \! -type d -printf "%TY%Tm%Td.%TH%TM %p\n" | sort -r +1
# compare to tpm.
Master=../../../Master
tpmfile=`ls $Master/texmf*/tpm/$pkg.tpm 2>/dev/null`
if test -z "$tpmfile"; then
echo "$0: no tpm file for $pkg in `cd $Master; pwd`." >&2
else
printf "\n\f new vs. present $tpmfile\n"
rm -f /tmp/pkgfiles.*
# remove leading text in case of lines starting with texmf.
# Then assume all actual files do start with texmf.
sed -n -e '/TPM:.*Files/,$s,^texmf,./texmf,p' $tpmfile \
| grep -v '\.tpm$' \
| sort >/tmp/pkgfiles.tpm
#
# list of files in the new package we've just cooked.
(cd $pkg && find \! -type d -print) | grep -v '/cooked/' \
| sort >/tmp/pkgfiles.new
#
comm -3 /tmp/pkgfiles.new /tmp/pkgfiles.tpm
#
for common_file in `comm -12 /tmp/pkgfiles.new /tmp/pkgfiles.tpm`; do
diff --ignore-all-space -u0 $Master/$common_file $pkg/$common_file
done >/tmp/tldiff
diff_lines=`wc -l </tmp/tldiff`
diff_lines=`expr $diff_lines / 2`
printf "%d common files, ~%d lines different (/tmp/tldiff)\n" \
`comm -12 /tmp/pkgfiles.new /tmp/pkgfiles.tpm | wc -l` $diff_lines
fi
printf "\n\f place $place_chicken\n"
rm -rf $pkg.done
../place $place_chicken $pkg
status=$?
rm -rf ../raw/$pkg
exit $status
|