[ostree] libostree: Move pull code into here



commit 2535f32c563bd77fc0970ef1deef9d1da49f70a3
Author: Colin Walters <walters verbum org>
Date:   Tue Jul 9 20:14:53 2013 -0400

    libostree: Move pull code into here
    
    More library work.

 Makefile-libostree.am                              |   11 +++++
 Makefile-ostree.am                                 |    8 +---
 src/{ostree => libostree}/ostree-fetcher.c         |    0
 src/{ostree => libostree}/ostree-fetcher.h         |    0
 .../ostree-pull.c => libostree/ostree-repo-pull.c} |   21 ++++------
 src/libostree/ostree-repo.h                        |   12 ++++++
 src/ostree/ostree-pull.h                           |   40 --------------------
 src/ostree/ot-admin-builtin-upgrade.c              |    5 +-
 src/ostree/ot-builtin-pull.c                       |    7 +--
 9 files changed, 37 insertions(+), 67 deletions(-)
---
diff --git a/Makefile-libostree.am b/Makefile-libostree.am
index 3e5bce6..884d05c 100644
--- a/Makefile-libostree.am
+++ b/Makefile-libostree.am
@@ -59,6 +59,17 @@ libostree_la_CFLAGS += $(OT_DEP_LIBARCHIVE_CFLAGS)
 libostree_la_LIBADD += $(OT_DEP_LIBARCHIVE_LIBS)
 endif
 
+if USE_LIBSOUP
+libostree_la_SOURCES += \
+       src/libostree/ostree-fetcher.h \
+       src/libostree/ostree-fetcher.c \
+       src/libostree/ostree-repo-pull.c \
+       $(NULL)
+libostree_la_CFLAGS += $(OT_INTERNAL_SOUP_CFLAGS)
+libostree_la_LIBADD += $(OT_INTERNAL_SOUP_LIBS)
+endif
+
+
 INSTALL_DATA_HOOKS += install-libostree-data-hook
 install-libostree-data-hook: 
        rm -f $(DESTDIR)$(privlibdir)/libostree.la
diff --git a/Makefile-ostree.am b/Makefile-ostree.am
index 8083bf2..b438235 100644
--- a/Makefile-ostree.am
+++ b/Makefile-ostree.am
@@ -82,13 +82,7 @@ ostree_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS)
 ostree_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
 
 if USE_LIBSOUP
-ostree_SOURCES += src/ostree/ostree-fetcher.h \
-       src/ostree/ostree-fetcher.c \
-       src/ostree/ostree-pull.h \
-       src/ostree/ostree-pull.c \
-       src/ostree/ot-builtin-pull.c \
-       $(NULL)
-
+ostree_SOURCES += src/ostree/ot-builtin-pull.c
 ostree_CFLAGS += $(OT_INTERNAL_SOUP_CFLAGS)
 ostree_LDADD += $(OT_INTERNAL_SOUP_LIBS)
 endif
diff --git a/src/ostree/ostree-fetcher.c b/src/libostree/ostree-fetcher.c
similarity index 100%
rename from src/ostree/ostree-fetcher.c
rename to src/libostree/ostree-fetcher.c
diff --git a/src/ostree/ostree-fetcher.h b/src/libostree/ostree-fetcher.h
similarity index 100%
rename from src/ostree/ostree-fetcher.h
rename to src/libostree/ostree-fetcher.h
diff --git a/src/ostree/ostree-pull.c b/src/libostree/ostree-repo-pull.c
similarity index 99%
rename from src/ostree/ostree-pull.c
rename to src/libostree/ostree-repo-pull.c
index 8e59d29..ec5701d 100644
--- a/src/ostree/ostree-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -67,13 +67,8 @@
 
 #include "config.h"
 
-
 #include "ostree.h"
-#include "ot-main.h"
-#include "ot-builtins.h"
-
 #include "ostree-fetcher.h"
