summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2015-11-14 03:51:46 +0000
committerNorbert Preining <preining@logic.at>2015-11-14 03:51:46 +0000
commita1d415d842dff01e500201586f34ad3f3add237c (patch)
tree1b608c55d3143c20cb6b54abd3440290ed2426bc /Master/tlpkg
parent741cf249ebeeb8572471091720868f80fbc3f645 (diff)
add tl-list-format-deps based on analysis of -recorder output
git-svn-id: svn://tug.org/texlive/trunk@38850 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rwxr-xr-xMaster/tlpkg/bin/tl-list-format-deps82
1 files changed, 82 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/tl-list-format-deps b/Master/tlpkg/bin/tl-list-format-deps
new file mode 100755
index 00000000000..05d86d3775d
--- /dev/null
+++ b/Master/tlpkg/bin/tl-list-format-deps
@@ -0,0 +1,82 @@
+#!/bin/bash
+# tl-list-format-deps
+# Create format dependencies
+# (C) 2015 Norbert Preining
+# public domain
+#
+
+# check necessary files before we start
+if ! command -v tlpfiles >/dev/null 2>&1 ; then
+ echo "tlpfiles program not found, exiting!" >&2
+ exit 1
+fi
+
+texmfvar=`kpsewhich -var-value TEXMFSYSVAR`
+texmfroot=`kpsewhich -var-value TEXMFROOT`
+
+out=format-deps.`date +%Y%m%d%H%M`
+if [ -r $out ] ; then
+ echo "output file $out already exists, exiting" >&2
+ exit 1
+else
+ touch $out
+fi
+
+# rebuild all formats with recorder output
+# needs recent fmtutil!
+read -p "Should we rebuild all formats with recorder option?
+(can only be skipped if uptodate .fls/.ofl files are already available!)
+Y/n: " -t 5 yn
+case $yn in
+ [Nn]* ) echo "skipping format rebuild!" ;;
+ * ) echo "Rebuilding formats ... please wait a bit!" ;
+ fmtutil-sys --recorder --all --quiet
+ ;;
+esac
+
+# temp dir for created files
+td=`mktemp -d`
+
+# first strip all irrelevant info from the .fls
+for i in $texmfvar/web2c/*/*.fls $texmfvar/web2c/*/*.ofl ; do
+ fmt=$(basename $i .fls)
+ fmt=$(basename $fmt .ofl)
+ grep -v ^PWD $i | \
+ grep -v ^OUTPUT | \
+ awk '{print$2}' | \
+ sed -e "s!$texmfroot/!!" | \
+ grep -v '^\./texsys.aux' | \
+ grep -v '^texmf.cnf' | \
+ grep -v '^texmf-config' | \
+ grep -v '^texmf-var' | \
+ grep -v '^texmf/' | \
+ cat > $td/$fmt.input
+done
+
+# next collect all files used of all, and uniq them
+usedfls=`cat $td/*.input | sort | uniq`
+tlpfiles -fullpath -pkgof "$usedfls" > $td/file-to-pkg
+
+for i in $td/*.input ; do
+ fmt=$(basename $i .input)
+ for f in `cat $i` ; do
+ fnd=`grep -P "\t$f" $td/file-to-pkg`
+ if [ -n "$fnd" ] ; then
+ pkg=$(echo $fnd | awk '{print$1}')
+ echo $pkg >> $td/$fmt.packages.tmp
+ echo "$pkg:$f" >> $td/$fmt.input.with-pkgs
+ else
+ echo "cannot find $f for $fmt!" >&2
+ fi
+ done
+ sort $td/$fmt.packages.tmp | uniq > $td/$fmt.packages
+ echo $fmt >> $out
+ echo "------------" >> $out
+ cat $td/$fmt.packages >> $out
+ echo >> $out
+ rm $td/$fmt.packages.tmp
+done
+
+echo "Output stored in $out"
+echo "Temporary files in $td, please remove if not needed."
+