[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#402994: use new libpaper hook to track system paper size



On Thu, Dec 14, 2006 at 15:43 +0100, Ralf Stubner wrote:
> >> How about having the original files in TEXMFDIST and change texconfig
> >> such, that it writes the new files to TEXMF(SYS)VAR? That way the user
> >> will not have to deal with the files. But if needed, these files can be
> >> overruled by a file in TEXMF(SYS)CONFIG. One problem that I see right
> >> now is what texconfig(-sys) should do when such a file exists in
> >> TEXMF(SYS)CONFIG. Tricky ...
> > 
> > Hm.  Doesn't look very elegant to me.  
> 
> No, it's not. I will look at the code used in texconfig and see if
> something pops up.

Ok, this is what I have come up so far. The idea is to test where the
file we are changing originally came from. If from TEXMFCONFIG, then it
is placed there again. If from somewhere else, then it is placed in
TEXMFVAR. Up to now I have only patched fmgrConfigReplace() and tested
this with dvipdfm's config file. There are a few other places where
tcfmgr is used to edit files. So the below patch is only a proof of
concept. Comments?

cheerio
ralf

--- /usr/sbin/texconfig	2006-11-28 12:06:47.000000000 +0100
+++ /home/ralf/bin/texconfig	2006-12-15 00:08:18.958355000 +0100
@@ -255,6 +255,18 @@
 }
 
 ###############################################################################
+# setupTexmfconfig()
+#   get value for MT_TEXMFCONFIG (with caching)
+###############################################################################
+setupTexmfconfig()
+{
+  case $MT_TEXMFCONFIG in
+    "") MT_TEXMFCONFIG=`kpsewhich -var-value=TEXMFCONFIG`;;
+    *) return;;
+  esac
+}
+
+###############################################################################
 # setupSystexmf()
 #   get value for MT_SYSTEXMF (with caching)
 ###############################################################################
@@ -401,7 +413,13 @@
   set x $co; shift
   fmgrConfigReplaceID=$1; fmgrConfigReplaceCfgFile=$3; fmgrConfigReplaceOrigFile=$4
   configReplace "$fmgrConfigReplaceCfgFile" "$fmgrConfigReplaceRegex" "$fmgrConfigReplaceValue"
-  ci=`tcfmgr --tmp $tmpdir --cmd ci --id "$fmgrConfigReplaceID"`
+  # test if fmgrConfigReplaceCfgFile was in TEXMFCONFIG, if not use TEXMFVAR for output
+  setupTexmfvar # this function defines MT_TEXMVAR, not MT_TEXMFVAR. Typo?
+  setupTexmfconfig
+  moreArgs=""
+  echo $fmgrConfigReplaceOrigFile | grep $MT_TEXMFCONFIG >/dev/null \
+      || moreArgs="--texmfconfig $MT_TEXMVAR"
+  ci=`tcfmgr $moreArgs --tmp $tmpdir --cmd ci --id "$fmgrConfigReplaceID"`
   if test $? != 0; then
     echo "$progname: fmgrConfigReplace ci failed for \`$fmgrConfigReplaceFile'" >&2
     (exit 1); return 1




Reply to: