rpms/man/F-11 man-1.6f-makewhatis_perf.patch, NONE, 1.1 man-1.6f-makewhatis_update.patch, NONE, 1.1

Lubomir Rintel lkundrak at fedoraproject.org
Mon Apr 20 19:54:34 UTC 2009


Author: lkundrak

Update of /cvs/pkgs/rpms/man/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv24795/F-11

Added Files:
	man-1.6f-makewhatis_perf.patch 
	man-1.6f-makewhatis_update.patch 
Log Message:
add missing patch files

man-1.6f-makewhatis_perf.patch:

--- NEW FILE man-1.6f-makewhatis_perf.patch ---
Unpacking the manual twice, just to find out wherher it's utf8 -- Bad.
Launching awk per file instead of per dir -- Bad.
Determining which decompressor to use twice -- Bad.
Constantly sorting the database keeping it inconsistent -- Bad.

diff -up man-1.6f/src/makewhatis.sh.perf man-1.6f/src/makewhatis.sh
--- man-1.6f/src/makewhatis.sh.perf	2009-04-19 23:02:45.673198925 +0200
+++ man-1.6f/src/makewhatis.sh	2009-04-19 23:02:45.691198800 +0200
@@ -36,6 +36,8 @@
 # 060719 - section choosing behavior to match man's (Mike frysinger).
 #
 # 090419 - Add -U flag, Lubomir Rintel <lkundrak at v3.sk>
+# 090419 - Don't write the database until we're finished, Lubomir Rintel <lkundrak at v3.sk>
+# 090419 - Substantial performance improvements, Lubomir Rintel <lkundrak at v3.sk>
 #
 # Note for Slackware users: "makewhatis -v -w -c" will work.
 #
@@ -218,24 +220,7 @@ do
 	    cd ${pages}$i
 	    section=$i
 	    curdir=$mandir/${pages}$i
-	    export section verbose curdir
-
-	   utf8=
-            for x in $(find $mandir/${pages}$i -name '*' $findarg0 $findarg)
-            do
-               if [ "${x%.gz}" != "${x}" ]
-               then
-                  cat=zcat
-               elif [ "${x%.bz2}" != "${x}" ]
-               then
-                  cat=bzcat
-               else
-                  cat=cat
-               fi
-   
-               if ${cat} ${x} | iconv -f utf-8 -t utf-8 -o /dev/null 2>/dev/null
-               then
-                  echo ${x} | $AWK '
+            find $mandir/${pages}$i -name '*' $findarg0 $findarg | $AWK '
 
 	    function readline() {
               if (use_zcat || use_bzcat || use_lzcat) {
@@ -295,6 +280,8 @@ do
                 } else {
                   pipe_cmd = "lzcat \"" filename "\" 2>/dev/null";
                 }
+                # Chuck output unless it is utf-8
+                pipe_cmd = pipe_cmd " |iconv -f utf-8 -t utf-8 2>/dev/null"
 		# try to avoid suspicious stuff
 		if (filename ~ /[;&|`$(]/) {
 		  print "ignored strange file name " filename " in " curdir > "/dev/stderr";
@@ -442,24 +429,23 @@ do
 	      do_one();
 	    }
 	    ' pages=$pages section=$section verbose=$verbose curdir=$curdir
-		fi
-	      done
 	    cd ..
 	 fi
-       done > $TMPFILE
+       done >> $TMPFILE
 
        cd "$here"
 
-       if [ -f ${whatisdb} ]
-       then
-         cat ${whatisdb} >> $TMPFILE
-       fi
-       tr -s '\n' < $TMPFILE | sort -u > ${whatisdb}
-
-       chmod 644 ${whatisdb}
    done
+
 done
 
+if [ -f ${whatisdb} ]
+then
+  cat ${whatisdb} >> $TMPFILE
+fi
+tr -s '\n' < $TMPFILE | sort -u > ${whatisdb}
+chmod 644 ${whatisdb}
+
 # remove tempdir
 rm -rf $TMPFILE
 

man-1.6f-makewhatis_update.patch:

--- NEW FILE man-1.6f-makewhatis_update.patch ---
diff -up man-1.6f/src/makewhatis.sh.update man-1.6f/src/makewhatis.sh
--- man-1.6f/src/makewhatis.sh.update	2009-04-19 22:01:26.900609474 +0200
+++ man-1.6f/src/makewhatis.sh	2009-04-19 22:06:46.690612151 +0200
@@ -35,6 +35,8 @@
 # 060608 - Corrected traps.
 # 060719 - section choosing behavior to match man's (Mike frysinger).
 #
+# 090419 - Add -U flag, Lubomir Rintel <lkundrak at v3.sk>
+#
 # Note for Slackware users: "makewhatis -v -w -c" will work.
 #
 # makewhatis flc 060719 (from @version@)
@@ -121,6 +123,9 @@ case $name in
 	continue;;
     -o) setwhatis=1
         continue;;
+    -U) [ -f "$whatisdb" ] && findarg="-cnewer $whatisdb"
+	update=1
+	continue;;
     -u) findarg="-ctime 0"
 	update=1
 	continue;;
@@ -133,7 +138,8 @@ case $name in
 	echo "       This will build the whatis database for the man pages"
 	echo "       found in manpath and the cat pages found in catpath."
         echo "       -s: sections (default: $sections)"
-	echo "       -u: update database with new pages"
+	echo "       -u: update database with pages added today"
+	echo "       -U: update database with pages added since last makewhatis run"
 	echo "       -v: verbose"
         echo "       -o: location of whatis database (default: $DEFWHATIS)"
 	echo "       -w: use manpath obtained from \`man --path\`"




More information about the fedora-extras-commits mailing list