[ostree] admin: Use internal pull API instead of subprocess
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] admin: Use internal pull API instead of subprocess
- Date: Tue, 9 Jul 2013 22:46:50 +0000 (UTC)
commit 13e33cd76b86d652dee12a6b0454e0ef716cd744
Author: Colin Walters <walters verbum org>
Date: Tue Jul 9 18:23:55 2013 -0400
admin: Use internal pull API instead of subprocess
So we're doing more of the library thing.
src/ostree/ot-admin-builtin-upgrade.c | 8 ++++++--
src/ostree/ot-admin-functions.c | 18 ------------------
src/ostree/ot-admin-functions.h | 6 ------
3 files changed, 6 insertions(+), 26 deletions(-)
---
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c
index 5663c4f..1222803 100644
--- a/src/ostree/ot-admin-builtin-upgrade.c
+++ b/src/ostree/ot-admin-builtin-upgrade.c
@@ -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;
}
diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c
index e97250b..1b469eb 100644
--- a/src/ostree/ot-admin-functions.c
+++ b/src/ostree/ot-admin-functions.c
@@ -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)
diff --git a/src/ostree/ot-admin-functions.h b/src/ostree/ot-admin-functions.h
index ad2a932..21195b5 100644
--- a/src/ostree/ot-admin-functions.h
+++ b/src/ostree/ot-admin-functions.h
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]