ogajduse / rpms / texlive

Forked from rpms/texlive 5 years ago
Clone
0562794
#!/bin/sh
0562794
#
0562794
# This script checks out upstream archives from CTAN, removes unneeded files,
0562794
# expands files required for dependency resolution by tl2rpm.
0562794
# Written by Jindrich Novy (novyjindrich@gmail.com).
0562794
#
0562794
echo "Syncing with remote server..."
0562794
[ -e texlive/archive/asana-math.tar.xz ] && mv texlive/archive/asana-math.tar.xz texlive/archive/Asana-Math.tar.xz
0562794
[ -e texlive/archive/asana-math.doc.tar.xz ] && mv texlive/archive/asana-math.doc.tar.xz texlive/archive/Asana-Math.doc.tar.xz
0562794
[ -e texlive/archive/lineara.tar.xz ] && mv texlive/archive/lineara.tar.xz texlive/archive/linearA.tar.xz
0562794
[ -e texlive/archive/lineara.doc.tar.xz ] && mv texlive/archive/lineara.doc.tar.xz texlive/archive/linearA.doc.tar.xz
0562794
[ -e texlive/archive/lineara.source.tar.xz ] && mv texlive/archive/lineara.source.tar.xz texlive/archive/linearA.source.tar.xz
0562794
[ -e texlive/archive/musixtex-fnts.tar.xz ] && mv texlive/archive/musixtex-fnts.tar.xz texlive/archive/musixtex-fonts.tar.xz
0562794
[ -e texlive/archive/musixtex-fnts.doc.tar.xz ] && mv texlive/archive/musixtex-fnts.doc.tar.xz texlive/archive/musixtex-fonts.doc.tar.xz
0562794
#rsync -av --delete ftp.cstug.cz::pub/tex/local/tlpretest/archive texlive --delete-excluded \
0562794
#rsync -av --delete rsync://ftp.ctex.org/mirrors/texlive/tlpretest/ texlive --delete-excluded \
1b033d6
#rsync -av --delete ftp.cstug.cz::pub/tex/local/tlpretest/archive texlive --delete-excluded \
d409867
#rsync -av --delete rsync://ftp.fernuni-hagen.de/ctan/systems/texlive/tlnet/archive texlive --delete-excluded \
1b033d6
rsync -av --delete rsync://rsync.dante.ctan.org/CTAN/systems/texlive/tlnet/archive texlive --delete-excluded \
0562794
--exclude '*mactex*' \
0562794
--exclude '*.win32*' \
0562794
--exclude '*.i386-freebsd*' \
0562794
--exclude '*.i386-cygwin*' \
0562794
--exclude '*.i386-solaris*' \
0562794
--exclude '*.i386-netbsd*' \
0562794
--exclude '*.i386-kfreebsd*' \
0562794
--exclude '*.armel-linux*' \
0562794
--exclude '*.mipsel-linux*' \
0562794
--exclude '*.mips-irix*' \
0562794
--exclude '*.powerpc-*' \
0562794
--exclude '*.sparc-*' \
0562794
--exclude '*.amd64-*' \
0562794
--exclude '*.alpha-*' \
0562794
--exclude '*.x86_64-*' \
0562794
--exclude '*.universal-darwin*' \
d409867
--exclude '*.armhf-linux*' \
0562794
--exclude '*.exe.*' \
0562794
--exclude '*.exe' \
0562794
--exclude 'install-tl*' \
0562794
--exclude 'breakcites*' \
0562794
--exclude 'psutils*' \
0562794
--exclude 'rst.*' \
0562794
--exclude 't1utils*' \
0562794
--exclude 'xindy*' \
0562794
--exclude 'asymptote*' \
0562794
--exclude 'tlpkg/*' \
0562794
--exclude 'update-tlmgr*' | tee /tmp/rsynclogCTAN
0562794
EXIT=$?
0562794
[ -e texlive/archive/Asana-Math.tar.xz ] && mv texlive/archive/Asana-Math.tar.xz texlive/archive/asana-math.tar.xz
0562794
[ -e texlive/archive/Asana-Math.doc.tar.xz ] && mv texlive/archive/Asana-Math.doc.tar.xz texlive/archive/asana-math.doc.tar.xz
0562794
[ -e texlive/archive/linearA.tar.xz ] && mv texlive/archive/linearA.tar.xz texlive/archive/lineara.tar.xz
0562794
[ -e texlive/archive/linearA.doc.tar.xz ] && mv texlive/archive/linearA.doc.tar.xz texlive/archive/lineara.doc.tar.xz
0562794
[ -e texlive/archive/linearA.source.tar.xz ] && mv texlive/archive/linearA.source.tar.xz texlive/archive/lineara.source.tar.xz
0562794
[ -e texlive/archive/musixtex-fonts.tar.xz ] && mv texlive/archive/musixtex-fonts.tar.xz texlive/archive/musixtex-fnts.tar.xz
0562794
[ -e texlive/archive/musixtex-fonts.doc.tar.xz ] && mv texlive/archive/musixtex-fonts.doc.tar.xz texlive/archive/musixtex-fnts.doc.tar.xz
0562794
UPDATES=`grep 'tar.xz$' /tmp/rsynclogCTAN`
0562794
if [ "$UPDATES" == "" ]; then
0562794
  rm -f /tmp/rsynclogCTAN
