SOURCES: man-ro-usr.patch - fixed - now database whatis is formed

charles charles at pld-linux.org
Tue Aug 9 20:39:11 CEST 2005


Author: charles                      Date: Tue Aug  9 18:39:11 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fixed - now database whatis is formed

---- Files affected:
SOURCES:
   man-ro-usr.patch (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: SOURCES/man-ro-usr.patch
diff -u SOURCES/man-ro-usr.patch:1.5 SOURCES/man-ro-usr.patch:1.6
--- SOURCES/man-ro-usr.patch:1.5	Sat Jul  9 09:51:34 2005
+++ SOURCES/man-ro-usr.patch	Tue Aug  9 20:39:06 2005
@@ -1,37 +1,139 @@
---- man-1.5p/src/makewhatis.sh	2005-01-08 18:04:00.000000000 +0000
-+++ man-1.5p.new/src/makewhatis.sh	2005-03-07 21:44:16.818469600 +0000
-@@ -156,7 +156,7 @@
-       eval path="\$$pages"path
-       for mandir in $path
-       do
+--- man-1.5p/src/makewhatis.sh.orig	2005-07-30 18:59:14.000000000 +0200
++++ man-1.5p/src/makewhatis.sh	2005-08-01 23:36:57.000000000 +0200
+@@ -74,7 +74,7 @@
+ 
+ rm -rf /var/tmp/tmpwhatis*
+ TMPFILEDIR=`mktemp -d /var/tmp/tmpwhatisXXXXXX`
+-TMPFILE=$TMPFILEDIR/w
++TMPFILE="$TMPFILEDIR/w"
+ 
+ # make sure TMPFILEDIR is deleted if program is killed or terminates
+ # (just delete this line if your shell doesnt know about trap)
+@@ -105,6 +105,8 @@
+ 	defmanpath=
+ 	defcatpath=$DEFCATPATH
+ 	continue;;
++    -r) readonly=1
++	continue;;
+     -s) setsections=1
+ 	continue;;
+     -u) findarg="-ctime 0"
+@@ -115,9 +117,10 @@
+     -w) manpath=`man --path`
+ 	catpath=$manpath
+ 	continue;;
+-    -*) echo "Usage: makewhatis [-u] [-v] [-w] [manpath] [-c [catpath]]"
++    -*) echo "Usage: makewhatis [-r] [-u] [-v] [-w] [manpath] [-c [catpath]]"
+ 	echo "       This will build the whatis database for the man pages"
+ 	echo "       found in manpath and the cat pages found in catpath."
++	echo "       -r: allow make the whatis database if /usr is read-only"
+ 	echo "       -u: update database with new pages"
+ 	echo "       -v: verbose"
+ 	echo "       -w: use manpath obtained from \`man --path\`"
+@@ -144,17 +147,28 @@
+ fi
+ catpath=`echo ${catpath} | tr : ' '`
+ 
++# always truncate
++:> /var/cache/man/whatis
++
+ # first truncate all the whatis files that will be created new,
+ # then only update - we might visit the same directory twice
+-if [ x$update = x ]; then
+-   for pages in man cat
++for pages in man cat
++do
++   eval path="\$$pages"path
++   for mandir in $path
+    do
+-      eval path="\$$pages"path
+-      for mandir in $path
+-      do
 -	 cp /dev/null $mandir/whatis
-+	 :> /var/cache/man/whatis
-       done
+-      done
++      if [ x$update = x ]; then
++        [ -w "$mandir/whatis" ] && :> "$mandir/whatis"
++      fi
++      # check write permission
++      [ ! -w "$mandir/." ] && readonly=1
     done
++done
++
++# if readonly then exclude update
++if [ x$readonly != x ]; then
++   unset $update
++   unset $findarg
  fi
-@@ -170,7 +170,7 @@
+ 
+ for pages in man cat
+@@ -166,11 +180,11 @@
       if [ x$verbose != x ]; then
  	echo "about to enter $mandir" > /dev/stderr
       fi
 -     if [ -s ${mandir}/whatis -a $pages = man -a x$update = x ]; then
-+     if [ -s /var/cache/man/whatis -a $pages = man -a x$update = x ]; then
++     if [ -s "${mandir}/whatis" -a $pages = man -a x$update = x ]; then
  	if [ x$verbose != x ]; then
- 	   echo skipping $mandir - we did it already > /dev/stderr
+-	   echo skipping $mandir - we did it already > /dev/stderr
++	   echo "skipping $mandir - we did it already" > /dev/stderr
  	fi
-@@ -401,13 +401,13 @@
- 	 mandir1=$mandir
-        fi
+-     else      
++     else
+        here=`pwd`
+        cd $mandir
+        for i in $sections
+@@ -197,7 +211,7 @@
+ 	      }
+ 	      return result;
+ 	    }
+-	    
++
+ 	    function closeline() {
+ 	      if (use_zcat || use_bzcat) {
+ 		return close(pipe_cmd);
+@@ -205,7 +219,7 @@
+ 		return close(filename);
+ 	      }
+ 	    }
+-	    
++
+ 	    function do_one() {
+ 	      insh = 0; thisjoin = 1; done = 0;
+ 	      entire_line = "";
+@@ -213,7 +227,7 @@
+ 	      if (verbose) {
+ 		print "adding " filename > "/dev/stderr"
+ 	      }
+-	      
++
+ 	      use_zcat = match(filename,"\\.Z$") ||
+ 			 match(filename,"\\.z$") || match(filename,"\\.gz$");
+ 	      if (!use_zcat)
+@@ -243,7 +257,7 @@
+ 		  return;
+ 		}
+ 	      }
+-	    
++
+ 	      while (!done && readline() > 0) {
+ 		gsub(/.\b/, "");
+ 		if (($1 ~ /^\.[Ss][Hh]/ &&
+@@ -391,13 +405,13 @@
+ 
+        mandir1=$mandir
  
 -       if [ -f ${mandir1}/whatis ]
-+       if [ -f /var/cache/man/whatis ]
-        then
+-       then
 -	 cat ${mandir1}/whatis >> $TMPFILE
-+	 cat /var/cache/man/whatis >> $TMPFILE
++       if [ x$readonly != x ]; then
++          tr -s '\n' < $TMPFILE | sort -u >> /var/cache/man/whatis
++       else
++          [ -s "${mandir1}/whatis" ] && cat "${mandir1}/whatis" >> $TMPFILE
++          tr -s '\n' < $TMPFILE | sort -u > "${mandir1}/whatis"
++          chmod 644 "${mandir1}/whatis"
         fi
-        tr -s '\n' < $TMPFILE | sort -u > ${mandir1}/whatis
- 
+-       tr -s '\n' < $TMPFILE | sort -u > ${mandir1}/whatis
+-
 -       chmod 644 ${mandir1}/whatis
-+       chmod 644 /var/cache/man/whatis
         rm $TMPFILE
       fi
     done
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/man-ro-usr.patch?r1=1.5&r2=1.6&f=u




More information about the pld-cvs-commit mailing list