libostree: Move pull code into here

More library work.
This commit is contained in:
Colin Walters 2013-07-09 20:14:53 -04:00
parent 5dd0d5da40
commit 2535f32c56
9 changed files with 37 additions and 67 deletions

View File

@ -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

View File

@ -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

View File

@ -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,10 +1179,10 @@ load_remote_repo_config (OtPullData *pull_data,
}
gboolean
ostree_pull (OstreeRepo *repo,
ostree_repo_pull (OstreeRepo *repo,
const char *remote_name,
char **refs_to_fetch,
OstreePullFlags flags,
OstreeRepoPullFlags flags,
GCancellable *cancellable,
GError **error)
{

View File

@ -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

View File

@ -1,40 +0,0 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2013 Colin Walters <walters@verbum.org>
*
* 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.
*/
#pragma once
#include "ostree.h"
G_BEGIN_DECLS
typedef enum {
OSTREE_PULL_FLAGS_NONE,
OSTREE_PULL_FLAGS_RELATED
} OstreePullFlags;
gboolean ostree_pull (OstreeRepo *repo,
const char *remote_name,
char **refs_to_fetch,
OstreePullFlags flags,
GCancellable *cancellable,
GError **error);
G_END_DECLS

View File

@ -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,7 +122,7 @@ 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,
if (!ostree_repo_pull (repo, origin_remote, refs_to_fetch, OSTREE_REPO_PULL_FLAGS_NONE,
cancellable, error))
goto out;
}

View File

@ -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;