[glib] Bug 622565 - compile-schemas fails when no schemas



commit 8a7d9906983c23c9bafa8b10c1fd089fcd7989f8
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Jun 28 14:06:32 2010 -0400

    Bug 622565 - compile-schemas fails when no schemas
    
    Neutralise and deprecate the --uninstall option in the schema compiler
    and remove it from gsettings.m4.
    
    Make the new default behaviour a compromise between the old default
    behaviour and the previous --uninstall option:
    
      - never return a failure code if no schema files are found
    
      - issue a warning instead
    
      - remove the gschemas.compiled file if it exists

 gio/gschema-compile.c |   19 +++++++++----------
 m4macros/gsettings.m4 |    2 +-
 2 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/gio/gschema-compile.c b/gio/gschema-compile.c
index dd4a445..a6d28dd 100644
--- a/gio/gschema-compile.c
+++ b/gio/gschema-compile.c
@@ -1303,7 +1303,7 @@ main (int argc, char **argv)
   GOptionEntry entries[] = {
     { "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("where to store the gschemas.compiled file"), N_("DIRECTORY") },
     { "dry-run", 0, 0, G_OPTION_ARG_NONE, &dry_run, N_("Do not write the gschema.compiled file"), NULL },
-    { "uninstall", 0, 0, G_OPTION_ARG_NONE, &uninstall, N_("Do not give error for empty directory"), NULL },
+    { "uninstall", 0, 0, G_OPTION_ARG_NONE, &uninstall, N_("This option will be removed soon.") },
     { "allow-any-name", 0, 0, G_OPTION_ARG_NONE, &allow_any_name, N_("Do not enforce key name restrictions") },
 
     /* These options are only for use in the gschema-compile tests */
@@ -1365,16 +1365,15 @@ main (int argc, char **argv)
 
       if (files->len == 0)
         {
-          if (uninstall)
-            {
-              g_unlink (target);
-              return 0;
-            }
+          fprintf (stderr, _("No schema files found: "));
+
+          if (g_unlink (target))
+            fprintf (stderr, _("doing nothing.\n"));
+
           else
-            {
-              fprintf (stderr, _("No schema files found\n"));
-              return 1;
-            }
+            fprintf (stderr, _("removed existing output file.\n"));
+
+          return 0;
         }
       g_ptr_array_sort (files, compare_strings);
       g_ptr_array_add (files, NULL);
diff --git a/m4macros/gsettings.m4 b/m4macros/gsettings.m4
index ee97b57..58a826d 100644
--- a/m4macros/gsettings.m4
+++ b/m4macros/gsettings.m4
@@ -68,7 +68,7 @@ uninstall-gsettings-schemas:
 	test -n "$$files" || exit 0; \
 	echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
 	cd "$(DESTDIR)$(gsettingsschemadir)" && rm -f $$files
-	test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) --uninstall $(gsettingsschemadir)
+	test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir)
 
 clean-gsettings-schemas:
 	rm -f $(gsettings_SCHEMAS:.xml=.valid)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]