Richard W.M. Jones
2014-Mar-18 13:31 UTC
[Libguestfs] [PATCH 1/2] podwrapper: Give an error if an --insert or --verbatim pattern is not found in the input.
---
podwrapper.pl.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/podwrapper.pl.in b/podwrapper.pl.in
index 61d5e12..74432ad 100755
--- a/podwrapper.pl.in
+++ b/podwrapper.pl.in
@@ -274,7 +274,10 @@ foreach (@inserts) {
my @a = split /:/, $_, 2;
die "$progname: $input: no colon in parameter of --insert\n"
unless @a >= 2;
my $replacement = read_whole_file ($a[0]);
+ my $oldcontent = $content;
$content =~ s/$a[1]/$replacement/ge;
+ die "$progname: $input: could not find pattern '$a[1]' in
input file\n"
+ if $content eq $oldcontent;
}
# Perform @verbatims.
@@ -282,7 +285,10 @@ foreach (@verbatims) {
my @a = split /:/, $_, 2;
die "$progname: $input: no colon in parameter of --verbatim\n"
unless @a >= 2;
my $replacement = read_verbatim_file ($a[0]);
+ my $oldcontent = $content;
$content =~ s/$a[1]/$replacement/ge;
+ die "$progname: $input: could not find pattern '$a[1]' in
input file\n"
+ if $content eq $oldcontent;
}
if ($strict_checks) {
--
1.8.5.3
Richard W.M. Jones
2014-Mar-18 13:31 UTC
[Libguestfs] [PATCH 2/2] generator: Generate copyright notice in generated POD fragments.
Using =begin comment ... =end comment.
---
generator/c.ml | 6 ++++++
generator/docstrings.ml | 6 ++++--
generator/fish.ml | 6 ++++++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/generator/c.ml b/generator/c.ml
index 4b244a5..ee276dc 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -208,6 +208,8 @@ and generate_c_call_args ?handle ?(implicit_size_ptr =
"&size")
(* Generate the pod documentation for the C API. *)
and generate_actions_pod () + generate_header PODStyle GPLv2plus;
+
List.iter (
function
| ({ once_had_no_optargs = false } as f) ->
@@ -342,6 +344,8 @@ and generate_actions_pod_back_compat_entry { name = name;
pr "\n"
and generate_structs_pod () + generate_header PODStyle GPLv2plus;
+
(* Structs documentation. *)
List.iter (
fun { s_name = typ; s_cols = cols } ->
@@ -391,6 +395,8 @@ and generate_structs_pod () ) structs
and generate_availability_pod () + generate_header PODStyle GPLv2plus;
+
(* Availability documentation. *)
pr "=over 4\n";
pr "\n";
diff --git a/generator/docstrings.ml b/generator/docstrings.ml
index 01a3671..904a9e5 100644
--- a/generator/docstrings.ml
+++ b/generator/docstrings.ml
@@ -58,7 +58,7 @@ let copyright_years (* Generate a header block in a number of
standard styles. *)
type comment_style CStyle | CPlusPlusStyle | HashStyle | OCamlStyle |
HaskellStyle
- | ErlangStyle | LuaStyle
+ | ErlangStyle | LuaStyle | PODStyle
type license = GPLv2plus | LGPLv2plus
let generate_header ?(extra_inputs = []) ?emacs_mode comment license @@ -70,7
+70,8 @@ let generate_header ?(extra_inputs = []) ?emacs_mode comment license
| OCamlStyle -> pr "(* "; " *"
| HaskellStyle -> pr "{- "; " "
| ErlangStyle -> pr "%% "; "% "
- | LuaStyle -> pr "-- "; "--" in
+ | LuaStyle -> pr "-- "; "--"
+ | PODStyle -> pr "=begin comment\n\n"; "" in
pr "libguestfs generated file";
(match emacs_mode with
| None -> ()
@@ -122,5 +123,6 @@ let generate_header ?(extra_inputs = []) ?emacs_mode comment
license | HashStyle -> ()
| OCamlStyle -> pr " *)\n"
| HaskellStyle -> pr "-}\n"
+ | PODStyle -> pr "\n=end comment\n"
);
pr "\n"
diff --git a/generator/fish.ml b/generator/fish.ml
index fb3d0f6..db800ef 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -838,6 +838,8 @@ do_completion (const char *text, int start, int end)
(* Generate the POD documentation for guestfish. *)
and generate_fish_actions_pod () + generate_header PODStyle GPLv2plus;
+
let fishdoc_functions_sorted List.filter is_documented
fish_functions_sorted
in
@@ -908,6 +910,8 @@ Guestfish will prompt for these separately.\n\n";
(* Generate documentation for guestfish-only commands. *)
and generate_fish_commands_pod () + generate_header PODStyle GPLv2plus;
+
List.iter (
fun ({ name = name; longdesc = longdesc } as f) ->
let aliases = get_aliases f in
@@ -1018,6 +1022,8 @@ and generate_fish_prep_options_c () pr "};\n"
and generate_fish_prep_options_pod () + generate_header PODStyle GPLv2plus;
+
List.iter (
fun (name, shortdesc, args, longdesc) ->
pr "=head2 B<-N %s> - %s\n" name shortdesc;
--
1.8.5.3