[ITP] The Silver Searcher / Ag

Adam Dinwoodie adam@dinwoodie.org
Wed Feb 24 10:26:00 GMT 2016


On Tue, Feb 23, 2016 at 10:54:04AM -0600, Yaakov Selkowitz wrote:
> On 2016-02-23 08:42, Adam Dinwoodie wrote:
> >SRC_URI="https://github.com/ggreer/the_silver_searcher/archive/${PV}.tar.gz"
> 
> SRC_URI="https://github.com/ggreer/the_silver_searcher/archive/${VERSION}/the_silver_searcher-${VERSION}.tar.gz"
> 
> This works better with DISTDIR.

I didn't know that URL existed.  I'll switch to that and do similar for
fzf, which also uses the first version of the command.

> >the_silver_searcher_completion_REQUIRES='the_silver_searcher bash_completion'
>                                                                    ^
> That should be bash-completion with a hyphen.

Good spot, thank you!

> >  cyginstall bashcompdir=/etc/bash_completion.d
> 
> We have bash-completion-2.1 now, so you can use
> bashcompdir=$(pkg-config --variable=completionsdir bash-completion)
> -- and change *_CONTENTS accordingly.

Ooh.  I hadn't spotted that change or the addition of on-demand
completion loading.  I'll have a look at whether the other packages I
maintain can take advantage of that, too.

For this package, it doesn't look as simple as _just_ changing
bashcompdir, though, as the script is called "ag.bashcomp.sh".  That
works just fine putting the file in compatdir, but doesn't load if it's
in completionsdir, because that expects the script to just be called
"ag".  I can see a few different solutions, and I'd appreciate a second
opinion:

1. Patch the Ag build process to call the script "ag" rather than
   "ag.bashcomp.sh".  This looks like it'd be a slightly complex and
   fragile patch, though.

2. Rename "ag.bashcomp.sh" to "ag" after the cyginstall step.  This
   still feels a bit fragile to me, although less so than option 1.

3. Install the script as "ag.bashcomp.sh", then create a symlink from
   "ag" to "ag.bashcomp.sh".  I'm currently leaning towards this as the
   neatest and safest solution, not least because it uses Cygport's
   dosym rather than a bare mv, although it does leave a more-or-less
   useless file in the completions directory.

4. Just install to /etc/bash_completion.d (although probably using
   "pkg-config --variable=compatdir bash-completion), which appears to
   be what the upstream package currently intends.

Anyone have any thoughts/advances on those options?

(The neatest solution would obviously be to get the upstream package to
install in the right directory in the first place, and it looks like
they'd be amenable to such a change based on an issue from 2013[0], but
it looks like it'd require some autoconf magic to be able to handle
versions of Bash completion both with and without on-demand loading, and
autoconf is an art I do not currently have.)

[0]: https://github.com/ggreer/the_silver_searcher/issues/271



More information about the Cygwin-apps mailing list