From 403060bdb9460782cc2e26c04f1b84ad6d8f5db4 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Thu, 28 Nov 2013 14:13:58 -0500 Subject: dconf(1): add 'dconf compile' command This allows manually compiling dconf databases outside of /etc. This is meant to be used from the build system of projects that want to install dconf databases (like gdm) to easily build the database in-tree. https://bugzilla.gnome.org/show_bug.cgi?id=672303 --- bin/dconf-update.vala | 14 ++++++++++++++ bin/dconf.vala | 15 +++++++++++++++ 2 files changed, 29 insertions(+) (limited to 'bin') diff --git a/bin/dconf-update.vala b/bin/dconf-update.vala index 8b73658..867ded1 100644 --- a/bin/dconf-update.vala +++ b/bin/dconf-update.vala @@ -232,6 +232,20 @@ void update_all (string dirname) throws GLib.Error { } } +void dconf_compile (string[] args) throws GLib.Error { + if (args[2] == null || args[3] == null || args[4] != null) { + throw new OptionError.FAILED ("must give output file and .d dir"); + } + + try { + var table = read_directory (args[3]); + table.write_contents (args[2]); + } catch (Error e) { + printerr ("%s\n", e.message); + Process.exit (1); + } +} + void dconf_update (string[] args) throws GLib.Error { update_all ("/etc/dconf/db"); } diff --git a/bin/dconf.vala b/bin/dconf.vala index ea05f77..5c4ce4e 100644 --- a/bin/dconf.vala +++ b/bin/dconf.vala @@ -54,6 +54,11 @@ void show_help (bool requested, string? command) { synopsis = " [-f] PATH "; break; + case "compile": + description = "Compile a binary database from keyfiles"; + synopsis = " OUTPUT KEYFILEDIR "; + break; + case "update": description = "Update the system dconf databases"; synopsis = ""; @@ -91,6 +96,7 @@ Commands: list List the contents of a dir write Change the value of a key reset Reset the value of a key or dir + compile Compile a binary database from keyfiles update Update the system databases watch Watch a path for changes dump Dump an entire subpath to stdout @@ -126,6 +132,14 @@ Use 'dconf help COMMAND' to get detailed help. if (" VALUE " in synopsis) { str.append (" VALUE The value to write (in GVariant format)\n"); } + + if (" OUTPUT " in synopsis) { + str.append (" OUTPUT The filename of the (binary) output\n"); + } + + if (" KEYFILEDIR " in synopsis) { + str.append (" KEYFILEDIR The path to the .d directory containing keyfiles\n"); + } } str.append ("\n"); @@ -287,6 +301,7 @@ int main (string[] args) { CommandMapping ("list", dconf_list), CommandMapping ("write", dconf_write), CommandMapping ("reset", dconf_reset), + CommandMapping ("compile", dconf_compile), CommandMapping ("update", dconf_update), CommandMapping ("watch", dconf_watch), CommandMapping ("dump", dconf_dump), -- cgit v1.2.1