pull: add new switch option --disable-static-deltas

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2015-05-12 10:15:30 +02:00
parent f6d16a6d95
commit 45cb5b5f42
4 changed files with 10 additions and 2 deletions

View File

@ -1956,7 +1956,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
}
additional_metadata = g_variant_get_child_value (pull_data->summary, 1);
deltas = g_variant_lookup_value (additional_metadata, "ostree.static-deltas", G_VARIANT_TYPE ("a{sv}"));
deltas = g_variant_lookup_value (additional_metadata, OSTREE_SUMMARY_STATIC_DELTAS, G_VARIANT_TYPE ("a{sv}"));
n = deltas ? g_variant_n_children (deltas) : 0;
for (i = 0; i < n; i++)
{

View File

@ -29,6 +29,8 @@ G_BEGIN_DECLS
/* 1 byte for object type, 32 bytes for checksum */
#define OSTREE_STATIC_DELTA_OBJTYPE_CSUM_LEN 33
#define OSTREE_SUMMARY_STATIC_DELTAS "ostree.static-deltas"
/**
* OSTREE_STATIC_DELTA_PART_PAYLOAD_FORMAT_V0:
*

View File

@ -33,6 +33,7 @@
#include "ostree-repo-file.h"
#include "ostree-repo-file-enumerator.h"
#include "ostree-gpg-verifier.h"
#include "ostree-repo-static-delta-private.h"
#include <locale.h>
#include <glib/gstdio.h>
@ -3668,7 +3669,7 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
g_variant_dict_insert_value (&deltas_builder, delta_names->pdata[i], ot_gvariant_new_bytearray (csum, 32));
}
g_variant_dict_insert_value (&additional_metadata_builder, "ostree.static-deltas", g_variant_dict_end (&deltas_builder));
g_variant_dict_insert_value (&additional_metadata_builder, OSTREE_SUMMARY_STATIC_DELTAS, g_variant_dict_end (&deltas_builder));
}
{

View File

@ -29,11 +29,13 @@
static gboolean opt_disable_fsync;
static gboolean opt_mirror;
static gboolean opt_disable_static_deltas;
static char* opt_subpath;
static int opt_depth = 0;
static GOptionEntry options[] = {
{ "disable-fsync", 0, 0, G_OPTION_ARG_NONE, &opt_disable_fsync, "Do not invoke fsync()", NULL },
{ "disable-static-deltas", 0, 0, G_OPTION_ARG_NONE, &opt_disable_static_deltas, "Do not use static deltas", NULL },
{ "mirror", 0, 0, G_OPTION_ARG_NONE, &opt_mirror, "Write refs suitable for a mirror", NULL },
{ "subpath", 0, 0, G_OPTION_ARG_STRING, &opt_subpath, "Only pull the provided subpath", NULL },
{ "depth", 0, 0, G_OPTION_ARG_INT, &opt_depth, "Traverse DEPTH parents (-1=infinite) (default: 0)", "DEPTH" },
@ -135,6 +137,9 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
g_variant_builder_add (&builder, "{s@v}", "depth",
g_variant_new_variant (g_variant_new_int32 (opt_depth)));
g_variant_builder_add (&builder, "{s@v}", "disable-static-deltas",
g_variant_new_variant (g_variant_new_boolean (opt_disable_static_deltas)));
if (!ostree_repo_pull_with_options (repo, remote, g_variant_builder_end (&builder),
progress, cancellable, error))
goto out;