Bug 622565 - compile-schemas fails when no schemas
authorRyan Lortie <desrt@desrt.ca>
Mon, 28 Jun 2010 18:06:32 +0000 (14:06 -0400)
committerRyan Lortie <desrt@desrt.ca>
Mon, 28 Jun 2010 18:06:32 +0000 (14:06 -0400)
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
m4macros/gsettings.m4

index dd4a445..a6d28dd 100644 (file)
@@ -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);
index ee97b57..58a826d 100644 (file)
@@ -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)