[Libosinfo] [PATCH libosinfo 4/6] cfg.mk: enable and fix sc_error_message_uppercase

Giuseppe Scrivano gscrivan at redhat.com
Tue Jul 29 13:41:10 UTC 2014


Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 cfg.mk                         |  1 -
 osinfo/osinfo_install_script.c | 36 ++++++++++++++++++------------------
 osinfo/osinfo_loader.c         | 34 +++++++++++++++++-----------------
 osinfo/osinfo_media.c          |  8 ++++----
 osinfo/osinfo_tree.c           |  4 ++--
 tools/osinfo-db-validate.c     | 16 ++++++++--------
 tools/osinfo-install-script.c  |  2 +-
 tools/osinfo-query.c           | 14 +++++++-------
 8 files changed, 57 insertions(+), 58 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 40ec1db..8e1b541 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -23,7 +23,6 @@ local-checks-to-skip =			\
   sc_prohibit_atoi_atof			\
   sc_space_tab				\
   sc_two_space_separator_in_usage	\
-  sc_error_message_uppercase		\
   sc_program_name			\
   sc_makefile_check
 
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index fca1267..c6acac8 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -578,7 +578,7 @@ static xsltStylesheetPtr osinfo_install_script_load_template(const gchar *uri,
     pctxt = xmlNewParserCtxt();
     if (!pctxt || !pctxt->sax) {
         g_set_error(error, 0, 0, "%s",
-                    _("Unable to create XML parser context"));
+                    _("unable to create XML parser context"));
         goto cleanup;
     }
 
@@ -586,13 +586,13 @@ static xsltStylesheetPtr osinfo_install_script_load_template(const gchar *uri,
                                XML_PARSE_NOENT | XML_PARSE_NONET |
                                XML_PARSE_NOWARNING))) {
         g_set_error(error, 0, 0, "%s",
-                    _("Unable to read XSL template"));
+                    _("unable to read XSL template"));
         goto cleanup;
     }
 
     if (!(xslt = xsltParseStylesheetDoc(doc))) {
         g_set_error(error, 0, 0, "%s",
-                    _("Unable to parse XSL template"));
+                    _("unable to parse XSL template"));
         goto cleanup;
     }
 
