diff --git a/Makefile-rpm-ostree.am b/Makefile-rpm-ostree.am
index f283d6fccf..ab62dcb536 100644
--- a/Makefile-rpm-ostree.am
+++ b/Makefile-rpm-ostree.am
@@ -32,6 +32,7 @@ rpm_ostree_SOURCES = src/app/main.c \
src/app/rpmostree-builtin-initramfs.c \
src/app/rpmostree-builtin-livefs.c \
src/app/rpmostree-builtin-override.c \
+ src/app/rpmostree-builtin-refresh-md.c \
src/app/rpmostree-pkg-builtins.c \
src/app/rpmostree-builtin-status.c \
src/app/rpmostree-builtin-ex.c \
diff --git a/man/rpm-ostree.xml b/man/rpm-ostree.xml
index afa68d6244..06a424ffff 100644
--- a/man/rpm-ostree.xml
+++ b/man/rpm-ostree.xml
@@ -353,6 +353,17 @@ Boston, MA 02111-1307, USA.
+
+ refresh-md
+
+
+
+ Download the latest rpm repo metadata if necessary and generate the
+ cache.
+
+
+
+
cleanup
diff --git a/src/app/main.c b/src/app/main.c
index df5f7bc9d8..5038e6c772 100644
--- a/src/app/main.c
+++ b/src/app/main.c
@@ -74,6 +74,9 @@ static RpmOstreeCommand commands[] = {
{ "uninstall", 0,
"Remove one or more overlay packages",
rpmostree_builtin_uninstall },
+ { "refresh-md", 0,
+ "Generate rpm repo metadata",
+ rpmostree_builtin_refresh_md },
/* Legacy aliases */
{ "pkg-add", RPM_OSTREE_BUILTIN_FLAG_HIDDEN,
NULL, rpmostree_builtin_install },
@@ -82,6 +85,8 @@ static RpmOstreeCommand commands[] = {
{ "rpm", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD |
RPM_OSTREE_BUILTIN_FLAG_HIDDEN,
NULL, rpmostree_builtin_db },
+ { "makecache", RPM_OSTREE_BUILTIN_FLAG_HIDDEN,
+ NULL, rpmostree_builtin_refresh_md },
/* Hidden */
{ "ex", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD |
RPM_OSTREE_BUILTIN_FLAG_HIDDEN,
diff --git a/src/app/rpmostree-builtin-refresh-md.c b/src/app/rpmostree-builtin-refresh-md.c
new file mode 100644
index 0000000000..560125247f
--- /dev/null
+++ b/src/app/rpmostree-builtin-refresh-md.c
@@ -0,0 +1,97 @@
+/* Copyright (C) 2017 Jonathan Lebon
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include
+#include
+
+#include "rpmostree-builtins.h"
+#include "rpmostree-util.h"
+#include "rpmostree-libbuiltin.h"
+#include "rpmostree-dbus-helpers.h"
+
+#include
+
+static char *opt_osname;
+static char *opt_force;
+
+static GOptionEntry option_entries[] = {
+ { "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Operate on provided OSNAME", "OSNAME" },
+ { "force", 'f', 0, G_OPTION_ARG_NONE, &opt_force, "Expire current cache", NULL },
+ { NULL }
+};
+
+static GVariant *
+get_args_variant (void)
+{
+ GVariantDict dict;
+ g_variant_dict_init (&dict, NULL);
+ g_variant_dict_insert (&dict, "force", "b", opt_force);
+ return g_variant_dict_end (&dict);
+}
+
+int
+rpmostree_builtin_refresh_md (int argc,
+ char **argv,
+ RpmOstreeCommandInvocation *invocation,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_autoptr(GOptionContext) context = g_option_context_new ("");
+ glnx_unref_object RPMOSTreeOS *os_proxy = NULL;
+ glnx_unref_object RPMOSTreeSysroot *sysroot_proxy = NULL;
+ g_autofree char *transaction_address = NULL;
+ _cleanup_peer_ GPid peer_pid = 0;
+
+ if (!rpmostree_option_context_parse (context,
+ option_entries,
+ &argc, &argv,
+ invocation,
+ cancellable,
+ NULL, NULL,
+ &sysroot_proxy,
+ &peer_pid,
+ error))
+ return EXIT_FAILURE;
+
+ if (argc < 1 || argc > 2)
+ {
+ rpmostree_usage_error (context, "Too few or too many arguments", error);
+ return EXIT_FAILURE;
+ }
+
+ if (!rpmostree_load_os_proxy (sysroot_proxy, opt_osname,
+ cancellable, &os_proxy, error))
+ return EXIT_FAILURE;
+
+ if (!rpmostree_os_call_refresh_md_sync (os_proxy,
+ get_args_variant (),
+ &transaction_address,
+ cancellable,
+ error))
+ return EXIT_FAILURE;
+
+ if (!rpmostree_transaction_get_response_sync (sysroot_proxy,
+ transaction_address,
+ cancellable,
+ error))
+ return EXIT_FAILURE;
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/app/rpmostree-builtins.h b/src/app/rpmostree-builtins.h
index 2ddab3038a..21ca9b44ea 100644
--- a/src/app/rpmostree-builtins.h
+++ b/src/app/rpmostree-builtins.h
@@ -68,6 +68,7 @@ BUILTINPROTO(cleanup);
BUILTINPROTO(rollback);
BUILTINPROTO(initramfs);
BUILTINPROTO(status);
+BUILTINPROTO(refresh_md);
BUILTINPROTO(db);
BUILTINPROTO(internals);
BUILTINPROTO(container);
diff --git a/src/daemon/org.projectatomic.rpmostree1.xml b/src/daemon/org.projectatomic.rpmostree1.xml
index bd88941317..8c9a674843 100644
--- a/src/daemon/org.projectatomic.rpmostree1.xml
+++ b/src/daemon/org.projectatomic.rpmostree1.xml
@@ -225,6 +225,11 @@
+
+
+
+
+