generator, p2v: Generate AUTHORS and p2v/about-authors.c from a single place.

This also improves the "Credits" box in virt-p2v.  With Gtk >= 3.4
this can now show all contributors organized by the nature of their
contribution.
This commit is contained in:
Richard W.M. Jones
2017-03-25 13:12:10 +00:00
parent 9287e8954d
commit 34755dd86a
12 changed files with 264 additions and 116 deletions

2
.gitignore vendored
View File

@@ -47,6 +47,7 @@ Makefile.in
/appliance/stamp-libguestfs-make-fixed-appliance.pod
/appliance/stamp-supermin
/appliance/supermin.d
/AUTHORS
/autom4te.cache
/bash/guestunmount
/bash/virt-builder
@@ -383,6 +384,7 @@ Makefile.in
/ocaml/stamp-mlguestfs
/ocaml/t/*.bc
/ocaml/t/*.opt
/p2v/about-authors.c
/p2v/dependencies.archlinux
/p2v/dependencies.debian
/p2v/dependencies.redhat

75
AUTHORS
View File

@@ -1,75 +0,0 @@
Adam Huffman
Andrea Bolognani
Angus Salkeld
Ani Peter
Bastien ROUCARIÈS
Cao jin
Charles Duffy
Chen Hanxiao
Cole Robinson
Colin Walters
Cédric Bosdonnat
Dan Lipsitt
Daniel Berrange
Daniel Cabrera
Daniel Exner
Dave Vasilevsky
David Sommerseth
Dawid Zamirski
Douglas Schilling Landgraf
Eric Blake
Erik Nolte
Evaggelos Balaskas
Gabriele Cerami
Geert Warrink
Guido Günther
Hilko Bengen
Hu Tao
infernix
Jaswinder Singh
Jim Meyering
Jiri Popelka
John Eckersberg
Joseph Wang
Karel Klíč
Kashyap Chamarthy
Lars Kellogg-Stedman
Lee Yarwood
Marcin Gibula
Margaret Lewicka
Maros Zatko
Martin Kletzander
Masami HIRATA
Matteo Cafasso
Matthew Booth
Maxim Koltsov
Maxim Perevedentsev
Menanteau Guy
Michael Scherer
Mike Frysinger
Mike Kelly
Nicholas Strugnell
Nikita A Menkovich
Nikita Menkovich
Nikos Skalkotos
Olaf Hering
Or Goshen
Paul Mackerras
Pavel Butsykin
Pino Toscano
Piotr Drąg
Qin Guan
Rajesh Ranjan
Richard W.M. Jones
Robert Antoni Buj Gelonch
Roman Kagan
Sandeep Shedmake
Shahar Havivi
Shahar Lev
Shankar Prasad
Thomas S Hatch
Tomáš Golembiovský
Török Edwin
Wanlong Gao
Wulf C. Krueger
Yann E. MORIN

View File

@@ -290,7 +290,6 @@ maintainer-upload-website:
# When doing 'make dist' update a few files automatically.
#
# AUTHORS - list of authors (created from git)
# BUGS - list of bugs (created from Bugzilla)
# ChangeLog - changelog (created from git)
# docs/C_SOURCE_FILES
@@ -300,16 +299,11 @@ maintainer-upload-website:
# special xgettext option [not generated here]
# po/POTFILES-ml - OCaml files, which need a special tool to translate
dist-hook: AUTHORS BUGS ChangeLog docs/C_SOURCE_FILES po/POTFILES po/POTFILES-ml
dist-hook: BUGS ChangeLog docs/C_SOURCE_FILES po/POTFILES po/POTFILES-ml
cp AUTHORS $(distdir)/AUTHORS
cp BUGS $(distdir)/BUGS
cp ChangeLog $(distdir)/ChangeLog
AUTHORS: configure.ac
rm -f $@ $@-t
git shortlog -s | $(AWK) -F'\t' '{print $$2}' | sort -f > $@-t
mv $@-t $@
BUGS: configure.ac
rm -f $@ $@-t
$(top_srcdir)/update-bugs.sh > $@-t
@@ -560,6 +554,21 @@ maintainer-commit:
maintainer-tag:
git tag -a "v$(VERSION)" -m "Version $(VERSION) ($(BRANCH_TYPE))" -f
# Maintainer only: compare authors (found in git commit messages) to
# generator/authors.ml.
maintainer-check-authors:
rm -f $@ $@-t
git shortlog -s | \
$(AWK) -F'\t' '{print $$2}' | \
sort -f | \
while read author; do \
if ! grep -sqiF "\"$$author\"," generator/authors.ml; then \
echo "FAIL: $$author" is missing from generator/authors.ml; \
exit 1; \
fi; \
done
@echo PASS: AUTHORS test
# Maintainer only: check no files are missing from EXTRA_DIST rules,
# and that all generated files have been included in the tarball.
# (Note you must have done 'make dist')

View File

@@ -1030,6 +1030,11 @@ of the messages:
(See L<guestfs(3)/LIBGUESTFS VERSION NUMBERS> for the difference
between a stable and development release.)
=head3 make maintainer-check-authors
Check that all authors (found in git commit messages) are included in
the F<generator/authors.ml> file.
=head3 make maintainer-check-extra-dist
This rule must be run after C<make dist> (so there is a tarball in the

View File

@@ -43,6 +43,8 @@ sources = \
actions_properties_deprecated.mli \
actions_tsk.ml \
actions_tsk.mli \
authors.ml \
authors.mli \
bindtests.ml \
bindtests.mli \
c.ml \
@@ -138,6 +140,7 @@ objects = \
events.cmo \
pr.cmo \
docstrings.cmo \
authors.cmo \
checks.cmo \
c.cmo \
XDR.cmo \

173
generator/authors.ml Normal file
View File

@@ -0,0 +1,173 @@
(* libguestfs
* Copyright (C) 2017 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
*)
(* Please read generator/README first. *)
open Common_utils
open Utils
open Pr
open Docstrings
type role = Development | Quality_assurance | Documentation | V2V_and_P2V
(** Not exclusive, you can be in multiple roles :-) *)
(* Note that the following list interacts with
* [make maintainer-check-authors] in [libguestfs.git/Makefile.am].
*)
let authors = [
"Adam Huffman", [ Development ];
"Andrea Bolognani", [ Development ];
"Angus Salkeld", [ Development ];
"Ani Peter", [ Development ];
"Bastien ROUCARIÈS", [ Development ];
"Cao jin", [ Development ];
"Charles Duffy", [ Development ];
"Chen Hanxiao", [ Development ];
"Cole Robinson", [ Development ];
"Colin Walters", [ Development ];
"Cédric Bosdonnat", [ Development; V2V_and_P2V ];
"Dan Lipsitt", [ Development ];
"Daniel Berrange", [ Development ];
"Daniel Cabrera", [ Development ];
"Daniel Exner", [ Development ];
"Dave Vasilevsky", [ Development ];
"David Sommerseth", [ Development ];
"Dawid Zamirski", [ Development ];
"Douglas Schilling Landgraf", [ Development ];
"Eric Blake", [ Development ];
"Erik Nolte", [ Development ];
"Evaggelos Balaskas", [ Development ];
"Gabriele Cerami", [ Development ];
"Geert Warrink", [ Development ];
"Guido Günther", [ Development ];
"Hilko Bengen", [ Development ];
"Hu Tao", [ Development ];
"infernix", [ Development ];
"Jaswinder Singh", [ Development ];
"Jim Meyering", [ Development ];
"Jiri Popelka", [ Development ];
"John Eckersberg", [ Development; V2V_and_P2V ];
"Joseph Wang", [ Development ];
"Junqin Zhou", [ Quality_assurance; V2V_and_P2V ];
"Karel Klíč", [ Development ];
"Kashyap Chamarthy", [ Development ];
"Kean Li", [ Quality_assurance; V2V_and_P2V ];
"Kun Wei", [ Quality_assurance; V2V_and_P2V ];
"Lars Kellogg-Stedman", [ Development ];
"Laura Bailey", [ Documentation; V2V_and_P2V ];
"Lee Yarwood", [ Development ];
"Marcin Gibula", [ Development ];
"Margaret Lewicka", [ Development ];
"Maros Zatko", [ Development ];
"Martin Kletzander", [ Development ];
"Masami HIRATA", [ Development ];
"Matteo Cafasso", [ Development ];
"Matthew Booth", [ Development; V2V_and_P2V ];
"Maxim Koltsov", [ Development ];
"Maxim Perevedentsev", [ Development ];
"Menanteau Guy", [ Development ];
"Michael Scherer", [ Development ];
"Mike Frysinger", [ Development ];
"Mike Kelly", [ Development ];
"Mike Latimer", [ V2V_and_P2V ];
"Ming Xie", [ Quality_assurance; V2V_and_P2V ];
"Nicholas Strugnell", [ Development ];
"Nikita A Menkovich", [ Development ];
"Nikita Menkovich", [ Development ];
"Nikos Skalkotos", [ Development ];
"Olaf Hering", [ Development ];
"Or Goshen", [ Development ];
"Paul Mackerras", [ Development ];
"Pavel Butsykin", [ Development ];
"Pino Toscano", [ Development; V2V_and_P2V ];
"Piotr Drąg", [ Development ];
"Qin Guan", [ Development ];
"Rajesh Ranjan", [ Development ];
"Richard W.M. Jones", [ Development; V2V_and_P2V ];
"Robert Antoni Buj Gelonch", [ Development ];
"Roman Kagan", [ Development; V2V_and_P2V ];
"Sandeep Shedmake", [ Development ];
"Shahar Havivi", [ Development; V2V_and_P2V ];
"Shahar Lev", [ Development ];
"Shankar Prasad", [ Development ];
"Thomas S Hatch", [ Development ];
"Tingting Zheng", [ Quality_assurance; V2V_and_P2V ];
"Tomáš Golembiovský", [ Development ];
"Török Edwin", [ Development ];
"Wanlong Gao", [ Development ];
"Wulf C. Krueger", [ Development ];
"Xiang Hua Chen", [ Quality_assurance; V2V_and_P2V ];
"Yann E. MORIN", [ Development ];
"Yehuda Zimmerman", [ Documentation; V2V_and_P2V ];
]
(** List of authors and roles. *)
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\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"

View File

@@ -1,5 +1,5 @@
/* virt-p2v
* Copyright (C) 2009-2017 Red Hat Inc.
(* libguestfs
* Copyright (C) 2017 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
@@ -13,28 +13,14 @@
*
* 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.
*/
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
#include <config.h>
type role = Development | Quality_assurance | Documentation | V2V_and_P2V
(** Not exclusive, you can be in multiple roles :-) *)
#include "p2v.h"
val authors : (string * role list) list
(** List of authors and roles. *)
/* The list of authors of virt-p2v and virt-v2v, for the About dialog.
*
* Note: In alphabetical order of surname / family name.
*/
const char *authors[] = {
"Matthew Booth",
"Cédric Bosdonnat",
"John Eckersberg",
"Richard W.M. Jones",
"Shahar Havivi",
"Roman Kagan",
"Mike Latimer",
"Pino Toscano",
"Ming Xie",
"Tingting Zheng",
NULL
};
val generate_authors : unit -> unit
val generate_p2v_about_authors_c : unit -> unit

