[libvirt] [PATCH 0/4] Fix python sanity check after moving typedParam stuff to libvirt-common.h

Fixes the following breakage: Cannot get a value of enum VIR_TYPED_PARAM_BOOLEAN (originally VIR_DOMAIN_BLKIO_PARAM_BOOLEAN) Cannot get a value of enum VIR_TYPED_PARAM_DOUBLE (originally VIR_DOMAIN_BLKIO_PARAM_DOUBLE) Cannot get a value of enum VIR_TYPED_PARAM_INT (originally VIR_DOMAIN_BLKIO_PARAM_INT) ... Peter Krempa (4): include: common: Fix file header for apibuild.py apibuild: Allow completely skipping certain macros api: Generate docs for libvirt-common.h include: common: Fix function formatting docs/Makefile.am | 1 + docs/apibuild.py | 12 +++ docs/sitemap.html.in | 4 + include/libvirt/libvirt-common.h.in | 173 ++++++++++++++++-------------------- 4 files changed, 95 insertions(+), 95 deletions(-) -- 2.8.1

Our docs/web generator would take the complete license text and put it into the description of the file, since it depends on position of the "Author:" line. Move the author line to the top and remove the spurious emacs comment. --- include/libvirt/libvirt-common.h.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/libvirt/libvirt-common.h.in b/include/libvirt/libvirt-common.h.in index 772e40f..95cf023 100644 --- a/include/libvirt/libvirt-common.h.in +++ b/include/libvirt/libvirt-common.h.in @@ -1,8 +1,9 @@ -/* -*- c -*- +/* * libvirt-common.h * Summary: common macros and enums for the libvirt and libvirt-admin library * Description: Provides common macros and enums needed by both libvirt and * libvirt-admin libraries + * Author: Erik Skultety <eskultet@redhat.com> * * Copyright (C) 2015 Red Hat, Inc. * @@ -19,8 +20,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. - * - * Author: Erik Skultety <eskultet@redhat.com> */ #if !defined __VIR_LIBVIRT_H_INCLUDES__ && !defined __VIR_ADMIN_H_INCLUDES__ -- 2.8.1

