pull: Support --mirror option

There's several use cases for calling into ostree itself to do
mirroring, instead of using bare rsync.  For example, it's a bit more
efficient as it doesn't require syncing the objects/ directory.

https://bugzilla.gnome.org/show_bug.cgi?id=728351
This commit is contained in:
Colin Walters committed 2014-06-16 17:14:13 -04:00
1 parent 4ac27caefd
commit 6a5e66b152
4 files changed
+19 -3

No files matched your search

+2 -2
View File
@@ -1262,8 +1262,8 @@ ostree_repo_pull (OstreeRepo *self,
}
else
{
ostree_repo_transaction_set_ref (pull_data->repo, pull_data->remote_name, ref, checksum);
gboolean is_mirror = (pull_data->flags & OSTREE_REPO_PULL_FLAGS_MIRROR) > 0;
ostree_repo_transaction_set_ref (pull_data->repo, is_mirror ? NULL : pull_data->remote_name, ref, checksum);
}
}
+3 -1
View File
@@ -510,9 +510,11 @@ gboolean ostree_repo_prune (OstreeRepo *self,
/**
* OstreeRepoPullFlags:
* @OSTREE_REPO_PULL_FLAGS_NONE: No special options for pull
* @OSTREE_REPO_PULL_FLAGS_MIRROR: Write out refs suitable for mirrors
*/
typedef enum {
OSTREE_REPO_PULL_FLAGS_NONE
OSTREE_REPO_PULL_FLAGS_NONE,
OSTREE_REPO_PULL_FLAGS_MIRROR
} OstreeRepoPullFlags;
gboolean ostree_repo_pull (OstreeRepo *self,
+5
View File
@@ -28,9 +28,11 @@
#include "otutil.h"
static gboolean opt_disable_fsync;
static gboolean opt_mirror;
static GOptionEntry options[] = {
{ "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
{ "mirror", 0, 0, G_OPTION_ARG_NONE, &opt_mirror, "Write refs suitable for a mirror", NULL },
{ NULL }
};
@@ -60,6 +62,9 @@ ostree_builtin_pull (int argc, char **argv, OstreeRepo *repo, GCancellable *canc
if (opt_disable_fsync)
ostree_repo_set_disable_fsync (repo, TRUE);
if (opt_mirror)
pullflags |= OSTREE_REPO_PULL_FLAGS_MIRROR;
if (strchr (argv[1], ':') == NULL)
{
remote = g_strdup (argv[1]);