Re: [Pkg-haskell-commits] darcs: haskell-hoogle: Collect txt files from /usr/lib/ghc-doc/hoogle/ dir.
Hi Joachim,
On Thu, Oct 4, 2012 at 10:44 PM, Joachim Breitner <nomeata@debian.org> wrote:
> thanks for your work on hoogle. I hope you don’t mind some code
> review...
Thank's for your quick review!
>> -echo "Collect txt files from ghc-doc and libghc-*-doc"
>> -find /usr/share/doc -wholename "/usr/share/doc/ghc-doc/html/libraries/*/*.txt*" -or -wholename "/usr/share/doc/libghc-*-doc/html/*.txt" | \
>> - haddock-collect $URLPREFIX $DATABASE_DIR/
>> +TXTFILES=`find /usr/lib/ghc-doc/hoogle/ -name "*.txt" 2>/dev/null`
>
> I think you can remove the 2>/dev/null now, at least if you
> put /usr/lib/ghc-doc/hoogle/ in debian/dirs. As we don’t expect any
> errors, we want to see them when they become visible.
OK, I will remove it.
>> +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
# combine
Regards,
--
Kiwamu Okabe
Reply to: