New upstream version 2016.15
This commit is contained in:
commit
0ee312bf3e
141 files changed
+1045
-940
No files matched your search
@@ -364,6 +364,8 @@ global:
|
||||
ostree_repo_verify_commit_for_remote;
|
||||
} LIBOSTREE_2016.8;
|
||||
|
||||
/* No new symbols in 2016.15 */
|
||||
|
||||
/* NOTE NOTE NOTE
|
||||
* Versions above here are released. Only add symbols below this line.
|
||||
* NOTE NOTE NOTE
|
||||
|
||||
@@ -28,7 +28,7 @@ struct _OstreeBootconfigParser
|
||||
GObject parent_instance;
|
||||
|
||||
gboolean parsed;
|
||||
char *separators;
|
||||
const char *separators;
|
||||
|
||||
GHashTable *options;
|
||||
GPtrArray *lines;
|
||||
@@ -193,7 +193,7 @@ ostree_bootconfig_parser_write_at (OstreeBootconfigParser *self,
|
||||
else
|
||||
{
|
||||
write_key (self, buf, key, value);
|
||||
g_hash_table_insert (written_overrides, (gpointer)key, (gpointer)key);
|
||||
g_hash_table_add (written_overrides, (gpointer)key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +235,6 @@ ostree_bootconfig_parser_finalize (GObject *object)
|
||||
|
||||
g_hash_table_unref (self->options);
|
||||
g_ptr_array_unref (self->lines);
|
||||
g_free (self->separators);
|
||||
|
||||
G_OBJECT_CLASS (ostree_bootconfig_parser_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -261,6 +260,6 @@ ostree_bootconfig_parser_new (void)
|
||||
OstreeBootconfigParser *self = NULL;
|
||||
|
||||
self = g_object_new (OSTREE_TYPE_BOOTCONFIG_PARSER, NULL);
|
||||
self->separators = g_strdup (" \t");
|
||||
self->separators = " \t";
|
||||
return self;
|
||||
}
|
||||
@@ -133,7 +133,6 @@ OstreeDeployment *
|
||||
ostree_deployment_clone (OstreeDeployment *self)
|
||||
{
|
||||
glnx_unref_object OstreeBootconfigParser *new_bootconfig = NULL;
|
||||
GKeyFile *new_origin = NULL;
|
||||
OstreeDeployment *ret = ostree_deployment_new (self->index, self->osname, self->csum,
|
||||
self->deployserial,
|
||||
self->bootcsum, self->bootserial);
|
||||
@@ -143,6 +142,7 @@ ostree_deployment_clone (OstreeDeployment *self)
|
||||
|
||||
if (self->origin)
|
||||
{
|
||||
g_autoptr(GKeyFile) new_origin = NULL;
|
||||
g_autofree char *data = NULL;
|
||||
gsize len;
|
||||
gboolean success;
|
||||
|
||||
@@ -20,7 +20,13 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#include "ostree-enumtypes.h"
|
||||
|
||||
/* enumerations from "./src/libostree/ostree-fetcher.h" */
|
||||
#include "./src/libostree/ostree-fetcher.h"
|
||||
|
||||
|
||||
@@ -18,9 +18,15 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
/*** END file-header ***/
|
||||
|
||||
/*** BEGIN file-production ***/
|
||||
|
||||
/* enumerations from "@filename@" */
|
||||
#include "@filename@"
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
|
||||
#include <gio/gfiledescriptorbased.h>
|
||||
#include <gio/gunixoutputstream.h>
|
||||
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
|
||||
#include <libsoup/soup.h>
|
||||
#include <libsoup/soup-requester.h>
|
||||
#include <libsoup/soup-request-http.h>
|
||||
|
||||
#include "libglnx.h"
|
||||
#include "ostree-fetcher.h"
|
||||
@@ -418,25 +422,20 @@ static void
|
||||
create_pending_soup_request (OstreeFetcherPendingURI *pending,
|
||||
GError **error)
|
||||
{
|
||||
g_autofree char *uristr = NULL;
|
||||
SoupURI *next_mirror = NULL;
|
||||
SoupURI *uri = NULL;
|
||||
OstreeFetcherURI *next_mirror = NULL;
|
||||
g_autoptr(OstreeFetcherURI) uri = NULL;
|
||||
|
||||
g_assert (pending->mirrorlist);
|
||||
g_assert (pending->mirrorlist_idx < pending->mirrorlist->len);
|
||||
|
||||
next_mirror = g_ptr_array_index (pending->mirrorlist,
|
||||
pending->mirrorlist_idx);
|
||||
uristr = g_build_filename (soup_uri_get_path (next_mirror),
|
||||
pending->filename /* may be NULL */, NULL);
|
||||
uri = soup_uri_copy (next_mirror);
|
||||
soup_uri_set_path (uri, uristr);
|
||||
next_mirror = g_ptr_array_index (pending->mirrorlist, pending->mirrorlist_idx);
|
||||
if (pending->filename)
|
||||
uri = _ostree_fetcher_uri_new_subpath (next_mirror, pending->filename);
|
||||
|
||||
g_clear_object (&pending->request);
|
||||
|
||||
pending->request = soup_session_request_uri (pending->thread_closure->session,
|
||||
uri, error);
|
||||
soup_uri_free (uri);
|
||||
(SoupURI*)(uri ? uri : next_mirror), error);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1404,7 +1403,7 @@ _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
|
||||
/* Helper for callers who just want to fetch single one-off URIs */
|
||||
gboolean
|
||||
_ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
|
||||
SoupURI *uri,
|
||||
OstreeFetcherURI *uri,
|
||||
gboolean add_nul,
|
||||
gboolean allow_noent,
|
||||
GBytes **out_contents,
|
||||
@@ -1419,3 +1418,84 @@ _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
|
||||
out_contents, max_size,
|
||||
cancellable, error);
|
||||
}
|
||||
|
||||
void
|
||||
_ostree_fetcher_uri_free (OstreeFetcherURI *uri)
|
||||
{
|
||||
if (uri)
|
||||
soup_uri_free ((SoupURI*)uri);
|
||||
}
|
||||
|
||||
OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_parse (const char *str,
|
||||
GError **error)
|
||||
{
|
||||
SoupURI *soupuri = soup_uri_new (str);
|
||||
if (soupuri == NULL)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Failed to parse uri: %s", str);
|
||||
return NULL;
|
||||
}
|
||||
return (OstreeFetcherURI*)soupuri;
|
||||
}
|
||||
|
||||
static OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_new_path_internal (OstreeFetcherURI *uri,
|
||||
gboolean extend,
|
||||
const char *path)
|
||||
{
|
||||
SoupURI *newuri = soup_uri_copy ((SoupURI*)uri);
|
||||
if (path)
|
||||
{
|
||||
if (extend)
|
||||
{
|
||||
const char *origpath = soup_uri_get_path ((SoupURI*)uri);
|
||||
g_autofree char *newpath = g_build_filename (origpath, path, NULL);
|
||||
soup_uri_set_path (newuri, newpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
soup_uri_set_path (newuri, path);
|
||||
}
|
||||
}
|
||||
return (OstreeFetcherURI*)newuri;
|
||||
}
|
||||
|
||||
OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_new_path (OstreeFetcherURI *uri,
|
||||
const char *path)
|
||||
{
|
||||
return _ostree_fetcher_uri_new_path_internal (uri, FALSE, path);
|
||||
}
|
||||
|
||||
OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_new_subpath (OstreeFetcherURI *uri,
|
||||
const char *subpath)
|
||||
{
|
||||
return _ostree_fetcher_uri_new_path_internal (uri, TRUE, subpath);
|
||||
}
|
||||
|
||||
OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_clone (OstreeFetcherURI *uri)
|
||||
{
|
||||
return _ostree_fetcher_uri_new_subpath (uri, NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
_ostree_fetcher_uri_get_scheme (OstreeFetcherURI *uri)
|
||||
{
|
||||
return g_strdup (soup_uri_get_scheme ((SoupURI*)uri));
|
||||
}
|
||||
|
||||
char *
|
||||
_ostree_fetcher_uri_get_path (OstreeFetcherURI *uri)
|
||||
{
|
||||
return g_strdup (soup_uri_get_path ((SoupURI*)uri));
|
||||
}
|
||||
|
||||
char *
|
||||
_ostree_fetcher_uri_to_string (OstreeFetcherURI *uri)
|
||||
{
|
||||
return soup_uri_to_string ((SoupURI*)uri, FALSE);
|
||||
}
|
||||
@@ -22,10 +22,7 @@
|
||||
|
||||
#ifndef __GI_SCANNER__
|
||||
|
||||
#define LIBSOUP_USE_UNSTABLE_REQUEST_API
|
||||
#include <libsoup/soup.h>
|
||||
#include <libsoup/soup-requester.h>
|
||||
#include <libsoup/soup-request-http.h>
|
||||
#include "libglnx.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -39,6 +36,8 @@ G_BEGIN_DECLS
|
||||
/* Lower values have higher priority */
|
||||
#define OSTREE_FETCHER_DEFAULT_PRIORITY 0
|
||||
|
||||
typedef struct OstreeFetcherURI OstreeFetcherURI;
|
||||
|
||||
typedef struct OstreeFetcherClass OstreeFetcherClass;
|
||||
typedef struct OstreeFetcher OstreeFetcher;
|
||||
|
||||
@@ -52,6 +51,34 @@ typedef enum {
|
||||
OSTREE_FETCHER_FLAGS_TLS_PERMISSIVE = (1 << 0)
|
||||
} OstreeFetcherConfigFlags;
|
||||
|
||||
void
|
||||
_ostree_fetcher_uri_free (OstreeFetcherURI *uri);
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(OstreeFetcherURI, _ostree_fetcher_uri_free)
|
||||
|
||||
OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_parse (const char *str,
|
||||
GError **error);
|
||||
|
||||
OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_clone (OstreeFetcherURI *uri);
|
||||
|
||||
OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_new_path (OstreeFetcherURI *uri,
|
||||
const char *subpath);
|
||||
|
||||
OstreeFetcherURI *
|
||||
_ostree_fetcher_uri_new_subpath (OstreeFetcherURI *uri,
|
||||
const char *subpath);
|
||||
|
||||
char *
|
||||
_ostree_fetcher_uri_get_scheme (OstreeFetcherURI *uri);
|
||||
|
||||
char *
|
||||
_ostree_fetcher_uri_get_path (OstreeFetcherURI *uri);
|
||||
|
||||
char *
|
||||
_ostree_fetcher_uri_to_string (OstreeFetcherURI *uri);
|
||||
|
||||
GType _ostree_fetcher_get_type (void) G_GNUC_CONST;
|
||||
|
||||
OstreeFetcher *_ostree_fetcher_new (int tmpdir_dfd,
|
||||
@@ -100,7 +127,7 @@ gboolean _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
|
||||
GError **error);
|
||||
|
||||
gboolean _ostree_fetcher_request_uri_to_membuf (OstreeFetcher *fetcher,
|
||||
SoupURI *uri,
|
||||
OstreeFetcherURI *uri,
|
||||
gboolean add_nul,
|
||||
gboolean allow_noent,
|
||||
GBytes **out_contents,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include "ostree-libarchive-private.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Copyright (C) 2016 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: Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include "libglnx.h"
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
#include <archive.h>
|
||||
#include <archive_entry.h>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_write_archive, archive_write_free)
|
||||
#define ot_cleanup_write_archive __attribute__((cleanup (flatpak_local_free_write_archive)))
|
||||
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_read_archive, archive_read_free)
|
||||
#define ot_cleanup_read_archive __attribute__((cleanup (flatpak_local_free_read_archive)))
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
@@ -43,7 +43,7 @@ struct OstreeMetalink
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
SoupURI *uri;
|
||||
OstreeFetcherURI *uri;
|
||||
|
||||
OstreeFetcher *fetcher;
|
||||
char *requested_file;
|
||||
@@ -357,7 +357,7 @@ metalink_parser_text (GMarkupParseContext *context,
|
||||
case OSTREE_METALINK_STATE_URL:
|
||||
{
|
||||
g_autofree char *uri_text = g_strndup (text, text_len);
|
||||
SoupURI *uri = soup_uri_new (uri_text);
|
||||
OstreeFetcherURI *uri = _ostree_fetcher_uri_parse (uri_text, NULL);
|
||||
if (uri != NULL)
|
||||
g_ptr_array_add (self->urls, uri);
|
||||
}
|
||||
@@ -377,7 +377,7 @@ _ostree_metalink_finalize (GObject *object)
|
||||
|
||||
g_object_unref (self->fetcher);
|
||||
g_free (self->requested_file);
|
||||
soup_uri_free (self->uri);
|
||||
_ostree_fetcher_uri_free (self->uri);
|
||||
|
||||
G_OBJECT_CLASS (_ostree_metalink_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -399,15 +399,15 @@ OstreeMetalink *
|
||||
_ostree_metalink_new (OstreeFetcher *fetcher,
|
||||
const char *requested_file,
|
||||
guint64 max_size,
|
||||
SoupURI *uri)
|
||||
OstreeFetcherURI *uri)
|
||||
{
|
||||
OstreeMetalink *self = (OstreeMetalink*)g_object_new (OSTREE_TYPE_METALINK, NULL);
|
||||
|
||||
self->fetcher = g_object_ref (fetcher);
|
||||
self->requested_file = g_strdup (requested_file);
|
||||
self->max_size = max_size;
|
||||
self->uri = soup_uri_copy (uri);
|
||||
|
||||
self->uri = _ostree_fetcher_uri_clone (uri);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ valid_hex_checksum (const char *s, gsize expected_len)
|
||||
|
||||
static gboolean
|
||||
try_one_url (OstreeMetalinkRequest *self,
|
||||
SoupURI *uri,
|
||||
OstreeFetcherURI *uri,
|
||||
GBytes **out_data,
|
||||
GError **error)
|
||||
{
|
||||
@@ -479,19 +479,20 @@ try_one_url (OstreeMetalinkRequest *self,
|
||||
|
||||
ret = TRUE;
|
||||
if (out_data)
|
||||
*out_data = g_bytes_ref (bytes);
|
||||
*out_data = g_steal_pointer (&bytes);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
try_metalink_targets (OstreeMetalinkRequest *self,
|
||||
SoupURI **out_target_uri,
|
||||
OstreeFetcherURI **out_target_uri,
|
||||
GBytes **out_data,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
SoupURI *target_uri = NULL;
|
||||
OstreeFetcherURI *target_uri = NULL;
|
||||
g_autoptr(GBytes) ret_data = NULL;
|
||||
|
||||
if (!self->found_a_file_element)
|
||||
{
|
||||
@@ -546,7 +547,7 @@ try_metalink_targets (OstreeMetalinkRequest *self,
|
||||
|
||||
target_uri = self->urls->pdata[self->current_url_index];
|
||||
|
||||
if (try_one_url (self, target_uri, out_data, &temp_error))
|
||||
if (try_one_url (self, target_uri, &ret_data, &temp_error))
|
||||
break;
|
||||
else
|
||||
{
|
||||
@@ -567,7 +568,9 @@ try_metalink_targets (OstreeMetalinkRequest *self,
|
||||
|
||||
ret = TRUE;
|
||||
if (out_target_uri)
|
||||
*out_target_uri = soup_uri_copy (target_uri);
|
||||
*out_target_uri = _ostree_fetcher_uri_clone (target_uri);
|
||||
if (out_data)
|
||||
*out_data = g_steal_pointer (&ret_data);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
@@ -582,7 +585,7 @@ static const GMarkupParser metalink_parser = {
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SoupURI **out_target_uri;
|
||||
OstreeFetcherURI **out_target_uri;
|
||||
GBytes **out_data;
|
||||
gboolean success;
|
||||
GError **error;
|
||||
@@ -591,7 +594,7 @@ typedef struct
|
||||
|
||||
gboolean
|
||||
_ostree_metalink_request_sync (OstreeMetalink *self,
|
||||
SoupURI **out_target_uri,
|
||||
OstreeFetcherURI **out_target_uri,
|
||||
GBytes **out_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@@ -599,7 +602,7 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
|
||||
gboolean ret = FALSE;
|
||||
OstreeMetalinkRequest request = { 0, };
|
||||
g_autoptr(GMainContext) mainctx = NULL;
|
||||
GBytes *out_contents = NULL;
|
||||
g_autoptr(GBytes) contents = NULL;
|
||||
gsize len;
|
||||
const guint8 *data;
|
||||
|
||||
@@ -607,20 +610,20 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
|
||||
g_main_context_push_thread_default (mainctx);
|
||||
|
||||
request.metalink = g_object_ref (self);
|
||||
request.urls = g_ptr_array_new_with_free_func ((GDestroyNotify) soup_uri_free);
|
||||
request.urls = g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_fetcher_uri_free);
|
||||
request.parser = g_markup_parse_context_new (&metalink_parser, G_MARKUP_PREFIX_ERROR_POSITION, &request, NULL);
|
||||
|
||||
if (!_ostree_fetcher_request_uri_to_membuf (self->fetcher,
|
||||
self->uri,
|
||||
FALSE,
|
||||
FALSE,
|
||||
&out_contents,
|
||||
&contents,
|
||||
self->max_size,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
data = g_bytes_get_data (out_contents, &len);
|
||||
data = g_bytes_get_data (contents, &len);
|
||||
if (!g_markup_parse_context_parse (request.parser, (const char*)data, len, error))
|
||||
goto out;
|
||||
|
||||
@@ -639,9 +642,3 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
|
||||
g_clear_pointer (&request.parser, g_markup_parse_context_free);
|
||||
return ret;
|
||||
}
|
||||
|
||||
SoupURI *
|
||||
_ostree_metalink_get_uri (OstreeMetalink *self)
|
||||
{
|
||||
return self->uri;
|
||||
}
|
||||
@@ -46,12 +46,10 @@ GType _ostree_metalink_get_type (void) G_GNUC_CONST;
|
||||
OstreeMetalink *_ostree_metalink_new (OstreeFetcher *fetcher,
|
||||
const char *requested_file,
|
||||
guint64 max_size,
|
||||
SoupURI *uri);
|
||||
|
||||
SoupURI *_ostree_metalink_get_uri (OstreeMetalink *self);
|
||||
OstreeFetcherURI *uri);
|
||||
|
||||
gboolean _ostree_metalink_request_sync (OstreeMetalink *self,
|
||||
SoupURI **out_target_uri,
|
||||
OstreeFetcherURI **out_target_uri,
|
||||
GBytes **out_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
@@ -554,7 +554,7 @@ checkout_one_file_at (OstreeRepo *repo,
|
||||
g_ascii_xdigit_value (checksum[1]));
|
||||
if (repo->updated_uncompressed_dirs == NULL)
|
||||
repo->updated_uncompressed_dirs = g_hash_table_new (NULL, NULL);
|
||||
g_hash_table_insert (repo->updated_uncompressed_dirs, key, key);
|
||||
g_hash_table_add (repo->updated_uncompressed_dirs, key);
|
||||
}
|
||||
g_mutex_unlock (&repo->cache_lock);
|
||||
|
||||
|
||||
@@ -913,10 +913,9 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self,
|
||||
{
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
gboolean ret = FALSE;
|
||||
struct archive *a = NULL;
|
||||
ot_cleanup_read_archive struct archive *a = archive_read_new ();
|
||||
OstreeRepoImportArchiveOptions opts = { 0, };
|
||||
|
||||
a = archive_read_new ();
|
||||
#ifdef HAVE_ARCHIVE_READ_SUPPORT_FILTER_ALL
|
||||
archive_read_support_filter_all (a);
|
||||
#else
|
||||
@@ -945,7 +944,6 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self,
|
||||
if (a)
|
||||
{
|
||||
(void)archive_read_close (a);
|
||||
(void)archive_read_free (a);
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
|
||||
@@ -72,7 +72,6 @@ struct OstreeRepo {
|
||||
int cache_dir_fd;
|
||||
char *cache_dir;
|
||||
int objects_dir_fd;
|
||||
GFile *deltas_dir;
|
||||
int uncompressed_objects_dir_fd;
|
||||
GFile *sysroot_dir;
|
||||
char *remotes_config_dir;
|
||||
|
||||
@@ -353,7 +353,7 @@ fetch_mirrored_uri_contents_utf8_sync (OstreeFetcher *fetcher,
|
||||
|
||||
static gboolean
|
||||
fetch_uri_contents_utf8_sync (OstreeFetcher *fetcher,
|
||||
SoupURI *uri,
|
||||
OstreeFetcherURI *uri,
|
||||
char **out_contents,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@@ -522,7 +522,7 @@ scan_dirtree_object (OtPullData *pull_data,
|
||||
}
|
||||
else if (!file_is_stored && !g_hash_table_lookup (pull_data->requested_content, file_checksum))
|
||||
{
|
||||
g_hash_table_insert (pull_data->requested_content, file_checksum, file_checksum);
|
||||
g_hash_table_add (pull_data->requested_content, file_checksum);
|
||||
enqueue_one_object_request (pull_data, file_checksum, OSTREE_OBJECT_TYPE_FILE, path, FALSE, FALSE);
|
||||
file_checksum = NULL; /* Transfer ownership */
|
||||
}
|
||||
@@ -1010,8 +1010,6 @@ static_deltapart_fetch_on_complete (GObject *object,
|
||||
_ostree_static_delta_part_execute_async (pull_data->repo,
|
||||
fetch_data->objects,
|
||||
part,
|
||||
/* Trust checksums if summary was gpg signed */
|
||||
pull_data->gpg_verify_summary && pull_data->summary_data_sig,
|
||||
pull_data->cancellable,
|
||||
on_static_delta_written,
|
||||
fetch_data);
|
||||
@@ -1137,10 +1135,6 @@ scan_commit_object (OtPullData *pull_data,
|
||||
is_partial = pull_data->legacy_transaction_resuming
|
||||
|| (commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL) > 0;
|
||||
|
||||
if (!ostree_repo_load_variant (pull_data->repo, OSTREE_OBJECT_TYPE_COMMIT, checksum,
|
||||
&commit, error))
|
||||
goto out;
|
||||
|
||||
/* PARSE OSTREE_SERIALIZED_COMMIT_VARIANT */
|
||||
g_variant_get_child (commit, 1, "@ay", &parent_csum);
|
||||
if (g_variant_n_children (parent_csum) > 0)
|
||||
@@ -1279,15 +1273,15 @@ scan_one_metadata_object_c (OtPullData *pull_data,
|
||||
{
|
||||
if (!is_stored)
|
||||
{
|
||||
if (!ostree_repo_import_object_from_with_trust (pull_data->repo, pull_data->remote_repo_local,
|
||||
objtype, tmp_checksum, !pull_data->is_untrusted,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (objtype == OSTREE_OBJECT_TYPE_COMMIT)
|
||||
{
|
||||
if (!write_commitpartial_for (pull_data, tmp_checksum, error))
|
||||
goto out;
|
||||
}
|
||||
if (!ostree_repo_import_object_from_with_trust (pull_data->repo, pull_data->remote_repo_local,
|
||||
objtype, tmp_checksum, !pull_data->is_untrusted,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
is_stored = TRUE;
|
||||
is_requested = TRUE;
|
||||
@@ -1298,7 +1292,7 @@ scan_one_metadata_object_c (OtPullData *pull_data,
|
||||
char *duped_checksum = g_strdup (tmp_checksum);
|
||||
gboolean do_fetch_detached;
|
||||
|
||||
g_hash_table_insert (pull_data->requested_metadata, duped_checksum, duped_checksum);
|
||||
g_hash_table_add (pull_data->requested_metadata, duped_checksum);
|
||||
|
||||
do_fetch_detached = (objtype == OSTREE_OBJECT_TYPE_COMMIT);
|
||||
enqueue_one_object_request (pull_data, tmp_checksum, objtype, path, do_fetch_detached, FALSE);
|
||||
@@ -1312,7 +1306,7 @@ scan_one_metadata_object_c (OtPullData *pull_data,
|
||||
pull_data->cancellable, error))
|
||||
goto out;
|
||||
|
||||
g_hash_table_insert (pull_data->scanned_metadata, g_variant_ref (object), object);
|
||||
g_hash_table_add (pull_data->scanned_metadata, g_variant_ref (object));
|
||||
pull_data->n_scanned_metadata++;
|
||||
}
|
||||
else if (is_stored && objtype == OSTREE_OBJECT_TYPE_DIR_TREE)
|
||||
@@ -1321,7 +1315,7 @@ scan_one_metadata_object_c (OtPullData *pull_data,
|
||||
pull_data->cancellable, error))
|
||||
goto out;
|
||||
|
||||
g_hash_table_insert (pull_data->scanned_metadata, g_variant_ref (object), object);
|
||||
g_hash_table_add (pull_data->scanned_metadata, g_variant_ref (object));
|
||||
pull_data->n_scanned_metadata++;
|
||||
}
|
||||
|
||||
@@ -1482,8 +1476,8 @@ request_static_delta_superblock_sync (OtPullData *pull_data,
|
||||
}
|
||||
}
|
||||
|
||||
ret_delta_superblock = g_variant_new_from_bytes ((GVariantType*)OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT,
|
||||
delta_superblock_data, FALSE);
|
||||
ret_delta_superblock = g_variant_ref_sink (g_variant_new_from_bytes ((GVariantType*)OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT,
|
||||
delta_superblock_data, FALSE));
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
@@ -1542,7 +1536,7 @@ process_one_static_delta_fallback (OtPullData *pull_data,
|
||||
if (!g_hash_table_lookup (pull_data->requested_metadata, checksum))
|
||||
{
|
||||
gboolean do_fetch_detached;
|
||||
g_hash_table_insert (pull_data->requested_metadata, checksum, checksum);
|
||||
g_hash_table_add (pull_data->requested_metadata, checksum);
|
||||
|
||||
do_fetch_detached = (objtype == OSTREE_OBJECT_TYPE_COMMIT);
|
||||
enqueue_one_object_request (pull_data, checksum, objtype, NULL, do_fetch_detached, FALSE);
|
||||
@@ -1553,7 +1547,7 @@ process_one_static_delta_fallback (OtPullData *pull_data,
|
||||
{
|
||||
if (!g_hash_table_lookup (pull_data->requested_content, checksum))
|
||||
{
|
||||
g_hash_table_insert (pull_data->requested_content, checksum, checksum);
|
||||
g_hash_table_add (pull_data->requested_content, checksum);
|
||||
enqueue_one_object_request (pull_data, checksum, OSTREE_OBJECT_TYPE_FILE, NULL, FALSE, FALSE);
|
||||
checksum = NULL; /* Transfer ownership */
|
||||
}
|
||||
@@ -1665,7 +1659,6 @@ process_one_static_delta (OtPullData *pull_data,
|
||||
g_autoptr(GBytes) inline_part_bytes = NULL;
|
||||
guint64 size, usize;
|
||||
guint32 version;
|
||||
const gboolean trusted = pull_data->gpg_verify_summary && pull_data->summary_data_sig;
|
||||
|
||||
header = g_variant_get_child_value (headers, i);
|
||||
g_variant_get (header, "(u@aytt@ay)", &version, &csum_v, &size, &usize, &objects);
|
||||
@@ -1735,7 +1728,6 @@ process_one_static_delta (OtPullData *pull_data,
|
||||
_ostree_static_delta_part_execute_async (pull_data->repo,
|
||||
fetch_data->objects,
|
||||
inline_delta_part,
|
||||
trusted,
|
||||
pull_data->cancellable,
|
||||
on_static_delta_written,
|
||||
fetch_data);
|
||||
@@ -2063,17 +2055,13 @@ fetch_mirrorlist (OstreeFetcher *fetcher,
|
||||
gboolean ret = FALSE;
|
||||
g_auto(GStrv) lines = NULL;
|
||||
g_autofree char *contents = NULL;
|
||||
SoupURI *mirrorlist = NULL;
|
||||
g_autoptr(OstreeFetcherURI) mirrorlist = NULL;
|
||||
g_autoptr(GPtrArray) ret_mirrorlist =
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) soup_uri_free);
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_fetcher_uri_free);
|
||||
|
||||
mirrorlist = soup_uri_new (mirrorlist_url);
|
||||
if (mirrorlist == NULL)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Failed to parse mirrorlist URL '%s'", mirrorlist_url);
|
||||
goto out;
|
||||
}
|
||||
mirrorlist = _ostree_fetcher_uri_parse (mirrorlist_url, error);
|
||||
if (!mirrorlist)
|
||||
goto out;
|
||||
|
||||
if (!fetch_uri_contents_utf8_sync (fetcher, mirrorlist, &contents,
|
||||
cancellable, error))
|
||||
@@ -2091,27 +2079,28 @@ fetch_mirrorlist (OstreeFetcher *fetcher,
|
||||
for (char **iter = lines; iter && *iter; iter++)
|
||||
{
|
||||
const char *mirror_uri_str = *iter;
|
||||
SoupURI *mirror_uri = NULL;
|
||||
g_autoptr(OstreeFetcherURI) mirror_uri = NULL;
|
||||
g_autofree char *scheme = NULL;
|
||||
|
||||
/* let's be nice and support empty lines and comments */
|
||||
if (*mirror_uri_str == '\0' || *mirror_uri_str == '#')
|
||||
continue;
|
||||
|
||||
mirror_uri = soup_uri_new (mirror_uri_str);
|
||||
if (mirror_uri == NULL)
|
||||
mirror_uri = _ostree_fetcher_uri_parse (mirror_uri_str, NULL);
|
||||
if (!mirror_uri)
|
||||
{
|
||||
g_debug ("Can't parse mirrorlist line '%s'", mirror_uri_str);
|
||||
continue;
|
||||
}
|
||||
else if ((strcmp (soup_uri_get_scheme (mirror_uri), "http") != 0) &&
|
||||
(strcmp (soup_uri_get_scheme (mirror_uri), "https") != 0))
|
||||
|
||||
scheme = _ostree_fetcher_uri_get_scheme (mirror_uri);
|
||||
if (!(g_str_equal (scheme, "http") || (g_str_equal (scheme, "https"))))
|
||||
{
|
||||
/* let's not support mirrorlists that contain non-http based URIs for
|
||||
* now (e.g. local URIs) -- we need to think about if and how we want
|
||||
* to support this since we set up things differently depending on
|
||||
* whether we're pulling locally or not */
|
||||
g_debug ("Ignoring non-http/s mirrorlist entry '%s'", mirror_uri_str);
|
||||
soup_uri_free (mirror_uri);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2122,9 +2111,7 @@ fetch_mirrorlist (OstreeFetcher *fetcher,
|
||||
if (ret_mirrorlist->len == 0)
|
||||
{
|
||||
GError *local_error = NULL;
|
||||
g_autofree char *config_uri_str = g_build_filename (mirror_uri_str,
|
||||
"config", NULL);
|
||||
SoupURI *config_uri = soup_uri_new (config_uri_str);
|
||||
g_autoptr(OstreeFetcherURI) config_uri = _ostree_fetcher_uri_new_subpath (mirror_uri, "config");
|
||||
|
||||
if (fetch_uri_contents_utf8_sync (fetcher, config_uri, NULL,
|
||||
cancellable, &local_error))
|
||||
@@ -2135,16 +2122,11 @@ fetch_mirrorlist (OstreeFetcher *fetcher,
|
||||
mirror_uri_str, local_error->message);
|
||||
g_clear_error (&local_error);
|
||||
}
|
||||
|
||||
soup_uri_free (config_uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ptr_array_add (ret_mirrorlist, g_steal_pointer (&mirror_uri));
|
||||
}
|
||||
|
||||
if (mirror_uri != NULL)
|
||||
soup_uri_free (mirror_uri);
|
||||
}
|
||||
|
||||
if (ret_mirrorlist->len == 0)
|
||||
@@ -2159,8 +2141,6 @@ fetch_mirrorlist (OstreeFetcher *fetcher,
|
||||
ret = TRUE;
|
||||
|
||||
out:
|
||||
if (mirrorlist != NULL)
|
||||
soup_uri_free (mirrorlist);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2209,18 +2189,14 @@ repo_remote_fetch_summary (OstreeRepo *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
SoupURI *uri = soup_uri_new (url_string);
|
||||
g_autoptr(OstreeFetcherURI) uri = _ostree_fetcher_uri_parse (url_string, error);
|
||||
|
||||
if (uri == NULL)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Failed to parse url '%s'", url_string);
|
||||
goto out;
|
||||
}
|
||||
if (!uri)
|
||||
goto out;
|
||||
|
||||
mirrorlist =
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) soup_uri_free);
|
||||
g_ptr_array_add (mirrorlist, uri /* transfer ownership */ );
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_fetcher_uri_free);
|
||||
g_ptr_array_add (mirrorlist, g_steal_pointer (&uri));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2482,6 +2458,8 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_autofree char *unconfigured_state = NULL;
|
||||
|
||||
pull_data->remote_name = g_strdup (remote_name_or_baseurl);
|
||||
|
||||
/* Fetch GPG verification settings from remote if it wasn't already
|
||||
@@ -2495,6 +2473,22 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
if (!ostree_repo_remote_get_gpg_verify_summary (self, pull_data->remote_name,
|
||||
&pull_data->gpg_verify_summary, error))
|
||||
goto out;
|
||||
|
||||
/* NOTE: If changing this, see the matching implementation in
|
||||
* ostree-sysroot-upgrader.c
|
||||
*/
|
||||
if (!ostree_repo_get_remote_option (self, pull_data->remote_name,
|
||||
"unconfigured-state", NULL,
|
||||
&unconfigured_state,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
if (unconfigured_state)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"remote unconfigured-state: %s", unconfigured_state);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
pull_data->phase = OSTREE_PULL_PHASE_FETCHING_REFS;
|
||||
@@ -2530,36 +2524,27 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
SoupURI *baseuri = soup_uri_new (baseurl);
|
||||
g_autoptr(OstreeFetcherURI) baseuri = _ostree_fetcher_uri_parse (baseurl, error);
|
||||
|
||||
if (baseuri == NULL)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Failed to parse url '%s'", baseurl);
|
||||
goto out;
|
||||
}
|
||||
if (!baseuri)
|
||||
goto out;
|
||||
|
||||
pull_data->meta_mirrorlist =
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) soup_uri_free);
|
||||
g_ptr_array_add (pull_data->meta_mirrorlist, baseuri /* transfer */);
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_fetcher_uri_free);
|
||||
g_ptr_array_add (pull_data->meta_mirrorlist, g_steal_pointer (&baseuri));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_autoptr(GBytes) summary_bytes = NULL;
|
||||
SoupURI *metalink_uri = soup_uri_new (metalink_url_str);
|
||||
SoupURI *target_uri = NULL;
|
||||
|
||||
g_autoptr(OstreeFetcherURI) metalink_uri = _ostree_fetcher_uri_parse (metalink_url_str, error);
|
||||
g_autoptr(OstreeFetcherURI) target_uri = NULL;
|
||||
|
||||
if (!metalink_uri)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Invalid metalink URL: %s", metalink_url_str);
|
||||
goto out;
|
||||
}
|
||||
|
||||
goto out;
|
||||
|
||||
metalink = _ostree_metalink_new (pull_data->fetcher, "summary",
|
||||
OSTREE_MAX_METADATA_SIZE, metalink_uri);
|
||||
soup_uri_free (metalink_uri);
|
||||
|
||||
if (! _ostree_metalink_request_sync (metalink,
|
||||
&target_uri,
|
||||
@@ -2572,12 +2557,12 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
* mirrors here since we use it as such anyway (rather than the "usual"
|
||||
* use case of metalink, which is only for a single target filename) */
|
||||
{
|
||||
/* reuse target_uri and take ownership */
|
||||
g_autofree char *repo_base = g_path_get_dirname (soup_uri_get_path (target_uri));
|
||||
soup_uri_set_path (target_uri, repo_base);
|
||||
g_autofree char *path = _ostree_fetcher_uri_get_path (target_uri);
|
||||
g_autofree char *basepath = g_path_get_dirname (path);
|
||||
g_autoptr(OstreeFetcherURI) new_target_uri = _ostree_fetcher_uri_new_path (target_uri, basepath);
|
||||
pull_data->meta_mirrorlist =
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) soup_uri_free);
|
||||
g_ptr_array_add (pull_data->meta_mirrorlist, target_uri);
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_fetcher_uri_free);
|
||||
g_ptr_array_add (pull_data->meta_mirrorlist, g_steal_pointer (&new_target_uri));
|
||||
}
|
||||
|
||||
pull_data->summary = g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
|
||||
@@ -2611,19 +2596,15 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
SoupURI *contenturi = soup_uri_new (contenturl);
|
||||
g_autoptr(OstreeFetcherURI) contenturi = _ostree_fetcher_uri_parse (contenturl, error);
|
||||
|
||||
if (contenturi == NULL)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Failed to parse contenturl '%s'", contenturl);
|
||||
goto out;
|
||||
}
|
||||
if (!contenturi)
|
||||
goto out;
|
||||
|
||||
pull_data->content_mirrorlist =
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) soup_uri_free);
|
||||
g_ptr_array_new_with_free_func ((GDestroyNotify) _ostree_fetcher_uri_free);
|
||||
g_ptr_array_add (pull_data->content_mirrorlist,
|
||||
contenturi /* transfer */);
|
||||
g_steal_pointer (&contenturi));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2633,12 +2614,16 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
&configured_branches, error))
|
||||
goto out;
|
||||
|
||||
/* TODO reindent later */
|
||||
{ OstreeFetcherURI *first_uri = pull_data->meta_mirrorlist->pdata[0];
|
||||
g_autofree char *first_scheme = _ostree_fetcher_uri_get_scheme (first_uri);
|
||||
|
||||
/* NB: we don't support local mirrors in mirrorlists, so if this passes, it
|
||||
* means that we're not using mirrorlists (see also fetch_mirrorlist()) */
|
||||
if (strcmp (soup_uri_get_scheme (pull_data->meta_mirrorlist->pdata[0]), "file") == 0)
|
||||
if (g_str_equal (first_scheme, "file"))
|
||||
{
|
||||
g_autoptr(GFile) remote_repo_path =
|
||||
g_file_new_for_path (soup_uri_get_path (pull_data->meta_mirrorlist->pdata[0]));
|
||||
g_autofree char *path = _ostree_fetcher_uri_get_path (first_uri);
|
||||
g_autoptr(GFile) remote_repo_path = g_file_new_for_path (path);
|
||||
pull_data->remote_repo_local = ostree_repo_new (remote_repo_path);
|
||||
if (!ostree_repo_open (pull_data->remote_repo_local, cancellable, error))
|
||||
goto out;
|
||||
@@ -2667,6 +2652,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* For local pulls, default to disabling static deltas so that the
|
||||
* exact object files are copied.
|
||||
@@ -2804,7 +2790,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
const char *delta;
|
||||
GVariant *csum_v = NULL;
|
||||
g_autoptr(GVariant) csum_v = NULL;
|
||||
guchar *csum_data = g_malloc (OSTREE_SHA256_DIGEST_LEN);
|
||||
g_autoptr(GVariant) ref = g_variant_get_child_value (deltas, i);
|
||||
|
||||
@@ -2844,7 +2830,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
if (ostree_validate_checksum_string (branch, NULL))
|
||||
{
|
||||
char *key = g_strdup (branch);
|
||||
g_hash_table_insert (commits_to_fetch, key, key);
|
||||
g_hash_table_add (commits_to_fetch, key);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2955,7 +2941,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
g_autofree char *from_revision = NULL;
|
||||
const char *ref = key;
|
||||
const char *to_revision = value;
|
||||
GVariant *delta_superblock = NULL;
|
||||
g_autoptr(GVariant) delta_superblock = NULL;
|
||||
|
||||
if (!ostree_repo_resolve_rev (pull_data->repo, ref, TRUE,
|
||||
&from_revision, error))
|
||||
@@ -3169,9 +3155,10 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
* @self: Self
|
||||
* @name: name of a remote
|
||||
* @options: (nullable): A GVariant a{sv} with an extensible set of flags
|
||||
* @out_summary: (nullable): return location for raw summary data, or %NULL
|
||||
* @out_signatures: (nullable): return location for raw summary signature
|
||||
* data, or %NULL
|
||||
* @out_summary: (out) (optional): return location for raw summary data, or
|
||||
* %NULL
|
||||
* @out_signatures: (out) (optional): return location for raw summary
|
||||
* signature data, or %NULL
|
||||
* @cancellable: a #GCancellable
|
||||
* @error: a #GError
|
||||
*
|
||||
|
||||
@@ -132,7 +132,7 @@ xattr_chunk_hash (const void *vp)
|
||||
{
|
||||
const guint8* name;
|
||||
const guint8* value_data;
|
||||
GVariant *value = NULL;
|
||||
g_autoptr(GVariant) value = NULL;
|
||||
gsize value_len;
|
||||
|
||||
g_variant_get_child (v, i, "(^&ay@ay)",
|
||||
@@ -911,9 +911,8 @@ generate_delta_lowlatency (OstreeRepo *repo,
|
||||
|
||||
ostree_object_name_deserialize (serialized_key, &checksum, &objtype);
|
||||
|
||||
g_variant_ref (serialized_key);
|
||||
if (OSTREE_OBJECT_TYPE_IS_META (objtype))
|
||||
g_hash_table_add (new_reachable_metadata, serialized_key);
|
||||
g_hash_table_add (new_reachable_metadata, g_variant_ref (serialized_key));
|
||||
else
|
||||
{
|
||||
g_autoptr(GFileInfo) finfo = NULL;
|
||||
@@ -955,8 +954,9 @@ generate_delta_lowlatency (OstreeRepo *repo,
|
||||
}
|
||||
|
||||
/* We already ship the to commit in the superblock, don't ship it twice */
|
||||
g_hash_table_remove (new_reachable_metadata,
|
||||
ostree_object_name_serialize (to, OSTREE_OBJECT_TYPE_COMMIT));
|
||||
{ g_autoptr(GVariant) commit = ostree_object_name_serialize (to, OSTREE_OBJECT_TYPE_COMMIT);
|
||||
g_hash_table_remove (new_reachable_metadata, commit);
|
||||
}
|
||||
|
||||
rollsum_optimized_content_objects = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free,
|
||||
@@ -1359,8 +1359,8 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
for (i = 0; i < builder.parts->len; i++)
|
||||
{
|
||||
OstreeStaticDeltaPartBuilder *part_builder = builder.parts->pdata[i];
|
||||
GBytes *payload_b;
|
||||
GBytes *operations_b;
|
||||
g_autoptr(GBytes) payload_b;
|
||||
g_autoptr(GBytes) operations_b;
|
||||
g_autofree guchar *part_checksum = NULL;
|
||||
g_autoptr(GBytes) objtype_checksum_array = NULL;
|
||||
g_autoptr(GBytes) checksum_bytes = NULL;
|
||||
@@ -1415,10 +1415,11 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
}
|
||||
|
||||
/* FIXME - avoid duplicating memory here */
|
||||
delta_part = g_variant_new ("(y@ay)",
|
||||
compression_type_char,
|
||||
ot_gvariant_new_ay_bytes (g_memory_output_stream_steal_as_bytes (part_payload_out)));
|
||||
g_variant_ref_sink (delta_part);
|
||||
{ g_autoptr(GBytes) payload = g_memory_output_stream_steal_as_bytes (part_payload_out);
|
||||
delta_part = g_variant_ref_sink (g_variant_new ("(y@ay)",
|
||||
compression_type_char,
|
||||
ot_gvariant_new_ay_bytes (payload)));
|
||||
}
|
||||
|
||||
if (inline_parts)
|
||||
{
|
||||
@@ -1532,17 +1533,17 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
/* floating */ GVariant *to_csum_v =
|
||||
ostree_checksum_to_bytes_v (to);
|
||||
|
||||
delta_descriptor = g_variant_new ("(@a{sv}t@ay@ay@" OSTREE_COMMIT_GVARIANT_STRING "ay"
|
||||
"a" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT
|
||||
"@a" OSTREE_STATIC_DELTA_FALLBACK_FORMAT ")",
|
||||
g_variant_builder_end (&metadata_builder),
|
||||
GUINT64_TO_BE (g_date_time_to_unix (now)),
|
||||
from_csum_v,
|
||||
to_csum_v,
|
||||
to_commit,
|
||||
g_variant_builder_new (G_VARIANT_TYPE ("ay")),
|
||||
part_headers,
|
||||
fallback_headers);
|
||||
delta_descriptor = g_variant_ref_sink (g_variant_new ("(@a{sv}t@ay@ay@" OSTREE_COMMIT_GVARIANT_STRING "@ay"
|
||||
"a" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT
|
||||
"@a" OSTREE_STATIC_DELTA_FALLBACK_FORMAT ")",
|
||||
g_variant_builder_end (&metadata_builder),
|
||||
GUINT64_TO_BE (g_date_time_to_unix (now)),
|
||||
from_csum_v,
|
||||
to_csum_v,
|
||||
to_commit,
|
||||
ot_gvariant_new_bytearray ((guchar*)"", 0),
|
||||
part_headers,
|
||||
fallback_headers));
|
||||
g_date_time_unref (now);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,95 +73,100 @@ ostree_repo_list_static_delta_names (OstreeRepo *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GPtrArray) ret_deltas = NULL;
|
||||
g_autoptr(GFileEnumerator) dir_enum = NULL;
|
||||
glnx_fd_close int dfd = -1;
|
||||
|
||||
ret_deltas = g_ptr_array_new_with_free_func (g_free);
|
||||
|
||||
if (g_file_query_exists (self->deltas_dir, NULL))
|
||||
dfd = glnx_opendirat_with_errno (self->repo_dir_fd, "deltas", TRUE);
|
||||
if (dfd < 0)
|
||||
{
|
||||
dir_enum = g_file_enumerate_children (self->deltas_dir, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
NULL, error);
|
||||
if (!dir_enum)
|
||||
goto out;
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
glnx_set_error_from_errno (error);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
|
||||
if (!glnx_dirfd_iterator_init_take_fd (dfd, &dfd_iter, error))
|
||||
return FALSE;
|
||||
dfd = -1;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
g_autoptr(GFileEnumerator) dir_enum2 = NULL;
|
||||
GFileInfo *file_info;
|
||||
GFile *child;
|
||||
g_auto(GLnxDirFdIterator) sub_dfd_iter = { 0, };
|
||||
struct dirent *dent;
|
||||
|
||||
if (!g_file_enumerator_iterate (dir_enum, &file_info, &child,
|
||||
NULL, error))
|
||||
goto out;
|
||||
if (file_info == NULL)
|
||||
if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&dfd_iter, &dent, cancellable, error))
|
||||
return FALSE;
|
||||
if (dent == NULL)
|
||||
break;
|
||||
|
||||
if (g_file_info_get_file_type (file_info) != G_FILE_TYPE_DIRECTORY)
|
||||
if (dent->d_type != DT_DIR)
|
||||
continue;
|
||||
|
||||
|
||||
dir_enum2 = g_file_enumerate_children (child, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
NULL, error);
|
||||
if (!dir_enum2)
|
||||
goto out;
|
||||
if (!glnx_dirfd_iterator_init_at (dfd_iter.fd, dent->d_name, FALSE,
|
||||
&sub_dfd_iter, error))
|
||||
return FALSE;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
GFileInfo *file_info2;
|
||||
GFile *child2;
|
||||
struct dirent *sub_dent;
|
||||
const char *name1;
|
||||
const char *name2;
|
||||
g_autofree char *superblock_subpath = NULL;
|
||||
struct stat stbuf;
|
||||
|
||||
if (!g_file_enumerator_iterate (dir_enum2, &file_info2, &child2,
|
||||
NULL, error))
|
||||
goto out;
|
||||
if (file_info2 == NULL)
|
||||
if (!glnx_dirfd_iterator_next_dent_ensure_dtype (&sub_dfd_iter, &sub_dent,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (sub_dent == NULL)
|
||||
break;
|
||||
|
||||
if (g_file_info_get_file_type (file_info2) != G_FILE_TYPE_DIRECTORY)
|
||||
if (dent->d_type != DT_DIR)
|
||||
continue;
|
||||
|
||||
name1 = g_file_info_get_name (file_info);
|
||||
name2 = g_file_info_get_name (file_info2);
|
||||
name1 = dent->d_name;
|
||||
name2 = sub_dent->d_name;
|
||||
|
||||
{
|
||||
g_autoptr(GFile) meta_path = g_file_get_child (child2, "superblock");
|
||||
superblock_subpath = g_strconcat (name2, "/superblock", NULL);
|
||||
if (fstatat (sub_dfd_iter.fd, superblock_subpath, &stbuf, 0) < 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
{
|
||||
glnx_set_error_from_errno (error);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_autofree char *buf = g_strconcat (name1, name2, NULL);
|
||||
GString *out = g_string_new ("");
|
||||
char checksum[OSTREE_SHA256_STRING_LEN+1];
|
||||
guchar csum[OSTREE_SHA256_DIGEST_LEN];
|
||||
const char *dash = strchr (buf, '-');
|
||||
|
||||
if (g_file_query_exists (meta_path, NULL))
|
||||
{
|
||||
g_autofree char *buf = g_strconcat (name1, name2, NULL);
|
||||
GString *out = g_string_new ("");
|
||||
char checksum[OSTREE_SHA256_STRING_LEN+1];
|
||||
guchar csum[OSTREE_SHA256_DIGEST_LEN];
|
||||
const char *dash = strchr (buf, '-');
|
||||
ostree_checksum_b64_inplace_to_bytes (buf, csum);
|
||||
ostree_checksum_inplace_from_bytes (csum, checksum);
|
||||
g_string_append (out, checksum);
|
||||
if (dash)
|
||||
{
|
||||
g_string_append_c (out, '-');
|
||||
ostree_checksum_b64_inplace_to_bytes (dash+1, csum);
|
||||
ostree_checksum_inplace_from_bytes (csum, checksum);
|
||||
g_string_append (out, checksum);
|
||||
}
|
||||
|
||||
ostree_checksum_b64_inplace_to_bytes (buf, csum);
|
||||
ostree_checksum_inplace_from_bytes (csum, checksum);
|
||||
g_string_append (out, checksum);
|
||||
if (dash)
|
||||
{
|
||||
g_string_append_c (out, '-');
|
||||
ostree_checksum_b64_inplace_to_bytes (dash+1, csum);
|
||||
ostree_checksum_inplace_from_bytes (csum, checksum);
|
||||
g_string_append (out, checksum);
|
||||
}
|
||||
|
||||
g_ptr_array_add (ret_deltas, g_string_free (out, FALSE));
|
||||
}
|
||||
}
|
||||
g_ptr_array_add (ret_deltas, g_string_free (out, FALSE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
if (out_deltas)
|
||||
*out_deltas = g_steal_pointer (&ret_deltas);
|
||||
out:
|
||||
return ret;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -435,8 +440,7 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self,
|
||||
}
|
||||
|
||||
if (!_ostree_static_delta_part_execute (self, objects, part, skip_validation,
|
||||
FALSE, NULL,
|
||||
cancellable, error))
|
||||
NULL, cancellable, error))
|
||||
{
|
||||
g_prefix_error (error, "Executing delta part %i: ", i);
|
||||
goto out;
|
||||
@@ -653,7 +657,7 @@ show_one_part (OstreeRepo *self,
|
||||
(guint64)g_variant_n_children (ops));
|
||||
|
||||
if (!_ostree_static_delta_part_execute (self, objects,
|
||||
part, TRUE, TRUE,
|
||||
part, TRUE,
|
||||
&stats, cancellable, error))
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -141,7 +141,6 @@ typedef struct {
|
||||
gboolean _ostree_static_delta_part_execute (OstreeRepo *repo,
|
||||
GVariant *header,
|
||||
GVariant *part_payload,
|
||||
gboolean trusted,
|
||||
gboolean stats_only,
|
||||
OstreeDeltaExecuteStats *stats,
|
||||
GCancellable *cancellable,
|
||||
@@ -150,7 +149,6 @@ gboolean _ostree_static_delta_part_execute (OstreeRepo *repo,
|
||||
void _ostree_static_delta_part_execute_async (OstreeRepo *repo,
|
||||
GVariant *header,
|
||||
GVariant *part_payload,
|
||||
gboolean trusted,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
G_STATIC_ASSERT (sizeof (guint) >= sizeof (guint32));
|
||||
|
||||
typedef struct {
|
||||
gboolean trusted;
|
||||
gboolean stats_only;
|
||||
OstreeRepo *repo;
|
||||
guint checksum_index;
|
||||
@@ -180,7 +179,6 @@ gboolean
|
||||
_ostree_static_delta_part_execute (OstreeRepo *repo,
|
||||
GVariant *objects,
|
||||
GVariant *part,
|
||||
gboolean trusted,
|
||||
gboolean stats_only,
|
||||
OstreeDeltaExecuteStats *stats,
|
||||
GCancellable *cancellable,
|
||||
@@ -200,7 +198,6 @@ _ostree_static_delta_part_execute (OstreeRepo *repo,
|
||||
|
||||
state->repo = repo;
|
||||
state->async_error = error;
|
||||
state->trusted = trusted;
|
||||
state->stats_only = stats_only;
|
||||
|
||||
if (!_ostree_static_delta_parse_checksum_array (objects,
|
||||
@@ -286,6 +283,7 @@ _ostree_static_delta_part_execute (OstreeRepo *repo,
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
g_clear_pointer (&state->content_checksum, g_checksum_free);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -295,7 +293,6 @@ typedef struct {
|
||||
GVariant *part;
|
||||
GCancellable *cancellable;
|
||||
GSimpleAsyncResult *result;
|
||||
gboolean trusted;
|
||||
} StaticDeltaPartExecuteAsyncData;
|
||||
|
||||
static void
|
||||
@@ -322,7 +319,6 @@ static_delta_part_execute_thread (GSimpleAsyncResult *res,
|
||||
if (!_ostree_static_delta_part_execute (data->repo,
|
||||
data->header,
|
||||
data->part,
|
||||
data->trusted,
|
||||
FALSE, NULL,
|
||||
cancellable, &error))
|
||||
g_simple_async_result_take_error (res, error);
|
||||
@@ -332,7 +328,6 @@ void
|
||||
_ostree_static_delta_part_execute_async (OstreeRepo *repo,
|
||||
GVariant *header,
|
||||
GVariant *part,
|
||||
gboolean trusted,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
@@ -343,7 +338,6 @@ _ostree_static_delta_part_execute_async (OstreeRepo *repo,
|
||||
asyncdata->repo = g_object_ref (repo);
|
||||
asyncdata->header = g_variant_ref (header);
|
||||
asyncdata->part = g_variant_ref (part);
|
||||
asyncdata->trusted = trusted;
|
||||
asyncdata->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
|
||||
|
||||
asyncdata->result = g_simple_async_result_new ((GObject*) repo,
|
||||
@@ -516,9 +510,9 @@ dispatch_bspatch (OstreeRepo *repo,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* When processing untrusted static deltas, we need to checksum the
|
||||
* file content, which includes a header. Compare with what
|
||||
* ostree_checksum_file_from_input() is doing too.
|
||||
/* Before, we had a distinction between "trusted" and "untrusted" deltas
|
||||
* which we've decided wasn't a good idea. Now, we always checksum the content.
|
||||
* Compare with what ostree_checksum_file_from_input() is doing too.
|
||||
*/
|
||||
static gboolean
|
||||
handle_untrusted_content_checksum (OstreeRepo *repo,
|
||||
@@ -529,13 +523,10 @@ handle_untrusted_content_checksum (OstreeRepo *repo,
|
||||
g_autoptr(GVariant) header = NULL;
|
||||
g_autoptr(GFileInfo) finfo = NULL;
|
||||
gsize bytes_written;
|
||||
|
||||
if (state->trusted)
|
||||
return TRUE;
|
||||
|
||||
finfo = _ostree_header_gfile_info_new (state->mode, state->uid, state->gid);
|
||||
header = _ostree_file_header_new (finfo, state->xattrs);
|
||||
|
||||
|
||||
state->content_checksum = g_checksum_new (G_CHECKSUM_SHA256);
|
||||
|
||||
if (!_ostree_write_variant_with_size (NULL, header, 0, &bytes_written, state->content_checksum,
|
||||
@@ -578,26 +569,16 @@ dispatch_open_splice_and_close (OstreeRepo *repo,
|
||||
metadata = g_variant_new_from_data (ostree_metadata_variant_type (state->output_objtype),
|
||||
state->payload_data + offset, length, TRUE, NULL, NULL);
|
||||
|
||||
if (state->trusted)
|
||||
{
|
||||
if (!ostree_repo_write_metadata_trusted (state->repo, state->output_objtype,
|
||||
state->checksum,
|
||||
metadata,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_autofree guchar *actual_csum = NULL;
|
||||
{
|
||||
g_autofree guchar *actual_csum = NULL;
|
||||
|
||||
if (!ostree_repo_write_metadata (state->repo, state->output_objtype,
|
||||
state->checksum,
|
||||
metadata, &actual_csum,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
}
|
||||
if (!ostree_repo_write_metadata (state->repo, state->output_objtype,
|
||||
state->checksum,
|
||||
metadata, &actual_csum,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -671,29 +652,18 @@ dispatch_open_splice_and_close (OstreeRepo *repo,
|
||||
&object_input, &objlen,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (state->trusted)
|
||||
{
|
||||
if (!ostree_repo_write_content_trusted (state->repo,
|
||||
state->checksum,
|
||||
object_input,
|
||||
objlen,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_autofree guchar *actual_csum = NULL;
|
||||
if (!ostree_repo_write_content (state->repo,
|
||||
state->checksum,
|
||||
object_input,
|
||||
objlen,
|
||||
&actual_csum,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
{
|
||||
g_autofree guchar *actual_csum = NULL;
|
||||
if (!ostree_repo_write_content (state->repo,
|
||||
state->checksum,
|
||||
object_input,
|
||||
objlen,
|
||||
&actual_csum,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -919,8 +889,6 @@ dispatch_close (OstreeRepo *repo,
|
||||
{
|
||||
const char *actual_checksum = g_checksum_get_string (state->content_checksum);
|
||||
|
||||
g_assert (!state->trusted);
|
||||
|
||||
if (strcmp (actual_checksum, state->checksum) != 0)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
@@ -941,6 +909,7 @@ dispatch_close (OstreeRepo *repo,
|
||||
goto out;
|
||||
|
||||
g_clear_pointer (&state->xattrs, g_variant_unref);
|
||||
g_clear_pointer (&state->content_checksum, g_checksum_free);
|
||||
g_clear_object (&state->content_out);
|
||||
|
||||
state->checksum_index++;
|
||||
|
||||
@@ -348,9 +348,8 @@ traverse_iter (OstreeRepo *repo,
|
||||
ostree_repo_commit_traverse_iter_get_file (iter, &name, &checksum);
|
||||
|
||||
g_debug ("Found file object %s", checksum);
|
||||
key = ostree_object_name_serialize (checksum, OSTREE_OBJECT_TYPE_FILE);
|
||||
g_hash_table_replace (inout_reachable, key, key);
|
||||
key = NULL;
|
||||
key = g_variant_ref_sink (ostree_object_name_serialize (checksum, OSTREE_OBJECT_TYPE_FILE));
|
||||
g_hash_table_add (inout_reachable, g_steal_pointer (&key));
|
||||
}
|
||||
else if (iterres == OSTREE_REPO_COMMIT_ITER_RESULT_DIR)
|
||||
{
|
||||
@@ -363,15 +362,13 @@ traverse_iter (OstreeRepo *repo,
|
||||
|
||||
g_debug ("Found dirtree object %s", content_checksum);
|
||||
g_debug ("Found dirmeta object %s", meta_checksum);
|
||||
key = ostree_object_name_serialize (meta_checksum, OSTREE_OBJECT_TYPE_DIR_META);
|
||||
g_hash_table_replace (inout_reachable, key, key);
|
||||
key = NULL;
|
||||
key = g_variant_ref_sink (ostree_object_name_serialize (meta_checksum, OSTREE_OBJECT_TYPE_DIR_META));
|
||||
g_hash_table_add (inout_reachable, g_steal_pointer (&key));
|
||||
|
||||
key = ostree_object_name_serialize (content_checksum, OSTREE_OBJECT_TYPE_DIR_TREE);
|
||||
key = g_variant_ref_sink (ostree_object_name_serialize (content_checksum, OSTREE_OBJECT_TYPE_DIR_TREE));
|
||||
if (!g_hash_table_lookup (inout_reachable, key))
|
||||
{
|
||||
g_hash_table_replace (inout_reachable, key, key);
|
||||
key = NULL;
|
||||
g_hash_table_add (inout_reachable, g_steal_pointer (&key));
|
||||
|
||||
if (!traverse_dirtree (repo, content_checksum, inout_reachable,
|
||||
ignore_missing_dirs, cancellable, error))
|
||||
@@ -407,7 +404,7 @@ traverse_dirtree (OstreeRepo *repo,
|
||||
if (ignore_missing_dirs &&
|
||||
g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
g_print ("Ignoring not-found dirmeta %s", checksum);
|
||||
g_debug ("Ignoring not-found dirmeta %s", checksum);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
@@ -463,7 +460,7 @@ ostree_repo_traverse_commit_union (OstreeRepo *repo,
|
||||
OstreeRepoCommitState commitstate;
|
||||
gboolean ignore_missing_dirs = FALSE;
|
||||
|
||||
key = ostree_object_name_serialize (commit_checksum, OSTREE_OBJECT_TYPE_COMMIT);
|
||||
key = g_variant_ref_sink (ostree_object_name_serialize (commit_checksum, OSTREE_OBJECT_TYPE_COMMIT));
|
||||
|
||||
if (g_hash_table_contains (inout_reachable, key))
|
||||
break;
|
||||
|
||||
@@ -521,7 +521,6 @@ ostree_repo_finalize (GObject *object)
|
||||
(void) close (self->cache_dir_fd);
|
||||
if (self->objects_dir_fd != -1)
|
||||
(void) close (self->objects_dir_fd);
|
||||
g_clear_object (&self->deltas_dir);
|
||||
if (self->uncompressed_objects_dir_fd != -1)
|
||||
(void) close (self->uncompressed_objects_dir_fd);
|
||||
g_clear_object (&self->sysroot_dir);
|
||||
@@ -606,8 +605,6 @@ ostree_repo_constructed (GObject *object)
|
||||
|
||||
self->tmp_dir = g_file_resolve_relative_path (self->repodir, "tmp");
|
||||
|
||||
self->deltas_dir = g_file_get_child (self->repodir, "deltas");
|
||||
|
||||
/* Ensure the "sysroot-path" property is set. */
|
||||
if (self->sysroot_dir == NULL)
|
||||
self->sysroot_dir = g_object_ref (_ostree_get_default_sysroot_path ());
|
||||
@@ -1700,9 +1697,10 @@ out:
|
||||
* ostree_repo_remote_fetch_summary:
|
||||
* @self: Self
|
||||
* @name: name of a remote
|
||||
* @out_summary: (nullable): return location for raw summary data, or %NULL
|
||||
* @out_signatures: (nullable): return location for raw summary signature
|
||||
* data, or %NULL
|
||||
* @out_summary: (out) (optional): return location for raw summary data, or
|
||||
* %NULL
|
||||
* @out_signatures: (out) (optional): return location for raw summary
|
||||
* signature data, or %NULL
|
||||
* @cancellable: a #GCancellable
|
||||
* @error: a #GError
|
||||
*
|
||||
|
||||
@@ -77,7 +77,9 @@ parse_refspec (OstreeSysrootUpgrader *self,
|
||||
|
||||
if ((self->flags & OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED) == 0)
|
||||
{
|
||||
/* If explicit action by the OS creator is requried to upgrade, print their text as an error */
|
||||
/* If explicit action by the OS creator is requried to upgrade, print their text as an error.
|
||||
* NOTE: If changing this, see the matching implementation in ostree-repo-pull.c.
|
||||
*/
|
||||
unconfigured_state = g_key_file_get_string (self->origin, "origin", "unconfigured-state", NULL);
|
||||
if (unconfigured_state)
|
||||
{
|
||||
|
||||
@@ -613,8 +613,6 @@ parse_origin (OstreeSysroot *self,
|
||||
out:
|
||||
if (error)
|
||||
g_prefix_error (error, "Parsing %s: ", origin_path);
|
||||
if (ret_origin)
|
||||
g_key_file_unref (ret_origin);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -689,7 +687,7 @@ parse_deployment (OstreeSysroot *self,
|
||||
glnx_fd_close int deployment_dfd = -1;
|
||||
const char *deploy_basename;
|
||||
g_autofree char *treebootserial_target = NULL;
|
||||
GKeyFile *origin = NULL;
|
||||
g_autoptr(GKeyFile) origin = NULL;
|
||||
g_autofree char *unlocked_development_path = NULL;
|
||||
struct stat stbuf;
|
||||
|
||||
@@ -751,8 +749,6 @@ parse_deployment (OstreeSysroot *self,
|
||||
if (out_deployment)
|
||||
*out_deployment = g_steal_pointer (&ret_deployment);
|
||||
out:
|
||||
if (origin)
|
||||
g_key_file_unref (origin);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1327,7 +1323,7 @@ ostree_sysroot_try_lock (OstreeSysroot *self,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GError *local_error = NULL;
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
|
||||
if (!ensure_sysroot_fd (self, error))
|
||||
goto out;
|
||||
@@ -1342,7 +1338,7 @@ ostree_sysroot_try_lock (OstreeSysroot *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
g_propagate_error (error, g_steal_pointer (&local_error));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user