On Sat, Jul 07, 2018 at 12:40:47AM BST, Stuart Henderson wrote:
> On 2018/07/06 12:22, Raf Czlonka wrote:
> > Hi all,
> > 
> > Given that abook is in ports, could we have support for it enabled
> > in lbdb, please?
> > 
> > Regards,
> > 
> > Raf
> > 
> > Index: databases/lbdb/Makefile
> > ===================================================================
> > RCS file: /cvs/ports/databases/lbdb/Makefile,v
> > retrieving revision 1.19
> > diff -u -p -r1.19 Makefile
> > --- databases/lbdb/Makefile 29 Apr 2016 11:03:43 -0000      1.19
> > +++ databases/lbdb/Makefile 6 Jul 2018 11:19:35 -0000
> > @@ -36,7 +36,6 @@ CONFIGURE_STYLE = gnu
> >  
> >  CONFIGURE_ARGS +=  --libdir=${PREFIX}/lib/lbdb \
> >                     --with-libiconv-prefix=${LOCALBASE} \
> > -                   --without-abook \
> >                     --without-addr-email \
> >                     --without-niscat \
> >                     --without-gpg \
> > 
> 
> A bit more than that is needed, but it seems reasonable to add
> it, the extra dependency isn't too heavy.

Well, abook actually is not a dependency - it's only extra
functionality. If it isn't installed no harm done.

> Slight Makefile reordering while there. Does this work for you?

Yes and no - comments inline :^)

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/databases/lbdb/Makefile,v
> retrieving revision 1.19
> diff -u -p -r1.19 Makefile
> --- Makefile  29 Apr 2016 11:03:43 -0000      1.19
> +++ Makefile  6 Jul 2018 23:39:51 -0000
> @@ -4,6 +4,7 @@ COMMENT-main =                "little brother's databa
>  COMMENT-ldap =               LDAP support for lbdb
>  
>  VERSION =            0.40
> +REVISION-main =              0

D'oh! ;^)

>  DISTNAME =           lbdb_${VERSION}
>  PKGNAME-main =               lbdb-${VERSION}
> @@ -18,25 +19,27 @@ MULTI_PACKAGES =  -main -ldap
>  # GPLv2+
>  PERMIT_PACKAGE_CDROM =       Yes
>  
> +WANTLIB-main =               c iconv
> +
> +MASTER_SITES =               http://www.spinnaker.de/debian/
> +
> +BUILD_DEPENDS =              ${RUN_DEPENDS-main}
> +LIB_DEPENDS-main =   converters/libiconv
> +RUN_DEPENDS-main =   mail/abook

There's not need for abook to be a run dependency - m_abook module
is only usable if it is both specified in METHODS *and* abook
executable present, ignored otherwise.

>  RUN_DEPENDS-ldap =   databases/p5-ldap \
>                       databases/lbdb
>  
> -LIB_DEPENDS-main =   converters/libiconv
> -WANTLIB-main =               c iconv
>  LIB_DEPENDS-ldap =
>  WANTLIB-ldap =
>  
> -MASTER_SITES =               http://www.spinnaker.de/debian/
> -
>  MAKE_ENV =           install_prefix=${WRKINST}
>  
>  NO_TEST =            Yes
>  USE_GMAKE =          Yes
>  CONFIGURE_STYLE =    gnu
>  
> -CONFIGURE_ARGS +=    --libdir=${PREFIX}/lib/lbdb \
> +CONFIGURE_ARGS +=    --libdir=${PREFIX}/lib/lbdb \
>                       --with-libiconv-prefix=${LOCALBASE} \
> -                     --without-abook \
>                       --without-addr-email \
>                       --without-niscat \
>                       --without-gpg \
> Index: pkg/PLIST-main
> ===================================================================
> RCS file: /cvs/ports/databases/lbdb/pkg/PLIST-main,v
> retrieving revision 1.1.1.1
> diff -u -p -r1.1.1.1 PLIST-main
> --- pkg/PLIST-main    15 Jun 2008 07:22:57 -0000      1.1.1.1
> +++ pkg/PLIST-main    6 Jul 2018 23:39:51 -0000
> @@ -8,6 +8,7 @@ lib/lbdb/
>  lib/lbdb/lbdb-munge
>  lib/lbdb/lbdb_bbdb_query.el
>  lib/lbdb/lbdb_lib
> +lib/lbdb/m_abook

Double-d'oh! :^P

>  lib/lbdb/m_bbdb
>  lib/lbdb/m_fido
>  lib/lbdb/m_finger

Now, the main issue. The m_abook module doesn't work properly due
to tab escape sequences (\t) being used in sed regexes - something
sed(1) in base does not cope well with.

All that module does is running the below command:

        abook --datafile $HOME/.abook/addressbook --mutt-query "$@" \
                | sed -e '1d;s/\([^\t]*\t[^\t]*\).*/\1\tabook/'

but, due to the above, based sed(1) cuts the result short on 2nd
't' in the string, i.e.:

        firstname.surn...@example.org   Firstabook

or, if the string contains only one 't' or none at all:

        first.n...@example.org  My Name tabook

It works fine with gsed, which was obviously used when that module
was written/tested, but then gsed would need to become a run
dependency - something I am not keen on.

The "easiest" thing to do, would be to patch /usr/local/lib/lbdb/m_abook
and use literal tabs:

-               | sed -e '1d;s/\([^\t]*\t[^\t]*\).*/\1\tabook/'
+               | sed -e '1d;s/\([^     ]*      [^      ]*\).*/\1       abook/'

After the above change, it all seems to be working fine.

Thanks for looking into it.

Raf

Reply via email to