[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Pkg-haskell-commits] darcs: haskell-hoogle: Collect txt files from /usr/lib/ghc-doc/hoogle/ dir.



Hi,

Am Donnerstag, den 04.10.2012, 22:58 +0900 schrieb Kiwamu Okabe:
> >> +if [ "$TXTFILES" = "" ]; then
> >> +  echo "No txt files on /usr/lib/ghc-doc/hoogle/ dir..."
> >> +else
> >> +  echo "Collect txt files from /usr/lib/ghc-doc/hoogle/ dir"
> >> +  cp $TXTFILES $DATABASE_DIR/
> >> +fi
> >>
> >>  # convert
> >>  for i in $DATABASE_DIR/*.txt; do
> >
> > What is the point of first copying them and then converting them? Can’t
> > you just pass the filename in /usr/lib/ghc-doc/hoogle/ to hoogle?
> 
> How about this patch?
> 
> diff -rN -u old-debian/files_hoogle/update-hoogle
> new-debian/files_hoogle/update-hoogle
> --- old-debian/files_hoogle/update-hoogle       2012-10-04
> 22:55:20.711946275 +0900
> +++ new-debian/files_hoogle/update-hoogle       2012-10-04
> 22:55:20.715946292 +0900
> @@ -15,18 +15,12 @@
>  # new database
>  $HOOGLE data keyword
> 
> -TXTFILES=`find /usr/lib/ghc-doc/hoogle/ -name "*.txt" 2>/dev/null`
> -if [ "$TXTFILES" = "" ]; then
> -  echo "No txt files on /usr/lib/ghc-doc/hoogle/ dir..."
> -else
> -  echo "Collect txt files from /usr/lib/ghc-doc/hoogle/ dir"
> -  cp $TXTFILES $DATABASE_DIR/
> -fi
> +TXTFILES=`find /usr/lib/ghc-doc/hoogle/ -name "*.txt"`
> 
>  # convert
> -for i in $DATABASE_DIR/*.txt; do
> +for i in $TXTFILES; do
>      echo "Convert $i"
> -    $HOOGLE convert $i >/dev/null 2>&1
> +    $HOOGLE convert $i $DATABASE_DIR/`basename $i`.hoo >/dev/null 2>&1
>  done

I find that better, thanks.

Have you thought about only converting a file from $i if it is newer
than the corresponding .hoo file? Otherwise, with lots of installed
package, installing any new package will trigger a convert on _all_ .txt
files, which will become annoying.

If you do that, you should probably delete all .hoo files on upgrade, in
case the internal hoogle format changes.

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
Debian Developer
  nomeata@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: nomeata@joachim-breitner.de | http://people.debian.org/~nomeata

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: