From 4109734f267d2b9eaa5b4be0003bfe1faebeac31 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 11 Jun 2018 15:32:07 +0100 Subject: [PATCH] New upstream version 1.3.3. - New plugins: nbdkit-zero-plugin, nbdkit-random-plugin. - Remove upstream patches. --- ...sh-isn-t-available-disk-is-not-creat.patch | 54 --- 0002-Add-simple-bash-completion-script.patch | 369 ------------------ nbdkit.spec | 27 +- sources | 4 +- 4 files changed, 20 insertions(+), 434 deletions(-) delete mode 100644 0001-tests-If-guestfish-isn-t-available-disk-is-not-creat.patch delete mode 100644 0002-Add-simple-bash-completion-script.patch diff --git a/0001-tests-If-guestfish-isn-t-available-disk-is-not-creat.patch b/0001-tests-If-guestfish-isn-t-available-disk-is-not-creat.patch deleted file mode 100644 index a7ff863..0000000 --- a/0001-tests-If-guestfish-isn-t-available-disk-is-not-creat.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 07ecff1613b73f32b5954bd3a3d46bef6a39e396 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Sat, 9 Jun 2018 14:56:13 +0100 -Subject: [PATCH 1/2] =?UTF-8?q?tests:=20If=20guestfish=20isn't=20available?= - =?UTF-8?q?,=20=E2=80=98disk=E2=80=99=20is=20not=20created=20so=20disable?= - =?UTF-8?q?=20tests=20which=20need=20it.?= -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fixes commit 02f27adc50ed5b83021df4edc84f4dbf8b03a0e3. ---- - tests/Makefile.am | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 850240b..64a758e 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -279,6 +279,7 @@ test_file_LDADD = libtest.la $(LIBGUESTFS_LIBS) - - # gzip plugin test. - if HAVE_ZLIB -+if HAVE_GUESTFISH - - LIBGUESTFS_TESTS += test-gzip - check_DATA += disk.gz -@@ -292,6 +293,7 @@ disk.gz: disk - rm -f $@ - gzip -9 -c disk > $@ - -+endif HAVE_GUESTFISH - endif HAVE_ZLIB - - # memory plugin test. -@@ -347,6 +349,7 @@ test_streaming_LDADD = libtest.la $(LIBGUESTFS_LIBS) - - # xz plugin test. - if HAVE_LIBLZMA -+if HAVE_GUESTFISH - - LIBGUESTFS_TESTS += test-xz - check_DATA += disk.xz -@@ -360,6 +363,7 @@ disk.xz: disk - rm -f $@ - xz --best --block-size=16777216 -c disk > $@ - -+endif HAVE_GUESTFISH - endif HAVE_LIBLZMA - - #---------------------------------------------------------------------- --- -2.16.2 - diff --git a/0002-Add-simple-bash-completion-script.patch b/0002-Add-simple-bash-completion-script.patch deleted file mode 100644 index 58cfef8..0000000 --- a/0002-Add-simple-bash-completion-script.patch +++ /dev/null @@ -1,369 +0,0 @@ -From 772cfefad72f4c2ec5a72bc73f75a2921fe6054b Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Sat, 9 Jun 2018 17:01:06 +0100 -Subject: [PATCH 2/2] Add simple bash completion script. - -So far this can complete plugin names: - - $ nbdkit - curl example4 libvirt perl ruby vddk - example1 file memory python split xz - example2 guestfs nbd python2 streaming - example3 gzip null python3 tar - -Plugin parameters: - - $ nbdkit curl - password= sslverify= timeout= url= user= - -Filter names: - - $ nbdkit --filter= - cache cow delay offset partition - -General options (short or long or both): - - $ nbdkit - - --dump-config --new-style --single - --dump-plugin --newstyle --stdin - -e --no-fork -t - --exit-with-parent -o --threads - --export --old-style --tls - --export-name --oldstyle --tls-certificates - --exportname -p --tls-verify-peer - -f -P -u - --filter --pid-file -U - --foreground --pidfile --unix - -g --port --user - --group -r -v - --help --read-only -V - -i --readonly --verbose - --ip-addr --run --version - --ipaddr -s - -n --selinux-label - -And --tls options: - - $ nbdkit --tls= - off on require - -There is still quite a lot more which it doesn't do, such as -completing filter parameters, and smarter completion for options. ---- - Makefile.am | 1 + - README | 4 ++ - TODO | 2 - - bash/Makefile.am | 40 ++++++++++++++++++++ - bash/README | 8 ++++ - bash/nbdkit | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - configure.ac | 15 ++++++++ - src/main.c | 17 +++++++++ - 8 files changed, 198 insertions(+), 2 deletions(-) - create mode 100644 bash/Makefile.am - create mode 100644 bash/README - create mode 100644 bash/nbdkit - -diff --git a/Makefile.am b/Makefile.am -index 9c5b4c3..9d097f5 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -44,6 +44,7 @@ EXTRA_DIST = \ - noinst_SCRIPTS = nbdkit - - SUBDIRS = \ -+ bash \ - docs \ - include \ - src -diff --git a/README b/README -index e58df8b..a589d77 100644 ---- a/README -+++ b/README -@@ -91,6 +91,10 @@ For the OCaml plugin: - - OCaml >= 4.02.2 which has support for shared libraries, see: - http://caml.inria.fr/mantis/view.php?id=6693 - -+For bash tab completion: -+ -+ - bash-completion >= 1.99 -+ - To run the test suite: - - - bash -diff --git a/TODO b/TODO -index fe0af0c..07f40cc 100644 ---- a/TODO -+++ b/TODO -@@ -10,8 +10,6 @@ General ideas for improvements - - * Performance - measure and improve it. - --* Bash tab completion. -- - * Exit on last connection (the default behaviour of qemu-nbd unless - you use -t). - -diff --git a/bash/Makefile.am b/bash/Makefile.am -new file mode 100644 -index 0000000..2a2799a ---- /dev/null -+++ b/bash/Makefile.am -@@ -0,0 +1,40 @@ -+# nbdkit -+# Copyright (C) 2018 Red Hat Inc. -+# All rights reserved. -+# -+# Redistribution and use in source and binary forms, with or without -+# modification, are permitted provided that the following conditions are -+# met: -+# -+# * Redistributions of source code must retain the above copyright -+# notice, this list of conditions and the following disclaimer. -+# -+# * Redistributions in binary form must reproduce the above copyright -+# notice, this list of conditions and the following disclaimer in the -+# documentation and/or other materials provided with the distribution. -+# -+# * Neither the name of Red Hat nor the names of its contributors may be -+# used to endorse or promote products derived from this software without -+# specific prior written permission. -+# -+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+# SUCH DAMAGE. -+ -+EXTRA_DIST = README -+ -+if HAVE_BASH_COMPLETION -+ -+bashcompdir = @bashcompdir@ -+dist_bashcomp_DATA = nbdkit -+ -+endif -diff --git a/bash/README b/bash/README -new file mode 100644 -index 0000000..21a4f71 ---- /dev/null -+++ b/bash/README -@@ -0,0 +1,8 @@ -+This directory contains the scripts for tab-completing commands in -+bash. Note these new-style demand-loaded scripts require -+bash-completion >= 1.99. -+ -+Tip: To test the bash completions without having to install them, -+simply start a new shell and do: -+ -+ source ./bash/nbdkit; PATH=$PWD:$PATH -diff --git a/bash/nbdkit b/bash/nbdkit -new file mode 100644 -index 0000000..3db531d ---- /dev/null -+++ b/bash/nbdkit -@@ -0,0 +1,113 @@ -+# nbdkit bash completion script -*- shell-script -*- -+# Copyright (C) 2010-2018 Red Hat Inc. -+# All rights reserved. -+# -+# Redistribution and use in source and binary forms, with or without -+# modification, are permitted provided that the following conditions are -+# met: -+# -+# * Redistributions of source code must retain the above copyright -+# notice, this list of conditions and the following disclaimer. -+# -+# * Redistributions in binary form must reproduce the above copyright -+# notice, this list of conditions and the following disclaimer in the -+# documentation and/or other materials provided with the distribution. -+# -+# * Neither the name of Red Hat nor the names of its contributors may be -+# used to endorse or promote products derived from this software without -+# specific prior written permission. -+# -+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+# SUCH DAMAGE. -+ -+_nbdkit_list_plugins () -+{ -+ local plugindir -+ plugindir="$( -+ nbdkit --dump-config | grep ^plugindir= | sed 's/^plugindir=//' -+ )" -+ ls -1 "$plugindir" | sed 's/^nbdkit-//' | sed 's/-plugin.*//' -+} -+ -+_nbdkit_list_filters () -+{ -+ local filterdir -+ filterdir="$( -+ nbdkit --dump-config | grep ^filterdir= | sed 's/^filterdir=//' -+ )" -+ ls -1 "$filterdir" | sed 's/^nbdkit-//' | sed 's/-filter.*//' -+} -+ -+# This handler function is called when the user presses tab. -+_nbdkit () -+{ -+ local cur prev words cword split -+ local shortopts longopts plugin plugins filters args i -+ -+ _init_completion -s || return -+ -+ # Did we get the plugin name yet? -+ # This is only a heuristic because it can be confused by -+ # long opt parameters with an arguments. XXX -+ plugin= -+ for (( i=1; i < ${#words[@]}; ++i)) ; do -+ if [[ "${words[i]}" =~ ^[a-zA-Z0-9]+$ ]]; then -+ plugin="${words[i]}" -+ break -+ fi -+ done -+ -+ # Previous item on the current line is a completable flag or plugin name? -+ case "$prev" in -+ --filter) -+ filters="$(_nbdkit_list_filters)" -+ COMPREPLY=( $(compgen -W "$filters" "$cur") ) -+ return ;; -+ --tls) -+ COMPREPLY=( $(compgen -W "off on require" "$cur") ) -+ return ;; -+ # Could complete -u and -g options too. XXX -+ esac -+ -+ # Current item is an option we can expand? -+ case "$cur" in -+ --*) -+ longopts="$(nbdkit --long-options)" -+ COMPREPLY=( $(compgen -W "$longopts" -- "$cur") ) -+ return ;; -+ -*) -+ shortopts="$(nbdkit --short-options)" -+ longopts="$(nbdkit --long-options)" -+ COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") ) -+ return ;; -+ *) -+ if [ "$plugin" = "" ]; then -+ # Complete plugin name. -+ plugins="$(_nbdkit_list_plugins)" -+ COMPREPLY=( $(compgen -W "$plugins" "$cur") ) -+ return -+ else -+ # Complete plugin args. -+ args="$( -+ nbdkit $plugin --help 2>/dev/null | -+ grep -E '^[a-z0-9]+=' | sed 's/=.*/=/' -+ )" -+ COMPREPLY=( $(compgen -W "$args" "$cur") ) -+ return -+ fi -+ ;; -+ esac -+} -+ -+# Install the handler function. -+complete -o default -F _nbdkit nbdkit -diff --git a/configure.ac b/configure.ac -index 0ef9673..abf7048 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -164,6 +164,20 @@ AS_IF([test "$GNUTLS_LIBS" != ""],[ - dnl Check for valgrind. - AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no]) - -+dnl Bash completion. -+PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [ -+ bash_completion=yes -+ AC_MSG_CHECKING([for bash-completions directory]) -+ PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], , -+ bashcompdir="${sysconfdir}/bash_completion.d") -+ AC_MSG_RESULT([$bashcompdir]) -+ AC_SUBST([bashcompdir]) -+],[ -+ bash_completion=no -+ AC_MSG_WARN([bash-completion not installed]) -+]) -+AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"]) -+ - dnl Check for Perl POD. - AC_CHECK_PROG([POD2MAN], [pod2man], [pod2man], [no]) - AS_IF([test "x$POD2MAN" != "xno"],[ -@@ -526,6 +540,7 @@ AC_CONFIG_HEADERS([config.h]) - AC_CONFIG_FILES([nbdkit], - [chmod +x,-w nbdkit]) - AC_CONFIG_FILES([Makefile -+ bash/Makefile - docs/Makefile - include/Makefile - plugins/Makefile -diff --git a/src/main.c b/src/main.c -index d2e5674..660d036 100644 ---- a/src/main.c -+++ b/src/main.c -@@ -126,6 +126,7 @@ static const struct option long_options[] = { - { "group", 1, NULL, 'g' }, - { "ip-addr", 1, NULL, 'i' }, - { "ipaddr", 1, NULL, 'i' }, -+ { "long-options", 0, NULL, 0 }, - { "new-style", 0, NULL, 'n' }, - { "newstyle", 0, NULL, 'n' }, - { "old-style", 0, NULL, 'o' }, -@@ -137,6 +138,7 @@ static const struct option long_options[] = { - { "readonly", 0, NULL, 'r' }, - { "run", 1, NULL, 0 }, - { "selinux-label", 1, NULL, 0 }, -+ { "short-options", 0, NULL, 0 }, - { "single", 0, NULL, 's' }, - { "stdin", 0, NULL, 's' }, - { "threads", 1, NULL, 't' }, -@@ -263,6 +265,14 @@ main (int argc, char *argv[]) - t->filename = optarg; - filter_filenames = t; - } -+ else if (strcmp (long_options[option_index].name, "long-options") == 0) { -+ for (i = 0; long_options[i].name != NULL; ++i) { -+ if (strcmp (long_options[i].name, "long-options") != 0 && -+ strcmp (long_options[i].name, "short-options") != 0) -+ printf ("--%s\n", long_options[i].name); -+ } -+ exit (EXIT_SUCCESS); -+ } - else if (strcmp (long_options[option_index].name, "run") == 0) { - if (socket_activation) { - fprintf (stderr, "%s: cannot use socket activation with --run flag\n", -@@ -276,6 +286,13 @@ main (int argc, char *argv[]) - selinux_label = optarg; - break; - } -+ else if (strcmp (long_options[option_index].name, "short-options") == 0) { -+ for (i = 0; short_options[i]; ++i) { -+ if (short_options[i] != ':') -+ printf ("-%c\n", short_options[i]); -+ } -+ exit (EXIT_SUCCESS); -+ } - else if (strcmp (long_options[option_index].name, "tls") == 0) { - tls_set_on_cli = 1; - if (strcmp (optarg, "off") == 0 || strcmp (optarg, "0") == 0) --- -2.16.2 - diff --git a/nbdkit.spec b/nbdkit.spec index df7fe27..2b32649 100644 --- a/nbdkit.spec +++ b/nbdkit.spec @@ -20,7 +20,7 @@ %global verify_tarball_signature 1 Name: nbdkit -Version: 1.3.2 +Version: 1.3.3 Release: 1%{?dist} Summary: NBD server @@ -34,12 +34,6 @@ Source1: http://libguestfs.org/download/nbdkit/%{name}-%{version}.tar.gz. Source2: libguestfs.keyring %endif -# Upstream patch to fix tests. Touches autotools files so we -# need autotools temporarily. -Patch1: 0001-tests-If-guestfish-isn-t-available-disk-is-not-creat.patch -Patch2: 0002-Add-simple-bash-completion-script.patch -BuildRequires: autoconf, automake, libtool - %if 0%{?rhel} == 7 # On RHEL 7, nothing in the virt stack is shipped on aarch64 and # libguestfs was not shipped on POWER (fixed in 7.5). We could in @@ -146,6 +140,10 @@ trivial dependencies. A null (bitbucket) plugin. +* nbdkit-random-plugin + + Random content plugin for testing. + * nbdkit-split-plugin Concatenate one or more files into a single virtual disk. @@ -154,6 +152,10 @@ trivial dependencies. A streaming file serving plugin. +* nbdkit-zero-plugin + + Zero-length plugin for testing. + %package example-plugins Summary: Example plugins for %{name} @@ -430,8 +432,6 @@ gpgv2 --homedir "$tmphome" --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0} %endif %setup -q %autopatch -p1 -# Temporarily while patches touch autotools files. -autoreconf -i %ifnarch %{complete_test_arches} # Simplify the test suite so it doesn't require qemu. @@ -545,14 +545,18 @@ popd %{_libdir}/%{name}/plugins/nbdkit-memory-plugin.so %{_libdir}/%{name}/plugins/nbdkit-nbd-plugin.so %{_libdir}/%{name}/plugins/nbdkit-null-plugin.so +%{_libdir}/%{name}/plugins/nbdkit-random-plugin.so %{_libdir}/%{name}/plugins/nbdkit-split-plugin.so %{_libdir}/%{name}/plugins/nbdkit-streaming-plugin.so +%{_libdir}/%{name}/plugins/nbdkit-zero-plugin.so %{_mandir}/man1/nbdkit-file-plugin.1* %{_mandir}/man1/nbdkit-memory-plugin.1* %{_mandir}/man1/nbdkit-nbd-plugin.1* %{_mandir}/man1/nbdkit-null-plugin.1* +%{_mandir}/man1/nbdkit-random-plugin.1* %{_mandir}/man1/nbdkit-split-plugin.1* %{_mandir}/man1/nbdkit-streaming-plugin.1* +%{_mandir}/man1/nbdkit-zero-plugin.1* %files example-plugins @@ -705,6 +709,11 @@ popd %changelog +* Mon Jul 11 2018 Richard W.M. Jones - 1.3.3-1 +- New upstream version 1.3.3. +- New plugins: nbdkit-zero-plugin, nbdkit-random-plugin. +- Remove upstream patches. + * Sat Jun 9 2018 Richard W.M. Jones - 1.3.2-2 - New upstream version 1.3.2. - Remove patches now upstream. diff --git a/sources b/sources index e3e8154..e23c798 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (nbdkit-1.3.2.tar.gz) = 03db669bef2fde2714ac5b7143bd1e81517f175dac9913e116d8207dd7fe4aba187478d8b2506cfe296672e89229a530e045f4f50118aa59e03e629939f9d68b -SHA512 (nbdkit-1.3.2.tar.gz.sig) = 2d96e4e48e07ae530e6e62cc759adfb49f3daf8732c5b67a4ae26c2f6d99d2179716310dee764cb3a1fbc91d95d279e7c417ba1b3871ac96a0ab4d3fbf8c4697 +SHA512 (nbdkit-1.3.3.tar.gz) = 6a721093baa860adecf07355fe152c7ae1d06e9d73e9e3408bb83c1a50c6b903b89dc87b21853e38928f50076873a72e3d36c11cb1bb94abaad99233c6c6709e +SHA512 (nbdkit-1.3.3.tar.gz.sig) = d66763ddf1fbe511bf7c544ab04db9485c757e89faa2355120af7ce67099d9f5e009954fc26c510a17cacc8608050fcb4490019ee89af43cd841e94d74252f63