[PATCH libnbd] generator: Define new Closure type
by Richard W.M. Jones
** INCOMPLETE **
This is the generator change as discussed on the list already.
The Python and OCaml bindings are not yet done.
It passes all [C only] tests and valgrind.
Note that nbd_add_close_callback is inconsistent with other closure
types because it passes the user_data parameter after the function.
(This is not caused by the current patch, it was already
inconsistent). We decided that nbd_add_close_callback should be
manually generated and not automatically generated because it should
only be called from C, or perhaps more accurately it is only _needed_
from C (to support cleanup of the non-C bindings), but I don't think
there's any reason not to automatically generate it. If we did
generate it, then it would be an API break because these two
parameters would get swapped around.
Rich.
5 years, 4 months
[RFC libnbd PATCH 0/2] Start fixing python nbd.pread_structured_callback
by Eric Blake
Posting now that I got something to compile (at the expense of
breaking OCaml bindings), but I'm open to ideas on how to improve it.
Eric Blake (2):
generator: Tweak print_c_arg_list to take alternate first arg
RFC: generator: Handle shared callbacks in Python
generator/generator | 556 ++++++++++++++++++++++----------------------
1 file changed, 280 insertions(+), 276 deletions(-)
--
2.20.1
5 years, 4 months
Plans for virt-p2v
by Pino Toscano
Hi,
after the latest changes, I think that the split of virt-p2v should
be completed at this point. I have a local branch of libguestfs to
track the removal of virt-p2v, and I do not see anything more left
of virt-p2v after removing all the bits already converted/moved.
Rich, I think it would be good for you to take a look at it, and check
whether everything is in order e.g. for releases -- no hurry needed.
As I do not do releases, I might have missed to copy/add something for
them. In any case, I can do any change needed.
One thing about the version number: considering that virt-p2v drives
virt-v2v based on the capabilities returned by virt-2v, I do not think
there is a need to keep the version in sync with libguestfs.
Also, considering that virt-p2v is generally stable, we can get away
with the stable/unstable series, and just number each version as
1.XX.0 (so the next would be 1.41.0). The .0 as patch version is kept
in case we need to hot-fix a version, so a .1 release can be done.
What do you think?
--
Pino Toscano
5 years, 4 months
[p2v PATCH 0/5] More small fixes
by Pino Toscano
See individual patches for details.
Pino Toscano (5):
Include signal.h
Remove unused variables
Push -Wsuggest-attribute=noreturn only with GCC
tests: do not set libguestfs environment variables
Define the GCC version macro
Makefile.am | 2 +-
conversion.c | 3 +++
p2v.h | 7 +++++++
ssh.c | 8 +++++---
4 files changed, 16 insertions(+), 4 deletions(-)
--
2.21.0
5 years, 4 months
[p2v PATCH 0/4] More imports and fixes
by Pino Toscano
See individual patches for details.
Pino Toscano (4):
Add valgrind suppression file
podwrapper: the tools here start with p2v
Import some internal documentation
podwrapper: adapt footer to p2v
.gitignore | 6 +
Makefile.am | 4 +-
configure.ac | 1 +
docs/Makefile.am | 65 ++++++++
docs/p2v-building.pod | 259 ++++++++++++++++++++++++++++++++
docs/p2v-hacking.pod | 293 +++++++++++++++++++++++++++++++++++++
docs/p2v-release-notes.pod | 47 ++++++
podwrapper.pl.in | 14 +-
run.in | 2 +-
test-functions.sh | 2 +-
valgrind-suppressions | 43 ++++++
virt-p2v-make-disk.in | 2 +-
virt-p2v-make-disk.pod | 2 +-
13 files changed, 726 insertions(+), 14 deletions(-)
create mode 100644 docs/Makefile.am
create mode 100644 docs/p2v-building.pod
create mode 100644 docs/p2v-hacking.pod
create mode 100644 docs/p2v-release-notes.pod
create mode 100644 valgrind-suppressions
--
2.21.0
5 years, 4 months
[libnbd] Slight API inconsistency
by Martin Kletzander
The callback (e.g. for `nbd_block_status`) now has a support for returning
errors thanks to the last parameter (`int *error`), so it was switched to
returning void. But that was not switched everywhere and some code expects it
to return `int`. Yet another inconsistency is in the debug callback, which is
supposed to return `void`, I guess, but due to the way the generator is
implemented it's defined to return `int` instead.
So my question is, should all callbacks just return nothing and if there is a
need for some information to get back they will just use a pointer to some data
(like with the `int *error`)? Or do we need different return types for
callbacks and should `Callback` and `CallbackPersist` be defined as:
`string * arg list * ret` ?
Have a nice day,
Martin
5 years, 4 months
[p2v PATCH] Add bash completion scripts
by Pino Toscano
Copy over the bash completion machinery from libguestfs, along with the
simple completion script; use this script for all the tools.
---
.gitignore | 2 +
Makefile.am | 3 ++
bash/Makefile.am | 68 +++++++++++++++++++++++++++++++++
bash/README | 6 +++
bash/test-complete-in-script.sh | 40 +++++++++++++++++++
bash/virt-p2v-make-disk | 59 ++++++++++++++++++++++++++++
configure.ac | 5 +++
m4/p2v-bash-completion.m4 | 29 ++++++++++++++
8 files changed, 212 insertions(+)
create mode 100644 bash/Makefile.am
create mode 100644 bash/README
create mode 100755 bash/test-complete-in-script.sh
create mode 100644 bash/virt-p2v-make-disk
create mode 100644 m4/p2v-bash-completion.m4
diff --git a/.gitignore b/.gitignore
index e1d27b7..a81b59a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,8 @@ Makefile.in
/about-authors.c
/aclocal.m4
/autom4te.cache/
+/bash/virt-p2v-make-kickstart
+/bash/virt-p2v-make-kiwi
/blank-part.img
/build-aux/
/config.c
diff --git a/Makefile.am b/Makefile.am
index ac7e62f..2d0178c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,6 +24,9 @@ if ENABLE_GNULIB_TESTS
SUBDIRS += gnulib/tests
endif
+# bash-completion
+SUBDIRS += bash
+
EXTRA_DIST = \
$(BUILT_SOURCES) \
$(TESTS) $(LIBGUESTFS_TESTS) $(SLOW_TESTS) \
diff --git a/bash/Makefile.am b/bash/Makefile.am
new file mode 100644
index 0000000..2a59f75
--- /dev/null
+++ b/bash/Makefile.am
@@ -0,0 +1,68 @@
+# libguestfs
+# Copyright (C) 2013-2019 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+include $(top_srcdir)/subdir-rules.mk
+
+scripts = \
+ virt-p2v-make-disk
+
+# Some of the scripts are simply symbolic links.
+symlinks = \
+ virt-p2v-make-kickstart \
+ virt-p2v-make-kiwi
+
+# Note: Don't distribute the symbolic links, only the real files.
+EXTRA_DIST = \
+ README \
+ $(scripts) \
+ $(TESTS)
+
+CLEANFILES += \
+ $(symlinks)
+
+$(symlinks):
+ rm -f $@
+ $(LN_S) virt-p2v-make-disk $@
+
+if HAVE_BASH_COMPLETION
+
+# Bash completion script.
+
+bashcompletiondir = $(BASH_COMPLETIONS_DIR)
+#bashcompletion_DATA = $(scripts)
+
+all-local: $(scripts) $(symlinks)
+ -test $(srcdir) != $(builddir) && cd $(srcdir) && cp $(scripts) $(abs_builddir)/
+
+install-data-local:
+ $(mkdir_p) $(DESTDIR)$(bashcompletiondir)
+ cp -d $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir)
+
+clean-local:
+ -test $(srcdir) != $(builddir) && rm -f $(scripts)
+
+endif
+
+# Tests.
+TESTS_ENVIRONMENT = \
+ scripts="$(scripts)" \
+ symlinks="$(scripts)" \
+ commands="$(scripts) $(symlinks)" \
+ $(top_builddir)/run --test
+
+TESTS = \
+ test-complete-in-script.sh
diff --git a/bash/README b/bash/README
new file mode 100644
index 0000000..314bfd0
--- /dev/null
+++ b/bash/README
@@ -0,0 +1,6 @@
+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 'source ./virt-foo'.
diff --git a/bash/test-complete-in-script.sh b/bash/test-complete-in-script.sh
new file mode 100755
index 0000000..7fff0bc
--- /dev/null
+++ b/bash/test-complete-in-script.sh
@@ -0,0 +1,40 @@
+#!/bin/bash -
+# libguestfs bash completion test script
+# Copyright (C) 2016 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# Test that the correct 'complete' command is included in the script.
+# Mainly prevents symlinking errors and some omissions.
+
+$TEST_FUNCTIONS
+skip_if_skipped
+
+if [ -z "$commands" ]; then
+ echo "$0: \$commands is not defined. Use 'make check' to run this test."
+ exit 1
+fi
+
+for cmd in $commands; do
+ if [ ! -f $cmd ]; then
+ echo "$0: script or symlink '$cmd' is missing"
+ exit 1
+ fi
+ if ! grep "^complete.*$cmd\$" $cmd; then
+ echo "$0: script or symlink '$cmd' does not have"
+ echo "a 'complete' rule for '$cmd'"
+ exit 1
+ fi
+done
diff --git a/bash/virt-p2v-make-disk b/bash/virt-p2v-make-disk
new file mode 100644
index 0000000..6a879a1
--- /dev/null
+++ b/bash/virt-p2v-make-disk
@@ -0,0 +1,59 @@
+# virt-p2v-make-disk bash completion script -*- shell-script -*-
+# Copyright (C) 2014-2019 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+_p2v_options_only ()
+{
+ local cur prev words cword split
+ local shortopts longopts tool="$1"
+
+ _init_completion -s || return
+
+ case "$cur" in
+ --*)
+ # --options
+ longopts="$($tool --long-options)"
+ COMPREPLY=( $(compgen -W "$longopts" -- "$cur") )
+ return ;;
+ -*)
+ # -o and --options
+ shortopts="$($tool --short-options)"
+ longopts="$($tool --long-options)"
+ COMPREPLY=( $(compgen -W "$shortopts $longopts" -- "$cur") )
+ return ;;
+ *)
+ COMPREPLY=( $(compgen "$cur") )
+ return ;;
+ esac
+}
+
+_virt_p2v_make_disk ()
+{
+ _p2v_options_only "virt-p2v-make-disk"
+} &&
+complete -o default -F _virt_p2v_make_disk virt-p2v-make-disk
+
+_virt_p2v_make_kickstart ()
+{
+ _p2v_options_only "virt-p2v-make-kickstart"
+} &&
+complete -o default -F _virt_p2v_make_kickstart virt-p2v-make-kickstart
+
+_virt_p2v_make_kiwi ()
+{
+ _p2v_options_only "virt-p2v-make-kiwi"
+} &&
+complete -o default -F _virt_p2v_make_kiwi virt-p2v-make-kiwi
diff --git a/configure.ac b/configure.ac
index dbd46cb..aeb50a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,10 @@ dnl Any C libraries required by virt-p2v.
HEADING([Checking for libraries used by virt-p2v])
m4_include([m4/p2v-libraries.m4])
+dnl Bash completion.
+HEADING([Checking for bash completion])
+m4_include([m4/p2v-bash-completion.m4])
+
dnl All the programs used for tests.
HEADING([Checking for programs for tests])
m4_include([m4/p2v-tests.m4])
@@ -100,6 +104,7 @@ AC_CONFIG_FILES([run],
[chmod +x,-w run])
AC_CONFIG_FILES([Makefile
+ bash/Makefile
gnulib/lib/Makefile
gnulib/tests/Makefile])
diff --git a/m4/p2v-bash-completion.m4 b/m4/p2v-bash-completion.m4
new file mode 100644
index 0000000..eee5067
--- /dev/null
+++ b/m4/p2v-bash-completion.m4
@@ -0,0 +1,29 @@
+# libguestfs
+# Copyright (C) 2009-2019 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+dnl Bash completion.
+PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], [
+ bash_completion=yes
+ AC_MSG_CHECKING([for bash-completions directory])
+ BASH_COMPLETIONS_DIR="`pkg-config --variable=completionsdir bash-completion`"
+ AC_MSG_RESULT([$BASH_COMPLETIONS_DIR])
+ AC_SUBST([BASH_COMPLETIONS_DIR])
+],[
+ bash_completion=no
+ AC_MSG_WARN([bash-completion not installed])
+])
+AM_CONDITIONAL([HAVE_BASH_COMPLETION],[test "x$bash_completion" = "xyes"])
--
2.21.0
5 years, 4 months
[p2v PATCH] Use List::MoreUtils instead of List::Util
by Pino Toscano
List::Util has "any" only from version 1.33, which older distros (like
RHEL/CentOS 7/6) do not have. Instead use List::MoreUtils, which is
available, and provides the same functionality.
---
generate-p2v-config.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/generate-p2v-config.pl b/generate-p2v-config.pl
index 01387e0..be98838 100755
--- a/generate-p2v-config.pl
+++ b/generate-p2v-config.pl
@@ -20,7 +20,7 @@ use warnings;
use Class::Struct;
use Getopt::Long;
-use List::Util qw(any);
+use List::MoreUtils qw(any);
struct ConfigSection =>
{
--
2.21.0
5 years, 4 months