0562794
  exit 0
0562794
else
0562794
  UPDATES=`grep 'tar.xz$' /tmp/rsynclogCTAN | grep -v 'deleting'`
0562794
  for i in $UPDATES; do
0562794
    echo "+ $i"
0562794
  done
0562794
fi
0562794
rm -f /tmp/rsynclogCTAN
0562794
[ $EXIT != 0 ] && exit 1
0562794
0562794
echo "Creating symlinks..."
0562794
for i in `ls texlive/archive`; do
3969a3e
  rm -f ~/rpmbuild/SOURCES/$i
0562794
done
d409867
RPMBUILDDIR=`rpm --eval "%_topdir"`
d409867
ACTDIR=`pwd`
0562794
for i in `ls texlive/archive`; do
d409867
  ln -s $ACTDIR/texlive/archive/$i $RPMBUILDDIR/SOURCES/$i
0562794
done
0562794
0562794
echo "Expanding..."
0562794
rm -rf texlive.expanded.old
3969a3e
if [ -d texlive.expanded ]; then
3969a3e
  mv texlive.expanded texlive.expanded.old
3969a3e
else
3969a3e
  mkdir -p texlive.expanded.old
3969a3e
fi
0562794
mkdir texlive.expanded
0562794
for i in texlive/archive/*.tar.xz; do
0562794
  tar xf $i -C texlive.expanded '*.sty' '*.tex' '*.cls' '*.ldf' '*.bbx' '*.cbx' '*.def' '*.tlpobj' '*.clo' '*.bug' '*.bg2' '*i386-linux*' '*texmf/scripts*' '*texmf-dist/scripts*' > /dev/null 2>&1
0562794
done
0562794
diff -ru texlive.expanded.old texlive.expanded > archive.diff
0562794
0562794
echo "Moving..."
0562794
pushd texlive.expanded
0562794
cp -pr doc source tex texmf-dist
0562794
rm -rf doc source tex
0562794
popd
0562794
0562794
echo "Generating tlpdb..."
0562794
pushd ./texlive.expanded/tlpkg/tlpobj
0562794
OUT=../../../texlive.tlpdb
0562794
mv $OUT $OUT.bck
0562794
for i in `ls *.tlpobj | grep -v '\.i386-linux.tlpobj$' | grep -v '\.doc.tlpobj$' | grep -v '\.source.tlpobj$'`; do
0562794
  NAME=`echo $i | sed 's/.tlpobj$//g'`
0562794
  grep -v '^catalogue-' $i >> $OUT
0562794
  if [ -e $NAME.doc.tlpobj ]; then
0562794
    grep '^docfiles' $NAME.doc.tlpobj >> $OUT
0562794
    grep '^ ' $NAME.doc.tlpobj >> $OUT
0562794
  fi
0562794
  if [ -e $NAME.source.tlpobj ]; then
0562794
    grep '^srcfiles' $NAME.source.tlpobj >> $OUT
0562794
    grep '^ ' $NAME.source.tlpobj >> $OUT
0562794
  fi
0562794
  grep '^catalogue-' $i >> $OUT
0562794
  echo >> $OUT
0562794
  if [ -e $NAME.i386-linux.tlpobj ]; then
0562794
    cat $NAME.i386-linux.tlpobj >> $OUT
0562794
    echo >> $OUT
0562794
  fi
0562794
done
0562794
popd
0562794
patch texlive.tlpdb < tlpdb.patch
0562794
[ "$?" = "1" ] && exit 1
0562794
diff -u texlive.tlpdb.orig texlive.tlpdb > tlpdb.patch