-#include "ostree-pull.h"
 
 typedef struct {
   enum {
@@ -91,7 +86,7 @@ typedef struct {
 
 typedef struct {
   OstreeRepo   *repo;
-  OstreePullFlags flags;
+  OstreeRepoPullFlags flags;
   char         *remote_name;
   OstreeRepoMode remote_mode;
   OstreeFetcher *fetcher;
@@ -783,7 +778,7 @@ scan_commit_object (OtPullData         *pull_data,
                                  cancellable, error))
     goto out;
   
-  if (pull_data->flags & OSTREE_PULL_FLAGS_RELATED)
+  if (pull_data->flags & OSTREE_REPO_PULL_FLAGS_RELATED)
     {
       const char *name;
       gs_unref_variant GVariant *csum_v = NULL;
@@ -1184,12 +1179,12 @@ load_remote_repo_config (OtPullData    *pull_data,
 }
 
 gboolean
-ostree_pull (OstreeRepo               *repo,
-             const char               *remote_name,
-             char                    **refs_to_fetch,
-             OstreePullFlags           flags,
-             GCancellable             *cancellable,
-             GError                  **error)
+ostree_repo_pull (OstreeRepo               *repo,
+                  const char               *remote_name,
+                  char                    **refs_to_fetch,
+                  OstreeRepoPullFlags       flags,
+                  GCancellable             *cancellable,
+                  GError                  **error)
 {
   gboolean ret = FALSE;
   GHashTableIter hash_iter;
diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h
index 998bf43..60b213d 100644
--- a/src/libostree/ostree-repo.h
+++ b/src/libostree/ostree-repo.h
@@ -347,5 +347,17 @@ gboolean ostree_repo_prune (OstreeRepo        *repo,
                             GCancellable      *cancellable,
                             GError           **error);
 
+typedef enum {
+  OSTREE_REPO_PULL_FLAGS_NONE,
+  OSTREE_REPO_PULL_FLAGS_RELATED
+} OstreeRepoPullFlags;
+
+gboolean ostree_repo_pull (OstreeRepo             *repo,
+                           const char             *remote_name,
+                           char                  **refs_to_fetch,
+                           OstreeRepoPullFlags     flags,
+                           GCancellable           *cancellable,
+                           GError                **error);
+
 G_END_DECLS
 
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
index 1222803..b4b9981 100644
--- a/src/ostree/ot-admin-builtin-upgrade.c
+++ b/src/ostree/ot-admin-builtin-upgrade.c
@@ -25,7 +25,6 @@
 #include "ot-admin-builtins.h"
 #include "ot-admin-functions.h"
 #include "ot-admin-deploy.h"
-#include "ostree-pull.h"
 #include "ostree.h"
 #include "otutil.h"
 
@@ -123,8 +122,8 @@ ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
 
       g_print ("Fetching remote %s ref %s\n", origin_remote, origin_ref);
 
-      if (!ostree_pull (repo, origin_remote, refs_to_fetch, OSTREE_PULL_FLAGS_NONE,
-                        cancellable, error))
+      if (!ostree_repo_pull (repo, origin_remote, refs_to_fetch, OSTREE_REPO_PULL_FLAGS_NONE,
+                             cancellable, error))
         goto out;
     }
 
diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c
index a2f266e..a3aa73b 100644
--- a/src/ostree/ot-builtin-pull.c
+++ b/src/ostree/ot-builtin-pull.c
@@ -24,7 +24,6 @@
 
 #include "ot-builtins.h"
 #include "ostree.h"
-#include "ostree-pull.h"
 #include "ostree-repo-file.h"
 
 #include <gio/gunixoutputstream.h>
@@ -44,7 +43,7 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
   gboolean ret = FALSE;
   GCancellable *cancellable = NULL;
   const char *remote;
-  OstreePullFlags pullflags = 0;
+  OstreeRepoPullFlags pullflags = 0;
   gs_unref_object OstreeRepo *repo = NULL;
   gs_unref_ptrarray GPtrArray *refs_to_fetch = NULL;
 
@@ -75,9 +74,9 @@ ostree_builtin_pull (int argc, char **argv, GFile *repo_path, GError **error)
     }
 
   if (opt_related)
-    pullflags |= OSTREE_PULL_FLAGS_RELATED;
+    pullflags |= OSTREE_REPO_PULL_FLAGS_RELATED;
 
-  if (!ostree_pull (repo, remote, refs_to_fetch ? (char**)refs_to_fetch->pdata : NULL,
+  if (!ostree_repo_pull (repo, remote, refs_to_fetch ? (char**)refs_to_fetch->pdata : NULL,
                     pullflags, cancellable, error))
     goto out;
  


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