mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
54
p2v/generate-p2v-authors.pl
Executable file
54
p2v/generate-p2v-authors.pl
Executable file
@@ -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);
|
||||
Reference in New Issue
Block a user