[ostree] pull: add new switch option --disable-static-deltas



commit 45cb5b5f429cc065bfb1088c4391fd12c4936790
Author: Giuseppe Scrivano <gscrivan redhat com>
Date:   Tue May 12 10:15:30 2015 +0200

    pull: add new switch option --disable-static-deltas
    
    Signed-off-by: Giuseppe Scrivano <gscrivan redhat com>

 src/libostree/ostree-repo-pull.c                 |    2 +-
 src/libostree/ostree-repo-static-delta-private.h |    2 ++
 src/libostree/ostree-repo.c                      |    3 ++-
 src/ostree/ot-builtin-pull.c                     |    5 +++++
 4 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 175e312..19e8d7e 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -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++)
             {
diff --git a/src/libostree/ostree-repo-static-delta-private.h 
b/src/libostree/ostree-repo-static-delta-private.h
index 0cf2a0b..4df3b8c 100644
--- a/src/libostree/ostree-repo-static-delta-private.h
+++ b/src/libostree/ostree-repo-static-delta-private.h
@@ -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:
  *
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index d823725..0d4f4e2 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -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));
   }
 
   {
diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c
index 424ba41..874e6da 100644
--- a/src/ostree/ot-builtin-pull.c
+++ b/src/ostree/ot-builtin-pull.c
@@ -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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]