Blame src/ostree/ot-builtin-checkout.c

rpm-build 0fba15
/*
rpm-build 0fba15
 * Copyright (C) 2011 Colin Walters <walters@verbum.org>
rpm-build 0fba15
 *
rpm-build 0fba15
 * SPDX-License-Identifier: LGPL-2.0+
rpm-build 0fba15
 *
rpm-build 0fba15
 * This library is free software; you can redistribute it and/or
rpm-build 0fba15
 * modify it under the terms of the GNU Lesser General Public
rpm-build 0fba15
 * License as published by the Free Software Foundation; either
rpm-build 0fba15
 * version 2 of the License, or (at your option) any later version.
rpm-build 0fba15
 *
rpm-build 0fba15
 * This library is distributed in the hope that it will be useful,
rpm-build 0fba15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
rpm-build 0fba15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rpm-build 0fba15
 * Lesser General Public License for more details.
rpm-build 0fba15
 *
rpm-build 0fba15
 * You should have received a copy of the GNU Lesser General Public
rpm-build 0fba15
 * License along with this library; if not, write to the
rpm-build 0fba15
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
rpm-build 0fba15
 * Boston, MA 02111-1307, USA.
rpm-build 0fba15
 *
rpm-build 0fba15
 * Author: Colin Walters <walters@verbum.org>
rpm-build 0fba15
 */
rpm-build 0fba15
rpm-build 0fba15
#include "config.h"
rpm-build 0fba15
rpm-build 0fba15
#include <string.h>
rpm-build 0fba15
#include <gio/gunixinputstream.h>
rpm-build 0fba15
rpm-build 0fba15
#include "ot-main.h"
rpm-build 0fba15
#include "ot-builtins.h"
rpm-build 0fba15
#include "ostree.h"
rpm-build 0fba15
#include "otutil.h"
rpm-build 0fba15
rpm-build 0fba15
static gboolean opt_user_mode;
rpm-build 0fba15
static gboolean opt_allow_noent;
rpm-build 0fba15
static gboolean opt_disable_cache;
rpm-build 0fba15
static char *opt_subpath;
rpm-build 0fba15
static gboolean opt_union;
rpm-build 0fba15
static gboolean opt_union_add;
rpm-build 0fba15
static gboolean opt_union_identical;
rpm-build 0fba15
static gboolean opt_whiteouts;
rpm-build 0fba15
static gboolean opt_from_stdin;
rpm-build 0fba15
static char *opt_from_file;
rpm-build 0fba15
static gboolean opt_disable_fsync;
rpm-build 0fba15
static gboolean opt_require_hardlinks;
rpm-build 0fba15
static gboolean opt_force_copy;
rpm-build 0fba15
static gboolean opt_force_copy_zerosized;
rpm-build 0fba15
static gboolean opt_bareuseronly_dirs;
rpm-build 0fba15
static char *opt_skiplist_file;
rpm-build 0fba15
static char *opt_selinux_policy;
rpm-build 0fba15
static char *opt_selinux_prefix;
rpm-build 0fba15
rpm-build 0fba15
static gboolean
rpm-build 0fba15
parse_fsync_cb (const char  *option_name,
rpm-build 0fba15
                const char  *value,
rpm-build 0fba15
                gpointer     data,
rpm-build 0fba15
                GError     **error)
rpm-build 0fba15
{
rpm-build 0fba15
  gboolean val;
rpm-build 0fba15
rpm-build 0fba15
  if (!ot_parse_boolean (value, &val, error))
rpm-build 0fba15
    return FALSE;
rpm-build 0fba15
rpm-build 0fba15
  opt_disable_fsync = !val;
rpm-build 0fba15
rpm-build 0fba15
  return TRUE;
rpm-build 0fba15
}
rpm-build 0fba15
rpm-build 0fba15
/* ATTENTION:
rpm-build 0fba15
 * Please remember to update the bash-completion script (bash/ostree) and
rpm-build 0fba15
 * man page (man/ostree-checkout.xml) when changing the option list.
rpm-build 0fba15
 */