@@ -665,7 +665,7 @@ static xmlNodePtr osinfo_install_script_generate_entity_xml(OsinfoInstallScript
 
     if (!(node = xmlNewDocNode(NULL, NULL, (xmlChar*)name, NULL))) {
         xmlErrorPtr err = xmlGetLastError();
-        g_set_error(error, 0, 0, _("Unable to create XML node '%s': '%s'"),
+        g_set_error(error, 0, 0, _("unable to create XML node '%s': '%s'"),
                     name, err ? err->message : "");
         goto error;
     }
@@ -673,13 +673,13 @@ static xmlNodePtr osinfo_install_script_generate_entity_xml(OsinfoInstallScript
     if (!(data = xmlNewDocRawNode(NULL, NULL, (const xmlChar*)"id",
                                   (const xmlChar*)osinfo_entity_get_id(entity)))) {
         xmlErrorPtr err = xmlGetLastError();
-        g_set_error(error, 0, 0, _("Unable to create XML node 'id': '%s'"),
+        g_set_error(error, 0, 0, _("unable to create XML node 'id': '%s'"),
                     err ? err->message : "");
         goto error;
     }
     if (!(xmlAddChild(node, data))) {
         xmlErrorPtr err = xmlGetLastError();
-        g_set_error(error, 0, 0, _("Unable to add XML child '%s'"), err ? err->message : "");
+        g_set_error(error, 0, 0, _("unable to add XML child '%s'"), err ? err->message : "");
         goto error;
     }
     data = NULL;
@@ -701,13 +701,13 @@ static xmlNodePtr osinfo_install_script_generate_entity_xml(OsinfoInstallScript
             if (!(data = xmlNewDocRawNode(NULL, NULL, (const xmlChar*)tmp1->data,
                                           (const xmlChar*)tmp2->data))) {
                 xmlErrorPtr err = xmlGetLastError();
-                g_set_error(error, 0, 0, _("Unable to create XML node '%s': '%s'"),
+                g_set_error(error, 0, 0, _("unable to create XML node '%s': '%s'"),
                             (const gchar *)tmp1->data, err ? err->message : "");
                 goto error;
             }
             if (!(xmlAddChild(node, data))) {
                 xmlErrorPtr err = xmlGetLastError();
-                g_set_error(error, 0, 0, _("Unable to add XML child '%s'"), err ? err->message : "");
+                g_set_error(error, 0, 0, _("unable to add XML child '%s'"), err ? err->message : "");
                 goto error;
             }
             data = NULL;
@@ -752,7 +752,7 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript *
         goto error;
     if (!(xmlAddChild(root, node))) {
         xmlErrorPtr err = xmlGetLastError();
-        g_set_error(error, 0, 0, _("Unable to set XML root '%s'"), err ? err->message : "");
+        g_set_error(error, 0, 0, _("unable to set XML root '%s'"), err ? err->message : "");
         goto error;
     }
 
@@ -763,7 +763,7 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript *
         goto error;
     if (!(xmlAddChild(root, node))) {
         xmlErrorPtr err = xmlGetLastError();
-        g_set_error(error, 0, 0, _("Unable to set XML root '%s'"), err ? err->message : "");
+        g_set_error(error, 0, 0, _("unable to set XML root '%s'"), err ? err->message : "");
         goto error;
     }
 
@@ -774,7 +774,7 @@ static xmlDocPtr osinfo_install_script_generate_config_xml(OsinfoInstallScript *
         goto error;
     if (!(xmlAddChild(root, node))) {
         xmlErrorPtr err = xmlGetLastError();
-        g_set_error(error, 0, 0, _("Unable to set XML root '%s'"), err ? err->message : "");
+        g_set_error(error, 0, 0, _("unable to set XML root '%s'"), err ? err->message : "");
         goto error;
     }
 
@@ -796,17 +796,17 @@ static gchar *osinfo_install_script_apply_xslt(xsltStylesheetPtr ss,
     int len;
 
     if (!(ctxt = xsltNewTransformContext(ss, doc))) {
-        g_set_error(error, 0, 0, "%s", _("Unable to create XSL transform context"));
+        g_set_error(error, 0, 0, "%s", _("unable to create XSL transform context"));
         goto cleanup;
     }
 
     if (!(docOut = xsltApplyStylesheetUser(ss, doc, NULL, NULL, NULL, ctxt))) {
-        g_set_error(error, 0, 0, "%s", _("Unable to apply XSL transform context"));
+        g_set_error(error, 0, 0, "%s", _("unable to apply XSL transform context"));
         goto cleanup;
     }
 
     if (xsltSaveResultToString((xmlChar **)&ret, &len, docOut, ss) < 0) {
-        g_set_error(error, 0, 0, "%s", _("Unable to convert XSL output to string"));
+        g_set_error(error, 0, 0, "%s", _("unable to convert XSL output to string"));
         goto cleanup;
     }
 
@@ -863,7 +863,7 @@ static void osinfo_install_script_template_loaded(GObject *src,
                                      &length,
                                      NULL,
                                      &error)) {
-        g_prefix_error(&error, _("Failed to load script template %s: "), uri);
+        g_prefix_error(&error, _("failed to load script template %s: "), uri);
         g_simple_async_result_take_error(data->res, error);
         goto cleanup;
     }
@@ -877,7 +877,7 @@ static void osinfo_install_script_template_loaded(GObject *src,
                                               &output,
                                               data->config,
                                               &error)) {
-        g_prefix_error(&error, _("Failed to apply script template %s: "), uri);
+        g_prefix_error(&error, _("failed to apply script template %s: "), uri);
         g_simple_async_result_take_error(data->res, error);
         goto cleanup;
     }
@@ -922,7 +922,7 @@ void osinfo_install_script_generate_async(OsinfoInstallScript *script,
                                                   &output,
                                                   data->config,
                                                   &error)) {
-            g_prefix_error(&error, "%s", _("Failed to apply script template: "));
+            g_prefix_error(&error, "%s", _("failed to apply script template: "));
             g_simple_async_result_take_error(data->res, error);
             g_simple_async_result_complete(data->res);
             osinfo_install_script_generate_data_free(data);
@@ -1231,7 +1231,7 @@ gchar *osinfo_install_script_generate_command_line(OsinfoInstallScript *script,
                                                   &output,
                                                   config,
                                                   &error)) {
-            g_prefix_error(&error, "%s", _("Failed to apply script template: "));
+            g_prefix_error(&error, "%s", _("failed to apply script template: "));
         }
     }
 
diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index b8d6e45..035af13 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -170,7 +170,7 @@ osinfo_loader_nodeset(const char *xpath,
         return 0;
     if (obj->type != XPATH_NODESET) {
         g_set_error(err, g_quark_from_static_string("libosinfo"), 0,
-                    _("Expected a nodeset in XPath query %s"), xpath);
+                    _("expected a nodeset in XPath query %s"), xpath);
         xmlXPathFreeObject(obj);
         return -1;
     }
@@ -250,7 +250,7 @@ osinfo_loader_boolean(const char *xpath,
             break;
         }
         if (node->children->type != XML_TEXT_NODE) {
-            OSINFO_ERROR(err, _("Expected a text node attribute value"));
+            OSINFO_ERROR(err, _("expected a text node attribute value"));
             goto cleanup;
         }
 
@@ -292,13 +292,13 @@ osinfo_loader_doc(const char *xpath,
     if (!(buf = xmlBufferCreate())) {
         xmlXPathFreeObject(obj);
         g_set_error(err, 0, 0, "%s",
-                    "Cannot allocate buffer");
+                    "cannot allocate buffer");
         return NULL;
     }
     if (xmlNodeDump(buf, NULL, obj->nodesetval->nodeTab[0], 0, 1) < 0) {
         xmlXPathFreeObject(obj);
         g_set_error(err, 0, 0, "%s",
-                    "Cannot format stylesheet");
+                    "cannot format stylesheet");
     }
     ret = g_strdup((char *)buf->content);
 
@@ -394,7 +394,7 @@ static void osinfo_loader_entity(OsinfoLoader *loader,
 
         if (!param->children ||
             param->children->type != XML_TEXT_NODE) {
-            OSINFO_ERROR(err, _("Expected a text node attribute value"));
+            OSINFO_ERROR(err, _("expected a text node attribute value"));
             goto cleanup;
         }
 
@@ -485,7 +485,7 @@ static void osinfo_loader_device(OsinfoLoader *loader,
         { NULL, G_TYPE_INVALID }
     };
     if (!id) {
-        OSINFO_ERROR(err, _("Missing device id property"));
+        OSINFO_ERROR(err, _("missing device id property"));
         return;
     }
 
@@ -515,7 +515,7 @@ static void osinfo_loader_device_link(OsinfoLoader *loader,
         };
         gchar *id = (gchar *)xmlGetProp(related[i], BAD_CAST "id");
         if (!id) {
-            OSINFO_ERROR(err, _("Missing device link id property"));
+            OSINFO_ERROR(err, _("missing device link id property"));
             goto cleanup;
         }
         OsinfoDevice *dev = osinfo_loader_get_device(loader, id);
@@ -565,7 +565,7 @@ static void osinfo_loader_product_relshp(OsinfoLoader *loader,
 
         gchar *id = (gchar *) xmlGetProp(it, BAD_CAST "id");
         if (!id) {
-            OSINFO_ERROR(err, _("Missing product upgrades id property"));
+            OSINFO_ERROR(err, _("missing product upgrades id property"));
             goto cleanup;
         }
         OsinfoProduct *relproduct;
@@ -637,7 +637,7 @@ static void osinfo_loader_platform(OsinfoLoader *loader,
 {
     gchar *id = (gchar *)xmlGetProp(root, BAD_CAST "id");
     if (!id) {
-        OSINFO_ERROR(err, _("Missing platform id property"));
+        OSINFO_ERROR(err, _("missing platform id property"));
         return;
     }
 
@@ -665,13 +665,13 @@ static void osinfo_loader_deployment(OsinfoLoader *loader,
 {
     gchar *id = (gchar *)xmlGetProp(root, BAD_CAST "id");
     if (!id) {
-        OSINFO_ERROR(err, _("Missing deployment id property"));
+        OSINFO_ERROR(err, _("missing deployment id property"));
         return;
     }
 
     gchar *osid = osinfo_loader_string("string(./os/@id)", loader, ctxt, err);
     if (!osid && 0) {
-        OSINFO_ERROR(err, _("Missing deployment os id property"));
+        OSINFO_ERROR(err, _("missing deployment os id property"));
         xmlFree(id);
         return;
     }
@@ -681,7 +681,7 @@ static void osinfo_loader_deployment(OsinfoLoader *loader,
     gchar *platformid = osinfo_loader_string("string(./platform/@id)", loader,
                                              ctxt, err);
     if (!platformid) {
-        OSINFO_ERROR(err, _("Missing deployment platform id property"));
+        OSINFO_ERROR(err, _("missing deployment platform id property"));
         xmlFree(id);
         return;
     }
@@ -719,7 +719,7 @@ static void osinfo_loader_datamap(OsinfoLoader *loader,
     gchar *id = (gchar *)xmlGetProp(root, BAD_CAST "id");
 
     if (!id) {
-        OSINFO_ERROR(err, _("Missing os id property"));
+        OSINFO_ERROR(err, _("missing os id property"));
         return;
     }
 
@@ -835,7 +835,7 @@ static void osinfo_loader_install_script(OsinfoLoader *loader,
     GFlagsClass *flags_class;
 
     if (!id) {
-        OSINFO_ERROR(err, _("Missing install script id property"));
+        OSINFO_ERROR(err, _("missing install script id property"));
         return;
     }
 
@@ -1279,7 +1279,7 @@ static void osinfo_loader_os(OsinfoLoader *loader,
     };
 
     if (!id) {
-        OSINFO_ERROR(err, _("Missing os id property"));
+        OSINFO_ERROR(err, _("missing os id property"));
         return;
     }
 
@@ -1389,7 +1389,7 @@ static void osinfo_loader_os(OsinfoLoader *loader,
     for (i = 0; i < nnodes; i++) {
         gchar *scriptid = (gchar *)xmlGetProp(nodes[i], BAD_CAST "id");
         if (!scriptid) {
-            OSINFO_ERROR(err, _("Missing OS install script property"));
+            OSINFO_ERROR(err, _("missing OS install script property"));
             goto cleanup;
         }
         OsinfoInstallScript *script;
@@ -1540,7 +1540,7 @@ static void osinfo_loader_process_xml(OsinfoLoader *loader,
     root = xmlDocGetRootElement(xml);
 
     if (!root) {
-        OSINFO_ERROR(err, _("Missing root XML element"));
+        OSINFO_ERROR(err, _("missing root XML element"));
         goto cleanup;
     }
 
diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index 96f9603..9ac423b 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -658,7 +658,7 @@ static void on_svd_read(GObject *source,
                                      &error);
     if (ret < 0) {
         g_prefix_error(&error,
-                       _("Failed to read supplementary volume descriptor: "));
+                       _("failed to read supplementary volume descriptor: "));
         goto EXIT;
     }
     if (ret == 0) {
@@ -744,7 +744,7 @@ static void on_pvd_read(GObject *source,
                                      res,
                                      &error);
     if (ret < 0) {
-        g_prefix_error(&error, _("Failed to read primary volume descriptor: "));
+        g_prefix_error(&error, _("failed to read primary volume descriptor: "));
         goto ON_ERROR;
     }
     if (ret == 0) {
@@ -811,7 +811,7 @@ static void on_location_skipped(GObject *source,
 
     if (g_input_stream_skip_finish(stream, res, &error) < PVD_OFFSET) {
         if (error)
-            g_prefix_error(&error, _("Failed to skip %d bytes"), PVD_OFFSET);
+            g_prefix_error(&error, _("failed to skip %d bytes"), PVD_OFFSET);
         else
             g_set_error(&error,
                         OSINFO_MEDIA_ERROR,
@@ -848,7 +848,7 @@ static void on_location_read(GObject *source,
 
     stream = g_file_read_finish(G_FILE(source), res, &error);
     if (error != NULL) {
-        g_prefix_error(&error, _("Failed to open file"));
+        g_prefix_error(&error, _("failed to open file"));
         g_simple_async_result_take_error(data->res, error);
         g_simple_async_result_complete(data->res);
         create_from_location_async_data_free(data);
diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
index 55c572e..392cc2e 100644
--- a/osinfo/osinfo_tree.c
+++ b/osinfo/osinfo_tree.c
@@ -603,7 +603,7 @@ static void on_location_read(GObject *source,
                                      &length,
                                      NULL,
                                      &error)) {
-        g_prefix_error(&error, _("Failed to load .treeinfo file: "));
+        g_prefix_error(&error, _("failed to load .treeinfo file: "));
         g_simple_async_result_take_error(data->res, error);
         g_simple_async_result_complete(data->res);
         create_from_location_async_data_free(data);
@@ -614,7 +614,7 @@ static void on_location_read(GObject *source,
                              content,
                              length,
                              &error))) {
-        g_prefix_error(&error, _("Failed to process keyinfo file: "));
+        g_prefix_error(&error, _("failed to process keyinfo file: "));
         g_simple_async_result_take_error(data->res, error);
         goto cleanup;
     }
diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c
index f53aebe..d391575 100644
--- a/tools/osinfo-db-validate.c
+++ b/tools/osinfo-db-validate.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Red Hat, Inc
+ * Copyright (C) 2012, 2014 Red Hat, Inc
  *
  * osinfo-validate: validate that XML file(s) follows the published schema
  *
@@ -68,7 +68,7 @@ static xmlDocPtr parse_file(GFile *file, GError **error)
 
     if (!(pctxt = xmlNewParserCtxt())) {
         g_set_error(error, 0, 0, "%s",
-                    _("Unable to create libxml parser"));
+                    _("unable to create libxml parser"));
         goto cleanup;
     }
 
@@ -76,7 +76,7 @@ static xmlDocPtr parse_file(GFile *file, GError **error)
                                XML_PARSE_NOENT | XML_PARSE_NONET |
                                XML_PARSE_NOWARNING))) {
         g_set_error(error, 0, 0,
-                    _("Unable to parse XML document '%s'"),
+                    _("unable to parse XML document '%s'"),
                     uri);
         goto cleanup;
     }
@@ -108,7 +108,7 @@ static gboolean validate_file_regular(xmlRelaxNGValidCtxtPtr rngValid,
 
     if (xmlRelaxNGValidateDoc(rngValid, doc) != 0) {
         g_set_error(error, 0, 0,
-                    _("Unable to validate XML document '%s'"),
+                    _("unable to validate XML document '%s'"),
                     uri);
         goto cleanup;
     }
@@ -176,7 +176,7 @@ static gboolean validate_file(xmlRelaxNGValidCtxtPtr rngValid, GFile *file, GFil
             goto cleanup;
     } else {
         g_set_error(error, 0, 0,
-                    "Unable to handle file type for %s",
+                    "unable to handle file type for %s",
                     uri);
         goto cleanup;
     }
@@ -206,7 +206,7 @@ static gboolean validate_files(gint argc, gchar **argv, GError **error)
     rngParser = xmlRelaxNGNewParserCtxt(SCHEMA);
     if (!rngParser) {
         g_set_error(error, 0, 0,
-                    _("Unable to create RNG parser for %s"),
+                    _("unable to create RNG parser for %s"),
                     SCHEMA);
         goto cleanup;
     }
@@ -214,7 +214,7 @@ static gboolean validate_files(gint argc, gchar **argv, GError **error)
     rng = xmlRelaxNGParse(rngParser);
     if (!rng) {
         g_set_error(error, 0, 0,
-                    _("Unable to parse RNG %s"),
+                    _("unable to parse RNG %s"),
                     SCHEMA);
         goto cleanup;
     }
@@ -222,7 +222,7 @@ static gboolean validate_files(gint argc, gchar **argv, GError **error)
     rngValid = xmlRelaxNGNewValidCtxt(rng);
     if (!rngValid) {
         g_set_error(error, 0, 0,
-                    _("Unable to create RNG validation context %s"),
+                    _("unable to create RNG validation context %s"),
                     SCHEMA);
         goto cleanup;
     }
diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c
index 9f9894a..135a1ea 100644
--- a/tools/osinfo-install-script.c
+++ b/tools/osinfo-install-script.c
@@ -50,7 +50,7 @@ static gboolean handle_config(const gchar *option_name G_GNUC_UNUSED,
 
     if (!(val = strchr(value, '='))) {
         g_set_error(error, 0, 0,
-                    _("Expected configuration key=value"));
+                    _("expected configuration key=value"));
         return FALSE;
     }
     len = val - value;
diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c
index 43ded4f..df2aa29 100644
--- a/tools/osinfo-query.c
+++ b/tools/osinfo-query.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Red Hat, Inc
+ * Copyright (C) 2012, 2014 Red Hat, Inc
  *
  * osinfo-query: query the contents of the database
  *
@@ -150,7 +150,7 @@ static gboolean toggle_fields(struct OsinfoLabel *labels,
         }
         if (!found) {
             g_set_error(error, 0, 0,
-                        _("Unknown property name %s"), fields[i]);
+                        _("unknown property name %s"), fields[i]);
             goto cleanup;
         }
     }
@@ -174,7 +174,7 @@ static gboolean build_filter(struct OsinfoLabel *labels,
     for (i = 0; i < argc; i++) {
         const gchar *tmp = strchr(argv[i], '=');
         if (!tmp) {
-            g_set_error(error, 0, 0, "%s", _("Syntax error in condition, expecting KEY=VALUE"));
+            g_set_error(error, 0, 0, "%s", _("syntax error in condition, expecting KEY=VALUE"));
             goto cleanup;
         }
         gchar *key = g_strndup(argv[i], tmp-argv[i]);
@@ -188,7 +188,7 @@ static gboolean build_filter(struct OsinfoLabel *labels,
 
         if (!found) {
             g_set_error(error, 0, 0,
-                        _("Unknown property name %s"), key);
+                        _("unknown property name %s"), key);
             goto cleanup;
         }
 
@@ -446,17 +446,17 @@ gint main(gint argc, gchar **argv)
     }
 
     if (!entities) {
-        g_printerr(_("Unknown type '%s' requested\n"), type);
+        g_printerr(_("unknown type '%s' requested\n"), type);
         goto error;
     }
 
     if (!build_filter(labels, filter, argc-2, argv+2, &error)) {
-        g_printerr(_("Unable to construct filter: %s\n"), error->message);
+        g_printerr(_("unable to construct filter: %s\n"), error->message);
         goto error;
     }
 
     if (!toggle_fields(labels, fields, &error)) {
-        g_printerr(_("Unable to set field visibility: %s\n"), error->message);
+        g_printerr(_("unable to set field visibility: %s\n"), error->message);
         goto error;
     }
 
-- 
1.9.3




More information about the Libosinfo mailing list