admin: Use internal pull API instead of subprocess

So we're doing more of the library thing.
This commit is contained in:
Colin Walters 2013-07-09 18:23:55 -04:00
parent 4c2a8bc210
commit 13e33cd76b
3 changed files with 6 additions and 26 deletions

View File

@ -25,6 +25,7 @@
#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"
@ -118,9 +119,12 @@ ot_admin_builtin_upgrade (int argc, char **argv, OtAdminBuiltinOpts *admin_opts,
if (origin_remote)
{
char *refs_to_fetch[] = { origin_ref, NULL };
g_print ("Fetching remote %s ref %s\n", origin_remote, origin_ref);
if (!ot_admin_pull (admin_opts->sysroot, origin_remote, origin_ref,
cancellable, error))
if (!ostree_pull (repo, origin_remote, refs_to_fetch, OSTREE_PULL_FLAGS_NONE,
cancellable, error))
goto out;
}

View File

@ -776,24 +776,6 @@ ot_admin_list_deployments (GFile *sysroot,
return ret;
}
gboolean
ot_admin_pull (GFile *sysroot,
const char *remote,
const char *ref,
GCancellable *cancellable,
GError **error)
{
gs_unref_object GFile *repo_path = g_file_resolve_relative_path (sysroot, "ostree/repo");
gs_free char *repo_arg = g_strconcat ("--repo=",
gs_file_get_path_cached (repo_path),
NULL);
return gs_subprocess_simple_run_sync (NULL,
GS_SUBPROCESS_STREAM_DISPOSITION_INHERIT,
cancellable, error,
"ostree", repo_arg, "pull", remote, ref, NULL);
}
GFile *
ot_admin_get_deployment_directory (GFile *sysroot,
OtDeployment *deployment)

View File

@ -118,12 +118,6 @@ gboolean ot_admin_get_default_ostree_dir (GFile **out_ostree_dir,
GKeyFile *ot_origin_new_from_refspec (const char *refspec);
gboolean ot_admin_pull (GFile *ostree_dir,
const char *remote,
const char *ref,
GCancellable *cancellable,
GError **error);
G_END_DECLS
#endif