rpm-build 0fba15
rpm-build 0fba15
static GOptionEntry options[] = {
rpm-build 0fba15
  { "user-mode", 'U', 0, G_OPTION_ARG_NONE, &opt_user_mode, "Do not change file ownership or initialize extended attributes", NULL },
rpm-build 0fba15
  { "disable-cache", 0, 0, G_OPTION_ARG_NONE, &opt_disable_cache, "Do not update or use the internal repository uncompressed object cache", NULL },
rpm-build 0fba15
  { "subpath", 0, 0, G_OPTION_ARG_FILENAME, &opt_subpath, "Checkout sub-directory PATH", "PATH" },
rpm-build 0fba15
  { "union", 0, 0, G_OPTION_ARG_NONE, &opt_union, "Keep existing directories, overwrite existing files", NULL },
rpm-build 0fba15
  { "union-add", 0, 0, G_OPTION_ARG_NONE, &opt_union_add, "Keep existing files/directories, only add new", NULL },
rpm-build 0fba15
  { "union-identical", 0, 0, G_OPTION_ARG_NONE, &opt_union_identical, "When layering checkouts, error out if a file would be replaced with a different version, but add new files and directories", NULL },
rpm-build 0fba15
  { "whiteouts", 0, 0, G_OPTION_ARG_NONE, &opt_whiteouts, "Process 'whiteout' (Docker style) entries", NULL },
rpm-build 0fba15
  { "allow-noent", 0, 0, G_OPTION_ARG_NONE, &opt_allow_noent, "Do nothing if specified path does not exist", NULL },
rpm-build 0fba15
  { "from-stdin", 0, 0, G_OPTION_ARG_NONE, &opt_from_stdin, "Process many checkouts from standard input", NULL },
rpm-build 0fba15
  { "from-file", 0, 0, G_OPTION_ARG_STRING, &opt_from_file, "Process many checkouts from input file", "FILE" },
rpm-build 0fba15
  { "fsync", 0, 0, G_OPTION_ARG_CALLBACK, parse_fsync_cb, "Specify how to invoke fsync()", "POLICY" },
rpm-build 0fba15
  { "require-hardlinks", 'H', 0, G_OPTION_ARG_NONE, &opt_require_hardlinks, "Do not fall back to full copies if hardlinking fails", NULL },
rpm-build 0fba15
  { "force-copy-zerosized", 'z', 0, G_OPTION_ARG_NONE, &opt_force_copy_zerosized, "Do not hardlink zero-sized files", NULL },
rpm-build 0fba15
  { "force-copy", 'C', 0, G_OPTION_ARG_NONE, &opt_force_copy, "Never hardlink (but may reflink if available)", NULL },
rpm-build 0fba15
  { "bareuseronly-dirs", 'M', 0, G_OPTION_ARG_NONE, &opt_bareuseronly_dirs, "Suppress mode bits outside of 0775 for directories (suid, world writable, etc.)", NULL },
rpm-build 0fba15
  { "skip-list", 0, 0, G_OPTION_ARG_FILENAME, &opt_skiplist_file, "File containing list of files to skip", "FILE" },
rpm-build 0fba15
  { "selinux-policy", 0, 0, G_OPTION_ARG_FILENAME, &opt_selinux_policy, "Set SELinux labels based on policy in root filesystem PATH (may be /); implies --force-copy", "PATH" },
rpm-build 0fba15
  { "selinux-prefix", 0, 0, G_OPTION_ARG_STRING, &opt_selinux_prefix, "When setting SELinux labels, prefix all paths by PREFIX", "PREFIX" },
rpm-build 0fba15
  { NULL }
rpm-build 0fba15
};
rpm-build 0fba15
rpm-build 0fba15
static gboolean
rpm-build 0fba15
handle_skiplist_line (const char  *line,
rpm-build 0fba15
                      void        *data,
rpm-build 0fba15
                      GError     **error)
rpm-build 0fba15
{
rpm-build 0fba15
  GHashTable *files = data;
rpm-build 0fba15
  g_hash_table_add (files, g_strdup (line));
rpm-build 0fba15
  return TRUE;
rpm-build 0fba15
}
rpm-build 0fba15
rpm-build 0fba15
static OstreeRepoCheckoutFilterResult
rpm-build 0fba15
checkout_filter (OstreeRepo         *self,
rpm-build 0fba15
                 const char         *path,
rpm-build 0fba15
                 struct stat        *st_buf,
rpm-build 0fba15
                 gpointer            user_data)