Some macros don't make sense to be documented at all. Add infrastructure to the web/api generator and add VIR_DEPRECATED and VIR_EXPORT_VAR as macros we should not document. --- docs/apibuild.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/apibuild.py b/docs/apibuild.py index f934fb2..9e63270 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -111,6 +111,12 @@ ignored_macros = { "_virMemoryParameter": "backward compatibility macro for virTypedParameter", } +# macros that should be completely skipped +hidden_macros = { + "VIR_DEPRECATED", # internal macro to mark deprecated apis + "VIR_EXPORT_VAR", # internal macro to mark exported vars +} + def escape(raw): raw = string.replace(raw, '&', '&') raw = string.replace(raw, '<', '<') @@ -1034,6 +1040,11 @@ class CParser: name = string.split(name, '(') [0] except: pass + + # skip hidden macros + if name in hidden_macros: + return token + strValue = None if len(lst) == 1 and lst[0][0] == '"' and lst[0][-1] == '"': strValue = lst[0][1:-1] -- 2.8.1

Since commit f5d9c5d00cfc0c moved the virTypedParam stuff into libvirt-common we did not generate any docs for them and neither populated them into libvirt-api.xml. This broke the sanity check in libvirt python. Fix it by generating docs for libvirt-common.h too. --- docs/Makefile.am | 1 + docs/apibuild.py | 1 + docs/sitemap.html.in | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/docs/Makefile.am b/docs/Makefile.am index 9524c94..3ca53a4 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -28,6 +28,7 @@ apihtml = \ $(apihtml_generated) apihtml_generated = \ + html/libvirt-libvirt-common.html \ html/libvirt-libvirt-domain.html \ html/libvirt-libvirt-domain-snapshot.html \ html/libvirt-libvirt-event.html \ diff --git a/docs/apibuild.py b/docs/apibuild.py index 9e63270..9c82c4a 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -21,6 +21,7 @@ debugsym=None # C parser analysis code # included_files = { + "libvirt-common.h": "header with general libvirt API definitions", "libvirt-domain.h": "header with general libvirt API definitions", "libvirt-domain-snapshot.h": "header with general libvirt API definitions", "libvirt-event.h": "header with general libvirt API definitions", diff --git a/docs/sitemap.html.in b/docs/sitemap.html.in index 22e410c..d5cf723 100644 --- a/docs/sitemap.html.in +++ b/docs/sitemap.html.in @@ -305,6 +305,10 @@ --> <ul> <li> + <a href="html/libvirt-libvirt-common.html">Common</a> + <span>common APIs for the libvirt library</span> + </li> + <li> <a href="html/libvirt-libvirt-domain.html">Domain</a> <span>domain APIs for the libvirt library</span> </li> -- 2.8.1

--- include/libvirt/libvirt-common.h.in | 168 ++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 92 deletions(-) diff --git a/include/libvirt/libvirt-common.h.in b/include/libvirt/libvirt-common.h.in index 95cf023..7223c36 100644 --- a/include/libvirt/libvirt-common.h.in +++ b/include/libvirt/libvirt-common.h.in @@ -203,106 +203,90 @@ struct _virTypedParameter { typedef virTypedParameter *virTypedParameterPtr; -virTypedParameterPtr -virTypedParamsGet (virTypedParameterPtr params, - int nparams, - const char *name); -int -virTypedParamsGetInt (virTypedParameterPtr params, - int nparams, - const char *name, - int *value); -int -virTypedParamsGetUInt (virTypedParameterPtr params, - int nparams, - const char *name, - unsigned int *value); -int -virTypedParamsGetLLong (virTypedParameterPtr params, - int nparams, - const char *name, - long long *value); -int -virTypedParamsGetULLong (virTypedParameterPtr params, - int nparams, - const char *name, - unsigned long long *value); -int -virTypedParamsGetDouble (virTypedParameterPtr params, - int nparams, - const char *name, - double *value); -int -virTypedParamsGetBoolean(virTypedParameterPtr params, +virTypedParameterPtr virTypedParamsGet(virTypedParameterPtr params, + int nparams, + const char *name);\ + +int virTypedParamsGetInt(virTypedParameterPtr params, int nparams, const char *name, int *value); -int -virTypedParamsGetString (virTypedParameterPtr params, - int nparams, - const char *name, - const char **value); -int -virTypedParamsAddInt (virTypedParameterPtr *params, - int *nparams, - int *maxparams, - const char *name, - int value); -int -virTypedParamsAddUInt (virTypedParameterPtr *params, - int *nparams, - int *maxparams, - const char *name, - unsigned int value); -int -virTypedParamsAddLLong (virTypedParameterPtr *params, - int *nparams, - int *maxparams, - const char *name, - long long value); -int -virTypedParamsAddULLong (virTypedParameterPtr *params, - int *nparams, - int *maxparams, - const char *name, - unsigned long long value); -int -virTypedParamsAddDouble (virTypedParameterPtr *params, - int *nparams, - int *maxparams, - const char *name, - double value); -int -virTypedParamsAddBoolean(virTypedParameterPtr *params, +int virTypedParamsGetUInt(virTypedParameterPtr params, + int nparams, + const char *name, + unsigned int *value); +int virTypedParamsGetLLong(virTypedParameterPtr params, + int nparams, + const char *name, + long long *value); +int virTypedParamsGetULLong(virTypedParameterPtr params, + int nparams, + const char *name, + unsigned long long *value); +int virTypedParamsGetDouble(virTypedParameterPtr params, + int nparams, + const char *name, + double *value); +int virTypedParamsGetBoolean(virTypedParameterPtr params, + int nparams, + const char *name, + int *value); +int virTypedParamsGetString(virTypedParameterPtr params, + int nparams, + const char *name, + const char **value); + +int virTypedParamsAddInt(virTypedParameterPtr *params, int *nparams, int *maxparams, const char *name, int value); -int -virTypedParamsAddString (virTypedParameterPtr *params, - int *nparams, - int *maxparams, - const char *name, - const char *value); -int -virTypedParamsAddStringList(virTypedParameterPtr *params, - int *nparams, - int *maxparams, - const char *name, - const char **values); -int -virTypedParamsAddFromString(virTypedParameterPtr *params, - int *nparams, - int *maxparams, - const char *name, - int type, - const char *value); -void -virTypedParamsClear (virTypedParameterPtr params, - int nparams); -void -virTypedParamsFree (virTypedParameterPtr params, +int virTypedParamsAddUInt(virTypedParameterPtr *params, + int *nparams, + int *maxparams, + const char *name, + unsigned int value); +int virTypedParamsAddLLong(virTypedParameterPtr *params, + int *nparams, + int *maxparams, + const char *name, + long long value); +int virTypedParamsAddULLong(virTypedParameterPtr *params, + int *nparams, + int *maxparams, + const char *name, + unsigned long long value); +int virTypedParamsAddDouble(virTypedParameterPtr *params, + int *nparams, + int *maxparams, + const char *name, + double value); +int virTypedParamsAddBoolean(virTypedParameterPtr *params, + int *nparams, + int *maxparams, + const char *name, + int value); +int virTypedParamsAddString(virTypedParameterPtr *params, + int *nparams, + int *maxparams, + const char *name, + const char *value); +int virTypedParamsAddStringList(virTypedParameterPtr *params, + int *nparams, + int *maxparams, + const char *name, + const char **values); +int virTypedParamsAddFromString(virTypedParameterPtr *params, + int *nparams, + int *maxparams, + const char *name, + int type, + const char *value); + +void virTypedParamsClear(virTypedParameterPtr params, int nparams); +void virTypedParamsFree(virTypedParameterPtr params, + int nparams); # ifdef __cplusplus } -- 2.8.1

On Thu, Apr 21, 2016 at 14:53:42 +0200, Peter Krempa wrote:
--- include/libvirt/libvirt-common.h.in | 168 ++++++++++++++++-------------------- 1 file changed, 76 insertions(+), 92 deletions(-)
diff --git a/include/libvirt/libvirt-common.h.in b/include/libvirt/libvirt-common.h.in index 95cf023..7223c36 100644 --- a/include/libvirt/libvirt-common.h.in +++ b/include/libvirt/libvirt-common.h.in @@ -203,106 +203,90 @@ struct _virTypedParameter {
[...]
-int -virTypedParamsGetDouble (virTypedParameterPtr params, - int nparams, - const char *name, - double *value); -int -virTypedParamsGetBoolean(virTypedParameterPtr params, +virTypedParameterPtr virTypedParamsGet(virTypedParameterPtr params, + int nparams, + const char *name);\
Oops, that shouldn't be here. I'll fix it on my branch.
+ +int virTypedParamsGetInt(virTypedParameterPtr params, int nparams, const char *name,

Some of the libvirt public API was moved into the libvirt-common.h file. We should consider it while building python too. --- generator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/generator.py b/generator.py index ceba668..3144904 100755 --- a/generator.py +++ b/generator.py @@ -33,6 +33,7 @@ onlyOverrides = False libvirt_headers = [ "libvirt", + "libvirt-common", "libvirt-domain", "libvirt-domain-snapshot", "libvirt-event", -- 2.8.1

On 21/04/16 14:53, Peter Krempa wrote:
Fixes the following breakage: Cannot get a value of enum VIR_TYPED_PARAM_BOOLEAN (originally VIR_DOMAIN_BLKIO_PARAM_BOOLEAN) Cannot get a value of enum VIR_TYPED_PARAM_DOUBLE (originally VIR_DOMAIN_BLKIO_PARAM_DOUBLE) Cannot get a value of enum VIR_TYPED_PARAM_INT (originally VIR_DOMAIN_BLKIO_PARAM_INT) ...
Peter Krempa (4): include: common: Fix file header for apibuild.py apibuild: Allow completely skipping certain macros api: Generate docs for libvirt-common.h include: common: Fix function formatting
docs/Makefile.am | 1 + docs/apibuild.py | 12 +++ docs/sitemap.html.in | 4 + include/libvirt/libvirt-common.h.in | 173 ++++++++++++++++-------------------- 4 files changed, 95 insertions(+), 95 deletions(-)
ACK series, thanks for fixing my mess. Erik
participants (2)
-
Erik Skultety
-
Peter Krempa