Eric Blake
2018-Sep-11 19:13 UTC
Re: [Libguestfs] [PATCH nbdkit 1/4] build: Move list of plugins and filters to the configure script.
On 9/11/18 1:47 PM, Richard W.M. Jones wrote:> It's easier to get it to other places if it starts out in the > configure script. > > Also split the list into language and non-language plugins. > --- > common-rules.mk | 44 ---------------------------------------- > configure.ac | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 53 insertions(+), 44 deletions(-) >> +++ b/configure.ac > @@ -542,6 +542,59 @@ AC_ARG_ENABLE([vddk],[ > [enable_vddk=yes]) > AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"]) > > +dnl List of plugins and filters. > +lang_plugins="\ > + lua \ > + ocaml \ > + perl \ > + python \ > + ruby \ > + sh \ > + tcl \ > + " > +non_lang_plugins="\ > + curl \ > + data \ > + example1 \ > + example2 \Inconsistent spacing (space-vs-tab doesn't matter in this particular context, but it looks weird to use both)> + " > +plugins="$(echo $lang_plugins $non_lang_plugins | xargs -n1 | sort -u | xargs)"Your use of xargs as a reformatter is interesting ;) Could also be spelled: $(echo $lang_plugins $non_lang_plugins | tr -s ' \t\n' ' ' | sort -u | tr ' ' '\n')" but that's longer to type, so your version is fine. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Richard W.M. Jones
2018-Sep-11 21:06 UTC
Re: [Libguestfs] [PATCH nbdkit 1/4] build: Move list of plugins and filters to the configure script.
On Tue, Sep 11, 2018 at 02:13:03PM -0500, Eric Blake wrote:> On 9/11/18 1:47 PM, Richard W.M. Jones wrote: > >It's easier to get it to other places if it starts out in the > >configure script. > > > >Also split the list into language and non-language plugins. > >--- > > common-rules.mk | 44 ---------------------------------------- > > configure.ac | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 53 insertions(+), 44 deletions(-) > > > > >+++ b/configure.ac > >@@ -542,6 +542,59 @@ AC_ARG_ENABLE([vddk],[ > > [enable_vddk=yes]) > > AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"]) > >+dnl List of plugins and filters. > >+lang_plugins="\ > >+ lua \ > >+ ocaml \ > >+ perl \ > >+ python \ > >+ ruby \ > >+ sh \ > >+ tcl \ > >+ " > >+non_lang_plugins="\ > >+ curl \ > >+ data \ > >+ example1 \ > >+ example2 \ > > Inconsistent spacing (space-vs-tab doesn't matter in this particular > context, but it looks weird to use both)Ooops. Wasn't visible in emacs, but I can fix that next time.> >+ " > >+plugins="$(echo $lang_plugins $non_lang_plugins | xargs -n1 | sort -u | xargs)" > > Your use of xargs as a reformatter is interesting ;) Could also be spelled: > > $(echo $lang_plugins $non_lang_plugins | tr -s ' \t\n' ' ' | sort -u > | tr ' ' '\n')" > > but that's longer to type, so your version is fine.This one actually came from stackoverflow: https://stackoverflow.com/a/8802788 I wanted something that would work on BSD (although I didn't test it yet ...) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Eric Blake
2018-Sep-11 21:19 UTC
Re: [Libguestfs] [PATCH nbdkit 1/4] build: Move list of plugins and filters to the configure script.
On 9/11/18 4:06 PM, Richard W.M. Jones wrote:>>> + " >>> +plugins="$(echo $lang_plugins $non_lang_plugins | xargs -n1 | sort -u | xargs)" >> >> Your use of xargs as a reformatter is interesting ;) Could also be spelled: >> >> $(echo $lang_plugins $non_lang_plugins | tr -s ' \t\n' ' ' | sort -u >> | tr ' ' '\n')" >> >> but that's longer to type, so your version is fine. > > This one actually came from stackoverflow: > > https://stackoverflow.com/a/8802788which also mentioned: plugins=$(echo $(printf %s\\n $lang_plugins $non_lang_plugins | sort -u)) for less typing, fewer processes, and no dependence on xargs. Isn't shell golf fun :)> > I wanted something that would work on BSD (although I didn't test it > yet ...)I haven't tested on BSD either, but all of the solutions listed here [whether xargs, tr, or $echo $(printf %s\\n)] are portable at least according to POSIX. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Maybe Matching Threads
- Re: [PATCH nbdkit 1/4] build: Move list of plugins and filters to the configure script.
- [PATCH nbdkit 1/4] build: Move list of plugins and filters to the configure script.
- [PATCH nbdkit 0/4] tests: Move common functions into tests/functions.sh
- [nbdkit PATCH v2] vddk: Drop support for VDDK 5.1.1
- [PATCH v2 nbdkit 0/5] tests: Move common functions into tests/functions.sh