View File

@@ -73,6 +73,11 @@ Run it from the top source directory using the command
perror "lock: BUGS" exn;
exit 1);
output_to "AUTHORS"
Authors.generate_authors;
output_to "p2v/about-authors.c"
Authors.generate_p2v_about_authors_c;
output_to "common/errnostring/errnostring-gperf.gperf"
Errnostring.generate_errnostring_gperf;
output_to "common/errnostring/errnostring.c"

View File

@@ -17,7 +17,14 @@
include $(top_srcdir)/subdir-rules.mk
generator_built = \
about-authors.c
BUILT_SOURCES = \
$(generator_built)
EXTRA_DIST = \
$(BUILT_SOURCES) \
$(TESTS) $(SLOW_TESTS) \
dependencies.m4 \
issue \

View File

@@ -37,6 +37,11 @@
(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.

View File

@@ -612,16 +612,41 @@ xterm_button_clicked (GtkWidget *w, gpointer data)
static void
about_button_clicked (GtkWidget *w, gpointer data)
{
gtk_show_about_dialog (GTK_WINDOW (conn_dlg),
"program-name", getprogname (),
"version", PACKAGE_VERSION_FULL " (" host_cpu ")",
"copyright", "\u00A9 2009-2017 Red Hat Inc.",
"comments",
_("Virtualize a physical machine to run on KVM"),
"license", gplv2plus,
"website", "http://libguestfs.org/",
"authors", authors,
NULL);
GtkWidget *dialog;
GtkWidget *parent = conn_dlg;
dialog = gtk_about_dialog_new ();
g_object_set (G_OBJECT (dialog),
"program-name", getprogname (),
"version", PACKAGE_VERSION_FULL " (" host_cpu ")",
"copyright", "\u00A9 2009-2017 Red Hat Inc.",
"comments",
_("Virtualize a physical machine to run on KVM"),
"license", gplv2plus,
"website", "http://libguestfs.org/",
"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);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
/**

View File

@@ -190,6 +190,9 @@ extern char **output_drivers;
/* about-authors.c */
extern const char *authors[];
extern const char *qa[];
extern const char *documenters[];
extern const char *others[];
/* about-license.c */
extern const char *gplv2plus;