cygport patches for TeX Live

Ken Brown kbrown@cornell.edu
Tue Dec 16 22:49:00 GMT 2014


Now that setup.exe supports perpetual postinstall scripts, I'd like to 
streamline the TeX Live postinstall process.  I'm attaching two perpetual 
postinstall scripts that I'd like to use (one before the ordinary postinstall 
scripts and one after), as well as four cygport patches.

With these changes, I was able to reduce the total postinstall time for a 
complete TeX Live install from 48 minutes to 14 minutes on my system.

Here's a summary of the changes and the reasons for them.

1. The most time-consuming command in the current postinstall process is 
mktexlsr, which is run many times.  The proposed changes reduce this to one 
call, at the beginning; all remaining postinstall commands keep the ls-R files 
up to date at minimal cost.

2. Another somewhat time-consuming command is updmap.  Each call (even just to 
enable or disable a map) takes at least 2-3 seconds.  If several maps are 
enabled/disabled at once, there's no noticeable increase in time.  The proposed 
changes use just one call to updmap to enable all maps.

3. Similarly, there are a lot of unnecessary calls to fc-cache.  I've reduced 
that to a single call, at the end.

I'm open to suggestions as to better ways to do all this.

Ken
-------------- next part --------------
postinstalldir=/etc/texmf/postinstall

for f in ${postinstalldir}/*.lsr
do
    if [ -f ${f} ]
    then
	/usr/bin/mktexlsr
	for g in ${postinstalldir}/*.lsr
	do
	    mv -f ${g} ${g}.done
	done
    fi
    break
done

if [ -f ${postinstalldir}/texlive.refresh_fmts ]
then
    /usr/bin/fmtutil-sys --refresh
    mv -f ${postinstalldir}/texlive.refresh_fmts \
       ${postinstalldir}/texlive.refresh_fmts.done
fi
-------------- next part --------------
From 408d371b734ab7295adfaf1d1ad9e4fa9481ce7c Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Tue, 25 Nov 2014 09:27:52 -0500
Subject: [PATCH 1/4] prep_texlive: remove references to /usr/share/texmf

This is no longer used as of TeX Live 2013.
---
 lib/src_postinst.cygpart | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index 9963b63..86870f5 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -371,7 +371,7 @@ __prep_texlive() {
 		_EOF
 	fi
 
-	for d in /usr/share/texmf{-dist,}/fonts/{opentype,truetype,type1}
+	for d in /usr/share/texmf-dist/fonts/{opentype,truetype,type1}
 	do
 		if [ -d ${D}${d} ]
 		then
@@ -655,14 +655,10 @@ __prepetc() {
 		__prep_freedesktop_mime || error "Shared Mime Info postinstall failed"
 	fi
 
-	for d in /usr/share/texmf{,-dist}
-	do
-		if [ -d ${D}${d} ]
-		then
-			__prep_texlive
-			break
-		fi
-	done
+	if [-d /usr/share/texmf-dist ]
+	then
+	    __prep_texlive
+	fi
 
 	if [ -d ${D}/usr/share/xsessions ]
 	then
-- 
2.1.1

-------------- next part --------------
From 8b7624d5d064bc19c4a513592d0d559201c648c0 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Wed, 26 Nov 2014 07:35:13 -0500
Subject: [PATCH 2/4] prep_texlive: remove calls to mktexlsr

Instead create a marker file in /etc/texmf/postinstall indicating that
mktexlsr should be run by a perpetual postinstall script.
---
 lib/src_postinst.cygpart | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index 86870f5..a769ffc 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -328,11 +328,9 @@ __prep_mateconf_schemas() {
 __prep_texlive() {
 	local d fmt fmts map maps
 
-	dodir /etc/postinstall /etc/preremove
+	dodir /etc/postinstall /etc/preremove /etc/texmf/postinstall
 
-	cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-		/usr/bin/mktexlsr
-	_EOF
+	/usr/bin/touch /etc/texmf/postinstall/${PN}.lsr
 
 	fmts=$(__config_get texlive_fmts)
 	maps=$(__config_get texlive_maps)
@@ -351,7 +349,6 @@ __prep_texlive() {
 		cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
 			/usr/bin/updmap-sys --nohash --syncwithtrees
 			/usr/bin/updmap-sys --nohash
-			/usr/bin/mktexlsr
 		_EOF
 	fi
 	if [ -n "${fmts#0}" ]
@@ -366,9 +363,6 @@ __prep_texlive() {
 				/usr/bin/fmtutil-sys --disablefmt $fmt
 			_EOF
 		done
-		cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-			/usr/bin/mktexlsr
-		_EOF
 	fi
 
 	for d in /usr/share/texmf-dist/fonts/{opentype,truetype,type1}
-- 
2.1.1

-------------- next part --------------
From fdb63bef25522127109bbbf36a932fc825ec6172 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Wed, 26 Nov 2014 07:53:29 -0500
Subject: [PATCH 3/4] prep_texlive: remove calls to fc-cache

Instead, create a file in /etc/texmf/postinstall listing the font
directories on which fc-cache should be run by a perpetual postinstall
script.
---
 lib/src_postinst.cygpart | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index a769ffc..5d915b1 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -369,8 +369,8 @@ __prep_texlive() {
 	do
 		if [ -d ${D}${d} ]
 		then
-			cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-				/usr/bin/fc-cache -f $d
+			cat >> ${D}/etc/texmf/postinstall/${PN}.fc <<-_EOF
+				${d}
 			_EOF
 		fi
 	done
-- 
2.1.1

-------------- next part --------------
From f642dfdbbb2ad47612ebb31cdd1b4e1372946daa Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Fri, 28 Nov 2014 10:47:49 -0500
Subject: [PATCH 4/4] prep_texlive: group enable/disable commands in calls to
 updmap

In postinstall scripts we remove the updmap calls completely and
instead create a file of commands in /etc/texmf/postinstall, to be run
by a perpetual postinstall script.  In preremove scripts we just group
the commands into a single call to updmap, since setup.exe doesn't yet
support perpetual preremove scripts.
---
 lib/src_postinst.cygpart | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index 5d915b1..818ccef 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -337,19 +337,19 @@ __prep_texlive() {
 
 	if [ -n "${maps#0}" ]
 	then
+		cat >> ${D}/etc/preremove/${PN}.sh <<-_EOF
+			/usr/bin/updmap-sys --nohash --nomkmap \\
+		_EOF
 		for map in $maps
 		do
-			cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-				/usr/bin/updmap-sys --nohash --nomkmap --enable $map
-			_EOF
 			cat >> ${D}/etc/preremove/${PN}.sh <<-_EOF
-				/usr/bin/updmap-sys --nohash --nomkmap --disable ${map#*=}
+				--disable ${map#*=} \\
+			_EOF
+			cat >> ${D}/etc/texmf/postinstall/${PN}.map <<-_EOF
+				--enable $map
 			_EOF
 		done
-		cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-			/usr/bin/updmap-sys --nohash --syncwithtrees
-			/usr/bin/updmap-sys --nohash
-		_EOF
+		echo >> ${D}/etc/preremove/${PN}.sh
 	fi
 	if [ -n "${fmts#0}" ]
 	then
-- 
2.1.1

-------------- next part --------------
postinstalldir=/etc/texmf/postinstall

maps=$(cat ${postinstalldir}/*.map)
if [ -n "${maps}" ]
then
    /usr/bin/updmap-sys --nohash --nomkmap ${maps}
    for f in ${postinstalldir}/*.map
    do
	mv -f ${f} ${f}.done
    done
    echo y | /usr/bin/updmap-sys --syncwithtrees
    /usr/bin/updmap-sys
fi

fc_dirs=$(sort -u ${postinstalldir}/*.fc)
if [ -n "${fc_dirs}" ]
then
    /usr/bin/fc-cache -f ${fc_dirs}
    for f in ${postinstalldir}/*.fc
    do
	mv -f ${f} ${f}.done
    done
fi


More information about the Cygwin-apps mailing list