rpm-build 0fba15
{
rpm-build 0fba15
  GHashTable *skiplist = user_data;
rpm-build 0fba15
  if (g_hash_table_contains (skiplist, path))
rpm-build 0fba15
    return OSTREE_REPO_CHECKOUT_FILTER_SKIP;
rpm-build 0fba15
  return OSTREE_REPO_CHECKOUT_FILTER_ALLOW;
rpm-build 0fba15
}
rpm-build 0fba15
rpm-build 0fba15
static gboolean
rpm-build 0fba15
process_one_checkout (OstreeRepo           *repo,
rpm-build 0fba15
                      const char           *resolved_commit,
rpm-build 0fba15
                      const char           *subpath,
rpm-build 0fba15
                      const char           *destination,
rpm-build 0fba15
                      GCancellable         *cancellable,
rpm-build 0fba15
                      GError              **error)
rpm-build 0fba15
{
rpm-build 0fba15
  gboolean ret = FALSE;
rpm-build 0fba15
rpm-build 0fba15
  /* This strange code structure is to preserve testing
rpm-build 0fba15
   * coverage of both `ostree_repo_checkout_tree` and
rpm-build 0fba15
   * `ostree_repo_checkout_at` until such time as we have a more
rpm-build 0fba15
   * convenient infrastructure for testing C APIs with data.
rpm-build 0fba15
   */
rpm-build 0fba15
  if (opt_disable_cache || opt_whiteouts || opt_require_hardlinks ||
rpm-build 0fba15
      opt_union_add || opt_force_copy || opt_force_copy_zerosized ||
rpm-build 0fba15
      opt_bareuseronly_dirs || opt_union_identical ||
rpm-build 0fba15
      opt_skiplist_file || opt_selinux_policy || opt_selinux_prefix)
rpm-build 0fba15
    {
rpm-build 0fba15
      OstreeRepoCheckoutAtOptions options = { 0, };
rpm-build 0fba15
rpm-build 0fba15
      /* do this early so option checking also catches force copy conflicts */
rpm-build 0fba15
      if (opt_selinux_policy)
rpm-build 0fba15
        opt_force_copy = TRUE;
rpm-build 0fba15
rpm-build 0fba15
      if (opt_user_mode)
rpm-build 0fba15
        options.mode = OSTREE_REPO_CHECKOUT_MODE_USER;
rpm-build 0fba15
      /* Can't union these */
rpm-build 0fba15
      if (opt_union && opt_union_add)
rpm-build 0fba15
        {
rpm-build 0fba15
          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
rpm-build 0fba15
                       "Cannot specify both --union and --union-add");
rpm-build 0fba15
          goto out;
rpm-build 0fba15
        }
rpm-build 0fba15
      if (opt_union && opt_union_identical)
rpm-build 0fba15
        {
rpm-build 0fba15
          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
rpm-build 0fba15
                       "Cannot specify both --union and --union-identical");
rpm-build 0fba15
          goto out;
rpm-build 0fba15
        }
rpm-build 0fba15
      if (opt_union_add && opt_union_identical)
rpm-build 0fba15
        {
rpm-build 0fba15
          g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
rpm-build 0fba15
                       "Cannot specify both --union-add and --union-identical ");
rpm-build 0fba15
          goto out;
rpm-build 0fba15
        }
rpm-build 0fba15
      if (opt_require_hardlinks && opt_force_copy)
rpm-build 0fba15
        {
rpm-build 0fba15
          glnx_throw (error, "Cannot specify both --require-hardlinks and --force-copy");
rpm-build 0fba15
          goto out;
rpm-build 0fba15
        }
rpm-build 0fba15
      if (opt_selinux_prefix && !opt_selinux_policy)
rpm-build 0fba15
        {
rpm-build 0fba15
          glnx_throw (error, "Cannot specify --selinux-prefix without --selinux-policy");
rpm-build 0fba15
          goto out;
rpm-build 0fba15
        }
rpm-build 0fba15
      else if (opt_union)
rpm-build 0fba15
        options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES;
rpm-build 0fba15
      else if (opt_union_add)
rpm-build 0fba15
        options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES;
rpm-build 0fba15
      else if (opt_union_identical)
rpm-build 0fba15
        {
rpm-build 0fba15
          if (!opt_require_hardlinks)
rpm-build 0fba15
            {
rpm-build 0fba15
              g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
rpm-build 0fba15
                           "--union-identical requires --require-hardlinks");
rpm-build 0fba15
              goto out;
rpm-build 0fba15
            }
rpm-build 0fba15
          options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL;
rpm-build 0fba15
        }
rpm-build 0fba15
      if (opt_whiteouts)
rpm-build 0fba15
        options.process_whiteouts = TRUE;
rpm-build 0fba15
      if (subpath)
rpm-build 0fba15
        options.subpath = subpath;
rpm-build 0fba15
rpm-build 0fba15
      g_autoptr(OstreeSePolicy) policy = NULL;
rpm-build 0fba15
      if (opt_selinux_policy)
rpm-build 0fba15
        {
rpm-build 0fba15
          glnx_autofd int rootfs_dfd = -1;
rpm-build 0fba15
          if (!glnx_opendirat (AT_FDCWD, opt_selinux_policy, TRUE, &rootfs_dfd, error))
rpm-build 0fba15
            {
rpm-build 0fba15
              g_prefix_error (error, "selinux-policy: ");
rpm-build 0fba15
              goto out;
rpm-build 0fba15
            }
rpm-build 0fba15
          policy = ostree_sepolicy_new_at (rootfs_dfd, cancellable, error);
rpm-build 0fba15
          if (!policy)
rpm-build 0fba15
            goto out;
rpm-build 0fba15
          options.sepolicy = policy;
rpm-build 0fba15
          options.sepolicy_prefix = opt_selinux_prefix;
rpm-build 0fba15
        }
rpm-build 0fba15
rpm-build 0fba15
      g_autoptr(GHashTable) skip_list =
rpm-build 0fba15
        g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
rpm-build 0fba15
      if (opt_skiplist_file)
rpm-build 0fba15
        {
rpm-build 0fba15
          if (!ot_parse_file_by_line (opt_skiplist_file, handle_skiplist_line, skip_list,
rpm-build 0fba15
                                      cancellable, error))
rpm-build 0fba15
            goto out;
rpm-build 0fba15
          options.filter = checkout_filter;
rpm-build 0fba15
          options.filter_user_data = skip_list;
rpm-build 0fba15
        }
rpm-build 0fba15
rpm-build 0fba15
      options.no_copy_fallback = opt_require_hardlinks;
rpm-build 0fba15
      options.force_copy = opt_force_copy;
rpm-build 0fba15
      options.force_copy_zerosized = opt_force_copy_zerosized;
rpm-build 0fba15
      options.bareuseronly_dirs = opt_bareuseronly_dirs;
rpm-build 0fba15
rpm-build 0fba15
      if (!ostree_repo_checkout_at (repo, &options,
rpm-build 0fba15
                                    AT_FDCWD, destination,
rpm-build 0fba15
                                    resolved_commit,
rpm-build 0fba15
                                    cancellable, error))
rpm-build 0fba15
        goto out;
rpm-build 0fba15
    }
rpm-build 0fba15
  else
rpm-build 0fba15
    {
rpm-build 0fba15
      GError *tmp_error = NULL;
rpm-build 0fba15
      g_autoptr(GFile) root = NULL;
rpm-build 0fba15
      g_autoptr(GFile) subtree = NULL;
rpm-build 0fba15
      g_autoptr(GFileInfo) file_info = NULL;
rpm-build 0fba15
      g_autoptr(GFile) destination_file = g_file_new_for_path (destination);
rpm-build 0fba15
rpm-build 0fba15
      if (!ostree_repo_read_commit (repo, resolved_commit, &root, NULL, cancellable, error))
rpm-build 0fba15
        goto out;
rpm-build 0fba15
rpm-build 0fba15
      if (subpath)
rpm-build 0fba15
        subtree = g_file_resolve_relative_path (root, subpath);
rpm-build 0fba15
      else
rpm-build 0fba15
        subtree = g_object_ref (root);
rpm-build 0fba15
rpm-build 0fba15
      file_info = g_file_query_info (subtree, OSTREE_GIO_FAST_QUERYINFO,
rpm-build 0fba15
                                     G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
rpm-build 0fba15
                                     cancellable, &tmp_error);
rpm-build 0fba15
      if (!file_info)
rpm-build 0fba15
        {
rpm-build 0fba15
          if (opt_allow_noent
rpm-build 0fba15
              && g_error_matches (tmp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
rpm-build 0fba15
            {
rpm-build 0fba15
              g_clear_error (&tmp_error);
rpm-build 0fba15
              ret = TRUE;
rpm-build 0fba15
            }
rpm-build 0fba15
          else
rpm-build 0fba15
            {
rpm-build 0fba15
              g_propagate_error (error, tmp_error);
rpm-build 0fba15
            }
rpm-build 0fba15
          goto out;
rpm-build 0fba15
        }
rpm-build 0fba15
rpm-build 0fba15
      if (!ostree_repo_checkout_tree (repo, opt_user_mode ? OSTREE_REPO_CHECKOUT_MODE_USER : 0,
rpm-build 0fba15
                                      opt_union ? OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES : 0,
rpm-build 0fba15
                                      destination_file,
rpm-build 0fba15
                                      OSTREE_REPO_FILE (subtree), file_info,
rpm-build 0fba15
                                      cancellable, error))
rpm-build 0fba15
        goto out;
rpm-build 0fba15
    }
rpm-build 0fba15
rpm-build 0fba15
  ret = TRUE;
rpm-build 0fba15
 out:
rpm-build 0fba15
  return ret;
rpm-build 0fba15
}
rpm-build 0fba15
rpm-build 0fba15
static gboolean
rpm-build 0fba15
process_many_checkouts (OstreeRepo         *repo,
rpm-build 0fba15
                        const char         *target,
rpm-build 0fba15
                        GCancellable       *cancellable,
rpm-build 0fba15
                        GError            **error)
rpm-build 0fba15
{
rpm-build 0fba15
  gboolean ret = FALSE;
rpm-build 0fba15
  gsize len;
rpm-build 0fba15
  GError *temp_error = NULL;
rpm-build 0fba15
  g_autoptr(GInputStream) instream = NULL;
rpm-build 0fba15
  g_autoptr(GDataInputStream) datastream = NULL;
rpm-build 0fba15
  g_autofree char *revision = NULL;
rpm-build 0fba15
  g_autofree char *subpath = NULL;
rpm-build 0fba15
  g_autofree char *resolved_commit = NULL;
rpm-build 0fba15
rpm-build 0fba15
  if (opt_from_stdin)
rpm-build 0fba15
    {
rpm-build 0fba15
      instream = (GInputStream*)g_unix_input_stream_new (0, FALSE);
rpm-build 0fba15
    }
rpm-build 0fba15
  else
rpm-build 0fba15
    {
rpm-build 0fba15
      g_autoptr(GFile) f = g_file_new_for_path (opt_from_file);
rpm-build 0fba15
rpm-build 0fba15
      instream = (GInputStream*)g_file_read (f, cancellable, error);
rpm-build 0fba15
      if (!instream)
rpm-build 0fba15
        goto out;
rpm-build 0fba15
    }
rpm-build 0fba15
rpm-build 0fba15
  datastream = g_data_input_stream_new (instream);
rpm-build 0fba15
rpm-build 0fba15
  while ((revision = g_data_input_stream_read_upto (datastream, "", 1, &len,
rpm-build 0fba15
                                                    cancellable, &temp_error)) != NULL)
rpm-build 0fba15
    {
rpm-build 0fba15
      if (revision[0] == '\0')
rpm-build 0fba15
        break;
rpm-build 0fba15
rpm-build 0fba15
      /* Read the null byte */
rpm-build 0fba15
      (void) g_data_input_stream_read_byte (datastream, cancellable, NULL);
rpm-build 0fba15
      g_free (subpath);
rpm-build 0fba15
      subpath = g_data_input_stream_read_upto (datastream, "", 1, &len,
rpm-build 0fba15
                                               cancellable, &temp_error);
rpm-build 0fba15
      if (temp_error)
rpm-build 0fba15
        {
rpm-build 0fba15
          g_propagate_error (error, temp_error);
rpm-build 0fba15
          goto out;
rpm-build 0fba15
        }
rpm-build 0fba15
rpm-build 0fba15
      /* Read the null byte */
rpm-build 0fba15
      (void) g_data_input_stream_read_byte (datastream, cancellable, NULL);
rpm-build 0fba15
rpm-build 0fba15
      if (!ostree_repo_resolve_rev (repo, revision, FALSE, &resolved_commit, error))
rpm-build 0fba15
        goto out;
rpm-build 0fba15
rpm-build 0fba15
      if (!process_one_checkout (repo, resolved_commit, subpath, target,
rpm-build 0fba15
                                 cancellable, error))
rpm-build 0fba15
        {
rpm-build 0fba15
          g_prefix_error (error, "Processing tree %s: ", resolved_commit);
rpm-build 0fba15
          goto out;
rpm-build 0fba15
        }
rpm-build 0fba15
rpm-build 0fba15
      g_free (revision);
rpm-build 0fba15
    }
rpm-build 0fba15
  if (temp_error)
rpm-build 0fba15
    {
rpm-build 0fba15
      g_propagate_error (error, temp_error);
rpm-build 0fba15
      goto out;
rpm-build 0fba15
    }
rpm-build 0fba15
rpm-build 0fba15
  ret = TRUE;
rpm-build 0fba15
 out:
rpm-build 0fba15
  return ret;
rpm-build 0fba15
}
rpm-build 0fba15
rpm-build 0fba15
gboolean
rpm-build 0fba15
ostree_builtin_checkout (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
rpm-build 0fba15
{
rpm-build 0fba15
  g_autoptr(GOptionContext) context = NULL;
rpm-build 0fba15
  g_autoptr(OstreeRepo) repo = NULL;
rpm-build 0fba15
  gboolean ret = FALSE;
rpm-build 0fba15
  const char *commit;
rpm-build 0fba15
  const char *destination;
rpm-build 0fba15
  g_autofree char *resolved_commit = NULL;
rpm-build 0fba15
rpm-build 0fba15
  context = g_option_context_new ("COMMIT [DESTINATION]");
rpm-build 0fba15
rpm-build 0fba15
  if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
rpm-build 0fba15
    goto out;
rpm-build 0fba15
rpm-build 0fba15
  if (opt_disable_fsync)
rpm-build 0fba15
    ostree_repo_set_disable_fsync (repo, TRUE);
rpm-build 0fba15
rpm-build 0fba15
  if (argc < 2)
rpm-build 0fba15
    {
rpm-build 0fba15
      gchar *help = g_option_context_get_help (context, TRUE, NULL);
rpm-build 0fba15
      g_printerr ("%s\n", help);
rpm-build 0fba15
      g_free (help);
rpm-build 0fba15
      g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
rpm-build 0fba15
                           "COMMIT must be specified");
rpm-build 0fba15
      goto out;
rpm-build 0fba15
    }
rpm-build 0fba15
rpm-build 0fba15
  if (opt_from_stdin || opt_from_file)
rpm-build 0fba15
    {
rpm-build 0fba15
      destination = argv[1];
rpm-build 0fba15
rpm-build 0fba15
      if (!process_many_checkouts (repo, destination, cancellable, error))
rpm-build 0fba15
        goto out;
rpm-build 0fba15
    }
rpm-build 0fba15
  else
rpm-build 0fba15
    {
rpm-build 0fba15
      commit = argv[1];
rpm-build 0fba15
      if (argc < 3)
rpm-build 0fba15
        destination = commit;
rpm-build 0fba15
      else
rpm-build 0fba15
        destination = argv[2];
rpm-build 0fba15
rpm-build 0fba15
      if (!ostree_repo_resolve_rev (repo, commit, FALSE, &resolved_commit, error))
rpm-build 0fba15
        goto out;
rpm-build 0fba15
rpm-build 0fba15
      if (!process_one_checkout (repo, resolved_commit, opt_subpath,
rpm-build 0fba15
                                 destination,
rpm-build 0fba15
                                 cancellable, error))
rpm-build 0fba15
        goto out;
rpm-build 0fba15
    }
rpm-build 0fba15
rpm-build 0fba15
  ret = TRUE;
rpm-build 0fba15
 out:
rpm-build 0fba15
  return ret;
rpm-build 0fba15
}