[subversion-commit] SVN tex-common commit + diffs: r1748 - in tex-common/trunk: debian scripts

Frank Küster frank at costa.debian.org
Mon Oct 9 18:41:34 UTC 2006


Author: frank
Date: 2006-10-09 18:41:34 +0000 (Mon, 09 Oct 2006)
New Revision: 1748

Modified:
   tex-common/trunk/debian/changelog
   tex-common/trunk/debian/rules
   tex-common/trunk/scripts/debianize-updmap
Log:
* Fix syntax error in debianize-updmap (closes: #391976).  Also, the
  logic in the script has been fixed, so that it actually works [frank] 
* remove line dupe from rules


Modified: tex-common/trunk/debian/changelog
===================================================================
--- tex-common/trunk/debian/changelog	2006-10-09 17:12:36 UTC (rev 1747)
+++ tex-common/trunk/debian/changelog	2006-10-09 18:41:34 UTC (rev 1748)
@@ -1,3 +1,10 @@
+tex-common (0.33~1) unreleased; urgency=medium
+
+  * Fix syntax error in debianize-updmap (closes: #391976).  Also, the
+    logic in the script has been fixed, so that it actually works [frank] 
+
+ -- Frank Küster <frank at debian.org>  Mon,  9 Oct 2006 20:40:45 +0200
+
 tex-common (0.32) unstable; urgency=medium
 
   * adapted sanity check in update-fontlang to TEXMFSYSCONFIG = /etc/texmf

Modified: tex-common/trunk/debian/rules
===================================================================
--- tex-common/trunk/debian/rules	2006-10-09 17:12:36 UTC (rev 1747)
+++ tex-common/trunk/debian/rules	2006-10-09 18:41:34 UTC (rev 1748)
@@ -16,7 +16,6 @@
 bin_manpages=$(foreach script,$(bin_scripts), scripts/$(script).1) scripts/update-updmap.1
 
 nonbin_installfiles=$(foreach script,$(nonbin_scripts), scripts/$(script))
-nonbin_installfiles=$(foreach script,$(nonbin_scripts), scripts/$(script))
 
 # create maintainer scripts etc.
 EPERL_FILES := debian/common.functions debian/postinst debian/postrm debian/config debian/preinst

Modified: tex-common/trunk/scripts/debianize-updmap
===================================================================
--- tex-common/trunk/scripts/debianize-updmap	2006-10-09 17:12:36 UTC (rev 1747)
+++ tex-common/trunk/scripts/debianize-updmap	2006-10-09 18:41:34 UTC (rev 1748)
@@ -52,6 +52,8 @@
 #   find the directory containing user-specific updmap snippets
 ###############################################################################
 FindDebianUserdir(){
+#  verboseMsg "entering FindDebianUserdir"
+
   defaultuserdir=$HOME/.texmf-config/updmap.d
 
   # this should read a config item in updmap.cfg, but for now we just
@@ -68,6 +70,8 @@
 #   we are going to act on these
 ###############################################################################
 createDebianConffilelist(){
+#  verboseMsg "entering createDebianConffilelist"
+
   local DebianConffilelist=""
   syswideFiles=`find /etc/texmf/updmap.d -maxdepth 1 -type f -name '*.cfg'`
   if ! DebianSyswideMode; then
@@ -77,13 +81,19 @@
     fi
   fi
   if [ -n "$userFiles" ]; then
-    userBasenames=`for file in $userFiles; do basename $file; done`
-    for file in $syswideFiles; do
+    for sysfile in $syswideFiles; do
       local copyInUserdir=false
-      
+      for userfile in $userFiles; do
+	if [ ! "$userfile" = "$sysfile" ]; then
+	  DebianConffilelist="$DebianConffilelist $sysfile"
+	fi
+      done
     done
+    DebianConffilelist="$DebianConffilelist $userFiles"
   else
+    DebianConffilelist="$syswideFiles"
   fi
+  echo $DebianConffilelist
 }
 
 ###############################################################################
@@ -158,7 +168,12 @@
 {
   map=$1
   file="$2"
-  egrep "^(MixedMap|Map)[ 	]*$map( |	|$)" "$file" | awk '{print $1}' | sort | uniq
+
+  if egrep -q "^(MixedMap|Map)[ 	]*$map( |	|$)" "$file" ; then
+    egrep "^(MixedMap|Map)[ 	]*$map( |	|$)" "$file" | awk '{print $1}' | sort | uniq
+  else
+    return 1
+  fi
 }
 
 
@@ -180,16 +195,58 @@
 }
 
 ###############################################################################
+# snippetFileIsWritable (debCnfFile)
+#   checks whether we are (supposed to be) able to write to a file
+###############################################################################
+snippetFileIsWritable(){
+  local file=$1
+
+  if DebianSyswideMode; then
+    return 0
+  else
+    # /etc/texmf/updmap.d shouldn't be hardcoded
+    if [ "${file#/etc/texmf}" = "${file}" ]; then
+      # file is not in systemwide dir
+      return 0
+    else
+      return 1
+    fi
+  fi
+}
+
+###############################################################################
+# makeUserCopy (filename)
+#   create a copy in the user dir
+###############################################################################
+makeUserCopy(){
+  local debCnfFile="$1"
+
+  # create a copy of that file in the user dir
+  debianuserdir=`FindDebianUserdir`
+  newdebCnfFile="$debianuserdir/`basename $debCnfFile`"
+  verboseMsg "Not allowed to handle $map in $debCnfFile."
+  verboseMsg "Creating copy in $debianuserdir instead."
+  cp $debCnfFile $newdebCnfFile
+  echo "$newdebCnfFile"
+}
+
+###############################################################################
 # findRightMatchfile (mapname,filelist)
 #   find the right file from filelist to enable mapname 
 ###############################################################################
 findRightMatchfile(){
   mapName=$1; shift
   matchfiles="$@"
+  local debCnfFile=""
+
   if [ $# -eq 1 ]; then
-    # it is only one, enable map in it
-    echo $matchfiles
-    verboseMsg "Enabling map file in $matchfiles"
+    # it is only one, enable map in it.  May we write it?
+    debCnfFile=$matchfiles
+    if ! snippetFileIsWritable $debCnfFile; then
+      debCnfFile=`makeUserCopy $debCnfFile`
+    fi
+    echo $debCnfFile
+    verboseMsg "Enabling map file in $debCnfFile."
     return 0
   else
     # there are more than one; 
@@ -199,7 +256,7 @@
       if [ `(set $usermatchfiles; echo $#)` -eq 1 ]; then
         # exactly one of them is a user-specific file
 	echo $usermatchfiles
-	verboseMsg "Enabling map file in user-specific file $matchfiles"
+	verboseMsg "Enabling map file in user-specific file $usermatchfiles."
 	return 0
       else
         # two files in the user directory (as bad as two in the site-wide
@@ -289,22 +346,37 @@
 ###############################################################################
 disableMapInner()
 {
+#  verboseMsg "entering disableMapInner"
   map=$1
+  noverbose="$2"
+  oldverbose="$verbose"
+  if [ -n "$noverbose" ]; then
+    # don't confuse users with disable messages when they called --enable
+#     verboseMsg "disabling verbosity"
+    verbose=false
+  fi
+
   local mapType
 
   if [ -z "$DebianConffilelist" ]; then
     DebianConffilelist=`createDebianConffilelist`
   fi
 
-  # act on all files that contain an entry
+  # create list of all files that contain an entry
   for debCnfFile in $DebianConffilelist; do
     if mapType=`grepType $map "$debCnfFile"`; then
+      if ! snippetFileIsWritable $debCnfFile; then
+	debCnfFile=`makeUserCopy $debCnfFile`
+      fi
       # although it's a bug, there might be two types enabled - we disable both
       for type in $mapType; do
+	verboseMsg "Disabling $map in $debCnfFile."
 	configReplace "$debCnfFile" "^$type[[:space:]]*$1" "#! $type $1"
       done
     fi
   done
+  
+  verbose="$oldverbose"
 }
 
 ###############################################################################
@@ -339,7 +411,7 @@
 
   # a map can only have one type, so we carefully disable everything
   # about map here:
-  disableMapInner "$mapName"
+  disableMapInner "$mapName" noverbose
 
   # now enable with the right type.
   # But we have to determine where to enable.




More information about the Pkg-tetex-commits mailing list