[ostree] core: Take --repo as the first argument
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Take --repo as the first argument
- Date: Fri, 4 Nov 2011 03:09:33 +0000 (UTC)
commit d6b3fb51184a9f0cf8bb4868cded7f9b5491b4cb
Author: Colin Walters <walters verbum org>
Date: Thu Nov 3 23:08:28 2011 -0400
core: Take --repo as the first argument
I kept doing this over and over...it feels more natural. The "prefix"
thing was (almost) unused anyways, and it was easy enough to replace.
ostree/main.c | 17 +++++++++++------
ostree/ot-builtin-checkout.c | 8 +-------
ostree/ot-builtin-commit.c | 17 +++++++----------
ostree/ot-builtin-compose.c | 8 +-------
ostree/ot-builtin-fsck.c | 7 +------
ostree/ot-builtin-init.c | 7 +------
ostree/ot-builtin-link-file.c | 7 +------
ostree/ot-builtin-log.c | 10 +---------
ostree/ot-builtin-pull.c | 8 +-------
ostree/ot-builtin-remote.c | 8 +-------
ostree/ot-builtin-rev-parse.c | 6 +-----
ostree/ot-builtin-run-triggers.c | 7 +------
ostree/ot-builtin-show.c | 8 +-------
ostree/ot-builtins.h | 26 +++++++++++++-------------
tests/libtest.sh | 22 ++++++++++++----------
tests/t0000-basic.sh | 16 ++++++++--------
tests/t0001-archive.sh | 2 +-
tests/t0002-log.sh | 2 +-
tests/t0003-remote-add.sh | 2 +-
tests/t0004-pull.sh | 6 +++---
tests/t0005-compose.sh | 10 +++++-----
21 files changed, 73 insertions(+), 131 deletions(-)
---
diff --git a/ostree/main.c b/ostree/main.c
index 3359227..e3a205f 100644
--- a/ostree/main.c
+++ b/ostree/main.c
@@ -55,7 +55,7 @@ usage (char **argv, gboolean is_error)
else
print_func = g_print;
- print_func ("usage: %s COMMAND [options]\n",
+ print_func ("usage: %s --repo=PATH COMMAND [options]\n",
argv[0]);
print_func ("Builtin commands:\n");
@@ -74,6 +74,7 @@ main (int argc,
{
OstreeBuiltin *builtin;
const char *cmd;
+ const char *repo;
g_type_init ();
@@ -81,10 +82,14 @@ main (int argc,
builtin = builtins;
- if (argc < 2)
+ if (argc < 3)
return usage (argv, 1);
- cmd = argv[1];
+ if (!g_str_has_prefix (argv[1], "--repo="))
+ return usage (argv, 1);
+ repo = argv[1] + strlen ("--repo=");
+
+ cmd = argv[2];
while (builtin->name)
{
@@ -95,13 +100,13 @@ main (int argc,
int tmp_argc;
char **tmp_argv;
- tmp_argc = argc - 1;
+ tmp_argc = argc - 2;
tmp_argv = g_new0 (char *, tmp_argc + 1);
tmp_argv[0] = (char*)builtin->name;
for (i = 0; i < tmp_argc; i++)
- tmp_argv[i+1] = argv[i+2];
- if (!builtin->fn (tmp_argc, tmp_argv, NULL, &error))
+ tmp_argv[i+1] = argv[i+3];
+ if (!builtin->fn (tmp_argc, tmp_argv, repo, &error))
{
g_free (tmp_argv);
g_printerr ("%s\n", error->message);
diff --git a/ostree/ot-builtin-checkout.c b/ostree/ot-builtin-checkout.c
index 5734257..ae17143 100644
--- a/ostree/ot-builtin-checkout.c
+++ b/ostree/ot-builtin-checkout.c
@@ -26,15 +26,12 @@
#include <glib/gi18n.h>
-static char *repo_path;
-
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ NULL }
};
gboolean
-ostree_builtin_checkout (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_checkout (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -51,9 +48,6 @@ ostree_builtin_checkout (int argc, char **argv, const char *prefix, GError **err
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
diff --git a/ostree/ot-builtin-commit.c b/ostree/ot-builtin-commit.c
index 19af39b..d6ccec4 100644
--- a/ostree/ot-builtin-commit.c
+++ b/ostree/ot-builtin-commit.c
@@ -26,7 +26,6 @@
#include <glib/gi18n.h>
-static char *repo_path;
static gboolean separator_null;
static int from_fd = -1;
static gboolean from_stdin;
@@ -39,7 +38,6 @@ static char **additions;
static char **removals;
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ "subject", 's', 0, G_OPTION_ARG_STRING, &subject, "One line subject", "subject" },
{ "body", 'm', 0, G_OPTION_ARG_STRING, &body, "Full description", "body" },
{ "branch", 'b', 0, G_OPTION_ARG_STRING, &branch, "Branch", "branch" },
@@ -54,11 +52,12 @@ static GOptionEntry options[] = {
};
gboolean
-ostree_builtin_commit (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_commit (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
OstreeRepo *repo = NULL;
+ char *cwd;
gboolean using_filename_cmdline;
gboolean using_filedescriptors;
GPtrArray *additions_array = NULL;
@@ -66,17 +65,14 @@ ostree_builtin_commit (int argc, char **argv, const char *prefix, GError **error
GChecksum *commit_checksum = NULL;
char **iter;
+ cwd = g_get_current_dir ();
+
context = g_option_context_new ("- Commit a new revision");
g_option_context_add_main_entries (context, options, NULL);
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
- if (prefix == NULL)
- prefix = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
@@ -125,7 +121,7 @@ ostree_builtin_commit (int argc, char **argv, const char *prefix, GError **error
g_ptr_array_add (removals_array, *iter);
if (!ostree_repo_commit (repo, branch, parent, subject, body, NULL,
- prefix, additions_array,
+ cwd, additions_array,
removals_array,
&commit_checksum,
error))
@@ -149,7 +145,7 @@ ostree_builtin_commit (int argc, char **argv, const char *prefix, GError **error
from_fd = temp_fd;
}
if (!ostree_repo_commit_from_filelist_fd (repo, branch, parent, subject, body, NULL,
- prefix, from_fd, separator,
+ cwd, from_fd, separator,
&commit_checksum, error))
{
if (temp_fd >= 0)
@@ -163,6 +159,7 @@ ostree_builtin_commit (int argc, char **argv, const char *prefix, GError **error
ret = TRUE;
g_print ("%s\n", g_checksum_get_string (commit_checksum));
out:
+ g_free (cwd);
if (context)
g_option_context_free (context);
g_clear_object (&repo);
diff --git a/ostree/ot-builtin-compose.c b/ostree/ot-builtin-compose.c
index 571eefd..a98751b 100644
--- a/ostree/ot-builtin-compose.c
+++ b/ostree/ot-builtin-compose.c
@@ -26,12 +26,9 @@
#include <glib/gi18n.h>
-static char *repo_path;
-
#define FAST_QUERYINFO "standard::name,standard::type,standard::is-symlink,standard::symlink-target,unix::*"
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ NULL }
};
@@ -214,7 +211,7 @@ compose_branch_on_dir (OstreeRepo *repo,
}
gboolean
-ostree_builtin_compose (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_compose (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -230,9 +227,6 @@ ostree_builtin_compose (int argc, char **argv, const char *prefix, GError **erro
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
diff --git a/ostree/ot-builtin-fsck.c b/ostree/ot-builtin-fsck.c
index 3a21752..7c87402 100644
--- a/ostree/ot-builtin-fsck.c
+++ b/ostree/ot-builtin-fsck.c
@@ -26,11 +26,9 @@
#include <glib/gi18n.h>
-static char *repo_path;
static gboolean quiet;
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", NULL },
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "Don't display informational messages", NULL },
{ NULL }
};
@@ -192,7 +190,7 @@ object_iter_callback (OstreeRepo *repo,
}
gboolean
-ostree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_fsck (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
HtFsckData data;
@@ -205,9 +203,6 @@ ostree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error)
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
data.n_objects = 0;
repo = ostree_repo_new (repo_path);
diff --git a/ostree/ot-builtin-init.c b/ostree/ot-builtin-init.c
index d16b57c..1e85801 100644
--- a/ostree/ot-builtin-init.c
+++ b/ostree/ot-builtin-init.c
@@ -26,11 +26,9 @@
#include <glib/gi18n.h>
-static char *repo_path;
static gboolean archive;
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", NULL },
{ "archive", 0, 0, G_OPTION_ARG_NONE, &archive, "Initialize repository as archive", NULL },
{ NULL }
};
@@ -40,7 +38,7 @@ static GOptionEntry options[] = {
gboolean
-ostree_builtin_init (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_init (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context = NULL;
gboolean ret = FALSE;
@@ -55,9 +53,6 @@ ostree_builtin_init (int argc, char **argv, const char *prefix, GError **error)
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repodir = ot_util_new_file_for_path (repo_path);
child = g_file_get_child (repodir, "config");
diff --git a/ostree/ot-builtin-link-file.c b/ostree/ot-builtin-link-file.c
index dddec44..27edcf5 100644
--- a/ostree/ot-builtin-link-file.c
+++ b/ostree/ot-builtin-link-file.c
@@ -26,19 +26,17 @@
#include <glib/gi18n.h>
-static char *repo_path;
static gboolean ignore_exists;
static gboolean force;
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ "ignore-exists", 'n', 0, G_OPTION_ARG_NONE, &ignore_exists, "Don't error if file exists", NULL },
{ "force", 'f', 0, G_OPTION_ARG_NONE, &force, "If object exists, relink file", NULL },
{ NULL }
};
gboolean
-ostree_builtin_link_file (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_link_file (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -51,9 +49,6 @@ ostree_builtin_link_file (int argc, char **argv, const char *prefix, GError **er
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
diff --git a/ostree/ot-builtin-log.c b/ostree/ot-builtin-log.c
index c6d725b..e28366c 100644
--- a/ostree/ot-builtin-log.c
+++ b/ostree/ot-builtin-log.c
@@ -26,15 +26,12 @@
#include <glib/gi18n.h>
-static char *repo_path;
-
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ NULL }
};
gboolean
-ostree_builtin_log (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_log (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -50,11 +47,6 @@ ostree_builtin_log (int argc, char **argv, const char *prefix, GError **error)
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
- if (prefix == NULL)
- prefix = ".";
-
if (argc < 2)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
diff --git a/ostree/ot-builtin-pull.c b/ostree/ot-builtin-pull.c
index 65a5206..09a1c63 100644
--- a/ostree/ot-builtin-pull.c
+++ b/ostree/ot-builtin-pull.c
@@ -28,10 +28,7 @@
#include <libsoup/soup-gnome.h>
-static char *repo_path;
-
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ NULL }
};
@@ -252,7 +249,7 @@ store_commit_recurse (OstreeRepo *repo,
}
gboolean
-ostree_builtin_pull (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_pull (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -276,9 +273,6 @@ ostree_builtin_pull (int argc, char **argv, const char *prefix, GError **error)
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
diff --git a/ostree/ot-builtin-remote.c b/ostree/ot-builtin-remote.c
index 40f7c29..83d8ada 100644
--- a/ostree/ot-builtin-remote.c
+++ b/ostree/ot-builtin-remote.c
@@ -26,10 +26,7 @@
#include <glib/gi18n.h>
-static char *repo_path;
-
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ NULL }
};
@@ -44,7 +41,7 @@ usage_error (GOptionContext *context, const char *message, GError **error)
}
gboolean
-ostree_builtin_remote (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_remote (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -59,9 +56,6 @@ ostree_builtin_remote (int argc, char **argv, const char *prefix, GError **error
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
diff --git a/ostree/ot-builtin-rev-parse.c b/ostree/ot-builtin-rev-parse.c
index 6e86d6c..9ea172d 100644
--- a/ostree/ot-builtin-rev-parse.c
+++ b/ostree/ot-builtin-rev-parse.c
@@ -29,12 +29,11 @@
static char *repo_path;
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ NULL }
};
gboolean
-ostree_builtin_rev_parse (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_rev_parse (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -50,9 +49,6 @@ ostree_builtin_rev_parse (int argc, char **argv, const char *prefix, GError **er
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
diff --git a/ostree/ot-builtin-run-triggers.c b/ostree/ot-builtin-run-triggers.c
index 4959156..9ebcee2 100644
--- a/ostree/ot-builtin-run-triggers.c
+++ b/ostree/ot-builtin-run-triggers.c
@@ -26,17 +26,15 @@
#include <glib/gi18n.h>
-static char *repo_path;
static gboolean quiet;
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "Don't display informational messages", NULL },
{ NULL }
};
gboolean
-ostree_builtin_run_triggers (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_run_triggers (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -50,9 +48,6 @@ ostree_builtin_run_triggers (int argc, char **argv, const char *prefix, GError *
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
diff --git a/ostree/ot-builtin-show.c b/ostree/ot-builtin-show.c
index 8985c56..223fa6d 100644
--- a/ostree/ot-builtin-show.c
+++ b/ostree/ot-builtin-show.c
@@ -26,15 +26,12 @@
#include <glib/gi18n.h>
-static char *repo_path;
-
static GOptionEntry options[] = {
- { "repo", 0, 0, G_OPTION_ARG_FILENAME, &repo_path, "Repository path", "repo" },
{ NULL }
};
gboolean
-ostree_builtin_show (int argc, char **argv, const char *prefix, GError **error)
+ostree_builtin_show (int argc, char **argv, const char *repo_path, GError **error)
{
GOptionContext *context;
gboolean ret = FALSE;
@@ -51,9 +48,6 @@ ostree_builtin_show (int argc, char **argv, const char *prefix, GError **error)
if (!g_option_context_parse (context, &argc, &argv, error))
goto out;
- if (repo_path == NULL)
- repo_path = ".";
-
repo = ostree_repo_new (repo_path);
if (!ostree_repo_check (repo, error))
goto out;
diff --git a/ostree/ot-builtins.h b/ostree/ot-builtins.h
index 68e471c..232d341 100644
--- a/ostree/ot-builtins.h
+++ b/ostree/ot-builtins.h
@@ -32,22 +32,22 @@ typedef enum {
typedef struct {
const char *name;
- gboolean (*fn) (int argc, char **argv, const char *prefix, GError **error);
+ gboolean (*fn) (int argc, char **argv, const char *repo, GError **error);
int flags; /* OstreeBuiltinFlags */
} OstreeBuiltin;
-gboolean ostree_builtin_checkout (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_commit (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_compose (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_init (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_log (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_link_file (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_pull (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_run_triggers (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_fsck (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_show (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_rev_parse (int argc, char **argv, const char *prefix, GError **error);
-gboolean ostree_builtin_remote (int argc, char **argv, const char *prefix, GError **error);
+gboolean ostree_builtin_checkout (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_commit (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_compose (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_init (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_log (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_link_file (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_pull (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_run_triggers (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_fsck (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_show (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_rev_parse (int argc, char **argv, const char *repo, GError **error);
+gboolean ostree_builtin_remote (int argc, char **argv, const char *repo, GError **error);
G_END_DECLS
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 0068b58..1c4ccc5 100644
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -80,16 +80,16 @@ setup_test_repository () {
mkdir repo
cd repo
ot_repo="--repo=`pwd`"
+ export OSTREE="ostree ${ot_repo}"
cd ../files
- export ot_repo
if test "$mode" = "archive"; then
- ostree init --archive $ot_repo
+ $OSTREE init --archive
else
- ostree init $ot_repo
+ $OSTREE init
fi
- ostree commit $ot_repo -b test2 -s "Test Commit 1" -m "Commit body first" --add=firstfile --add=somelink
- ostree commit $ot_repo -b test2 -s "Test Commit 2" -m "Commit body second" --add=baz/cow --add=baz/saucer --add=baz/deeper/ohyeah --add=baz/another/y --add=baz/alink
- ostree fsck -q $ot_repo
+ $OSTREE commit -b test2 -s "Test Commit 1" -m "Commit body first" --add=firstfile --add=somelink
+ $OSTREE commit -b test2 -s "Test Commit 2" -m "Commit body second" --add=baz/cow --add=baz/saucer --add=baz/deeper/ohyeah --add=baz/another/y --add=baz/alink
+ $OSTREE fsck -q
cd $oldpwd
}
@@ -99,20 +99,20 @@ setup_fake_remote_repo1() {
mkdir ostree-srv
cd ostree-srv
mkdir gnomerepo
- ostree init --archive --repo=gnomerepo
+ ostree --repo=gnomerepo init --archive
mkdir gnomerepo-files
cd gnomerepo-files
echo first > firstfile
mkdir baz
echo moo > baz/cow
echo alien > baz/saucer
- find | grep -v '^\.$' | ostree commit --repo=${test_tmpdir}/ostree-srv/gnomerepo -b main -s "A remote commit" -m "Some Commit body" --from-stdin
+ find | grep -v '^\.$' | ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main -s "A remote commit" -m "Some Commit body" --from-stdin
mkdir baz/deeper
- ostree commit --repo=${test_tmpdir}/ostree-srv/gnomerepo -b main -s "Add deeper" --add=baz/deeper
+ ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main -s "Add deeper" --add=baz/deeper
echo hi > baz/deeper/ohyeah
mkdir baz/another/
echo x > baz/another/y
- find | grep -v '^\.$' | ostree commit --repo=${test_tmpdir}/ostree-srv/gnomerepo -b main -s "The rest" --from-stdin
+ find | grep -v '^\.$' | ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo commit -b main -s "The rest" --from-stdin
cd ..
rm -rf gnomerepo-files
@@ -150,6 +150,8 @@ EOF
exit 1
fi
cd ${oldpwd}
+
+ export OSTREE="ostree --repo=repo"
}
trap 'die' EXIT
diff --git a/tests/t0000-basic.sh b/tests/t0000-basic.sh
index 3cd0604..10c332f 100755
--- a/tests/t0000-basic.sh
+++ b/tests/t0000-basic.sh
@@ -32,12 +32,12 @@ assert_streq "$(readlink ${test_tmpdir}/repo/objects/cf/443bea5eb400bc25b376c079
echo "ok check"
-ostree checkout $ot_repo test2 checkout-test2
+$OSTREE checkout test2 checkout-test2
echo "ok checkout"
-ostree rev-parse $ot_repo test2
-ostree rev-parse $ot_repo 'test2^'
-ostree rev-parse $ot_repo 'test2^^' 2>/dev/null && (echo 1>&2 "rev-parse test2^^ unexpectedly succeeded!"; exit 1)
+$OSTREE rev-parse test2
+$OSTREE rev-parse 'test2^'
+$OSTREE rev-parse 'test2^^' 2>/dev/null && (echo 1>&2 "rev-parse test2^^ unexpectedly succeeded!"; exit 1)
echo "ok rev-parse"
cd checkout-test2
@@ -47,10 +47,10 @@ assert_file_has_content baz/cow moo
assert_has_file baz/deeper/ohyeah
echo "ok content"
-ostree commit $ot_repo -b test2 -s delete -r firstfile
+$OSTREE commit -b test2 -s delete -r firstfile
assert_has_file firstfile # It should still exist in this checkout
cd $test_tmpdir
-ostree checkout $ot_repo test2 $test_tmpdir/checkout-test2-2
+$OSTREE checkout test2 $test_tmpdir/checkout-test2-2
cd $test_tmpdir/checkout-test2-2
assert_not_has_file firstfile
assert_has_file baz/saucer
@@ -68,11 +68,11 @@ mkdir -p another/nested/tree
echo anotherone > another/nested/tree/1
echo whee2 > another/whee
# FIXME - remove grep for .
-find | grep -v '^\.$' | ostree commit $ot_repo -b test2 -s "From find" --from-stdin
+find | grep -v '^\.$' | $OSTREE commit -b test2 -s "From find" --from-stdin
echo "ok stdin commit"
cd ${test_tmpdir}
-ostree checkout $ot_repo test2 $test_tmpdir/checkout-test2-3
+$OSTREE checkout test2 $test_tmpdir/checkout-test2-3
cd checkout-test2-3
assert_has_file a/nested/2
assert_file_has_content a/nested/2 'two2'
diff --git a/tests/t0001-archive.sh b/tests/t0001-archive.sh
index 39fb14f..af97a69 100755
--- a/tests/t0001-archive.sh
+++ b/tests/t0001-archive.sh
@@ -27,7 +27,7 @@ echo '1..3'
setup_test_repository "archive"
echo "ok setup"
-ostree checkout $ot_repo test2 checkout-test2
+$OSTREE checkout test2 checkout-test2
echo "ok checkout"
cd checkout-test2
diff --git a/tests/t0002-log.sh b/tests/t0002-log.sh
index b60af45..cdfa01c 100755
--- a/tests/t0002-log.sh
+++ b/tests/t0002-log.sh
@@ -25,7 +25,7 @@ set -e
echo "1..1"
setup_test_repository "regular"
-ostree log $ot_repo test2 > $test_tmpdir/log.txt
+$OSTREE log test2 > $test_tmpdir/log.txt
assert_file_has_content $test_tmpdir/log.txt "Test Commit 1"
assert_file_has_content $test_tmpdir/log.txt "Test Commit 2"
echo "ok log"
diff --git a/tests/t0003-remote-add.sh b/tests/t0003-remote-add.sh
index 16093d7..5a974f1 100755
--- a/tests/t0003-remote-add.sh
+++ b/tests/t0003-remote-add.sh
@@ -25,7 +25,7 @@ set -e
echo '1..2'
setup_test_repository "regular"
-ostree remote add $ot_repo origin http://example.com/ostree/gnome
+$OSTREE remote add origin http://example.com/ostree/gnome
echo "ok remote add"
assert_file_has_content $test_tmpdir/repo/config "example.com"
echo "ok config"
diff --git a/tests/t0004-pull.sh b/tests/t0004-pull.sh
index a0161a4..9d33b7e 100755
--- a/tests/t0004-pull.sh
+++ b/tests/t0004-pull.sh
@@ -27,7 +27,7 @@ echo '1..1'
setup_fake_remote_repo1
cd ${test_tmpdir}
mkdir repo
-ostree init --repo=repo
-ostree remote --repo=repo add origin $(cat httpd-address)/ostree/gnomerepo
-ostree pull --repo=repo origin main
+$OSTREE init
+$OSTREE remote add origin $(cat httpd-address)/ostree/gnomerepo
+$OSTREE pull origin main
echo "ok pull"
diff --git a/tests/t0005-compose.sh b/tests/t0005-compose.sh
index 88a1708..816fd8b 100755
--- a/tests/t0005-compose.sh
+++ b/tests/t0005-compose.sh
@@ -26,7 +26,7 @@ echo "1..3"
setup_test_repository "regular"
-ostree checkout $ot_repo test2 checkout-test2
+$OSTREE checkout test2 checkout-test2
cd "${test_tmpdir}"
mkdir artifact-libfoo-runtime
@@ -36,7 +36,7 @@ echo 'an ELF file' > usr/lib/libfoo.so
mkdir -p usr/share
echo 'some data' > usr/share/foo.data
-find | grep -v '^\.$' | ostree commit $ot_repo -b artifact-libfoo-runtime -s 'Build 12345 of libfoo' --from-stdin
+find | grep -v '^\.$' | $OSTREE commit -b artifact-libfoo-runtime -s 'Build 12345 of libfoo' --from-stdin
cd "${test_tmpdir}"
mkdir artifact-libfoo-devel
@@ -46,7 +46,7 @@ echo 'a header' > usr/include/foo.h
mkdir -p usr/share/doc
echo 'some documentation' > usr/share/doc/foo.txt
-find | grep -v '^\.$' | ostree commit $ot_repo -b artifact-libfoo-devel -s 'Build 12345 of libfoo' --from-stdin
+find | grep -v '^\.$' | $OSTREE commit -b artifact-libfoo-devel -s 'Build 12345 of libfoo' --from-stdin
cd "${test_tmpdir}"
mkdir artifact-barapp
@@ -54,12 +54,12 @@ cd artifact-barapp
mkdir -p usr/bin
echo 'another ELF file' > usr/bin/bar
-find | grep -v '^\.$' | ostree commit $ot_repo -b artifact-barapp -s 'Build 42 of barapp' --from-stdin
+find | grep -v '^\.$' | $OSTREE commit -b artifact-barapp -s 'Build 42 of barapp' --from-stdin
echo 'ok artifacts committed'
cd "${test_tmpdir}"
-ostree compose $ot_repo some-compose artifact-libfoo-runtime artifact-libfoo-devel artifact-barapp
+$OSTREE compose some-compose artifact-libfoo-runtime artifact-libfoo-devel artifact-barapp
echo 'ok compose command'
cd some-compose
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]