New upstream version 2016.13
This commit is contained in:
commit
d02ef65cdc
110 files changed
+1924
-390
No files matched your search
@@ -357,14 +357,15 @@ global:
|
||||
/* No new symbols in 2016.10 */
|
||||
/* No new symbols in 2016.11 */
|
||||
/* No new symbols in 2016.12 */
|
||||
/* No new symbols in 2016.13 */
|
||||
|
||||
/* NOTE NOTE NOTE
|
||||
* Versions above here are released. Only add symbols below this line.
|
||||
* NOTE NOTE NOTE
|
||||
*/
|
||||
|
||||
/* Remove comment when first new symbol is added
|
||||
LIBOSTREE_2016.12
|
||||
/* Remove comment when first new symbol is added, replace XX with new stable version.
|
||||
LIBOSTREE_2016.XX
|
||||
global:
|
||||
someostree_symbol_deleteme;
|
||||
} LIBOSTREE_2016.8;
|
||||
|
||||
@@ -54,7 +54,6 @@ _ostree_bootloader_grub2_query (OstreeBootloader *bootloader,
|
||||
gboolean ret = FALSE;
|
||||
OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
|
||||
g_autoptr(GFile) efi_basedir = NULL;
|
||||
g_autoptr(GFileInfo) file_info = NULL;
|
||||
|
||||
if (g_file_query_exists (self->config_path_bios, NULL))
|
||||
{
|
||||
@@ -290,8 +289,6 @@ _ostree_bootloader_grub2_write_config (OstreeBootloader *bootloader,
|
||||
{
|
||||
OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GFile) efi_new_config_temp = NULL;
|
||||
g_autoptr(GFile) efi_orig_config = NULL;
|
||||
g_autoptr(GFile) new_config_path = NULL;
|
||||
GSubprocessFlags subp_flags = 0;
|
||||
glnx_unref_object GSubprocessLauncher *launcher = NULL;
|
||||
|
||||
@@ -326,6 +326,16 @@ session_thread_set_proxy_cb (ThreadClosure *thread_closure,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
session_thread_set_cookie_jar_cb (ThreadClosure *thread_closure,
|
||||
gpointer data)
|
||||
{
|
||||
SoupCookieJar *jar = data;
|
||||
|
||||
soup_session_add_feature (thread_closure->session,
|
||||
SOUP_SESSION_FEATURE (jar));
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBSOUP_CLIENT_CERTS
|
||||
static void
|
||||
session_thread_set_tls_interaction_cb (ThreadClosure *thread_closure,
|
||||
@@ -746,6 +756,23 @@ _ostree_fetcher_set_proxy (OstreeFetcher *self,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_ostree_fetcher_set_cookie_jar (OstreeFetcher *self,
|
||||
const char *jar_path)
|
||||
{
|
||||
SoupCookieJar *jar;
|
||||
|
||||
g_return_if_fail (OSTREE_IS_FETCHER (self));
|
||||
g_return_if_fail (jar_path != NULL);
|
||||
|
||||
jar = soup_cookie_jar_text_new (jar_path, TRUE);
|
||||
|
||||
session_thread_idle_add (self->thread_closure,
|
||||
session_thread_set_cookie_jar_cb,
|
||||
jar, /* takes ownership */
|
||||
(GDestroyNotify) g_object_unref);
|
||||
}
|
||||
|
||||
void
|
||||
_ostree_fetcher_set_client_cert (OstreeFetcher *self,
|
||||
GTlsCertificate *cert)
|
||||
@@ -1030,6 +1057,7 @@ on_request_sent (GObject *object,
|
||||
switch (msg->status_code)
|
||||
{
|
||||
case 404:
|
||||
case 403:
|
||||
case 410:
|
||||
code = G_IO_ERROR_NOT_FOUND;
|
||||
break;
|
||||
@@ -1282,7 +1310,6 @@ _ostree_fetcher_mirrored_request_to_membuf (OstreeFetcher *fetcher,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
const guint8 nulchar = 0;
|
||||
g_autofree char *ret_contents = NULL;
|
||||
g_autoptr(GMemoryOutputStream) buf = NULL;
|
||||
g_autoptr(GMainContext) mainctx = NULL;
|
||||
FetchUriSyncData data;
|
||||
|
||||
@@ -59,6 +59,9 @@ OstreeFetcher *_ostree_fetcher_new (int tmpdir_dfd,
|
||||
|
||||
int _ostree_fetcher_get_dfd (OstreeFetcher *fetcher);
|
||||
|
||||
void _ostree_fetcher_set_cookie_jar (OstreeFetcher *self,
|
||||
const char *jar_path);
|
||||
|
||||
void _ostree_fetcher_set_proxy (OstreeFetcher *fetcher,
|
||||
const char *proxy);
|
||||
|
||||
|
||||
@@ -53,6 +53,23 @@ split_keyeq (char *arg)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_arg_has_prefix (const char *arg,
|
||||
char **prefixes)
|
||||
{
|
||||
char **strviter;
|
||||
|
||||
for (strviter = prefixes; strviter && *strviter; strviter++)
|
||||
{
|
||||
const char *prefix = *strviter;
|
||||
|
||||
if (g_str_has_prefix (arg, prefix))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
OstreeKernelArgs *
|
||||
_ostree_kernel_args_new (void)
|
||||
{
|
||||
@@ -87,12 +104,21 @@ _ostree_kernel_args_replace_take (OstreeKernelArgs *kargs,
|
||||
gboolean existed;
|
||||
GPtrArray *values = g_ptr_array_new_with_free_func (g_free);
|
||||
const char *value = split_keyeq (arg);
|
||||
gpointer old_key;
|
||||
|
||||
existed = g_hash_table_remove (kargs->table, arg);
|
||||
if (!existed)
|
||||
g_ptr_array_add (kargs->order, arg);
|
||||
g_ptr_array_add (values, g_strdup (value));
|
||||
g_hash_table_replace (kargs->table, arg, values);
|
||||
existed = g_hash_table_lookup_extended (kargs->table, arg, &old_key, NULL);
|
||||
|
||||
if (existed)
|
||||
{
|
||||
g_hash_table_replace (kargs->table, old_key, values);
|
||||
g_free (arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ptr_array_add (kargs->order, arg);
|
||||
g_hash_table_replace (kargs->table, arg, values);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -145,18 +171,28 @@ _ostree_kernel_args_replace_argv (OstreeKernelArgs *kargs,
|
||||
}
|
||||
|
||||
void
|
||||
_ostree_kernel_args_append_argv (OstreeKernelArgs *kargs,
|
||||
char **argv)
|
||||
_ostree_kernel_args_append_argv_filtered (OstreeKernelArgs *kargs,
|
||||
char **argv,
|
||||
char **prefixes)
|
||||
{
|
||||
char **strviter;
|
||||
|
||||
for (strviter = argv; strviter && *strviter; strviter++)
|
||||
{
|
||||
const char *arg = *strviter;
|
||||
_ostree_kernel_args_append (kargs, arg);
|
||||
|
||||
if (!_arg_has_prefix (arg, prefixes))
|
||||
_ostree_kernel_args_append (kargs, arg);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_ostree_kernel_args_append_argv (OstreeKernelArgs *kargs,
|
||||
char **argv)
|
||||
{
|
||||
_ostree_kernel_args_append_argv_filtered (kargs, argv, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
|
||||
GCancellable *cancellable,
|
||||
@@ -166,6 +202,13 @@ _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
|
||||
g_autofree char *proc_cmdline = NULL;
|
||||
gsize proc_cmdline_len = 0;
|
||||
g_auto(GStrv) proc_cmdline_args = NULL;
|
||||
/* When updating the filter list don't forget to update the list in the tests
|
||||
* e.g. tests/test-admin-deploy-karg.sh and
|
||||
* tests/test-admin-instutil-set-kargs.sh
|
||||
*/
|
||||
char *filtered_prefixes[] = { "BOOT_IMAGE=", /* GRUB 2 */
|
||||
"initrd=", /* sd-boot */
|
||||
NULL };
|
||||
|
||||
if (!g_file_load_contents (proc_cmdline_path, cancellable,
|
||||
&proc_cmdline, &proc_cmdline_len,
|
||||
@@ -175,7 +218,8 @@ _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
|
||||
g_strchomp (proc_cmdline);
|
||||
|
||||
proc_cmdline_args = g_strsplit (proc_cmdline, " ", -1);
|
||||
_ostree_kernel_args_append_argv (kargs, proc_cmdline_args);
|
||||
_ostree_kernel_args_append_argv_filtered (kargs, proc_cmdline_args,
|
||||
filtered_prefixes);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,9 @@ void _ostree_kernel_args_append (OstreeKernelArgs *kargs,
|
||||
const char *key);
|
||||
void _ostree_kernel_args_append_argv (OstreeKernelArgs *kargs,
|
||||
char **argv);
|
||||
void _ostree_kernel_args_append_argv_filtered (OstreeKernelArgs *kargs,
|
||||
char **argv,
|
||||
char **prefixes);
|
||||
|
||||
gboolean _ostree_kernel_args_append_proc_cmdline (OstreeKernelArgs *kargs,
|
||||
GCancellable *cancellable,
|
||||
|
||||
@@ -592,7 +592,6 @@ write_object (OstreeRepo *self,
|
||||
gboolean do_commit;
|
||||
OstreeRepoMode repo_mode;
|
||||
g_autofree char *temp_filename = NULL;
|
||||
g_autoptr(GFile) stored_path = NULL;
|
||||
g_autofree guchar *ret_csum = NULL;
|
||||
glnx_unref_object OstreeChecksumInputStream *checksum_input = NULL;
|
||||
g_autoptr(GInputStream) file_input = NULL;
|
||||
@@ -1093,9 +1092,6 @@ ostree_repo_prepare_transaction (OstreeRepo *self,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gboolean ret_transaction_resume = FALSE;
|
||||
g_autofree char *stagedir_name = NULL;
|
||||
glnx_fd_close int stagedir_fd = -1;
|
||||
g_auto(GLnxDirFdIterator) dfd_iter = { 0, };
|
||||
|
||||
g_return_val_if_fail (self->in_transaction == FALSE, FALSE);
|
||||
|
||||
@@ -2529,7 +2525,6 @@ write_directory_to_mtree_internal (OstreeRepo *self,
|
||||
gboolean ret = FALSE;
|
||||
OstreeRepoCommitFilterResult filter_result;
|
||||
OstreeRepoFile *repo_dir = NULL;
|
||||
g_autoptr(GFileEnumerator) dir_enum = NULL;
|
||||
g_autoptr(GFileInfo) child_info = NULL;
|
||||
|
||||
if (dir)
|
||||
|
||||
@@ -300,7 +300,6 @@ aic_apply_modifier_filter (OstreeRepoArchiveImportContext *ctx,
|
||||
const char *relpath,
|
||||
GFileInfo **out_file_info)
|
||||
{
|
||||
g_autofree char *hardlink = aic_get_final_entry_hardlink (ctx);
|
||||
g_autoptr(GFileInfo) file_info = NULL;
|
||||
g_autofree char *abspath = NULL;
|
||||
const char *cb_path = NULL;
|
||||
@@ -915,7 +914,6 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self,
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
gboolean ret = FALSE;
|
||||
struct archive *a = NULL;
|
||||
g_autoptr(GFileInfo) tmp_dir_info = NULL;
|
||||
OstreeRepoImportArchiveOptions opts = { 0, };
|
||||
|
||||
a = archive_read_new ();
|
||||
|
||||
@@ -311,29 +311,11 @@ ostree_repo_prune (OstreeRepo *self,
|
||||
while (g_hash_table_iter_next (&hash_iter, &key, &value))
|
||||
{
|
||||
const char *checksum = value;
|
||||
OstreeRepoCommitState commitstate;
|
||||
GError *local_error = NULL;
|
||||
|
||||
if (!ostree_repo_load_commit (self, checksum, NULL, &commitstate,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
g_debug ("Finding objects to keep for commit %s", checksum);
|
||||
if (!ostree_repo_traverse_commit_union (self, checksum, depth, data.reachable,
|
||||
cancellable, &local_error))
|
||||
{
|
||||
/* Don't fail traversing a partial commit */
|
||||
if ((commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL) > 0 &&
|
||||
g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
g_clear_error (&local_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,34 +331,16 @@ ostree_repo_prune (OstreeRepo *self,
|
||||
GVariant *serialized_key = key;
|
||||
const char *checksum;
|
||||
OstreeObjectType objtype;
|
||||
OstreeRepoCommitState commitstate;
|
||||
GError *local_error = NULL;
|
||||
|
||||
ostree_object_name_deserialize (serialized_key, &checksum, &objtype);
|
||||
|
||||
if (objtype != OSTREE_OBJECT_TYPE_COMMIT)
|
||||
continue;
|
||||
|
||||
if (!ostree_repo_load_commit (self, checksum, NULL, &commitstate,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
g_debug ("Finding objects to keep for commit %s", checksum);
|
||||
if (!ostree_repo_traverse_commit_union (self, checksum, depth, data.reachable,
|
||||
cancellable, &local_error))
|
||||
{
|
||||
/* Don't fail traversing a partial commit */
|
||||
if ((commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL) > 0 &&
|
||||
g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
g_clear_error (&local_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_propagate_error (error, local_error);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -608,10 +608,8 @@ lookup_commit_checksum_from_summary (OtPullData *pull_data,
|
||||
g_autoptr(GVariant) refs = g_variant_get_child_value (pull_data->summary, 0);
|
||||
g_autoptr(GVariant) refdata = NULL;
|
||||
g_autoptr(GVariant) reftargetdata = NULL;
|
||||
g_autoptr(GVariant) commit_data = NULL;
|
||||
guint64 commit_size;
|
||||
g_autoptr(GVariant) commit_csum_v = NULL;
|
||||
g_autoptr(GBytes) commit_bytes = NULL;
|
||||
int i;
|
||||
|
||||
if (!ot_variant_bsearch_str (refs, ref, &i))
|
||||
@@ -973,7 +971,6 @@ static_deltapart_fetch_on_complete (GObject *object,
|
||||
OstreeFetcher *fetcher = (OstreeFetcher *)object;
|
||||
FetchStaticDeltaData *fetch_data = user_data;
|
||||
OtPullData *pull_data = fetch_data->pull_data;
|
||||
g_autoptr(GVariant) metadata = NULL;
|
||||
g_autofree char *temp_path = NULL;
|
||||
g_autoptr(GInputStream) in = NULL;
|
||||
g_autoptr(GVariant) part = NULL;
|
||||
@@ -1430,8 +1427,6 @@ request_static_delta_superblock_sync (OtPullData *pull_data,
|
||||
g_autofree char *delta_name =
|
||||
_ostree_get_relative_static_delta_superblock_path (from_revision, to_revision);
|
||||
g_autoptr(GBytes) delta_superblock_data = NULL;
|
||||
g_autoptr(GBytes) delta_meta_data = NULL;
|
||||
g_autoptr(GVariant) delta_superblock = NULL;
|
||||
|
||||
if (!_ostree_fetcher_mirrored_request_to_membuf (pull_data->fetcher,
|
||||
pull_data->content_mirrorlist,
|
||||
@@ -1969,6 +1964,19 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self,
|
||||
_ostree_fetcher_set_proxy (fetcher, http_proxy);
|
||||
}
|
||||
|
||||
{
|
||||
g_autofree char *jar_path = NULL;
|
||||
g_autofree char *cookie_file = g_strdup_printf ("%s.cookies.txt",
|
||||
remote_name);
|
||||
|
||||
jar_path = g_build_filename (g_file_get_path (self->repodir), cookie_file,
|
||||
NULL);
|
||||
|
||||
if (g_file_test(jar_path, G_FILE_TEST_IS_REGULAR))
|
||||
_ostree_fetcher_set_cookie_jar (fetcher, jar_path);
|
||||
|
||||
}
|
||||
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
@@ -2335,8 +2343,6 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
gboolean opt_gpg_verify_set = FALSE;
|
||||
gboolean opt_gpg_verify_summary_set = FALSE;
|
||||
const char *url_override = NULL;
|
||||
g_autofree char *base_meta_url = NULL;
|
||||
g_autofree char *base_content_url = NULL;
|
||||
gboolean mirroring_into_archive;
|
||||
gboolean inherit_transaction = FALSE;
|
||||
int i;
|
||||
@@ -2641,7 +2647,6 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
|
||||
{
|
||||
g_autoptr(GBytes) bytes_sig = NULL;
|
||||
g_autofree char *ret_contents = NULL;
|
||||
gsize i, n;
|
||||
g_autoptr(GVariant) refs = NULL;
|
||||
g_autoptr(GVariant) deltas = NULL;
|
||||
@@ -2934,7 +2939,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
&from_revision, error))
|
||||
goto out;
|
||||
|
||||
if (!disable_static_deltas && !mirroring_into_archive &&
|
||||
if (!(disable_static_deltas || mirroring_into_archive || pull_data->is_commit_only) &&
|
||||
(from_revision == NULL || g_strcmp0 (from_revision, to_revision) != 0))
|
||||
{
|
||||
if (!request_static_delta_superblock_sync (pull_data, from_revision, to_revision,
|
||||
@@ -3131,6 +3136,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
|
||||
g_clear_pointer (&pull_data->requested_content, (GDestroyNotify) g_hash_table_unref);
|
||||
g_clear_pointer (&pull_data->requested_metadata, (GDestroyNotify) g_hash_table_unref);
|
||||
g_clear_pointer (&pull_data->idle_src, (GDestroyNotify) g_source_destroy);
|
||||
g_clear_pointer (&pull_data->dirs, (GDestroyNotify) g_ptr_array_unref);
|
||||
g_clear_pointer (&remote_config, (GDestroyNotify) g_key_file_unref);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -189,18 +189,30 @@ build_content_sizenames_filtered (OstreeRepo *repo,
|
||||
|
||||
static gboolean
|
||||
string_array_nonempty_intersection (GPtrArray *a,
|
||||
GPtrArray *b)
|
||||
GPtrArray *b,
|
||||
gboolean fuzzy)
|
||||
{
|
||||
guint i;
|
||||
for (i = 0; i < a->len; i++)
|
||||
{
|
||||
guint j;
|
||||
const char *a_str = a->pdata[i];
|
||||
const char *a_dot = strchr (a_str, '.');
|
||||
for (j = 0; j < b->len; j++)
|
||||
{
|
||||
const char *b_str = b->pdata[j];
|
||||
if (strcmp (a_str, b_str) == 0)
|
||||
return TRUE;
|
||||
const char *b_dot = strchr (b_str, '.');
|
||||
/* When doing fuzzy comparison, just compare the part before the '.' if it exists. */
|
||||
if (fuzzy && a_dot && b_dot && b_dot - b_str && b_dot - b_str == a_dot - a_str)
|
||||
{
|
||||
if (strncmp (a_str, b_str, a_dot - a_str) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (a_str, b_str) == 0)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
@@ -258,6 +270,8 @@ _ostree_delta_compute_similar_objects (OstreeRepo *repo,
|
||||
upper = from_sizes->len;
|
||||
for (i = 0; i < to_sizes->len; i++)
|
||||
{
|
||||
int fuzzy;
|
||||
gboolean found = FALSE;
|
||||
OstreeDeltaContentSizeNames *to_sizenames = to_sizes->pdata[i];
|
||||
const guint64 min_threshold = to_sizenames->size *
|
||||
(1.0-similarity_percent_threshold/100.0);
|
||||
@@ -268,31 +282,41 @@ _ostree_delta_compute_similar_objects (OstreeRepo *repo,
|
||||
if (to_sizenames->size == 0)
|
||||
continue;
|
||||
|
||||
for (j = lower; j < upper; j++)
|
||||
for (fuzzy = 0; fuzzy < 2 && !found; fuzzy++)
|
||||
{
|
||||
OstreeDeltaContentSizeNames *from_sizenames = from_sizes->pdata[j];
|
||||
|
||||
/* Don't build candidates for the empty object */
|
||||
if (from_sizenames->size == 0)
|
||||
continue;
|
||||
|
||||
if (from_sizenames->size < min_threshold)
|
||||
for (j = lower; j < upper; j++)
|
||||
{
|
||||
lower++;
|
||||
continue;
|
||||
OstreeDeltaContentSizeNames *from_sizenames = from_sizes->pdata[j];
|
||||
|
||||
/* Don't build candidates for the empty object */
|
||||
if (from_sizenames->size == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (from_sizenames->size < min_threshold)
|
||||
{
|
||||
lower++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (from_sizenames->size > max_threshold)
|
||||
break;
|
||||
|
||||
if (!string_array_nonempty_intersection (from_sizenames->basenames,
|
||||
to_sizenames->basenames,
|
||||
fuzzy == 1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Only one candidate right now */
|
||||
g_hash_table_insert (ret_modified_regfile_content,
|
||||
g_strdup (to_sizenames->checksum),
|
||||
g_strdup (from_sizenames->checksum));
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (from_sizenames->size > max_threshold)
|
||||
break;
|
||||
|
||||
if (!string_array_nonempty_intersection (from_sizenames->basenames, to_sizenames->basenames))
|
||||
continue;
|
||||
|
||||
/* Only one candidate right now */
|
||||
g_hash_table_insert (ret_modified_regfile_content,
|
||||
g_strdup (to_sizenames->checksum),
|
||||
g_strdup (from_sizenames->checksum));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "ostree-diff.h"
|
||||
#include "ostree-rollsum.h"
|
||||
#include "otutil.h"
|
||||
#include "libglnx.h"
|
||||
#include "ostree-varint.h"
|
||||
#include "bsdiff/bsdiff.h"
|
||||
|
||||
@@ -413,15 +414,11 @@ process_one_object (OstreeRepo *repo,
|
||||
|
||||
typedef struct {
|
||||
char *from_checksum;
|
||||
GBytes *tmp_from;
|
||||
GBytes *tmp_to;
|
||||
} ContentBsdiff;
|
||||
|
||||
typedef struct {
|
||||
char *from_checksum;
|
||||
OstreeRollsumMatches *matches;
|
||||
GBytes *tmp_from;
|
||||
GBytes *tmp_to;
|
||||
} ContentRollsum;
|
||||
|
||||
static void
|
||||
@@ -429,8 +426,6 @@ content_rollsums_free (ContentRollsum *rollsum)
|
||||
{
|
||||
g_free (rollsum->from_checksum);
|
||||
_ostree_rollsum_matches_free (rollsum->matches);
|
||||
g_clear_pointer (&rollsum->tmp_from, g_bytes_unref);
|
||||
g_clear_pointer (&rollsum->tmp_to, g_bytes_unref);
|
||||
g_free (rollsum);
|
||||
}
|
||||
|
||||
@@ -438,8 +433,6 @@ static void
|
||||
content_bsdiffs_free (ContentBsdiff *bsdiff)
|
||||
{
|
||||
g_free (bsdiff->from_checksum);
|
||||
g_clear_pointer (&bsdiff->tmp_from, g_bytes_unref);
|
||||
g_clear_pointer (&bsdiff->tmp_to, g_bytes_unref);
|
||||
g_free (bsdiff);
|
||||
}
|
||||
|
||||
@@ -450,50 +443,40 @@ static gboolean
|
||||
get_unpacked_unlinked_content (OstreeRepo *repo,
|
||||
const char *checksum,
|
||||
GBytes **out_content,
|
||||
GFileInfo **out_finfo,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
g_autofree char *tmpname = g_strdup ("/var/tmp/tmpostree-deltaobj-XXXXXX");
|
||||
g_autofree char *tmpname = NULL;
|
||||
glnx_fd_close int fd = -1;
|
||||
g_autoptr(GBytes) ret_content = NULL;
|
||||
g_autoptr(GInputStream) istream = NULL;
|
||||
g_autoptr(GFileInfo) ret_finfo = NULL;
|
||||
g_autoptr(GOutputStream) out = NULL;
|
||||
|
||||
fd = g_mkstemp (tmpname);
|
||||
if (fd == -1)
|
||||
{
|
||||
glnx_set_error_from_errno (error);
|
||||
goto out;
|
||||
}
|
||||
/* Doesn't need a name */
|
||||
(void) unlink (tmpname);
|
||||
if (!glnx_open_tmpfile_linkable_at (AT_FDCWD, "/tmp", O_RDWR | O_CLOEXEC,
|
||||
&fd, &tmpname, error))
|
||||
return FALSE;
|
||||
/* We don't need the file name */
|
||||
if (tmpname)
|
||||
(void) unlinkat (AT_FDCWD, tmpname, 0);
|
||||
|
||||
if (!ostree_repo_load_file (repo, checksum, &istream, &ret_finfo, NULL,
|
||||
if (!ostree_repo_load_file (repo, checksum, &istream, NULL, NULL,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
return FALSE;
|
||||
|
||||
g_assert (g_file_info_get_file_type (ret_finfo) == G_FILE_TYPE_REGULAR);
|
||||
|
||||
out = g_unix_output_stream_new (fd, FALSE);
|
||||
if (g_output_stream_splice (out, istream, G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
cancellable, error) < 0)
|
||||
goto out;
|
||||
|
||||
{ GMappedFile *mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
|
||||
return FALSE;
|
||||
|
||||
{ g_autoptr(GMappedFile) mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
|
||||
if (!mfile)
|
||||
goto out;
|
||||
return FALSE;
|
||||
ret_content = g_mapped_file_get_bytes (mfile);
|
||||
g_mapped_file_unref (mfile);
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
if (out_content)
|
||||
*out_content = g_steal_pointer (&ret_content);
|
||||
out:
|
||||
return ret;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -506,24 +489,20 @@ try_content_bsdiff (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GHashTable) from_bsdiff = NULL;
|
||||
g_autoptr(GHashTable) to_bsdiff = NULL;
|
||||
g_autoptr(GBytes) tmp_from = NULL;
|
||||
g_autoptr(GBytes) tmp_to = NULL;
|
||||
g_autoptr(GFileInfo) from_finfo = NULL;
|
||||
g_autoptr(GFileInfo) to_finfo = NULL;
|
||||
ContentBsdiff *ret_bsdiff = NULL;
|
||||
|
||||
*out_bsdiff = NULL;
|
||||
|
||||
if (!get_unpacked_unlinked_content (repo, from, &tmp_from, &from_finfo,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (!get_unpacked_unlinked_content (repo, to, &tmp_to, &to_finfo,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (!ostree_repo_load_file (repo, from, NULL, &from_finfo, NULL,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
if (!ostree_repo_load_file (repo, to, NULL, &to_finfo, NULL,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (g_bytes_get_size (tmp_to) + g_bytes_get_size (tmp_from) > max_bsdiff_size_bytes)
|
||||
if (g_file_info_get_size (to_finfo) + g_file_info_get_size (from_finfo) > max_bsdiff_size_bytes)
|
||||
{
|
||||
ret = TRUE;
|
||||
goto out;
|
||||
@@ -531,8 +510,6 @@ try_content_bsdiff (OstreeRepo *repo,
|
||||
|
||||
ret_bsdiff = g_new0 (ContentBsdiff, 1);
|
||||
ret_bsdiff->from_checksum = g_strdup (from);
|
||||
ret_bsdiff->tmp_from = tmp_from; tmp_from = NULL;
|
||||
ret_bsdiff->tmp_to = tmp_to; tmp_to = NULL;
|
||||
|
||||
ret = TRUE;
|
||||
if (out_bsdiff)
|
||||
@@ -551,12 +528,8 @@ try_content_rollsum (OstreeRepo *repo,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
g_autoptr(GHashTable) from_rollsum = NULL;
|
||||
g_autoptr(GHashTable) to_rollsum = NULL;
|
||||
g_autoptr(GBytes) tmp_from = NULL;
|
||||
g_autoptr(GBytes) tmp_to = NULL;
|
||||
g_autoptr(GFileInfo) from_finfo = NULL;
|
||||
g_autoptr(GFileInfo) to_finfo = NULL;
|
||||
OstreeRollsumMatches *matches = NULL;
|
||||
ContentRollsum *ret_rollsum = NULL;
|
||||
|
||||
@@ -565,11 +538,9 @@ try_content_rollsum (OstreeRepo *repo,
|
||||
/* Load the content objects, splice them to uncompressed temporary files that
|
||||
* we can just mmap() and seek around in conveniently.
|
||||
*/
|
||||
if (!get_unpacked_unlinked_content (repo, from, &tmp_from, &from_finfo,
|
||||
cancellable, error))
|
||||
if (!get_unpacked_unlinked_content (repo, from, &tmp_from, cancellable, error))
|
||||
goto out;
|
||||
if (!get_unpacked_unlinked_content (repo, to, &tmp_to, &to_finfo,
|
||||
cancellable, error))
|
||||
if (!get_unpacked_unlinked_content (repo, to, &tmp_to, cancellable, error))
|
||||
goto out;
|
||||
|
||||
matches = _ostree_compute_rollsum_matches (tmp_from, tmp_to);
|
||||
@@ -596,10 +567,8 @@ try_content_rollsum (OstreeRepo *repo,
|
||||
|
||||
ret_rollsum = g_new0 (ContentRollsum, 1);
|
||||
ret_rollsum->from_checksum = g_strdup (from);
|
||||
ret_rollsum->matches = matches; matches = NULL;
|
||||
ret_rollsum->tmp_from = tmp_from; tmp_from = NULL;
|
||||
ret_rollsum->tmp_to = tmp_to; tmp_to = NULL;
|
||||
|
||||
ret_rollsum->matches = g_steal_pointer (&matches);
|
||||
|
||||
ret = TRUE;
|
||||
if (out_rollsum)
|
||||
*out_rollsum = g_steal_pointer (&ret_rollsum);
|
||||
@@ -655,7 +624,7 @@ process_one_rollsum (OstreeRepo *repo,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
guint64 content_size;
|
||||
g_autoptr(GInputStream) content_stream = NULL;
|
||||
g_autoptr(GBytes) tmp_to = NULL;
|
||||
g_autoptr(GFileInfo) content_finfo = NULL;
|
||||
g_autoptr(GVariant) content_xattrs = NULL;
|
||||
OstreeStaticDeltaPartBuilder *current_part = *current_part_val;
|
||||
@@ -669,9 +638,13 @@ process_one_rollsum (OstreeRepo *repo,
|
||||
*current_part_val = current_part = allocate_part (builder);
|
||||
}
|
||||
|
||||
tmp_to_buf = g_bytes_get_data (rollsum->tmp_to, &tmp_to_len);
|
||||
if (!get_unpacked_unlinked_content (repo, to_checksum, &tmp_to,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!ostree_repo_load_file (repo, to_checksum, &content_stream,
|
||||
tmp_to_buf = g_bytes_get_data (tmp_to, &tmp_to_len);
|
||||
|
||||
if (!ostree_repo_load_file (repo, to_checksum, NULL,
|
||||
&content_finfo, &content_xattrs,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
@@ -758,9 +731,6 @@ process_one_rollsum (OstreeRepo *repo,
|
||||
g_string_append_c (current_part->operations, (gchar)OSTREE_STATIC_DELTA_OP_CLOSE);
|
||||
}
|
||||
|
||||
g_clear_pointer (&rollsum->tmp_from, g_bytes_unref);
|
||||
g_clear_pointer (&rollsum->tmp_to, g_bytes_unref);
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
return ret;
|
||||
@@ -777,10 +747,11 @@ process_one_bsdiff (OstreeRepo *repo,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
guint64 content_size;
|
||||
g_autoptr(GInputStream) content_stream = NULL;
|
||||
g_autoptr(GFileInfo) content_finfo = NULL;
|
||||
g_autoptr(GVariant) content_xattrs = NULL;
|
||||
OstreeStaticDeltaPartBuilder *current_part = *current_part_val;
|
||||
g_autoptr(GBytes) tmp_from = NULL;
|
||||
g_autoptr(GBytes) tmp_to = NULL;
|
||||
const guint8 *tmp_to_buf;
|
||||
gsize tmp_to_len;
|
||||
const guint8 *tmp_from_buf;
|
||||
@@ -793,10 +764,17 @@ process_one_bsdiff (OstreeRepo *repo,
|
||||
*current_part_val = current_part = allocate_part (builder);
|
||||
}
|
||||
|
||||
tmp_to_buf = g_bytes_get_data (bsdiff_content->tmp_to, &tmp_to_len);
|
||||
tmp_from_buf = g_bytes_get_data (bsdiff_content->tmp_from, &tmp_from_len);
|
||||
if (!get_unpacked_unlinked_content (repo, bsdiff_content->from_checksum, &tmp_from,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
if (!get_unpacked_unlinked_content (repo, to_checksum, &tmp_to,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!ostree_repo_load_file (repo, to_checksum, &content_stream,
|
||||
tmp_to_buf = g_bytes_get_data (tmp_to, &tmp_to_len);
|
||||
tmp_from_buf = g_bytes_get_data (tmp_from, &tmp_from_len);
|
||||
|
||||
if (!ostree_repo_load_file (repo, to_checksum, NULL,
|
||||
&content_finfo, &content_xattrs,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
@@ -857,9 +835,6 @@ process_one_bsdiff (OstreeRepo *repo,
|
||||
|
||||
g_string_append_c (current_part->operations, (gchar)OSTREE_STATIC_DELTA_OP_UNSET_READ_SOURCE);
|
||||
|
||||
g_clear_pointer (&bsdiff_content->tmp_from, g_bytes_unref);
|
||||
g_clear_pointer (&bsdiff_content->tmp_to, g_bytes_unref);
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
return ret;
|
||||
@@ -884,14 +859,12 @@ generate_delta_lowlatency (OstreeRepo *repo,
|
||||
g_autoptr(GVariant) to_commit = NULL;
|
||||
g_autoptr(GHashTable) to_reachable_objects = NULL;
|
||||
g_autoptr(GHashTable) from_reachable_objects = NULL;
|
||||
g_autoptr(GHashTable) from_regfile_content = NULL;
|
||||
g_autoptr(GHashTable) new_reachable_metadata = NULL;
|
||||
g_autoptr(GHashTable) new_reachable_regfile_content = NULL;
|
||||
g_autoptr(GHashTable) new_reachable_symlink_content = NULL;
|
||||
g_autoptr(GHashTable) modified_regfile_content = NULL;
|
||||
g_autoptr(GHashTable) rollsum_optimized_content_objects = NULL;
|
||||
g_autoptr(GHashTable) bsdiff_optimized_content_objects = NULL;
|
||||
g_autoptr(GHashTable) content_object_to_size = NULL;
|
||||
|
||||
if (from != NULL)
|
||||
{
|
||||
@@ -1261,7 +1234,7 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
guint min_fallback_size;
|
||||
guint max_bsdiff_size;
|
||||
guint max_chunk_size;
|
||||
g_auto(GVariantBuilder) metadata_builder = {{0,}};
|
||||
g_auto(GVariantBuilder) metadata_builder = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
DeltaOpts delta_opts = DELTAOPT_FLAG_NONE;
|
||||
guint64 total_compressed_size = 0;
|
||||
guint64 total_uncompressed_size = 0;
|
||||
@@ -1273,7 +1246,6 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
const char *opt_filename;
|
||||
g_autofree char *descriptor_name = NULL;
|
||||
glnx_fd_close int descriptor_dfd = -1;
|
||||
g_autoptr(GVariant) tmp_metadata = NULL;
|
||||
g_autoptr(GVariant) fallback_headers = NULL;
|
||||
g_autoptr(GVariant) detached = NULL;
|
||||
gboolean inline_parts;
|
||||
@@ -1387,7 +1359,6 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
GBytes *payload_b;
|
||||
GBytes *operations_b;
|
||||
g_autofree guchar *part_checksum = NULL;
|
||||
g_autoptr(GChecksum) checksum = NULL;
|
||||
g_autoptr(GBytes) objtype_checksum_array = NULL;
|
||||
g_autoptr(GBytes) checksum_bytes = NULL;
|
||||
g_autoptr(GOutputStream) part_temp_outstream = NULL;
|
||||
@@ -1399,8 +1370,8 @@ ostree_repo_static_delta_generate (OstreeRepo *self,
|
||||
g_autoptr(GVariant) delta_part_content = NULL;
|
||||
g_autoptr(GVariant) delta_part = NULL;
|
||||
g_autoptr(GVariant) delta_part_header = NULL;
|
||||
g_auto(GVariantBuilder) mode_builder = {{0,}};
|
||||
g_auto(GVariantBuilder) xattr_builder = {{0,}};
|
||||
g_auto(GVariantBuilder) mode_builder = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
g_auto(GVariantBuilder) xattr_builder = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
guint8 compression_type_char;
|
||||
|
||||
g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uuu)"));
|
||||
|
||||
@@ -356,7 +356,6 @@ ostree_repo_static_delta_execute_offline (OstreeRepo *self,
|
||||
char checksum[OSTREE_SHA256_STRING_LEN+1];
|
||||
gboolean have_all;
|
||||
g_autoptr(GInputStream) part_in = NULL;
|
||||
g_autoptr(GBytes) delta_data = NULL;
|
||||
g_autoptr(GVariant) inline_part_data = NULL;
|
||||
g_autoptr(GVariant) header = NULL;
|
||||
g_autoptr(GVariant) csum_v = NULL;
|
||||
@@ -765,7 +764,7 @@ _ostree_delta_get_endianness (GVariant *superblock,
|
||||
}
|
||||
}
|
||||
|
||||
return G_BYTE_ORDER;
|
||||
return OSTREE_DELTA_ENDIAN_INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -864,7 +863,6 @@ _ostree_repo_static_delta_dump (OstreeRepo *self,
|
||||
g_autofree char *from = NULL;
|
||||
g_autofree char *to = NULL;
|
||||
g_autofree char *superblock_path = NULL;
|
||||
glnx_fd_close int superblock_fd = -1;
|
||||
g_autoptr(GVariant) delta_superblock = NULL;
|
||||
guint64 total_size = 0, total_usize = 0;
|
||||
guint64 total_fallback_size = 0, total_fallback_usize = 0;
|
||||
|
||||
@@ -188,7 +188,6 @@ _ostree_static_delta_part_execute (OstreeRepo *repo,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
guint8 *checksums_data;
|
||||
g_autoptr(GVariant) checksums = NULL;
|
||||
g_autoptr(GVariant) mode_dict = NULL;
|
||||
g_autoptr(GVariant) xattr_dict = NULL;
|
||||
g_autoptr(GVariant) payload = NULL;
|
||||
@@ -471,7 +470,6 @@ dispatch_bspatch (OstreeRepo *repo,
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
guint64 offset, length;
|
||||
g_autoptr(GInputStream) in_stream = NULL;
|
||||
g_autoptr(GMappedFile) input_mfile = NULL;
|
||||
g_autofree guchar *buf = NULL;
|
||||
struct bspatch_stream stream;
|
||||
|
||||
@@ -301,6 +301,7 @@ static gboolean
|
||||
traverse_dirtree (OstreeRepo *repo,
|
||||
const char *checksum,
|
||||
GHashTable *inout_reachable,
|
||||
gboolean ignore_missing_dirs,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
@@ -308,6 +309,7 @@ static gboolean
|
||||
traverse_iter (OstreeRepo *repo,
|
||||
OstreeRepoCommitTraverseIter *iter,
|
||||
GHashTable *inout_reachable,
|
||||
gboolean ignore_missing_dirs,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
@@ -316,11 +318,26 @@ traverse_iter (OstreeRepo *repo,
|
||||
while (TRUE)
|
||||
{
|
||||
g_autoptr(GVariant) key = NULL;
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
OstreeRepoCommitIterResult iterres =
|
||||
ostree_repo_commit_traverse_iter_next (iter, cancellable, error);
|
||||
|
||||
ostree_repo_commit_traverse_iter_next (iter, cancellable, &local_error);
|
||||
|
||||
if (iterres == OSTREE_REPO_COMMIT_ITER_RESULT_ERROR)
|
||||
goto out;
|
||||
{
|
||||
/* There is only one kind of not-found error, which is
|
||||
failing to load the dirmeta itself, if so, we ignore that
|
||||
(and the whole subtree) if told to. */
|
||||
if (ignore_missing_dirs &&
|
||||
g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
g_debug ("Ignoring not-found dirmeta");
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
g_propagate_error (error, g_steal_pointer (&local_error));
|
||||
|
||||
goto out;
|
||||
}
|
||||
else if (iterres == OSTREE_REPO_COMMIT_ITER_RESULT_END)
|
||||
break;
|
||||
else if (iterres == OSTREE_REPO_COMMIT_ITER_RESULT_FILE)
|
||||
@@ -357,7 +374,7 @@ traverse_iter (OstreeRepo *repo,
|
||||
key = NULL;
|
||||
|
||||
if (!traverse_dirtree (repo, content_checksum, inout_reachable,
|
||||
cancellable, error))
|
||||
ignore_missing_dirs, cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
@@ -374,6 +391,7 @@ static gboolean
|
||||
traverse_dirtree (OstreeRepo *repo,
|
||||
const char *checksum,
|
||||
GHashTable *inout_reachable,
|
||||
gboolean ignore_missing_dirs,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
@@ -381,10 +399,22 @@ traverse_dirtree (OstreeRepo *repo,
|
||||
g_autoptr(GVariant) dirtree = NULL;
|
||||
ostree_cleanup_repo_commit_traverse_iter
|
||||
OstreeRepoCommitTraverseIter iter = { 0, };
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
|
||||
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_DIR_TREE, checksum,
|
||||
&dirtree, error))
|
||||
goto out;
|
||||
&dirtree, &local_error))
|
||||
{
|
||||
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);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
g_propagate_error (error, g_steal_pointer (&local_error));
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
g_debug ("Traversing dirtree %s", checksum);
|
||||
if (!ostree_repo_commit_traverse_iter_init_dirtree (&iter, repo, dirtree,
|
||||
@@ -392,7 +422,7 @@ traverse_dirtree (OstreeRepo *repo,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
if (!traverse_iter (repo, &iter, inout_reachable, cancellable, error))
|
||||
if (!traverse_iter (repo, &iter, inout_reachable, ignore_missing_dirs, cancellable, error))
|
||||
goto out;
|
||||
|
||||
ret = TRUE;
|
||||
@@ -430,6 +460,8 @@ ostree_repo_traverse_commit_union (OstreeRepo *repo,
|
||||
g_autoptr(GVariant) commit = NULL;
|
||||
ostree_cleanup_repo_commit_traverse_iter
|
||||
OstreeRepoCommitTraverseIter iter = { 0, };
|
||||
OstreeRepoCommitState commitstate;
|
||||
gboolean ignore_missing_dirs = FALSE;
|
||||
|
||||
key = ostree_object_name_serialize (commit_checksum, OSTREE_OBJECT_TYPE_COMMIT);
|
||||
|
||||
@@ -440,13 +472,21 @@ ostree_repo_traverse_commit_union (OstreeRepo *repo,
|
||||
commit_checksum, &commit,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
|
||||
/* Just return if the parent isn't found; we do expect most
|
||||
* people to have partial repositories.
|
||||
*/
|
||||
if (!commit)
|
||||
break;
|
||||
|
||||
/* See if the commit is partial, if so it's not an error to lack objects */
|
||||
if (!ostree_repo_load_commit (repo, commit_checksum, NULL, &commitstate,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
if ((commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL) != 0)
|
||||
ignore_missing_dirs = TRUE;
|
||||
|
||||
g_hash_table_add (inout_reachable, key);
|
||||
key = NULL;
|
||||
|
||||
@@ -456,9 +496,9 @@ ostree_repo_traverse_commit_union (OstreeRepo *repo,
|
||||
error))
|
||||
goto out;
|
||||
|
||||
if (!traverse_iter (repo, &iter, inout_reachable, cancellable, error))
|
||||
if (!traverse_iter (repo, &iter, inout_reachable, ignore_missing_dirs, cancellable, error))
|
||||
goto out;
|
||||
|
||||
|
||||
if (maxdepth == -1 || maxdepth > 0)
|
||||
{
|
||||
g_free (tmp_checksum);
|
||||
|
||||
@@ -936,7 +936,7 @@ keyfile_set_from_vardict (GKeyFile *keyfile,
|
||||
else if (g_variant_is_of_type (child, G_VARIANT_TYPE_STRING_ARRAY))
|
||||
{
|
||||
gsize len;
|
||||
const char *const*strv_child = g_variant_get_strv (child, &len);
|
||||
g_autofree const gchar **strv_child = g_variant_get_strv (child, &len);
|
||||
g_key_file_set_string_list (keyfile, section, key, strv_child, len);
|
||||
}
|
||||
else
|
||||
@@ -2593,7 +2593,7 @@ load_metadata_internal (OstreeRepo *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
GBytes *data = glnx_fd_readall_bytes (fd, cancellable, error);
|
||||
g_autoptr(GBytes) data = glnx_fd_readall_bytes (fd, cancellable, error);
|
||||
if (!data)
|
||||
goto out;
|
||||
ret_variant = g_variant_new_from_bytes (ostree_metadata_variant_type (objtype),
|
||||
@@ -3164,7 +3164,7 @@ ostree_repo_delete_object (OstreeRepo *self,
|
||||
|
||||
if (tombstone_commits)
|
||||
{
|
||||
g_auto(GVariantBuilder) builder = {{0,}};
|
||||
g_auto(GVariantBuilder) builder = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
g_autoptr(GVariant) variant = NULL;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
||||
@@ -4653,7 +4653,7 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
|
||||
g_autoptr(GVariant) summary = NULL;
|
||||
GList *ordered_keys = NULL;
|
||||
GList *iter = NULL;
|
||||
g_auto(GVariantDict) additional_metadata_builder = {{0,}};
|
||||
g_auto(GVariantDict) additional_metadata_builder = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
|
||||
if (!ostree_repo_list_refs (self, NULL, &refs, cancellable, error))
|
||||
goto out;
|
||||
@@ -4668,10 +4668,18 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
|
||||
{
|
||||
const char *ref = iter->data;
|
||||
const char *commit = g_hash_table_lookup (refs, ref);
|
||||
g_autofree char *remotename = NULL;
|
||||
g_autoptr(GVariant) commit_obj = NULL;
|
||||
|
||||
g_assert (commit);
|
||||
|
||||
if (!ostree_parse_refspec (ref, &remotename, NULL, NULL))
|
||||
g_assert_not_reached ();
|
||||
|
||||
/* Don't put remote refs in the summary */
|
||||
if (remotename != NULL)
|
||||
continue;
|
||||
|
||||
if (!ostree_repo_load_variant (self, OSTREE_OBJECT_TYPE_COMMIT, commit, &commit_obj, error))
|
||||
goto out;
|
||||
|
||||
@@ -4686,8 +4694,7 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
|
||||
{
|
||||
guint i;
|
||||
g_autoptr(GPtrArray) delta_names = NULL;
|
||||
g_auto(GVariantDict) deltas_builder = {{0,}};
|
||||
g_autoptr(GVariant) deltas = NULL;
|
||||
g_auto(GVariantDict) deltas_builder = OT_VARIANT_BUILDER_INITIALIZER;
|
||||
|
||||
if (!ostree_repo_list_static_delta_names (self, &delta_names, cancellable, error))
|
||||
goto out;
|
||||
@@ -4890,7 +4897,6 @@ _ostree_repo_allocate_tmpdir (int tmpdir_dfd,
|
||||
{
|
||||
g_autofree char *tmpdir_name_template = g_strconcat (tmpdir_prefix, "XXXXXX", NULL);
|
||||
glnx_fd_close int new_tmpdir_fd = -1;
|
||||
g_autoptr(GError) local_error = NULL;
|
||||
|
||||
/* No existing tmpdir found, create a new */
|
||||
|
||||
|
||||
@@ -534,7 +534,6 @@ checkout_deployment_tree (OstreeSysroot *sysroot,
|
||||
const char *csum = ostree_deployment_get_csum (deployment);
|
||||
g_autofree char *checkout_target_name = NULL;
|
||||
g_autofree char *osdeploy_path = NULL;
|
||||
g_autoptr(GFile) ret_deploy_target_path = NULL;
|
||||
glnx_fd_close int osdeploy_dfd = -1;
|
||||
int ret_fd;
|
||||
|
||||
@@ -1199,7 +1198,6 @@ swap_bootlinks (OstreeSysroot *self,
|
||||
gboolean ret = FALSE;
|
||||
int old_subbootversion, new_subbootversion;
|
||||
glnx_fd_close int ostree_dfd = -1;
|
||||
glnx_fd_close int ostree_subbootdir_dfd = -1;
|
||||
g_autofree char *ostree_bootdir_name = NULL;
|
||||
g_autofree char *ostree_subbootdir_name = NULL;
|
||||
|
||||
@@ -1749,7 +1747,7 @@ _ostree_sysroot_write_deployments_internal (OstreeSysroot *self,
|
||||
|
||||
/* Assign a bootserial to each new deployment.
|
||||
*/
|
||||
assign_bootserials (new_deployments);
|
||||
g_hash_table_unref (assign_bootserials (new_deployments));
|
||||
|
||||
/* Determine whether or not we need to touch the bootloader
|
||||
* configuration. If we have an equal number of deployments with
|
||||
@@ -2148,7 +2146,10 @@ ostree_sysroot_deploy_tree (OstreeSysroot *self,
|
||||
goto out;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
{ ostree_cleanup_sepolicy_fscreatecon gpointer dummy = NULL;
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/* Explicitly override the label for the origin file to ensure
|
||||
* it's system_conf_t.
|
||||
|
||||
@@ -188,6 +188,7 @@ ostree_sysroot_upgrader_finalize (GObject *object)
|
||||
g_free (self->origin_remote);
|
||||
g_free (self->origin_ref);
|
||||
g_free (self->override_csum);
|
||||
g_free (self->new_revision);
|
||||
|
||||
G_OBJECT_CLASS (ostree_sysroot_upgrader_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -530,7 +531,6 @@ ostree_sysroot_upgrader_pull_one_dir (OstreeSysrootUpgrader *self,
|
||||
glnx_unref_object OstreeRepo *repo = NULL;
|
||||
char *refs_to_fetch[] = { NULL, NULL };
|
||||
const char *from_revision = NULL;
|
||||
g_autofree char *new_revision = NULL;
|
||||
g_autofree char *origin_refspec = NULL;
|
||||
|
||||
if (self->override_csum != NULL)
|
||||
|
||||
@@ -689,7 +689,6 @@ parse_deployment (OstreeSysroot *self,
|
||||
glnx_fd_close int deployment_dfd = -1;
|
||||
const char *deploy_basename;
|
||||
g_autofree char *treebootserial_target = NULL;
|
||||
g_autofree char *deploy_dir = NULL;
|
||||
GKeyFile *origin = NULL;
|
||||
g_autofree char *unlocked_development_path = NULL;
|
||||
struct stat stbuf;
|
||||
|
||||
Reference in new issue
Block a user