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
This commit is contained in:
Ryan Lortie 2010-06-28 14:06:32 -04:00
parent ab1111b8bb
commit 8a7d990698
2 changed files with 10 additions and 11 deletions

View File

@ -1303,7 +1303,7 @@ main (int argc, char **argv)
GOptionEntry entries[] = { GOptionEntry entries[] = {
{ "targetdir", 0, 0, G_OPTION_ARG_FILENAME, &targetdir, N_("where to store the gschemas.compiled file"), N_("DIRECTORY") }, { "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 }, { "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") }, { "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 */ /* 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 (files->len == 0)
{ {
if (uninstall) fprintf (stderr, _("No schema files found: "));
{
g_unlink (target); if (g_unlink (target))
return 0; fprintf (stderr, _("doing nothing.\n"));
}
else else
{ fprintf (stderr, _("removed existing output file.\n"));
fprintf (stderr, _("No schema files found\n"));
return 1; return 0;
}
} }
g_ptr_array_sort (files, compare_strings); g_ptr_array_sort (files, compare_strings);
g_ptr_array_add (files, NULL); g_ptr_array_add (files, NULL);

View File

@ -68,7 +68,7 @@ uninstall-gsettings-schemas:
test -n "$$files" || exit 0; \ test -n "$$files" || exit 0; \
echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \ echo " ( cd '\''$(DESTDIR)$(gsettingsschemadir)'\'' && rm -f" $$files ")"; \
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: clean-gsettings-schemas:
rm -f $(gsettings_SCHEMAS:.xml=.valid) rm -f $(gsettings_SCHEMAS:.xml=.valid)