rpms/man/devel man-1.6f-makewhatis_perf.patch, NONE, 1.1 man-1.6f-makewhatis_update.patch, NONE, 1.1 makewhatis.crondaily, 1.4, 1.5 man.spec, 1.78, 1.79 makewhatis.cronweekly, 1.4, NONE

Lubomir Rintel lkundrak at fedoraproject.org
Mon Apr 20 19:48:11 UTC 2009


Author: lkundrak

Update of /cvs/pkgs/rpms/man/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv22511/devel

Modified Files:
	makewhatis.crondaily man.spec 
Added Files:
	man-1.6f-makewhatis_perf.patch 
	man-1.6f-makewhatis_update.patch 
Removed Files:
	makewhatis.cronweekly 
Log Message:
* Sun Apr 19 2009 Lubomir Rintel <lkundrak at v3.sk> - 1.6f-18
- Get rid of slow weekly updates
- Make daily updates reliable
- Speed up initial indexation


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\`"


Index: makewhatis.crondaily
===================================================================
RCS file: /cvs/pkgs/rpms/man/devel/makewhatis.crondaily,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- makewhatis.crondaily	27 Oct 2006 08:09:52 -0000	1.4
+++ makewhatis.crondaily	20 Apr 2009 19:47:40 -0000	1.5
@@ -16,5 +16,13 @@
 
 trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
 touch $LOCKFILE
-makewhatis -u -w
+# Rebuild the database if makewhatis was since last full run,
+# otherwise just update with new pages
+if [ ! -f /var/cache/man/whatis ] ||
+   find /usr/sbin/makewhatis -newer /var/cache/man/whatis |grep -q .
+then
+	makewhatis -w
+else
+	makewhatis -U -w
+fi
 exit 0


Index: man.spec
===================================================================
RCS file: /cvs/pkgs/rpms/man/devel/man.spec,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- man.spec	25 Feb 2009 23:06:04 -0000	1.78
+++ man.spec	20 Apr 2009 19:47:40 -0000	1.79
@@ -4,13 +4,12 @@
 Summary: A set of documentation tools: man, apropos and whatis
 Name: man
 Version: 1.6f
-Release: 17%{?dist}
+Release: 18%{?dist}
 
 License: GPLv2
 Group: System Environment/Base
 URL: http://primates.ximian.com/~flucifredi/man/
 Source0: http://primates.ximian.com/~flucifredi/man/man-%{version}.tar.gz
-Source1: makewhatis.cronweekly
 Source2: makewhatis.crondaily
 Source3: mess.ru
 Source4: man-cmp.sh
@@ -37,6 +36,8 @@
 Patch33: man-1.6f-star.patch
 Patch34: man-1.6f-lang_C.patch
 Patch35: man-1.6f-makewhatis_whis.patch
+Patch36: man-1.6f-makewhatis_update.patch
+Patch37: man-1.6f-makewhatis_perf.patch
 
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: coreutils
@@ -79,6 +80,8 @@
 %patch33 -p1 -b .star
 %patch34 -p1 -b .lang
 %patch35 -p1 -b .whis
+%patch36 -p1 -b .update
+%patch37 -p1 -b .perf
 
 cp -f %{SOURCE3} msgs   # replace bad ru trans
 cp -f %{SOURCE5} ./
@@ -135,7 +138,7 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
-mkdir -p $RPM_BUILD_ROOT/etc/cron.{daily,weekly}
+mkdir -p $RPM_BUILD_ROOT/etc/cron.daily
 mkdir -p $RPM_BUILD_ROOT%{_bindir} $RPM_BUILD_ROOT%{_sbindir}
 make install PREFIX=$RPM_BUILD_ROOT
 
@@ -183,7 +186,6 @@
 
 install -m 644 src/man.conf $RPM_BUILD_ROOT/etc/man.config
 
-install -m755 %{SOURCE1} $RPM_BUILD_ROOT/etc/cron.weekly/makewhatis.cron
 install -m755 %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.daily/makewhatis.cron
 
 mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}
@@ -243,7 +245,6 @@
 
 %files -f %{name}.lang
 %defattr(-,root,root,-)
-%config(noreplace) /etc/cron.weekly/makewhatis.cron
 %config(noreplace) /etc/cron.daily/makewhatis.cron
 %config(noreplace) /etc/man.config
 %if %{usecache}
@@ -269,6 +270,11 @@
 
 
 %changelog
+* Sun Apr 19 2009 Lubomir Rintel <lkundrak at v3.sk> - 1.6f-18
+- Get rid of slow weekly updates
+- Make daily updates reliable
+- Speed up initial indexation
+
 * Wed Feb 25 2009 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.6f-17
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
 


--- makewhatis.cronweekly DELETED ---




More information about the fedora-extras-commits mailing list