[Libguestfs] [PATCH] generator: Allow actions to be deprecated with no replacement.

Richard W.M. Jones rjones at redhat.com
Fri Mar 3 16:40:24 UTC 2017


On Fri, Mar 03, 2017 at 04:31:45PM +0100, Pino Toscano wrote:
> On Friday, 3 March 2017 11:18:26 CET Richard W.M. Jones wrote:
> > There is precisely one such function at the moment
> > (guestfs_wait_ready).
> > ---
> 
> Mostly LGTM, few notes below.

Thanks - I will push it with the changes you have noted below.

Rich.

> > diff --git a/generator/GObject.ml b/generator/GObject.ml
> > index eada33c..fd2c07c 100644
> > --- a/generator/GObject.ml
> > +++ b/generator/GObject.ml
> > @@ -1118,9 +1118,11 @@ guestfs_session_close (GuestfsSession *session, GError **err)
> >        );
> >        pr "\n";
> >        (match deprecated_by with
> > -      | None -> ()
> > -      | Some alt ->
> > +      | Not_deprecated -> ()
> > +      | Replaced_by alt ->
> >          pr " * Deprecated: In new code, use guestfs_session_%s() instead\n" alt
> > +      | Deprecated_no_replacement ->
> > +        pr " * Deprecated\n"
> 
> The "Deprecated" tag needs a text, so I'd just note to not use it anymore.
> 
> >        );
> >        (match version_added f with
> >        | None -> ()
> > diff --git a/generator/OCaml.ml b/generator/OCaml.ml
> > index 083e505..38b254d 100644
> > --- a/generator/OCaml.ml
> > +++ b/generator/OCaml.ml
> > @@ -186,10 +186,13 @@ end
> >              opt
> >        );
> >        (match f.deprecated_by with
> > -       | None -> ()
> > -       | Some replacement ->
> > +       | Not_deprecated -> ()
> > +       | Replaced_by replacement ->
> >            has_tags := true;
> >            pr "\n\n    @deprecated Use {!%s} instead" replacement
> > +       | Deprecated_no_replacement ->
> > +          has_tags := true;
> > +          pr "\n\n    @deprecated"
> 
> Ditto.
> 
> > diff --git a/generator/java.ml b/generator/java.ml
> > index 8f71feb..83f2e65 100644
> > --- a/generator/java.ml
> > +++ b/generator/java.ml
> > @@ -297,9 +297,11 @@ public class GuestFS {
> >          | Some version -> pr "   * @since %s\n" version
> >          );
> >          (match f with
> > -        | { deprecated_by = None } -> ()
> > -        | { deprecated_by = Some alt } ->
> > +        | { deprecated_by = Not_deprecated } -> ()
> > +        | { deprecated_by = Replaced_by alt } ->
> >            pr "   * @deprecated In new code, use {@link #%s} instead\n" alt
> > +        | { deprecated_by = Deprecated_no_replacement } ->
> > +          pr "   * @deprecated\n"
> >          );
> 
> Ditto.
> 
> > diff --git a/generator/ruby.ml b/generator/ruby.ml
> > index c938bc9..594036d 100644
> > --- a/generator/ruby.ml
> > +++ b/generator/ruby.ml
> > @@ -146,9 +146,12 @@ and generate_ruby_c actions () =
> >            | Some version -> doc ^ (sprintf "\n *\n * [Since] Added in version %s." version) in
> >          let doc =
> >            match f with
> > -          | { deprecated_by = None } -> doc
> > -          | { deprecated_by = Some alt } ->
> > -            doc ^ (sprintf "\n *\n * [Deprecated] In new code, use rdoc-ref:%s instead." alt) in
> > +          | { deprecated_by = Not_deprecated } -> doc
> > +          | { deprecated_by = Replaced_by alt } ->
> > +            doc ^
> > +              sprintf "\n *\n * [Deprecated] In new code, use rdoc-ref:%s instead." alt
> > +          | { deprecated_by = Deprecated_no_replacement } ->
> > +            doc ^ "\n *\n * [Deprecated]" in
> >          let doc =
> 
> Ditto.
> 
> > diff --git a/generator/actions_core_deprecated.ml b/generator/actions_core_deprecated.ml
> > index b8cca79..ae93f29 100644
> > --- a/generator/actions_core_deprecated.ml
> > +++ b/generator/actions_core_deprecated.ml
> > @@ -174,7 +174,7 @@ C<guestfs_part_init>" };
> >    { defaults with
> >      name = "blockdev_setbsz"; added = (1, 9, 3);
> >      style = RErr, [Device "device"; Int "blocksize"], [];
> > -    deprecated_by = Some "mkfs";
> > +    deprecated_by = Replaced_by "mkfs";
> >      shortdesc = "set blocksize of block device";
> >      longdesc = "\
> >  This call does nothing and has never done anything
> 
> This maybe could just become Deprecated_no_replacement, since it never
> did anything anyway.
> 
> Thanks,
> -- 
> Pino Toscano



> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list