libostree: Rename ostree-traverse.h into OstreeRepo namespace
This operates on the repo, it might as well be methods on it.
This commit is contained in:
parent
cb6b69616c
commit
2aa0251b1b
|
|
@ -34,6 +34,7 @@ libostree_la_SOURCES = src/libostree/ostree.h \
|
||||||
src/libostree/ostree-repo-checkout.c \
|
src/libostree/ostree-repo-checkout.c \
|
||||||
src/libostree/ostree-repo-libarchive.c \
|
src/libostree/ostree-repo-libarchive.c \
|
||||||
src/libostree/ostree-repo-refs.c \
|
src/libostree/ostree-repo-refs.c \
|
||||||
|
src/libostree/ostree-repo-traverse.c \
|
||||||
src/libostree/ostree-repo.h \
|
src/libostree/ostree-repo.h \
|
||||||
src/libostree/ostree-repo-private.h \
|
src/libostree/ostree-repo-private.h \
|
||||||
src/libostree/ostree-repo-file.c \
|
src/libostree/ostree-repo-file.c \
|
||||||
|
|
@ -41,8 +42,6 @@ libostree_la_SOURCES = src/libostree/ostree.h \
|
||||||
src/libostree/ostree-repo-file-enumerator.c \
|
src/libostree/ostree-repo-file-enumerator.c \
|
||||||
src/libostree/ostree-repo-file-enumerator.h \
|
src/libostree/ostree-repo-file-enumerator.h \
|
||||||
src/libostree/ostree-types.h \
|
src/libostree/ostree-types.h \
|
||||||
src/libostree/ostree-traverse.c \
|
|
||||||
src/libostree/ostree-traverse.h \
|
|
||||||
$(NULL)
|
$(NULL)
|
||||||
if USE_LIBARCHIVE
|
if USE_LIBARCHIVE
|
||||||
libostree_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \
|
libostree_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
#include "otutil.h"
|
#include "otutil.h"
|
||||||
|
|
||||||
GHashTable *
|
GHashTable *
|
||||||
ostree_traverse_new_reachable (void)
|
ostree_repo_traverse_new_reachable (void)
|
||||||
{
|
{
|
||||||
return g_hash_table_new_full (ostree_hash_object_name, g_variant_equal,
|
return g_hash_table_new_full (ostree_hash_object_name, g_variant_equal,
|
||||||
(GDestroyNotify)g_variant_unref, NULL);
|
(GDestroyNotify)g_variant_unref, NULL);
|
||||||
|
|
@ -119,11 +119,11 @@ traverse_dirtree_internal (OstreeRepo *repo,
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
ostree_traverse_dirtree (OstreeRepo *repo,
|
ostree_repo_traverse_dirtree (OstreeRepo *repo,
|
||||||
const char *dirtree_checksum,
|
const char *dirtree_checksum,
|
||||||
GHashTable *inout_reachable,
|
GHashTable *inout_reachable,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
return traverse_dirtree_internal (repo, dirtree_checksum, 0,
|
return traverse_dirtree_internal (repo, dirtree_checksum, 0,
|
||||||
inout_reachable, cancellable, error);
|
inout_reachable, cancellable, error);
|
||||||
|
|
@ -136,12 +136,12 @@ ostree_traverse_dirtree (OstreeRepo *repo,
|
||||||
* @commit_checksum, traversing @maxdepth parent commits.
|
* @commit_checksum, traversing @maxdepth parent commits.
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
ostree_traverse_commit (OstreeRepo *repo,
|
ostree_repo_traverse_commit (OstreeRepo *repo,
|
||||||
const char *commit_checksum,
|
const char *commit_checksum,
|
||||||
int maxdepth,
|
int maxdepth,
|
||||||
GHashTable *inout_reachable,
|
GHashTable *inout_reachable,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
gs_free char*tmp_checksum = NULL;
|
gs_free char*tmp_checksum = NULL;
|
||||||
|
|
@ -199,7 +199,7 @@ ostree_traverse_commit (OstreeRepo *repo,
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_checksum = ostree_checksum_from_bytes_v (content_csum_bytes);
|
tmp_checksum = ostree_checksum_from_bytes_v (content_csum_bytes);
|
||||||
if (!ostree_traverse_dirtree (repo, tmp_checksum, inout_reachable, cancellable, error))
|
if (!ostree_repo_traverse_dirtree (repo, tmp_checksum, inout_reachable, cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (maxdepth == -1 || maxdepth > 0)
|
if (maxdepth == -1 || maxdepth > 0)
|
||||||
|
|
@ -317,5 +317,21 @@ gboolean ostree_repo_list_objects (OstreeRepo *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
GHashTable *ostree_repo_traverse_new_reachable (void);
|
||||||
|
|
||||||
|
gboolean ostree_repo_traverse_dirtree (OstreeRepo *repo,
|
||||||
|
const char *commit_checksum,
|
||||||
|
GHashTable *inout_reachable,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
gboolean ostree_repo_traverse_commit (OstreeRepo *repo,
|
||||||
|
const char *commit_checksum,
|
||||||
|
int maxdepth,
|
||||||
|
GHashTable *inout_reachable,
|
||||||
|
GCancellable *cancellable,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
|
||||||
*
|
|
||||||
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
|
|
||||||
*
|
|
||||||
* This library 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 License, 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.
|
|
||||||
*
|
|
||||||
* Author: Colin Walters <walters@verbum.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ostree-core.h"
|
|
||||||
#include "ostree-types.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
GHashTable *ostree_traverse_new_reachable (void);
|
|
||||||
|
|
||||||
gboolean ostree_traverse_dirtree (OstreeRepo *repo,
|
|
||||||
const char *commit_checksum,
|
|
||||||
GHashTable *inout_reachable,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean ostree_traverse_commit (OstreeRepo *repo,
|
|
||||||
const char *commit_checksum,
|
|
||||||
int maxdepth,
|
|
||||||
GHashTable *inout_reachable,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
|
|
@ -28,5 +28,4 @@
|
||||||
#include <ostree-repo.h>
|
#include <ostree-repo.h>
|
||||||
#include <ostree-mutable-tree.h>
|
#include <ostree-mutable-tree.h>
|
||||||
#include <ostree-repo-file.h>
|
#include <ostree-repo-file.h>
|
||||||
#include <ostree-traverse.h>
|
|
||||||
#include <ostree-diff.h>
|
#include <ostree-diff.h>
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ ostree_prune (OstreeRepo *repo,
|
||||||
memset (&data, 0, sizeof (data));
|
memset (&data, 0, sizeof (data));
|
||||||
|
|
||||||
data.repo = repo;
|
data.repo = repo;
|
||||||
data.reachable = ostree_traverse_new_reachable ();
|
data.reachable = ostree_repo_traverse_new_reachable ();
|
||||||
|
|
||||||
if (refs_only)
|
if (refs_only)
|
||||||
{
|
{
|
||||||
|
|
@ -120,8 +120,8 @@ ostree_prune (OstreeRepo *repo,
|
||||||
{
|
{
|
||||||
const char *checksum = value;
|
const char *checksum = value;
|
||||||
|
|
||||||
if (!ostree_traverse_commit (repo, checksum, depth, data.reachable,
|
if (!ostree_repo_traverse_commit (repo, checksum, depth, data.reachable,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -144,8 +144,8 @@ ostree_prune (OstreeRepo *repo,
|
||||||
if (objtype != OSTREE_OBJECT_TYPE_COMMIT)
|
if (objtype != OSTREE_OBJECT_TYPE_COMMIT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!ostree_traverse_commit (repo, checksum, depth, data.reachable,
|
if (!ostree_repo_traverse_commit (repo, checksum, depth, data.reachable,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ fsck_reachable_objects_from_commits (OtFsckData *data,
|
||||||
gs_free guchar *computed_csum = NULL;
|
gs_free guchar *computed_csum = NULL;
|
||||||
gs_free char *tmp_checksum = NULL;
|
gs_free char *tmp_checksum = NULL;
|
||||||
|
|
||||||
reachable_objects = ostree_traverse_new_reachable ();
|
reachable_objects = ostree_repo_traverse_new_reachable ();
|
||||||
|
|
||||||
g_hash_table_iter_init (&hash_iter, commits);
|
g_hash_table_iter_init (&hash_iter, commits);
|
||||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||||
|
|
@ -71,8 +71,8 @@ fsck_reachable_objects_from_commits (OtFsckData *data,
|
||||||
|
|
||||||
g_assert (objtype == OSTREE_OBJECT_TYPE_COMMIT);
|
g_assert (objtype == OSTREE_OBJECT_TYPE_COMMIT);
|
||||||
|
|
||||||
if (!ostree_traverse_commit (data->repo, checksum, 0, reachable_objects,
|
if (!ostree_repo_traverse_commit (data->repo, checksum, 0, reachable_objects,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
|
||||||
|
|
||||||
g_print ("Enumerating objects...\n");
|
g_print ("Enumerating objects...\n");
|
||||||
|
|
||||||
source_objects = ostree_traverse_new_reachable ();
|
source_objects = ostree_repo_traverse_new_reachable ();
|
||||||
|
|
||||||
if (refs_to_clone)
|
if (refs_to_clone)
|
||||||
{
|
{
|
||||||
|
|
@ -263,7 +263,8 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
|
||||||
{
|
{
|
||||||
const char *checksum = value;
|
const char *checksum = value;
|
||||||
|
|
||||||
if (!ostree_traverse_commit (data->src_repo, checksum, 0, source_objects, cancellable, error))
|
if (!ostree_repo_traverse_commit (data->src_repo, checksum, 0, source_objects,
|
||||||
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +276,8 @@ ostree_builtin_pull_local (int argc, char **argv, GFile *repo_path, GError **err
|
||||||
{
|
{
|
||||||
const char *checksum = key;
|
const char *checksum = key;
|
||||||
|
|
||||||
if (!ostree_traverse_commit (data->src_repo, checksum, 0, source_objects, cancellable, error))
|
if (!ostree_repo_traverse_commit (data->src_repo, checksum, 0, source_objects,
|
||||||
|
cancellable, error))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue