Pino Toscano
2019-Jul-03 10:47 UTC
[Libguestfs] [PATCH 0/6] p2v: make it more independent (part #2)
As preliminary steps in splitting virt-p2v to an own repository,
continue making p2v more independent within libguestfs. This is
accomplished by the following changes:
- have only the authors in the about dialog, and read them from a local
AUTHORS file
- few more cleanups
This is still not complete, although I believe most of the work needed
is done, and it still makes p2v usable within libguestfs.
Pino Toscano (6):
p2v: generate an AUTHORS file
p2v: remove non-author credits
p2v: ship generate-p2v-config.pl
p2v: generate C about data authors from AUTHORS file
contrib: move p2v files within p2v
p2v: stop including guestfs.h
Makefile.am | 5 --
docs/C_SOURCE_FILES | 1 -
generator/authors.ml | 59 +++----------------
generator/authors.mli | 2 +-
generator/main.ml | 4 +-
p2v/.gitignore | 1 +
p2v/Makefile.am | 17 +++++-
.../contrib}/aux-scripts/do-build.sh | 0
{contrib/p2v => p2v/contrib}/build-p2v-iso.sh | 0
...BLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch | 0
...-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch | 0
{contrib/p2v => p2v/contrib}/test-p2v-iso.sh | 0
p2v/generate-p2v-authors.pl | 54 +++++++++++++++++
p2v/gui-gtk3-compat.h | 5 --
p2v/gui.c | 13 ----
p2v/p2v.h | 9 ---
16 files changed, 80 insertions(+), 90 deletions(-)
rename {contrib/p2v => p2v/contrib}/aux-scripts/do-build.sh (100%)
rename {contrib/p2v => p2v/contrib}/build-p2v-iso.sh (100%)
rename {contrib/p2v =>
p2v/contrib}/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
(100%)
rename {contrib/p2v =>
p2v/contrib}/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch (100%)
rename {contrib/p2v => p2v/contrib}/test-p2v-iso.sh (100%)
create mode 100755 p2v/generate-p2v-authors.pl
--
2.21.0
Create a simple AUTHORS file for virt-p2v, so it is easier to
extract or use it later on.
---
generator/authors.ml | 9 +++++++++
generator/authors.mli | 1 +
generator/main.ml | 2 ++
p2v/.gitignore | 1 +
p2v/Makefile.am | 3 ++-
5 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/generator/authors.ml b/generator/authors.ml
index 095eb5177..730eb5039 100644
--- a/generator/authors.ml
+++ b/generator/authors.ml
@@ -186,3 +186,12 @@ let generate_p2v_about_authors_c () List.iter fn others;
pr " NULL\n";
pr "};\n"
+
+let generate_p2v_authors () + let p2v_authors + List.filter_map (
+ fun (name, _, roles) ->
+ if List.mem V2V_and_P2V roles then Some name
+ else None
+ ) authors in
+ List.iter (pr "%s\n") p2v_authors
diff --git a/generator/authors.mli b/generator/authors.mli
index 410571583..f63ff3264 100644
--- a/generator/authors.mli
+++ b/generator/authors.mli
@@ -24,3 +24,4 @@ val authors : (string * string list * role list) list
val generate_authors : unit -> unit
val generate_p2v_about_authors_c : unit -> unit
+val generate_p2v_authors : unit -> unit
diff --git a/generator/main.ml b/generator/main.ml
index 187821647..5e6f067bb 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -77,6 +77,8 @@ Run it from the top source directory using the command
Authors.generate_authors;
output_to "p2v/about-authors.c"
Authors.generate_p2v_about_authors_c;
+ output_to "p2v/AUTHORS"
+ Authors.generate_p2v_authors;
output_to "common/errnostring/errnostring-gperf.gperf"
Errnostring.generate_errnostring_gperf;
diff --git a/p2v/.gitignore b/p2v/.gitignore
index 8495f6c2f..22ac25aed 100644
--- a/p2v/.gitignore
+++ b/p2v/.gitignore
@@ -8,6 +8,7 @@ Makefile
Makefile.in
/about-authors.c
+/AUTHORS
/blank-part.img
/config.c
/dependencies.archlinux
diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index 5ee9d97d5..a1b80d084 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -18,7 +18,8 @@
include $(top_srcdir)/subdir-rules.mk
generator_built = \
- about-authors.c
+ about-authors.c \
+ AUTHORS
BUILT_SOURCES = \
$(generator_built)
--
2.21.0
Pino Toscano
2019-Jul-03 10:47 UTC
[Libguestfs] [PATCH 2/6] p2v: remove non-author credits
Soon only the virt-p2v authors will be available, so remove all the
other roles. This leaves only in the virt-p2v about dialog, which is a
mild regression compared to the current situation, although it is just
for user information.
---
generator/authors.ml | 15 ---------------
p2v/gui-gtk3-compat.h | 5 -----
p2v/gui.c | 13 -------------
3 files changed, 33 deletions(-)
diff --git a/generator/authors.ml b/generator/authors.ml
index 730eb5039..14403c624 100644
--- a/generator/authors.ml
+++ b/generator/authors.ml
@@ -170,21 +170,6 @@ let generate_p2v_about_authors_c () pr "const char
*authors[] = {\n";
List.iter fn authors;
pr " NULL\n";
- pr "};\n\n";
- pr "/* Libguestfs quality assurance (if not included above). */\n";
- pr "const char *qa[] = {\n";
- List.iter fn qa;
- pr " NULL\n";
- pr "};\n\n";
- pr "/* Libguestfs documentation (if not included above). */\n";
- pr "const char *documenters[] = {\n";
- List.iter fn documenters;
- pr " NULL\n";
- pr "};\n\n";
- pr "/* Libguestfs developers (if not included above). */\n";
- pr "const char *others[] = {\n";
- List.iter fn others;
- pr " NULL\n";
pr "};\n"
let generate_p2v_authors () diff --git a/p2v/gui-gtk3-compat.h
b/p2v/gui-gtk3-compat.h
index 11a9ae120..a29e7b4da 100644
--- a/p2v/gui-gtk3-compat.h
+++ b/p2v/gui-gtk3-compat.h
@@ -49,11 +49,6 @@ gdk_event_get_button (const GdkEvent *event, guint *button)
(box) = gtk_vbox_new ((homogeneous), (spacing))
#endif
-#if !GTK_CHECK_VERSION(3,4,0) /* gtk < 3.4 */
-/* Gtk < 3.4 entirely lacked gtk_about_dialog_add_credit_section. */
-#define gtk_about_dialog_add_credit_section(d,k,v) do {} while (0)
-#endif
-
#if GTK_CHECK_VERSION(3,4,0) /* gtk >= 3.4 */
/* GtkGrid is sufficiently similar to GtkTable that we can just
* redefine these functions.
diff --git a/p2v/gui.c b/p2v/gui.c
index aa794b2b4..32c56dda7 100644
--- a/p2v/gui.c
+++ b/p2v/gui.c
@@ -654,19 +654,6 @@ about_button_clicked (GtkWidget *w, gpointer data)
"authors", authors,
NULL);
- if (documenters[0] != NULL)
- g_object_set (G_OBJECT (dialog),
- "documenters", documenters,
- NULL);
-
- if (qa[0] != NULL)
- gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
- "Quality assurance", qa);
-
- if (others[0] != NULL)
- gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
- "Libguestfs development",
others);
-
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
--
2.21.0
Pino Toscano
2019-Jul-03 10:47 UTC
[Libguestfs] [PATCH 3/6] p2v: ship generate-p2v-config.pl
Fixes commit 796ce74f319e819a03d10bf7106f20deabb1f014. --- p2v/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/p2v/Makefile.am b/p2v/Makefile.am index a1b80d084..689722ad8 100644 --- a/p2v/Makefile.am +++ b/p2v/Makefile.am @@ -28,6 +28,7 @@ EXTRA_DIST = \ $(BUILT_SOURCES) \ $(TESTS) $(SLOW_TESTS) \ dependencies.m4 \ + generate-p2v-config.pl \ issue \ kiwi-config.sh \ kiwi-config.xml.in \ -- 2.21.0
Pino Toscano
2019-Jul-03 10:47 UTC
[Libguestfs] [PATCH 4/6] p2v: generate C about data authors from AUTHORS file
Create a small Perl script to generate about-authors.c from the p2v
AUTHORS file at build time, instead of generating in the generator
at dist time.
---
docs/C_SOURCE_FILES | 1 -
generator/authors.ml | 37 -------------------------
generator/authors.mli | 1 -
generator/main.ml | 2 --
p2v/Makefile.am | 10 ++++---
p2v/generate-p2v-authors.pl | 54 +++++++++++++++++++++++++++++++++++++
6 files changed, 61 insertions(+), 44 deletions(-)
create mode 100755 p2v/generate-p2v-authors.pl
diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES
index 20a38162c..c9a576c0c 100644
--- a/docs/C_SOURCE_FILES
+++ b/docs/C_SOURCE_FILES
@@ -355,7 +355,6 @@ ocaml/guestfs-c-actions.c
ocaml/guestfs-c-errnos.c
ocaml/guestfs-c.c
ocaml/guestfs-c.h
-p2v/about-authors.c
p2v/conversion.c
p2v/cpuid.c
p2v/gui-gtk2-compat.h
diff --git a/generator/authors.ml b/generator/authors.ml
index 14403c624..3c8ee1de3 100644
--- a/generator/authors.ml
+++ b/generator/authors.ml
@@ -135,43 +135,6 @@ let authors = [
let generate_authors () List.iter (fun (name, _, _) -> pr
"%s\n" name) authors
-let generate_p2v_about_authors_c () - generate_header CStyle GPLv2plus;
-
- pr "#include <config.h>\n";
- pr "\n";
- pr "#include \"p2v.h\"\n";
- pr "\n";
-
- (* Split up the list according to how we want to add people to
- * credit sections. However don't assign anyone to more than a
- * single category. Be aware that with Gtk < 3.4, only the
- * "authors" and "documenters" categories are actually
displayed.
- *)
- let authors, qa, documenters, others - let rec loop (authors, qa,
documenters, others) = function
- | [] -> authors, qa, documenters, others
- | ((_, _, roles) as a) :: rest ->
- if List.mem V2V_and_P2V roles then
- loop (a :: authors, qa, documenters, others) rest
- else if List.mem Quality_assurance roles then
- loop (authors, a :: qa, documenters, others) rest
- else if List.mem Documentation roles then
- loop (authors, qa, a :: documenters, others) rest
- else
- loop (authors, qa, documenters, a :: others) rest
- in
- let authors, qa, documenters, others = loop ([],[],[],[]) authors in
- List.rev authors, List.rev qa, List.rev documenters, List.rev others in
-
- let fn (name, _, _) = pr " \"%s\",\n" name in
-
- pr "/* Authors involved with virt-v2v and virt-p2v directly. */\n";
- pr "const char *authors[] = {\n";
- List.iter fn authors;
- pr " NULL\n";
- pr "};\n"
-
let generate_p2v_authors () let p2v_authors List.filter_map (
diff --git a/generator/authors.mli b/generator/authors.mli
index f63ff3264..834bcb811 100644
--- a/generator/authors.mli
+++ b/generator/authors.mli
@@ -23,5 +23,4 @@ val authors : (string * string list * role list) list
(** List of authors, their aliases, and their roles. *)
val generate_authors : unit -> unit
-val generate_p2v_about_authors_c : unit -> unit
val generate_p2v_authors : unit -> unit
diff --git a/generator/main.ml b/generator/main.ml
index 5e6f067bb..acacfb9e4 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -75,8 +75,6 @@ Run it from the top source directory using the command
output_to "AUTHORS"
Authors.generate_authors;
- output_to "p2v/about-authors.c"
- Authors.generate_p2v_about_authors_c;
output_to "p2v/AUTHORS"
Authors.generate_p2v_authors;
diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index 689722ad8..20e00fcc0 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -18,7 +18,6 @@
include $(top_srcdir)/subdir-rules.mk
generator_built = \
- about-authors.c \
AUTHORS
BUILT_SOURCES = \
@@ -28,6 +27,7 @@ EXTRA_DIST = \
$(BUILT_SOURCES) \
$(TESTS) $(SLOW_TESTS) \
dependencies.m4 \
+ generate-p2v-authors.pl \
generate-p2v-config.pl \
issue \
kiwi-config.sh \
@@ -52,6 +52,7 @@ EXTRA_DIST = \
CLEANFILES += \
$(dependencies_files) \
$(generated_sources) \
+ about-authors.c \
stamp-test-virt-p2v-pxe-data-files \
stamp-test-virt-p2v-pxe-kernel \
test-virt-p2v-pxe.authorized_keys \
@@ -81,7 +82,6 @@ virt-p2v.xz: virt-p2v
noinst_PROGRAMS = virt-p2v
virt_p2v_SOURCES = \
- about-authors.c \
conversion.c \
cpuid.c \
gui.c \
@@ -105,7 +105,8 @@ generated_sources = \
kernel-config.c
nodist_virt_p2v_SOURCES = \
- $(generated_sources)
+ $(generated_sources) \
+ about-authors.c
virt_p2v_CPPFLAGS = \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
@@ -135,6 +136,9 @@ virt_p2v_LDADD = \
$(generated_sources) virt-p2v-kernel-config.pod:
$(srcdir)/generate-p2v-config.pl
$(AM_V_GEN)rm -f $@ $@-t && $(PERL) $(<) --file=$@ --output=$@-t
&& mv $@-t $@
+about-authors.c: $(srcdir)/generate-p2v-authors.pl $(srcdir)/AUTHORS
+ $(AM_V_GEN)rm -f $@ $@-t && $(PERL) $(<) $(srcdir)/AUTHORS >
$@-t && mv $@-t $@
+
# Scripts to build the disk image, USB key, or kickstart.
bin_SCRIPTS = virt-p2v-make-disk virt-p2v-make-kickstart virt-p2v-make-kiwi
diff --git a/p2v/generate-p2v-authors.pl b/p2v/generate-p2v-authors.pl
new file mode 100755
index 000000000..18a825bd7
--- /dev/null
+++ b/p2v/generate-p2v-authors.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/env perl
+# Copyright (C) 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.
+
+use strict;
+use warnings;
+
+# Clean up the program name.
+my $progname = $0;
+$progname =~ s{.*/}{};
+
+my $filename = shift or die "$progname: missing filename";
+
+open(my $fh, '<', $filename) or die "Unable to open file
'$filename': $!";
+
+print <<"EOF";
+/* libguestfs generated file
+ * WARNING: THIS FILE IS GENERATED FROM THE FOLLOWING FILES:
+ * $filename
+ * ANY CHANGES YOU MAKE TO THIS FILE WILL BE LOST.
+ */
+
+#include <config.h>
+
+#include "p2v.h"
+
+/* Authors involved with virt-v2v and virt-p2v directly. */
+const char *authors[] = {
+EOF
+
+while (<$fh>) {
+ chomp $_;
+ printf " \"%s\",\n", $_;
+}
+
+print <<"EOF";
+ NULL
+};
+EOF
+
+close($fh);
--
2.21.0
Pino Toscano
2019-Jul-03 10:47 UTC
[Libguestfs] [PATCH 5/6] contrib: move p2v files within p2v
---
Makefile.am | 5 -----
p2v/Makefile.am | 5 +++++
{contrib/p2v => p2v/contrib}/aux-scripts/do-build.sh | 0
{contrib/p2v => p2v/contrib}/build-p2v-iso.sh | 0
...HEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch | 0
.../0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch | 0
{contrib/p2v => p2v/contrib}/test-p2v-iso.sh | 0
7 files changed, 5 insertions(+), 5 deletions(-)
rename {contrib/p2v => p2v/contrib}/aux-scripts/do-build.sh (100%)
rename {contrib/p2v => p2v/contrib}/build-p2v-iso.sh (100%)
rename {contrib/p2v =>
p2v/contrib}/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
(100%)
rename {contrib/p2v =>
p2v/contrib}/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch (100%)
rename {contrib/p2v => p2v/contrib}/test-p2v-iso.sh (100%)
diff --git a/Makefile.am b/Makefile.am
index b5f33f62b..e76ea6daf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -229,11 +229,6 @@ EXTRA_DIST = \
contrib/intro/vmm-icons-t.png \
contrib/intro/vmm-icons.png \
contrib/intro/win7.xml \
- contrib/p2v/aux-scripts/do-build.sh \
- contrib/p2v/build-p2v-iso.sh \
-
contrib/p2v/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
\
- contrib/p2v/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch \
- contrib/p2v/test-p2v-iso.sh \
contrib/README \
contrib/visualize-alignment/.gitignore \
contrib/visualize-alignment/guestfish-add-mount.qtr \
diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index 20e00fcc0..1545490d2 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -26,6 +26,11 @@ BUILT_SOURCES = \
EXTRA_DIST = \
$(BUILT_SOURCES) \
$(TESTS) $(SLOW_TESTS) \
+ contrib/aux-scripts/do-build.sh \
+ contrib/build-p2v-iso.sh \
+
contrib/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
\
+ contrib/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch \
+ contrib/test-p2v-iso.sh \
dependencies.m4 \
generate-p2v-authors.pl \
generate-p2v-config.pl \
diff --git a/contrib/p2v/aux-scripts/do-build.sh
b/p2v/contrib/aux-scripts/do-build.sh
similarity index 100%
rename from contrib/p2v/aux-scripts/do-build.sh
rename to p2v/contrib/aux-scripts/do-build.sh
diff --git a/contrib/p2v/build-p2v-iso.sh b/p2v/contrib/build-p2v-iso.sh
similarity index 100%
rename from contrib/p2v/build-p2v-iso.sh
rename to p2v/contrib/build-p2v-iso.sh
diff --git
a/contrib/p2v/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
b/p2v/contrib/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
similarity index 100%
rename from
contrib/p2v/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
rename to
p2v/contrib/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
diff --git
a/contrib/p2v/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch
b/p2v/contrib/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch
similarity index 100%
rename from
contrib/p2v/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch
rename to
p2v/contrib/patches/0002-RHEL-5-ONLY-QEMU-NBD-1.4-HAS-NO-f-OPTION.patch
diff --git a/contrib/p2v/test-p2v-iso.sh b/p2v/contrib/test-p2v-iso.sh
similarity index 100%
rename from contrib/p2v/test-p2v-iso.sh
rename to p2v/contrib/test-p2v-iso.sh
--
2.21.0
It is no more needed, guestfs-utils.h is enough these days. --- p2v/p2v.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/p2v/p2v.h b/p2v/p2v.h index 2447cf05e..66c245eda 100644 --- a/p2v/p2v.h +++ b/p2v/p2v.h @@ -30,17 +30,8 @@ #include "miniexpect.h" #include "p2v-config.h" -/* We don't use libguestfs directly here, and we don't link to it - * either (in fact, we don't want libguestfs on the ISO). However - * we include this just so that we can use the convenience macros in - * utils.h. - */ -#include "guestfs.h" #include "guestfs-utils.h" -/* Ensure we don't use libguestfs. */ -#define guestfs_h DO_NOT_USE - /* All disks / removable media / network interfaces discovered * when the program started. Do not change these. */ -- 2.21.0
Richard W.M. Jones
2019-Jul-04 11:29 UTC
Re: [Libguestfs] [PATCH 6/6] p2v: stop including guestfs.h
ACK series. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW