From 80300ba7c8600afdf4df615193fa59824281a9c4 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 13 Nov 2014 20:39:42 -0500 Subject: [PATCH] compose: Support 'install-langs' This should exist for the same reason the yum and RPM options do; some people want to construct more minimal systems. --- doc/treefile.md | 3 +++ src/rpmostree-compose-builtin-tree.c | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/doc/treefile.md b/doc/treefile.md index cc341b20..14cda523 100644 --- a/doc/treefile.md +++ b/doc/treefile.md @@ -27,6 +27,9 @@ Treefile set; rpm-ostree will modify the `/etc/nsswitch.conf` in the target root to ensure that `/usr/lib/passwd` is used. + * `install-langs`: Array of strings, optional. This sets the RPM + _install_langs macro. Set this to e.g. `["en_US", "fr_FR"]`. + * `packages`: Array of strings, mandatory: Set of installed packages. Names prefixed with an `@` (e.g. `@core`) are taken to be the names of comps groups. diff --git a/src/rpmostree-compose-builtin-tree.c b/src/rpmostree-compose-builtin-tree.c index 280925be..cd29acdb 100644 --- a/src/rpmostree-compose-builtin-tree.c +++ b/src/rpmostree-compose-builtin-tree.c @@ -315,6 +315,7 @@ yum_context_new (RpmOstreeTreeComposeContext *self, { gboolean success = FALSE; YumContext *yumctx = NULL; + JsonNode *install_langs_n; GPtrArray *yum_argv = g_ptr_array_new_with_free_func (g_free); pid_t child; int clone_flags = SIGCHLD | CLONE_NEWNS | CLONE_NEWPID; @@ -327,6 +328,25 @@ yum_context_new (RpmOstreeTreeComposeContext *self, cancellable, error)) goto out; + install_langs_n = json_object_get_member (treedata, "install-langs"); + if (install_langs_n != NULL) + { + JsonArray *instlangs_a = json_node_get_array (install_langs_n); + guint len = json_array_get_length (instlangs_a); + guint i; + GString *opt = g_string_new ("--setopt=override_install_langs="); + + for (i = 0; i < len; i++) + { + g_string_append (opt, json_array_get_string_element (instlangs_a, i)); + if (i < len - 1) + g_string_append_c (opt, ','); + } + + g_ptr_array_add (yum_argv, opt->str); + g_string_free (opt, FALSE); + } + g_ptr_array_add (yum_argv, g_strconcat ("--installroot=", gs_file_get_path_cached (yumroot), NULL));