summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémy Bobbio <lunar@debian.org>2016-02-20 12:48:47 +0100
committerRichard Hughes <richard@hughsie.com>2017-12-28 20:23:56 +0000
commit8de70f517900989f0cbcd48369b2e21a2f96368a (patch)
tree8fe4d1a98b668b4f0c1e9895e7c77b5e3c300eef
parentf0623d1cdbfdb30ed44c94d6bceb46874e3fac46 (diff)
downloadcolord-8de70f517900989f0cbcd48369b2e21a2f96368a.tar.gz
Add --enable-timestamps option for CREATED header
For the same input `cd-it8 create-cmf` and `cd-it8 create-sp` will create the exact same output except for the creation time. As the header is optional and prevents CMF and spectra to be built reproducibly, disable it by default.
-rw-r--r--client/cd-it8.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/client/cd-it8.c b/client/cd-it8.c
index 91ca47f..a64fbca 100644
--- a/client/cd-it8.c
+++ b/client/cd-it8.c
@@ -35,6 +35,7 @@
typedef struct {
GOptionContext *context;
GPtrArray *cmd_array;
+ gboolean timestamps;
} CdUtilPrivate;
typedef gboolean (*CdUtilPrivateCb) (CdUtilPrivate *util,
@@ -285,6 +286,7 @@ cd_util_create_cmf (CdUtilPrivate *priv,
if (dot != NULL)
*dot = '\0';
cd_it8_set_title (cmf, title);
+ cd_it8_set_enable_created (cmf, priv->timestamps);
/* save */
file = g_file_new_for_path (values[0]);
@@ -437,6 +439,7 @@ cd_util_create_sp (CdUtilPrivate *priv,
if (dot != NULL)
*dot = '\0';
cd_it8_set_title (cmf, title);
+ cd_it8_set_enable_created (cmf, priv->timestamps);
/* save */
file = g_file_new_for_path (values[0]);
@@ -455,6 +458,7 @@ main (int argc, char *argv[])
CdUtilPrivate *priv;
gboolean ret;
gboolean verbose = FALSE;
+ gboolean enable_timestamps = FALSE;
guint retval = 1;
g_autoptr(GError) error = NULL;
g_autofree gchar *cmd_descriptions = NULL;
@@ -462,6 +466,9 @@ main (int argc, char *argv[])
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
/* TRANSLATORS: command line option */
_("Show extra debugging information"), NULL },
+ { "enable-timestamps", 'd', 0, G_OPTION_ARG_NONE, &enable_timestamps,
+ /* TRANSLATORS: command line option */
+ _("Write embedded creation timestamps"), NULL },
{ NULL}
};
@@ -473,6 +480,7 @@ main (int argc, char *argv[])
/* create helper object */
priv = g_new0 (CdUtilPrivate, 1);
+ priv->timestamps = enable_timestamps;
/* add commands */
priv->cmd_array = g_ptr_array_new_with_free_func ((GDestroyNotify) cd_util_item_free);