Author: pablo
Date: Fri Dec  8 19:44:11 2006
New Revision: 93847

Added:
   packages/cooker/man/current/SOURCES/man-1.5m2-i18n-whatis.patch
Removed:
   packages/cooker/man/current/SOURCES/man-1.5m2-l10ned-whatis.patch.bz2
   packages/cooker/man/current/SOURCES/man-1.5m2-lang-aware_whatis.patch.bz2
Modified:
   packages/cooker/man/current/SPECS/man.spec

Log:
- fixed makewhatis to not overwrite LANG value (reported by UTUMI Hirosi)
- added MAN_NAME and MAN_DESCRIPTION environement variables to makewhatis
  so that language-specific values can be defined
- i18n fixes and improvements to whatis and apropos (now recognizes
  LANGUAGE and only report a man page in only the first found language)
- calling awk with LC_ALL, as otherwise if the data is in a different
  encoding than the locale, the string handling doens't work (as the
  stream of bytes are not recognized as valid characters)


Added: packages/cooker/man/current/SOURCES/man-1.5m2-i18n-whatis.patch
==============================================================================
--- (empty file)
+++ packages/cooker/man/current/SOURCES/man-1.5m2-i18n-whatis.patch     Fri Dec 
 8 19:44:11 2006
@@ -0,0 +1,156 @@
+--- ./src/makewhatis.sh_i18n   2006-12-08 19:17:38.000000000 +0100
++++ ./src/makewhatis.sh        2006-12-08 19:22:25.000000000 +0100
+@@ -37,12 +37,32 @@
+ 
+ program=`basename $0`
+ 
++# this allows to define language specific values fro NAME, DESCRIPTION
++# if not defined, using those default values
++if [ -z "$MAN_NAME" ]
++then
++      MAN_NAME="ИМЕ|NOM|JMÉNO|NAVN|ΟΝΟΜΑ|NOMBRE|NIME|IZENA|NIMI|IME|\
++NÉV|NOME|名前|이름|NAAM|NAZWA|NUME|ИМЯ|MENO|НАЗВА|名称|名稱"
++fi
++if [ -z "$MAN_DESCRIPTION" ]
++then
++      MAN_DESCRIPTION="ОПИСАНИЕ|DESCRIPCIÓ|POPIS|BESKRIVELSE|BESCHREIBUNG|\
++ΠΕΡΙΓΡΑΦΗ|DESCRIPCIÓN|KIRJELDUS|AZALPENA|KUVAUS|OPIS|LEÍRÁS|DESCRIZIONE|\
++説明|설명|BESCHRIJVING|DESCRIÇÃO|DESCRIERE|ОПИС|描述"
++fi
++# make them into awk regexp
++MAN_NAME="^(${MAN_NAME})";
++MAN_DESCRIPTION="^(${MAN_DESCRIPTION})";
++
+ # In case both /usr/man and /usr/share/man exist, the former is local
+ # and should be first.
+ # It is a bug to add /var/cache/man to DEFCATPATH.
+ dm=
+ for d in /usr/share/man /usr/man
+ do
++    if [ -n "$LANG" -a -d "$d/$LANG" ]; then
++      if [ x$dm = x ]; then dm="$d/$LANG"; else dm=$dm:"$d/$LANG"; fi
++    fi
+     if [ -d $d ]; then
+       if [ x$dm = x ]; then dm=$d; else dm=$dm:$d; fi
+     fi
+@@ -51,6 +71,9 @@
+ dc=
+ for d in /var/cache/man /usr/share/man/preformat /usr/man/preformat 
/usr/share/man /usr/man
+ do
++    if [ -n "$LANG" -a -d "$d/$LANG" ]; then
++      if [ x$dc = x ]; then dm="$d/$LANG"; else dm=$dc:"$d/$LANG"; fi
++    fi
+     if [ -d $d ]; then
+       if [ x$dc = x ]; then dc=$d; else dc=$dc:$d; fi
+     fi
+@@ -180,7 +203,7 @@
+           section=$i
+           curdir=$mandir/${pages}$i
+           export section verbose curdir
+-          find $mandir/${pages}$i/. -name '*' $findarg0 $findarg -print | 
$AWK '
++          find $mandir/${pages}$i/. -name '*' $findarg0 $findarg -print | 
LC_ALL=C $AWK -v MAN_NAME="$MAN_NAME" -v MAN_DESCRIPTION="$MAN_DESCRIPTION" '
+ 
+           function readline() {
+             if (use_zcat || use_bzcat) {
+@@ -247,13 +270,7 @@
+               gsub(/.\b/, "");
+               if (($1 ~ /^\.[Ss][Hh]/ &&
+                 ($2 ~ /[Nn][Aa][Mm][Ee]/ ||
+-                 $2 ~ /^JM�NO/ || $2 ~ /^NAVN/ || $2 ~ /^NUME/ ||
+-                 $2 ~ /^BEZEICHNUNG/ || $2 ~ /^NOMBRE/ ||
+-                 $2 ~ /^NIMI/ || $2 ~ /^NOM/ || $2 ~ /^IME/ ||
+-                 $2 ~ /^N[�E]V/ || $2 ~ /^NAMA/ || $2 ~ /^̾��/ ||
+-                 $2 ~ /^̾��/ || $2 ~ /^�̸�/ || $2 ~ /^NAZWA/ ||
+-                 $2 ~ /^��������/ || $2 ~ /^����/ || $2 ~ /^�W��/ ||
+-                 $2 ~ /^NOME/ || $2 ~ /^NAAM/)) ||
++                 $2 ~ MAN_NAME )) ||
+                 (pages == "cat" && $1 ~ /^NAME/)) {
+                   if (!insh) {
+                     insh = 1;
+@@ -264,6 +281,7 @@
+                 if ($1 ~ /^\.[Ss][HhYS]/ ||
+                   (pages == "cat" &&
+                   ($1 ~ /^S[yYeE]/ || $1 ~ /^DESCRIPTION/ ||
++                   $1 ~ MAN_DESCRIPTION ||
+                    $1 ~ /^COMMAND/ || $1 ~ /^OVERVIEW/ ||
+                    $1 ~ /^STRUCTURES/ || $1 ~ /^INTRODUCTION/ ||
+                    $0 ~ /^[^ ]/))) {
+--- ./src/apropos.sh.l10n      2006-12-07 17:05:59.000000000 +0100
++++ ./src/apropos.sh   2006-12-08 19:24:17.000000000 +0100
+@@ -65,16 +65,40 @@
+     esac
+ done
+ 
++# list of languages to look for
++LANG_LIST=`echo $LANGUAGE:$LC_ALL:$LC_MESSAGES:$LANG | tr ':' ' '`
++DIR_LIST=""
++for d in /var/cache/man $manpath /usr/lib
++do
++    for l in $LANG_LIST
++    do
++      if [ -d $d/$l ]
++      then
++              # check that the path is not already in the list
++              if ! echo "$DIR_LIST" | grep " $d/$l\b" > /dev/null
++              then
++                      DIR_LIST="$DIR_LIST $d/$l"
++              fi
++      fi
++    done
++    DIR_LIST="$DIR_LIST $d"
++    # check that the path is not already in the list
++    if ! echo "$DIR_LIST" | grep " $d\b" > /dev/null
++    then
++          DIR_LIST="$DIR_LIST $d/$l"
++    fi
++done
++
+ # avoid using a pager if only output is "nothing appropriate"
+ nothing=
+ found=0
+ while [ $found = 0 -a -n "$1" ]
+ do
+-    for d in /var/cache/man $manpath /usr/lib
++    for d in $DIR_LIST
+     do
+-        if [ -f $d/whatis ]
++        if [ $found == 0 -a -f $d/whatis ]
+         then
+-            if grep -"$grepopt1"%grepsilent% "$grepopt2""$1" $d/whatis > 
/dev/null
++            if grep -"$grepopt1"q "$grepopt2""$1" $d/whatis > /dev/null
+             then
+                 found=1
+             fi
+@@ -104,13 +128,29 @@
+     done
+     nothing=
+     found=0
+-    for d in /var/cache/man $manpath /usr/lib
++    # in order not to display lines in more than one language for
++    # a same man page; we check that a given man page name
++    # hasn't already been displayed 
++    BAZ=""
++    for d in $DIR_LIST
+     do
+         if [ -f $d/whatis ]
+         then
+-            if grep -"$grepopt1" "$grepopt2""$1" $d/whatis
++            if FOO=`grep -"$grepopt1" "$grepopt2""$1" $d/whatis`
+             then
+-                found=1
++              # the LC_ALL=C is needed in case the text is 
++              # in a different encoding than the locale
++              BAR=`echo -e "$FOO" | LC_ALL=C sed 's/ - .*$//' | tr ' []' '_' 
| sort -u`
++              for i in $BAR
++              do
++                      if ! echo "$BAZ" | grep "$i" > /dev/null
++                      then
++                              BAZ="$BAZ $i"
++                              i="^`echo $i | sed 's:_\+:\\\(\[_ 
\]\\\|\\\[\\\|\\\]\\\)\\\+:g'`"
++                              echo -e "$FOO" | grep "$i"
++                              found=1
++                      fi
++              done
+             fi
+         fi
+     done

Modified: packages/cooker/man/current/SPECS/man.spec
==============================================================================
--- packages/cooker/man/current/SPECS/man.spec  (original)
+++ packages/cooker/man/current/SPECS/man.spec  Fri Dec  8 19:44:11 2006
@@ -1,7 +1,7 @@
 Summary: A set of documentation tools:  man, apropos and whatis
 Name: man
 Version: 1.5m2
-Release: %mkrel 5
+Release: %mkrel 6
 License: GPL
 Group: System/Base
 Url:    ftp://ftp.win.tue.nl:/pub/linux-local/utils/man
@@ -29,13 +29,13 @@
 
 # Japanese patches
 Patch51: man-1.5h1-gencat.patch.bz2
-Patch101: man-1.5m2-lang-aware_whatis.patch.bz2
 Patch102: man-1.5g-nonrootbuild.patch.bz2
 Patch104: man-1.5m2-tv_fhs.patch.bz2
 Patch105: man-1.5j-i18n.patch.bz2
 Patch107: man-1.5j-whatis2.patch.bz2
-Patch201: man-1.5m2-l10ned-whatis.patch.bz2
 
+# i18n fixes for whatis and makewhatis
+Patch201: man-1.5m2-i18n-whatis.patch
 Patch300: man-1.5m2-new-sections.patch.bz2
 
 
@@ -76,12 +76,11 @@
 %patch25 -p1
 %patch26 -p1 -b .color
 
-%patch101 -p1 -b .whatbz2
 %patch102 -p1
 %patch104 -p1 -b .tv_fhs
 %patch105 -p1 -b .i18n
 %patch107 -p0
-%patch201 -p0 -b .l10n
+%patch201 -p0 -b .i18n
 
 %patch300 -p1 -b .sect
 

Reply via email to