summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile-libostree.am7
-rw-r--r--apidoc/ostree-sections.txt1
-rw-r--r--src/libostree/bupsplit.c12
-rw-r--r--src/libostree/bupsplit.h12
-rw-r--r--src/libostree/libostree-devel.sym5
-rw-r--r--src/libostree/ostree-bootconfig-parser.c2
-rw-r--r--src/libostree/ostree-bootloader-uboot.c2
-rw-r--r--src/libostree/ostree-chain-input-stream.c6
-rw-r--r--src/libostree/ostree-checksum-input-stream.c4
-rw-r--r--src/libostree/ostree-cmd-private.c2
-rw-r--r--src/libostree/ostree-content-writer.c4
-rw-r--r--src/libostree/ostree-core-private.h6
-rw-r--r--src/libostree/ostree-dummy-enumtypes.c2
-rw-r--r--src/libostree/ostree-fetcher-soup.c8
-rw-r--r--src/libostree/ostree-fetcher-uri.c2
-rw-r--r--src/libostree/ostree-kernel-args.c2
-rw-r--r--src/libostree/ostree-kernel-args.h2
-rw-r--r--src/libostree/ostree-libarchive-input-stream.c4
-rw-r--r--src/libostree/ostree-lzma-compressor.c2
-rw-r--r--src/libostree/ostree-metalink.c4
-rw-r--r--src/libostree/ostree-repo-commit.c82
-rw-r--r--src/libostree/ostree-repo-file-enumerator.c8
-rw-r--r--src/libostree/ostree-repo-file.c14
-rw-r--r--src/libostree/ostree-repo-libarchive.c4
-rw-r--r--src/libostree/ostree-repo-os.c4
-rw-r--r--src/libostree/ostree-repo-os.h4
-rw-r--r--src/libostree/ostree-repo-private.h8
-rw-r--r--src/libostree/ostree-repo-prune.c12
-rw-r--r--src/libostree/ostree-repo-pull-verify.c2
-rw-r--r--src/libostree/ostree-repo-pull.c2
-rw-r--r--src/libostree/ostree-repo-static-delta-compilation-analysis.c6
-rw-r--r--src/libostree/ostree-repo-static-delta-private.h6
-rw-r--r--src/libostree/ostree-repo-traverse.c10
-rw-r--r--src/libostree/ostree-repo-verity.c8
-rw-r--r--src/libostree/ostree-repo.c329
-rw-r--r--src/libostree/ostree-repo.h21
-rw-r--r--src/libostree/ostree-rollsum.c8
-rw-r--r--src/libostree/ostree-sepolicy.c2
-rw-r--r--src/libostree/ostree-sign-ed25519.c8
-rw-r--r--src/libostree/ostree-sign-private.h39
-rw-r--r--src/libostree/ostree-sign.c61
-rw-r--r--src/libostree/ostree-sysroot-cleanup.c6
-rw-r--r--src/libostree/ostree-sysroot-deploy.c10
-rw-r--r--src/libostree/ostree-sysroot.c4
-rw-r--r--src/libostree/ostree-varint.c2
-rw-r--r--src/libotutil/ot-checksum-instream.c2
-rw-r--r--src/libotutil/ot-gio-utils.c2
-rw-r--r--src/libotutil/ot-keyfile-utils.c2
-rw-r--r--src/libotutil/zbase32.c8
-rw-r--r--src/libotutil/zbase32.h2
-rw-r--r--src/ostree/ostree-trivial-httpd.c10
-rw-r--r--src/ostree/ot-admin-builtin-set-origin.c8
-rw-r--r--src/ostree/ot-admin-builtin-status.c2
-rw-r--r--src/ostree/ot-admin-builtin-unlock.c2
-rw-r--r--src/ostree/ot-admin-functions.c2
-rw-r--r--src/ostree/ot-admin-instutil-builtin-grub2-generate.c2
-rw-r--r--src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c6
-rw-r--r--src/ostree/ot-admin-kargs-builtin-edit-in-place.c8
-rw-r--r--src/ostree/ot-builtin-admin.c2
-rw-r--r--src/ostree/ot-builtin-diff.c4
-rw-r--r--src/ostree/ot-builtin-export.c6
-rw-r--r--src/ostree/ot-builtin-fsck.c2
-rw-r--r--src/ostree/ot-builtin-ls.c20
-rw-r--r--src/ostree/ot-builtin-prune.c2
-rw-r--r--src/ostree/ot-builtin-pull-local.c8
-rw-r--r--src/ostree/ot-builtin-pull.c4
-rw-r--r--src/ostree/ot-builtin-rev-parse.c2
-rw-r--r--src/ostree/ot-builtin-summary.c162
-rw-r--r--src/ostree/ot-editor.c2
-rw-r--r--src/switchroot/ostree-remount.c2
-rw-r--r--tests/test-basic-c.c8
-rw-r--r--tests/test-commit-sign-sh-ext.c12
-rw-r--r--tests/test-libarchive-import.c2
-rw-r--r--tests/test-pull-c.c6
-rw-r--r--tests/test-repo.c6
-rw-r--r--tests/test-sysroot-c.c4
76 files changed, 648 insertions, 411 deletions
diff --git a/Makefile-libostree.am b/Makefile-libostree.am
index 4b8a46f5..55813dd1 100644
--- a/Makefile-libostree.am
+++ b/Makefile-libostree.am
@@ -173,9 +173,9 @@ endif # USE_GPGME
symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym
# Uncomment this include when adding new development symbols.
-# if BUILDOPT_IS_DEVEL_BUILD
-# symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym
-# endif
+if BUILDOPT_IS_DEVEL_BUILD
+symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym
+endif
# http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html
wl_versionscript_arg = -Wl,--version-script=
@@ -251,6 +251,7 @@ libostree_1_la_SOURCES += \
src/libostree/ostree-sign-dummy.h \
src/libostree/ostree-sign-ed25519.c \
src/libostree/ostree-sign-ed25519.h \
+ src/libostree/ostree-sign-private.h \
$(NULL)
if USE_LIBSODIUM
diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt
index eb162dc4..a0db55c7 100644
--- a/apidoc/ostree-sections.txt
+++ b/apidoc/ostree-sections.txt
@@ -483,6 +483,7 @@ ostree_repo_verify_commit
ostree_repo_verify_commit_ext
ostree_repo_verify_commit_for_remote
ostree_repo_verify_summary
+ostree_repo_regenerate_metadata
ostree_repo_regenerate_summary
<SUBSECTION Standard>
OSTREE_REPO
diff --git a/src/libostree/bupsplit.c b/src/libostree/bupsplit.c
index 79207a65..f2de86f3 100644
--- a/src/libostree/bupsplit.c
+++ b/src/libostree/bupsplit.c
@@ -1,20 +1,20 @@
/*
* Copyright 2011 Avery Pennarun. All rights reserved.
- *
+ *
* (This license applies to bupsplit.c and bupsplit.h only.)
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AVERY PENNARUN ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@@ -96,7 +96,7 @@ int bupsplit_find_ofs(const unsigned char *buf, int len, int *bits)
{
Rollsum r;
int count;
-
+
rollsum_init(&r);
for (count = 0; count < len; count++)
{
diff --git a/src/libostree/bupsplit.h b/src/libostree/bupsplit.h
index f770ee58..d7710d49 100644
--- a/src/libostree/bupsplit.h
+++ b/src/libostree/bupsplit.h
@@ -1,20 +1,20 @@
/*
* Copyright 2011 Avery Pennarun. All rights reserved.
- *
+ *
* (This license applies to bupsplit.c and bupsplit.h only.)
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY AVERY PENNARUN ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@@ -48,5 +48,5 @@ int bupsplit_find_ofs(const unsigned char *buf, int len, int *bits);
#ifdef __cplusplus
}
#endif
-
+
#endif /* __BUPSPLIT_H */
diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym
index 9168db73..c1a8f94e 100644
--- a/src/libostree/libostree-devel.sym
+++ b/src/libostree/libostree-devel.sym
@@ -20,6 +20,11 @@
- uncomment the include in Makefile-libostree.am
*/
+LIBOSTREE_2023.1 {
+global:
+ ostree_repo_regenerate_metadata;
+} LIBOSTREE_2022.7;
+
/* Stub section for the stable release *after* this development one; don't
* edit this other than to update the year. This is just a copy/paste
* source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION
diff --git a/src/libostree/ostree-bootconfig-parser.c b/src/libostree/ostree-bootconfig-parser.c
index 08259ebf..365a7bc5 100644
--- a/src/libostree/ostree-bootconfig-parser.c
+++ b/src/libostree/ostree-bootconfig-parser.c
@@ -40,7 +40,7 @@ G_DEFINE_TYPE (OstreeBootconfigParser, ostree_bootconfig_parser, G_TYPE_OBJECT)
/**
* ostree_bootconfig_parser_clone:
* @self: Bootconfig to clone
- *
+ *
* Returns: (transfer full): Copy of @self
*/
OstreeBootconfigParser *
diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c
index fb2c2fcf..d0207ad5 100644
--- a/src/libostree/ostree-bootloader-uboot.c
+++ b/src/libostree/ostree-bootloader-uboot.c
@@ -46,7 +46,7 @@ static gboolean
_ostree_bootloader_uboot_query (OstreeBootloader *bootloader,
gboolean *out_is_active,
GCancellable *cancellable,
- GError **error)
+ GError **error)
{
OstreeBootloaderUboot *self = OSTREE_BOOTLOADER_UBOOT (bootloader);
struct stat stbuf;
diff --git a/src/libostree/ostree-chain-input-stream.c b/src/libostree/ostree-chain-input-stream.c
index 5ff4392a..22f40227 100644
--- a/src/libostree/ostree-chain-input-stream.c
+++ b/src/libostree/ostree-chain-input-stream.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
@@ -87,7 +87,7 @@ ostree_chain_input_stream_set_property (GObject *object,
GParamSpec *pspec)
{
OstreeChainInputStream *self;
-
+
self = OSTREE_CHAIN_INPUT_STREAM (object);
switch (prop_id)
@@ -165,7 +165,7 @@ ostree_chain_input_stream_read (GInputStream *stream,
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return -1;
-
+
if (self->priv->index >= self->priv->streams->len)
return 0;
diff --git a/src/libostree/ostree-checksum-input-stream.c b/src/libostree/ostree-checksum-input-stream.c
index 9747515e..6481bf07 100644
--- a/src/libostree/ostree-checksum-input-stream.c
+++ b/src/libostree/ostree-checksum-input-stream.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
@@ -80,7 +80,7 @@ ostree_checksum_input_stream_set_property (GObject *object,
GParamSpec *pspec)
{
OstreeChecksumInputStream *self;
-
+
self = OSTREE_CHECKSUM_INPUT_STREAM (object);
switch (prop_id)
diff --git a/src/libostree/ostree-cmd-private.c b/src/libostree/ostree-cmd-private.c
index ad820fde..173d430e 100644
--- a/src/libostree/ostree-cmd-private.c
+++ b/src/libostree/ostree-cmd-private.c
@@ -28,7 +28,7 @@
#include "otutil.h"
-static gboolean
+static gboolean
impl_ostree_generate_grub2_config (OstreeSysroot *sysroot, int bootversion, int target_fd, GCancellable *cancellable, GError **error)
{
return _ostree_bootloader_grub2_generate_config (sysroot, bootversion, target_fd, cancellable, error);
diff --git a/src/libostree/ostree-content-writer.c b/src/libostree/ostree-content-writer.c
index fa4180ac..3bc5dd17 100644
--- a/src/libostree/ostree-content-writer.c
+++ b/src/libostree/ostree-content-writer.c
@@ -1,4 +1,4 @@
-/*
+/*
* SPDX-License-Identifier: LGPL-2.0+
*
* This library is free software; you can redistribute it and/or
@@ -46,7 +46,7 @@ ostree_content_writer_class_init (OstreeContentWriterClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GOutputStreamClass *stream_class = G_OUTPUT_STREAM_CLASS (klass);
-
+
gobject_class->finalize = ostree_content_writer_finalize;
stream_class->write_fn = ostree_content_writer_write;
diff --git a/src/libostree/ostree-core-private.h b/src/libostree/ostree-core-private.h
index 48b2b8ab..cac45f78 100644
--- a/src/libostree/ostree-core-private.h
+++ b/src/libostree/ostree-core-private.h
@@ -46,7 +46,7 @@ G_BEGIN_DECLS
/*
* File objects are stored as a stream, with one #GVariant header,
* followed by content.
- *
+ *
* The file header is of the following form:
*
* &lt;BE guint32 containing variant length&gt;
@@ -54,7 +54,7 @@ G_BEGIN_DECLS
* u - gid
* u - mode
* u - rdev (must be 0)
- * s - symlink target
+ * s - symlink target
* a(ayay) - xattrs
*
* Then the rest of the stream is data.
@@ -71,7 +71,7 @@ G_BEGIN_DECLS
* u - gid
* u - mode
* u - rdev (must be 0)
- * s - symlink target
+ * s - symlink target
* a(ayay) - xattrs
* ---
* zlib-compressed data
diff --git a/src/libostree/ostree-dummy-enumtypes.c b/src/libostree/ostree-dummy-enumtypes.c
index b03d61c4..1967b489 100644
--- a/src/libostree/ostree-dummy-enumtypes.c
+++ b/src/libostree/ostree-dummy-enumtypes.c
@@ -21,7 +21,7 @@
#include "ostree-dummy-enumtypes.h"
-/* Exported for backwards compat - see
+/* Exported for backwards compat - see
* https://bugzilla.gnome.org/show_bug.cgi?id=764131
*/
GType
diff --git a/src/libostree/ostree-fetcher-soup.c b/src/libostree/ostree-fetcher-soup.c
index ec1d8e09..53a63f14 100644
--- a/src/libostree/ostree-fetcher-soup.c
+++ b/src/libostree/ostree-fetcher-soup.c
@@ -908,7 +908,7 @@ remove_pending (OstreeFetcherPendingURI *pending)
static void
on_out_splice_complete (GObject *object,
GAsyncResult *result,
- gpointer user_data)
+ gpointer user_data)
{
GTask *task = G_TASK (user_data);
OstreeFetcherPendingURI *pending;
@@ -944,7 +944,7 @@ on_out_splice_complete (GObject *object,
static void
on_stream_read (GObject *object,
GAsyncResult *result,
- gpointer user_data)
+ gpointer user_data)
{
GTask *task = G_TASK (user_data);
OstreeFetcherPendingURI *pending;
@@ -1055,7 +1055,7 @@ on_stream_read (GObject *object,
static void
on_request_sent (GObject *object,
GAsyncResult *result,
- gpointer user_data)
+ gpointer user_data)
{
GTask *task = G_TASK (user_data);
/* Hold a ref to the pending across this function, since we remove
@@ -1175,7 +1175,7 @@ on_request_sent (GObject *object,
}
pending->state = OSTREE_FETCHER_STATE_DOWNLOADING;
-
+
pending->content_length = soup_request_get_content_length (pending->request);
g_input_stream_read_bytes_async (pending->request_body,
diff --git a/src/libostree/ostree-fetcher-uri.c b/src/libostree/ostree-fetcher-uri.c
index d5ed576d..722aeeeb 100644
--- a/src/libostree/ostree-fetcher-uri.c
+++ b/src/libostree/ostree-fetcher-uri.c
@@ -156,7 +156,7 @@ _ostree_fetcher_uri_to_string (OstreeFetcherURI *uri)
* out invalid input.
*/
gboolean
-_ostree_fetcher_uri_validate (OstreeFetcherURI *uri, GError **error)
+_ostree_fetcher_uri_validate (OstreeFetcherURI *uri, GError **error)
{
const char *scheme = g_uri_get_scheme ((GUri*)uri);
// TODO only allow file if explicitly requested by a higher level
diff --git a/src/libostree/ostree-kernel-args.c b/src/libostree/ostree-kernel-args.c
index d15d28a7..e0046e0c 100644
--- a/src/libostree/ostree-kernel-args.c
+++ b/src/libostree/ostree-kernel-args.c
@@ -823,7 +823,7 @@ ostree_kernel_args_append_if_missing (OstreeKernelArgs *kargs,
// Don't insert a duplicate key.
if (ostree_kernel_args_contains (kargs, arg))
return;
-
+
ostree_kernel_args_append (kargs, arg);
}
diff --git a/src/libostree/ostree-kernel-args.h b/src/libostree/ostree-kernel-args.h
index 6a1aaac1..915faca2 100644
--- a/src/libostree/ostree-kernel-args.h
+++ b/src/libostree/ostree-kernel-args.h
@@ -131,7 +131,7 @@ _OSTREE_PUBLIC
char *ostree_kernel_args_to_string (OstreeKernelArgs *kargs);
_OSTREE_PUBLIC
-void ostree_kernel_args_append_if_missing (OstreeKernelArgs *kargs,
+void ostree_kernel_args_append_if_missing (OstreeKernelArgs *kargs,
const char *arg);
_OSTREE_PUBLIC
diff --git a/src/libostree/ostree-libarchive-input-stream.c b/src/libostree/ostree-libarchive-input-stream.c
index 3c313c1d..426db589 100644
--- a/src/libostree/ostree-libarchive-input-stream.c
+++ b/src/libostree/ostree-libarchive-input-stream.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2011 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
@@ -94,7 +94,7 @@ ostree_libarchive_input_stream_set_property (GObject *object,
GParamSpec *pspec)
{
OstreeLibarchiveInputStream *self;
-
+
self = OSTREE_LIBARCHIVE_INPUT_STREAM (object);
switch (prop_id)
diff --git a/src/libostree/ostree-lzma-compressor.c b/src/libostree/ostree-lzma-compressor.c
index c60e6b71..0404d366 100644
--- a/src/libostree/ostree-lzma-compressor.c
+++ b/src/libostree/ostree-lzma-compressor.c
@@ -173,7 +173,7 @@ _ostree_lzma_compressor_convert (GConverter *converter,
{
OstreeLzmaCompressor *self = OSTREE_LZMA_COMPRESSOR (converter);
int res;
- lzma_action action;
+ lzma_action action;
if (inbuf_size != 0 && outbuf_size == 0)
{
diff --git a/src/libostree/ostree-metalink.c b/src/libostree/ostree-metalink.c
index 7178f34f..d028266f 100644
--- a/src/libostree/ostree-metalink.c
+++ b/src/libostree/ostree-metalink.c
@@ -62,7 +62,7 @@ typedef struct
guint passthrough_depth;
OstreeMetalinkState passthrough_previous;
-
+
guint found_a_file_element : 1;
guint found_our_file_element : 1;
guint verification_known : 1;
@@ -550,7 +550,7 @@ try_metalink_targets (OstreeMetalinkRequest *self,
GError *temp_error = NULL;
target_uri = self->urls->pdata[self->current_url_index];
-
+
if (try_one_url (self, target_uri, &ret_data, &temp_error))
break;
else
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c
index de79d64a..7f668b7d 100644
--- a/src/libostree/ostree-repo-commit.c
+++ b/src/libostree/ostree-repo-commit.c
@@ -47,7 +47,7 @@
#endif
/* Understanding ostree's fsync strategy
- *
+ *
* A long time ago, ostree used to invoke fsync() on each object,
* then move it into the objects directory. However, it turned
* out to be a *lot* faster to write the objects into a separate "staging"
@@ -2350,7 +2350,8 @@ ostree_repo_commit_transaction (OstreeRepo *self,
/* Update the summary if auto-update-summary is set, because doing so was
* delayed for each ref change during the transaction.
*/
- if ((self->txn.refs || self->txn.collection_refs) &&
+ if (!self->txn.disable_auto_summary &&
+ (self->txn.refs || self->txn.collection_refs) &&
!_ostree_repo_maybe_regenerate_summary (self, cancellable, error))
return FALSE;
@@ -2856,7 +2857,7 @@ ostree_repo_write_regfile_inline (OstreeRepo *self,
* Returns: (transfer full): Checksum (as a hex string) of the committed file
* Since: 2021.2
*/
-char *
+char *
ostree_repo_write_symlink (OstreeRepo *self,
const char *expected_checksum,
guint32 uid,
@@ -2888,14 +2889,14 @@ ostree_repo_write_symlink (OstreeRepo *self,
* @content_len: Expected content length
* @xattrs: (allow-none): Extended attributes (GVariant type `(ayay)`)
* @error: Error
- *
+ *
* Create an `OstreeContentWriter` that allows streaming output into
* the repository.
*
* Returns: (transfer full): A new writer, or %NULL on error
* Since: 2021.2
*/
-OstreeContentWriter *
+OstreeContentWriter *
ostree_repo_write_regfile (OstreeRepo *self,
const char *expected_checksum,
guint32 uid,
@@ -4402,7 +4403,7 @@ ostree_repo_commit_modifier_set_sepolicy (OstreeRepoCommitModifier
*
* Since: 2020.4
*/
-gboolean
+gboolean
ostree_repo_commit_modifier_set_sepolicy_from_commit (OstreeRepoCommitModifier *modifier,
OstreeRepo *repo,
const char *rev,
@@ -4870,3 +4871,72 @@ ostree_repo_transaction_stats_free (OstreeRepoTransactionStats *stats)
G_DEFINE_BOXED_TYPE(OstreeRepoTransactionStats, ostree_repo_transaction_stats,
ostree_repo_transaction_stats_copy,
ostree_repo_transaction_stats_free);
+
+
+gboolean
+_ostree_repo_transaction_write_repo_metadata (OstreeRepo *self,
+ GVariant *additional_metadata,
+ char **out_checksum,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_assert (self != NULL);
+ g_assert (OSTREE_IS_REPO (self));
+ g_assert (self->in_transaction == TRUE);
+
+ const char *collection_id = ostree_repo_get_collection_id (self);
+ if (collection_id == NULL)
+ return glnx_throw (error, "Repository must have collection ID to write repo metadata");
+
+ OstreeCollectionRef collection_ref = { (gchar *) collection_id,
+ (gchar *) OSTREE_REPO_METADATA_REF };
+ g_autofree char *old_checksum = NULL;
+ if (!ostree_repo_resolve_rev (self, OSTREE_REPO_METADATA_REF, TRUE,
+ &old_checksum, error))
+ return FALSE;
+
+ /* Add bindings to the commit metadata. */
+ g_autoptr(GVariantDict) metadata_dict = g_variant_dict_new (additional_metadata);
+ g_variant_dict_insert (metadata_dict, OSTREE_COMMIT_META_KEY_COLLECTION_BINDING,
+ "s", collection_ref.collection_id);
+ g_variant_dict_insert_value (metadata_dict, OSTREE_COMMIT_META_KEY_REF_BINDING,
+ g_variant_new_strv ((const gchar * const *) &collection_ref.ref_name, 1));
+ g_autoptr(GVariant) metadata = g_variant_dict_end (metadata_dict);
+
+ /* Set up an empty mtree. */
+ g_autoptr(OstreeMutableTree) mtree = ostree_mutable_tree_new ();
+
+ glnx_unref_object GFileInfo *fi = g_file_info_new ();
+ g_file_info_set_attribute_uint32 (fi, "unix::uid", 0);
+ g_file_info_set_attribute_uint32 (fi, "unix::gid", 0);
+ g_file_info_set_attribute_uint32 (fi, "unix::mode", (0755 | S_IFDIR));
+
+ g_autoptr(GVariant) dirmeta = ostree_create_directory_metadata (fi, NULL /* xattrs */);
+
+ g_autofree guchar *csum_raw = NULL;
+ if (!ostree_repo_write_metadata (self, OSTREE_OBJECT_TYPE_DIR_META, NULL,
+ dirmeta, &csum_raw, cancellable, error))
+ return FALSE;
+
+ g_autofree char *csum = ostree_checksum_from_bytes (csum_raw);
+ ostree_mutable_tree_set_metadata_checksum (mtree, csum);
+
+ g_autoptr(OstreeRepoFile) repo_file = NULL;
+ if (!ostree_repo_write_mtree (self, mtree, (GFile **) &repo_file, cancellable, error))
+ return FALSE;
+
+ g_autofree gchar *new_checksum = NULL;
+ if (!ostree_repo_write_commit (self, old_checksum,
+ NULL /* subject */, NULL /* body */,
+ metadata, repo_file,
+ &new_checksum,
+ cancellable, error))
+ return FALSE;
+
+ ostree_repo_transaction_set_collection_ref (self, &collection_ref, new_checksum);
+
+ if (out_checksum != NULL)
+ *out_checksum = g_steal_pointer (&new_checksum);
+
+ return TRUE;
+}
diff --git a/src/libostree/ostree-repo-file-enumerator.c b/src/libostree/ostree-repo-file-enumerator.c
index a9ff5476..502fe6c4 100644
--- a/src/libostree/ostree-repo-file-enumerator.c
+++ b/src/libostree/ostree-repo-file-enumerator.c
@@ -55,7 +55,7 @@ ostree_repo_file_enumerator_dispose (GObject *object)
g_clear_object (&self->dir);
g_free (self->attributes);
-
+
if (G_OBJECT_CLASS (ostree_repo_file_enumerator_parent_class)->dispose)
G_OBJECT_CLASS (ostree_repo_file_enumerator_parent_class)->dispose (object);
}
@@ -77,7 +77,7 @@ ostree_repo_file_enumerator_class_init (OstreeRepoFileEnumeratorClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GFileEnumeratorClass *enumerator_class = G_FILE_ENUMERATOR_CLASS (klass);
-
+
gobject_class->finalize = ostree_repo_file_enumerator_finalize;
gobject_class->dispose = ostree_repo_file_enumerator_dispose;
@@ -98,7 +98,7 @@ _ostree_repo_file_enumerator_new (OstreeRepoFile *dir,
GError **error)
{
OstreeRepoFileEnumerator *self;
-
+
self = g_object_new (OSTREE_TYPE_REPO_FILE_ENUMERATOR,
"container", dir,
NULL);
@@ -106,7 +106,7 @@ _ostree_repo_file_enumerator_new (OstreeRepoFile *dir,
self->dir = g_object_ref (dir);
self->attributes = g_strdup (attributes);
self->flags = flags;
-
+
return G_FILE_ENUMERATOR (self);
}
diff --git a/src/libostree/ostree-repo-file.c b/src/libostree/ostree-repo-file.c
index 3d396ced..2f086de5 100644
--- a/src/libostree/ostree-repo-file.c
+++ b/src/libostree/ostree-repo-file.c
@@ -131,7 +131,7 @@ ostree_repo_file_new_child (OstreeRepoFile *parent,
{
OstreeRepoFile *self;
size_t len;
-
+
self = g_object_new (OSTREE_TYPE_REPO_FILE, NULL);
self->repo = g_object_ref (parent->repo);
self->parent = g_object_ref (parent);
@@ -534,7 +534,7 @@ static guint
ostree_repo_file_hash (GFile *file)
{
OstreeRepoFile *self = OSTREE_REPO_FILE (file);
-
+
if (self->parent)
return g_file_hash (self->parent) + g_str_hash (self->name);
else
@@ -563,7 +563,7 @@ ostree_repo_file_equal (GFile *file1,
}
static const char *
-match_prefix (const char *path,
+match_prefix (const char *path,
const char *prefix)
{
int prefix_len;
@@ -571,13 +571,13 @@ match_prefix (const char *path,
prefix_len = strlen (prefix);
if (strncmp (path, prefix, prefix_len) != 0)
return NULL;
-
+
/* Handle the case where prefix is the root, so that
* the IS_DIR_SEPRARATOR check below works */
if (prefix_len > 0 &&
G_IS_DIR_SEPARATOR (prefix[prefix_len-1]))
prefix_len--;
-
+
return path + prefix_len;
}
@@ -608,7 +608,7 @@ ostree_repo_file_get_relative_path (GFile *parent,
parent_path = gs_file_get_path_cached (parent);
descendant_path = gs_file_get_path_cached (descendant);
remainder = match_prefix (descendant_path, parent_path);
-
+
if (remainder != NULL && G_IS_DIR_SEPARATOR (*remainder))
return g_strdup (remainder + 1);
return NULL;
@@ -649,7 +649,7 @@ ostree_repo_file_resolve_relative_path (GFile *file,
parent = ostree_repo_file_new_child (self, filename);
g_free (filename);
-
+
if (!rest)
ret = (GFile*)parent;
else
diff --git a/src/libostree/ostree-repo-libarchive.c b/src/libostree/ostree-repo-libarchive.c
index 631c6d4b..89cae2c1 100644
--- a/src/libostree/ostree-repo-libarchive.c
+++ b/src/libostree/ostree-repo-libarchive.c
@@ -1083,7 +1083,7 @@ file_to_archive_entry_common (GFile *root,
if (!opts->disable_xattrs)
{
int i, n;
-
+
n = g_variant_n_children (xattrs);
for (i = 0; i < n; i++)
{
@@ -1152,7 +1152,7 @@ write_directory_to_libarchive_recurse (OstreeRepo *self,
if (!write_header_free_entry (a, &entry, error))
goto out;
- dir_enum = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO,
+ dir_enum = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable, error);
if (!dir_enum)
diff --git a/src/libostree/ostree-repo-os.c b/src/libostree/ostree-repo-os.c
index 784e0336..85b37561 100644
--- a/src/libostree/ostree-repo-os.c
+++ b/src/libostree/ostree-repo-os.c
@@ -41,7 +41,7 @@ gboolean
ostree_commit_metadata_for_bootable (GFile *root, GVariantDict *dict, GCancellable *cancellable, GError **error)
{
g_autoptr(GFile) modules = g_file_resolve_relative_path (root, "usr/lib/modules");
- g_autoptr(GFileEnumerator) dir_enum
+ g_autoptr(GFileEnumerator) dir_enum
= g_file_enumerate_children (modules, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable, error);
@@ -60,7 +60,7 @@ ostree_commit_metadata_for_bootable (GFile *root, GVariantDict *dict, GCancellab
break;
if (g_file_info_get_file_type (child_info) != G_FILE_TYPE_DIRECTORY)
continue;
-
+
g_autoptr(GFile) kernel_path = g_file_resolve_relative_path (child_path, "vmlinuz");
if (!g_file_query_exists (kernel_path, NULL))
continue;
diff --git a/src/libostree/ostree-repo-os.h b/src/libostree/ostree-repo-os.h
index 9019ea59..30c54c1a 100644
--- a/src/libostree/ostree-repo-os.h
+++ b/src/libostree/ostree-repo-os.h
@@ -23,14 +23,14 @@
G_BEGIN_DECLS
-/**
+/**
* OSTREE_METADATA_KEY_BOOTABLE:
*
* GVariant type `b`: Set if this commit is intended to be bootable
* Since: 2021.1
*/
#define OSTREE_METADATA_KEY_BOOTABLE "ostree.bootable"
-/**
+/**
* OSTREE_METADATA_KEY_LINUX:
*
* GVariant type `s`: Contains the Linux kernel release (i.e. `uname -r`)
diff --git a/src/libostree/ostree-repo-private.h b/src/libostree/ostree-repo-private.h
index 18e0199e..17993574 100644
--- a/src/libostree/ostree-repo-private.h
+++ b/src/libostree/ostree-repo-private.h
@@ -101,6 +101,7 @@ typedef struct {
/* Implementation of min-free-space-percent */
gulong blocksize;
fsblkcnt_t max_blocks;
+ gboolean disable_auto_summary;
} OstreeRepoTxn;
typedef struct {
@@ -522,6 +523,13 @@ ostree_repo_list_objects_set (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
+gboolean
+_ostree_repo_transaction_write_repo_metadata (OstreeRepo *self,
+ GVariant *additional_metadata,
+ char **out_checksum,
+ GCancellable *cancellable,
+ GError **error);
+
/**
* OstreeRepoAutoTransaction:
*
diff --git a/src/libostree/ostree-repo-prune.c b/src/libostree/ostree-repo-prune.c
index e53b8163..9394c621 100644
--- a/src/libostree/ostree-repo-prune.c
+++ b/src/libostree/ostree-repo-prune.c
@@ -365,7 +365,7 @@ ostree_repo_traverse_reachable_refs (OstreeRepo *self,
GCancellable *cancellable,
GError **error)
{
- return traverse_reachable_internal (self,
+ return traverse_reachable_internal (self,
OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE,
depth, reachable,
cancellable, error);
@@ -439,9 +439,9 @@ ostree_repo_prune (OstreeRepo *self,
if (commit_only)
{
if (!ostree_repo_list_commit_objects_starting_with (self, "", &objects, cancellable, error))
- return FALSE;
+ return FALSE;
}
- else
+ else
{
objects = ostree_repo_list_objects_set (self, OSTREE_REPO_LIST_OBJECTS_ALL | OSTREE_REPO_LIST_OBJECTS_NO_PARENTS,
cancellable, error);
@@ -519,11 +519,11 @@ ostree_repo_prune_from_reachable (OstreeRepo *self,
g_autoptr(GHashTable) objects = NULL;
OstreeRepoPruneFlags flags = options->flags;
gboolean commit_only = (flags & OSTREE_REPO_PRUNE_FLAGS_COMMIT_ONLY) > 0;
- if (commit_only)
+ if (commit_only)
{
if (!ostree_repo_list_commit_objects_starting_with (self, "", &objects, cancellable, error))
- return FALSE;
- }
+ return FALSE;
+ }
else
{
objects =
diff --git a/src/libostree/ostree-repo-pull-verify.c b/src/libostree/ostree-repo-pull-verify.c
index 8989d663..d38bc9f8 100644
--- a/src/libostree/ostree-repo-pull-verify.c
+++ b/src/libostree/ostree-repo-pull-verify.c
@@ -368,7 +368,7 @@ validate_metadata_size (const char *prefix, GBytes *buf, GError **error)
* contain at least one valid signature. If GPG and signapi are
* both enabled, then both must find at least one valid signature.
*/
-gboolean
+gboolean
ostree_repo_signature_verify_commit_data (OstreeRepo *self,
const char *remote_name,
GBytes *commit_data,
diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c
index 18bb7fb7..dd21e8c8 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -4017,7 +4017,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
if (custom_backend)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Cannot fetch via libostree - remote '%s' uses custom backend '%s'",
+ "Cannot fetch via libostree - remote '%s' uses custom backend '%s'",
pull_data->remote_name, custom_backend);
goto out;
}
diff --git a/src/libostree/ostree-repo-static-delta-compilation-analysis.c b/src/libostree/ostree-repo-static-delta-compilation-analysis.c
index f92951eb..ee3103d7 100644
--- a/src/libostree/ostree-repo-static-delta-compilation-analysis.c
+++ b/src/libostree/ostree-repo-static-delta-compilation-analysis.c
@@ -54,7 +54,7 @@ build_content_sizenames_recurse (OstreeRepo *repo,
{
OstreeRepoCommitIterResult iterres =
ostree_repo_commit_traverse_iter_next (iter, cancellable, error);
-
+
if (iterres == OSTREE_REPO_COMMIT_ITER_RESULT_ERROR)
goto out;
else if (iterres == OSTREE_REPO_COMMIT_ITER_RESULT_END)
@@ -64,7 +64,7 @@ build_content_sizenames_recurse (OstreeRepo *repo,
char *name;
char *checksum;
OstreeDeltaContentSizeNames *csizenames;
-
+
ostree_repo_commit_traverse_iter_get_file (iter, &name, &checksum);
if (include_only_objects && !g_hash_table_contains (include_only_objects, checksum))
@@ -103,7 +103,7 @@ build_content_sizenames_recurse (OstreeRepo *repo,
OstreeRepoCommitTraverseIter subiter = { 0, };
ostree_repo_commit_traverse_iter_get_dir (iter, &name, &content_checksum, &meta_checksum);
-
+
if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_DIR_TREE,
content_checksum, &dirtree,
error))
diff --git a/src/libostree/ostree-repo-static-delta-private.h b/src/libostree/ostree-repo-static-delta-private.h
index ccc0ad0c..e1b4de3b 100644
--- a/src/libostree/ostree-repo-static-delta-private.h
+++ b/src/libostree/ostree-repo-static-delta-private.h
@@ -88,7 +88,7 @@ G_BEGIN_DECLS
*
* The metadata would include things like a version number, as well as
* extended verification data like a GPG signature.
- *
+ *
* The second array is an array of delta objects that should be
* fetched and applied before this one. This is a fairly generic
* recursion mechanism that would potentially allow saving significant
@@ -99,7 +99,7 @@ G_BEGIN_DECLS
* Finally, we have the fallback array, which is the set of objects to
* fetch individually - the compiler determined it wasn't worth
* duplicating the space.
- */
+ */
#define OSTREE_STATIC_DELTA_SUPERBLOCK_FORMAT "(a{sv}tayay" OSTREE_COMMIT_GVARIANT_STRING "aya" OSTREE_STATIC_DELTA_META_ENTRY_FORMAT "a" OSTREE_STATIC_DELTA_FALLBACK_FORMAT ")"
/**
@@ -168,7 +168,7 @@ void _ostree_static_delta_part_execute_async (OstreeRepo *repo,
gboolean _ostree_static_delta_part_execute_finish (OstreeRepo *repo,
GAsyncResult *result,
- GError **error);
+ GError **error);
gboolean
_ostree_static_delta_parse_checksum_array (GVariant *array,
diff --git a/src/libostree/ostree-repo-traverse.c b/src/libostree/ostree-repo-traverse.c
index 5efed100..6de36f86 100644
--- a/src/libostree/ostree-repo-traverse.c
+++ b/src/libostree/ostree-repo-traverse.c
@@ -124,7 +124,7 @@ ostree_repo_commit_traverse_iter_init_dirtree (OstreeRepoCommitTraverseIter *i
* data for that directory. Similarly, if
* %OSTREE_REPO_COMMIT_ITER_RESULT_FILE is returned, call
* ostree_repo_commit_traverse_iter_get_file().
- *
+ *
* If %OSTREE_REPO_COMMIT_ITER_RESULT_ERROR is returned, it is a
* program error to call any further API on @iter except for
* ostree_repo_commit_traverse_iter_clear().
@@ -195,7 +195,7 @@ ostree_repo_commit_traverse_iter_next (OstreeRepoCommitTraverseIter *iter,
if (!csum)
goto out;
ostree_checksum_inplace_from_bytes (csum, real->checksum_meta);
-
+
res = OSTREE_REPO_COMMIT_ITER_RESULT_DIR;
real->idx++;
@@ -203,7 +203,7 @@ ostree_repo_commit_traverse_iter_next (OstreeRepoCommitTraverseIter *iter,
else
res = OSTREE_REPO_COMMIT_ITER_RESULT_END;
}
-
+
real->state = res;
out:
return res;
@@ -607,7 +607,7 @@ ostree_repo_traverse_commit_with_flags (OstreeRepo *repo,
g_hash_table_add (inout_reachable, g_variant_ref (key));
/* Save time by skipping traversal of non-commit objects */
- if (!commit_only)
+ if (!commit_only)
{
g_debug ("Traversing commit %s", commit_checksum);
ostree_cleanup_repo_commit_traverse_iter
@@ -619,7 +619,7 @@ ostree_repo_traverse_commit_with_flags (OstreeRepo *repo,
if (!traverse_iter (repo, &iter, key, inout_reachable, inout_parents, ignore_missing_dirs, cancellable, error))
return FALSE;
- }
+ }
gboolean recurse = FALSE;
if (maxdepth == -1 || maxdepth > 0)
diff --git a/src/libostree/ostree-repo-verity.c b/src/libostree/ostree-repo-verity.c
index d25d6934..403058c0 100644
--- a/src/libostree/ostree-repo-verity.c
+++ b/src/libostree/ostree-repo-verity.c
@@ -29,7 +29,7 @@
#include <linux/fsverity.h>
#endif
-gboolean
+gboolean
_ostree_repo_parse_fsverity_config (OstreeRepo *self, GError **error)
{
/* Currently experimental */
@@ -51,7 +51,7 @@ _ostree_repo_parse_fsverity_config (OstreeRepo *self, GError **error)
return glnx_throw (error, "fsverity required, but libostree compiled without support");
}
else
- {
+ {
gboolean fsverity_opportunistic = FALSE;
if (!ot_keyfile_get_boolean_with_default (self->config, fsverity_key, "opportunistic",
FALSE, &fsverity_opportunistic, error))
@@ -108,7 +108,7 @@ _ostree_tmpf_fsverity_core (GLnxTmpfile *tmpf,
return glnx_throw_errno_prefix (error, "ioctl(FS_IOC_ENABLE_VERITY)");
}
}
-
+
if (supported)
*supported = TRUE;
#endif
@@ -161,7 +161,7 @@ _ostree_tmpf_fsverity (OstreeRepo *self,
g_mutex_unlock (&self->txn_lock);
return TRUE;
}
-
+
g_mutex_lock (&self->txn_lock);
self->fs_verity_supported = _OSTREE_FEATURE_YES;
g_mutex_unlock (&self->txn_lock);
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index f3a3e039..4dbec47b 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -43,6 +43,7 @@
#include "ostree-repo-static-delta-private.h"
#include "ot-fs-utils.h"
#include "ostree-autocleanups.h"
+#include "ostree-sign-private.h"
#include <locale.h>
#include <glib/gstdio.h>
@@ -1413,8 +1414,8 @@ ostree_repo_init (OstreeRepo *self)
self->remotes = g_hash_table_new_full (g_str_hash, g_str_equal,
(GDestroyNotify) NULL,
(GDestroyNotify) ostree_remote_unref);
- self->bls_append_values = g_hash_table_new_full (g_str_hash, g_str_equal,
- (GDestroyNotify) g_free,
+ self->bls_append_values = g_hash_table_new_full (g_str_hash, g_str_equal,
+ (GDestroyNotify) g_free,
(GDestroyNotify) g_free);
g_mutex_init (&self->remotes_lock);
@@ -3363,7 +3364,7 @@ reload_core_config (OstreeRepo *self,
if (!_ostree_repo_parse_fsverity_config (self, error))
return FALSE;
-
+
{
g_clear_pointer (&self->collection_id, g_free);
if (!ot_keyfile_get_value_with_default (self->config, "core", "collection-id",
@@ -3525,16 +3526,16 @@ reload_sysroot_config (OstreeRepo *self,
valid_bootloader = TRUE;
}
}
- if (!valid_bootloader)
+ if (!valid_bootloader)
{
return glnx_throw (error, "Invalid bootloader configuration: '%s'", bootloader);
}
/* Parse bls-append-except-default string list. */
g_auto(GStrv) read_values = NULL;
- if (!ot_keyfile_get_string_list_with_default (self->config, "sysroot", "bls-append-except-default",
+ if (!ot_keyfile_get_string_list_with_default (self->config, "sysroot", "bls-append-except-default",
';', NULL, &read_values, error))
return glnx_throw(error, "Unable to parse bls-append-except-default");
-
+
/* get all key value pairs in bls-append-except-default */
g_hash_table_remove_all (self->bls_append_values);
for (char **iter = read_values; iter && *iter; iter++)
@@ -3548,7 +3549,7 @@ reload_sysroot_config (OstreeRepo *self,
}
char *key = g_strndup (key_value, sep - key_value);
char *value = g_strdup (sep + 1);
- g_hash_table_replace (self->bls_append_values, key, value);
+ g_hash_table_replace (self->bls_append_values, key, value);
}
return TRUE;
@@ -4383,7 +4384,7 @@ _ostree_repo_load_file_bare (OstreeRepo *self,
{
if (self->disable_xattrs)
ret_xattrs = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("(ayay)"), NULL, 0));
- else
+ else
{
ret_xattrs = ostree_fs_get_all_xattrs (fd, cancellable, error);
if (!ret_xattrs)
@@ -5592,26 +5593,17 @@ ostree_repo_sign_delta (OstreeRepo *self,
return FALSE;
}
-/**
- * ostree_repo_add_gpg_signature_summary:
- * @self: Self
- * @key_id: (array zero-terminated=1) (element-type utf8): NULL-terminated array of GPG keys.
- * @homedir: (allow-none): GPG home directory, or %NULL
- * @cancellable: A #GCancellable
- * @error: a #GError
- *
- * Add a GPG signature to a summary file.
- */
-gboolean
-ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
- const gchar **key_id,
- const gchar *homedir,
- GCancellable *cancellable,
- GError **error)
+static gboolean
+_ostree_repo_add_gpg_signature_summary_at (OstreeRepo *self,
+ int dir_fd,
+ const gchar **key_id,
+ const gchar *homedir,
+ GCancellable *cancellable,
+ GError **error)
{
#ifndef OSTREE_DISABLE_GPGME
glnx_autofd int fd = -1;
- if (!glnx_openat_rdonly (self->repo_dir_fd, "summary", TRUE, &fd, error))
+ if (!glnx_openat_rdonly (dir_fd, "summary", TRUE, &fd, error))
return FALSE;
g_autoptr(GBytes) summary_data = ot_fd_readall_or_mmap (fd, 0, error);
if (!summary_data)
@@ -5620,7 +5612,7 @@ ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
glnx_close_fd (&fd);
g_autoptr(GVariant) metadata = NULL;
- if (!ot_openat_ignore_enoent (self->repo_dir_fd, "summary.sig", &fd, error))
+ if (!ot_openat_ignore_enoent (dir_fd, "summary.sig", &fd, error))
return FALSE;
if (fd >= 0)
{
@@ -5644,7 +5636,7 @@ ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
g_autoptr(GVariant) normalized = g_variant_get_normal_form (metadata);
if (!_ostree_repo_file_replace_contents (self,
- self->repo_dir_fd,
+ dir_fd,
"summary.sig",
g_variant_get_data (normalized),
g_variant_get_size (normalized),
@@ -5653,6 +5645,35 @@ ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
return TRUE;
#else
+ return glnx_throw (error, "GPG feature is disabled at build time");
+#endif /* OSTREE_DISABLE_GPGME */
+}
+
+/**
+ * ostree_repo_add_gpg_signature_summary:
+ * @self: Self
+ * @key_id: (array zero-terminated=1) (element-type utf8): NULL-terminated array of GPG keys.
+ * @homedir: (allow-none): GPG home directory, or %NULL
+ * @cancellable: A #GCancellable
+ * @error: a #GError
+ *
+ * Add a GPG signature to a summary file.
+ */
+gboolean
+ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
+ const gchar **key_id,
+ const gchar *homedir,
+ GCancellable *cancellable,
+ GError **error)
+{
+#ifndef OSTREE_DISABLE_GPGME
+ return _ostree_repo_add_gpg_signature_summary_at (self,
+ self->repo_dir_fd,
+ key_id,
+ homedir,
+ cancellable,
+ error);
+#else
return glnx_throw (error, "GPG feature is disabled in a build time");
#endif /* OSTREE_DISABLE_GPGME */
}
@@ -6235,37 +6256,13 @@ summary_add_ref_entry (OstreeRepo *self,
return TRUE;
}
-/**
- * ostree_repo_regenerate_summary:
- * @self: Repo
- * @additional_metadata: (allow-none): A GVariant of type a{sv}, or %NULL
- * @cancellable: Cancellable
- * @error: Error
- *
- * An OSTree repository can contain a high level "summary" file that
- * describes the available branches and other metadata.
- *
- * If the timetable for making commits and updating the summary file is fairly
- * regular, setting the `ostree.summary.expires` key in @additional_metadata
- * will aid clients in working out when to check for updates.
- *
- * It is regenerated automatically after any ref is
- * added, removed, or updated if `core/auto-update-summary` is set.
- *
- * If the `core/collection-id` key is set in the configuration, it will be
- * included as %OSTREE_SUMMARY_COLLECTION_ID in the summary file. Refs that
- * have associated collection IDs will be included in the generated summary
- * file, listed under the %OSTREE_SUMMARY_COLLECTION_MAP key. Collection IDs
- * and refs in %OSTREE_SUMMARY_COLLECTION_MAP are guaranteed to be in
- * lexicographic order.
- *
- * Locking: shared (Prior to 2021.7, this was exclusive)
- */
-gboolean
-ostree_repo_regenerate_summary (OstreeRepo *self,
- GVariant *additional_metadata,
- GCancellable *cancellable,
- GError **error)
+static gboolean
+regenerate_metadata (OstreeRepo *self,
+ gboolean do_metadata_commit,
+ GVariant *additional_metadata,
+ GVariant *options,
+ GCancellable *cancellable,
+ GError **error)
{
g_autoptr(OstreeRepoAutoLock) lock = NULL;
gboolean no_deltas_in_summary = FALSE;
@@ -6275,12 +6272,99 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
if (!lock)
return FALSE;
+ /* Parse options vardict. */
+ g_autofree char **gpg_key_ids = NULL;
+ const char *gpg_homedir = NULL;
+ g_autoptr(GVariant) sign_keys = NULL;
+ const char *sign_type = NULL;
+ g_autoptr(OstreeSign) sign = NULL;
+
+ if (options != NULL)
+ {
+ if (!g_variant_is_of_type (options, G_VARIANT_TYPE_VARDICT))
+ return glnx_throw (error, "Invalid options doesn't match variant type '%s'",
+ (const char *) G_VARIANT_TYPE_VARDICT);
+
+ g_variant_lookup (options, "gpg-key-ids", "^a&s", &gpg_key_ids);
+ g_variant_lookup (options, "gpg-homedir", "&s", &gpg_homedir);
+ sign_keys = g_variant_lookup_value (options, "sign-keys", G_VARIANT_TYPE_ARRAY);
+ g_variant_lookup (options, "sign-type", "&s", &sign_type);
+
+ if (sign_keys != NULL)
+ {
+ if (sign_type == NULL)
+ sign_type = OSTREE_SIGN_NAME_ED25519;
+
+ sign = ostree_sign_get_by_name (sign_type, error);
+ if (sign == NULL)
+ return FALSE;
+ }
+ }
+
+ const gchar *main_collection_id = ostree_repo_get_collection_id (self);
+
+ /* Write out a new metadata commit for the repository when it has a collection ID. */
+ if (do_metadata_commit && main_collection_id != NULL)
+ {
+ g_autoptr(OstreeRepoAutoTransaction) txn =
+ _ostree_repo_auto_transaction_start (self, cancellable, error);
+ if (!txn)
+ return FALSE;
+
+ /* Disable automatic summary updating since we're already doing it */
+ self->txn.disable_auto_summary = TRUE;
+
+ g_autofree gchar *new_ostree_metadata_checksum = NULL;
+ if (!_ostree_repo_transaction_write_repo_metadata (self,
+ additional_metadata,
+ &new_ostree_metadata_checksum,
+ cancellable,
+ error))
+ return FALSE;
+
+ /* Sign the new commit. */
+ if (gpg_key_ids != NULL)
+ {
+ for (const char * const *iter = (const char * const *) gpg_key_ids;
+ iter != NULL && *iter != NULL; iter++)
+ {
+ const char *gpg_key_id = *iter;
+
+ if (!ostree_repo_sign_commit (self,
+ new_ostree_metadata_checksum,
+ gpg_key_id,
+ gpg_homedir,
+ cancellable,
+ error))
+ return FALSE;
+ }
+ }
+
+ if (sign_keys != NULL)
+ {
+ GVariantIter *iter;
+ GVariant *key;
+
+ g_variant_get (sign_keys, "av", &iter);
+ while (g_variant_iter_loop (iter, "v", &key))
+ {
+ if (!ostree_sign_set_sk (sign, key, error))
+ return FALSE;
+
+ if (!ostree_sign_commit (sign, self, new_ostree_metadata_checksum,
+ cancellable, error))
+ return FALSE;
+ }
+ }
+
+ if (!_ostree_repo_auto_transaction_commit (txn, NULL, cancellable, error))
+ return FALSE;
+ }
+
g_auto(GVariantDict) additional_metadata_builder = OT_VARIANT_BUILDER_INITIALIZER;
g_variant_dict_init (&additional_metadata_builder, additional_metadata);
g_autoptr(GVariantBuilder) refs_builder = g_variant_builder_new (G_VARIANT_TYPE ("a(s(taya{sv}))"));
- const gchar *main_collection_id = ostree_repo_get_collection_id (self);
-
{
if (main_collection_id == NULL)
{
@@ -6460,8 +6544,17 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
if (!ostree_repo_static_delta_reindex (self, 0, NULL, cancellable, error))
return FALSE;
+ /* Create the summary and signature in a temporary directory so that
+ * the summary isn't published without a matching signature.
+ */
+ g_auto(GLnxTmpDir) summary_tmpdir = { 0, };
+ if (!glnx_mkdtempat (self->tmp_dir_fd, "summary-XXXXXX", 0777,
+ &summary_tmpdir, error))
+ return FALSE;
+ g_debug ("Using summary tmpdir %s", summary_tmpdir.path);
+
if (!_ostree_repo_file_replace_contents (self,
- self->repo_dir_fd,
+ summary_tmpdir.fd,
"summary",
g_variant_get_data (summary),
g_variant_get_size (summary),
@@ -6469,12 +6562,124 @@ ostree_repo_regenerate_summary (OstreeRepo *self,
error))
return FALSE;
- if (!ot_ensure_unlinked_at (self->repo_dir_fd, "summary.sig", error))
+ if (gpg_key_ids != NULL &&
+ !_ostree_repo_add_gpg_signature_summary_at (self, summary_tmpdir.fd,
+ (const char **) gpg_key_ids, gpg_homedir,
+ cancellable, error))
+ return FALSE;
+
+ if (sign_keys != NULL &&
+ !_ostree_sign_summary_at (sign, self, summary_tmpdir.fd, sign_keys,
+ cancellable, error))
return FALSE;
+ /* Rename them into place */
+ if (!glnx_renameat (summary_tmpdir.fd, "summary",
+ self->repo_dir_fd, "summary",
+ error))
+ return glnx_prefix_error (error, "Unable to rename summary file: ");
+
+ if (gpg_key_ids != NULL || sign_keys != NULL)
+ {
+ if (!glnx_renameat (summary_tmpdir.fd, "summary.sig",
+ self->repo_dir_fd, "summary.sig",
+ error))
+ {
+ /* Delete an existing signature since it no longer corresponds
+ * to the published summary.
+ */
+ g_debug ("Deleting existing unmatched summary.sig file");
+ (void) ot_ensure_unlinked_at (self->repo_dir_fd, "summary.sig", NULL);
+
+ return glnx_prefix_error (error, "Unable to rename summary signature file: ");
+ }
+ }
+ else
+ {
+ g_debug ("Deleting existing unmatched summary.sig file");
+ if (!ot_ensure_unlinked_at (self->repo_dir_fd, "summary.sig", error))
+ return glnx_prefix_error (error, "Unable to delete summary signature file: ");
+ }
+
return TRUE;
}
+/**
+ * ostree_repo_regenerate_summary:
+ * @self: Repo
+ * @additional_metadata: (allow-none): A GVariant of type a{sv}, or %NULL
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * An OSTree repository can contain a high level "summary" file that
+ * describes the available branches and other metadata.
+ *
+ * If the timetable for making commits and updating the summary file is fairly
+ * regular, setting the `ostree.summary.expires` key in @additional_metadata
+ * will aid clients in working out when to check for updates.
+ *
+ * It is regenerated automatically after any ref is
+ * added, removed, or updated if `core/auto-update-summary` is set.
+ *
+ * If the `core/collection-id` key is set in the configuration, it will be
+ * included as %OSTREE_SUMMARY_COLLECTION_ID in the summary file. Refs that
+ * have associated collection IDs will be included in the generated summary
+ * file, listed under the %OSTREE_SUMMARY_COLLECTION_MAP key. Collection IDs
+ * and refs in %OSTREE_SUMMARY_COLLECTION_MAP are guaranteed to be in
+ * lexicographic order.
+ *
+ * Locking: shared (Prior to 2021.7, this was exclusive)
+ */
+gboolean
+ostree_repo_regenerate_summary (OstreeRepo *self,
+ GVariant *additional_metadata,
+ GCancellable *cancellable,
+ GError **error)
+{
+ return regenerate_metadata (self, FALSE, additional_metadata, NULL, cancellable, error);
+}
+
+/**
+ * ostree_repo_regenerate_metadata:
+ * @self: Repo
+ * @additional_metadata: (nullable): A GVariant `a{sv}`, or %NULL
+ * @options: (nullable): A GVariant `a{sv}` with an extensible set of flags
+ * @cancellable: Cancellable
+ * @error: Error
+ *
+ * Regenerate the OSTree repository metadata used by clients to describe
+ * available branches and other metadata.
+ *
+ * The repository metadata currently consists of the `summary` file. See
+ * ostree_repo_regenerate_summary() and %OSTREE_SUMMARY_GVARIANT_FORMAT for
+ * additional details on its contents.
+ *
+ * Additionally, if the `core/collection-id` key is set in the configuration, a
+ * %OSTREE_REPO_METADATA_REF commit will be created.
+ *
+ * The following @options are currently defined:
+ *
+ * * `gpg-key-ids` (`as`): Array of GPG key IDs to sign the metadata with.
+ * * `gpg-homedir` (`s`): GPG home directory.
+ * * `sign-keys` (`av`): Array of keys to sign the metadata with. The key
+ * type is specific to the sign engine used.
+ * * `sign-type` (`s`): Sign engine type to use. If not specified,
+ * %OSTREE_SIGN_NAME_ED25519 is used.
+ *
+ * Locking: shared
+ *
+ * Since: 2023.1
+ */
+gboolean
+ostree_repo_regenerate_metadata (OstreeRepo *self,
+ GVariant *additional_metadata,
+ GVariant *options,
+ GCancellable *cancellable,
+ GError **error)
+{
+ return regenerate_metadata (self, TRUE, additional_metadata, options, cancellable, error);
+}
+
/* Regenerate the summary if `core/auto-update-summary` is set. We default to FALSE for
* this setting because OSTree supports multiple processes committing to the same repo (but
* different refs) concurrently, and in fact gnome-continuous actually does this. In that
diff --git a/src/libostree/ostree-repo.h b/src/libostree/ostree-repo.h
index ce9b2507..a85db11a 100644
--- a/src/libostree/ostree-repo.h
+++ b/src/libostree/ostree-repo.h
@@ -442,7 +442,7 @@ OstreeContentWriter * ostree_repo_write_regfile (OstreeRepo *self,
guint64 content_len,
GVariant *xattrs,
GError **error);
-
+
_OSTREE_PUBLIC
char * ostree_repo_write_symlink (OstreeRepo *self,
const char *expected_checksum,
@@ -573,20 +573,20 @@ gboolean ostree_repo_remote_list_collection_refs (OstreeRepo *self,
_OSTREE_PUBLIC
gboolean ostree_repo_load_variant (OstreeRepo *self,
OstreeObjectType objtype,
- const char *sha256,
+ const char *sha256,
GVariant **out_variant,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_repo_load_variant_if_exists (OstreeRepo *self,
OstreeObjectType objtype,
- const char *sha256,
+ const char *sha256,
GVariant **out_variant,
GError **error);
_OSTREE_PUBLIC
gboolean ostree_repo_load_commit (OstreeRepo *self,
- const char *checksum,
+ const char *checksum,
GVariant **out_commit,
OstreeRepoCommitState *out_state,
GError **error);
@@ -612,7 +612,7 @@ gboolean ostree_repo_load_object_stream (OstreeRepo *self,
_OSTREE_PUBLIC
gboolean ostree_repo_query_object_storage_size (OstreeRepo *self,
OstreeObjectType objtype,
- const char *sha256,
+ const char *sha256,
guint64 *out_size,
GCancellable *cancellable,
GError **error);
@@ -647,7 +647,7 @@ gboolean ostree_repo_fsck_object (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
-/**
+/**
* OstreeRepoCommitFilterResult:
* @OSTREE_REPO_COMMIT_FILTER_ALLOW: Do commit this object
* @OSTREE_REPO_COMMIT_FILTER_SKIP: Ignore this object
@@ -1561,7 +1561,7 @@ OstreeGpgVerifyResult * ostree_repo_verify_summary (OstreeRepo *self,
* @OSTREE_REPO_VERIFY_FLAGS_NONE: No flags
* @OSTREE_REPO_VERIFY_FLAGS_NO_GPG: Skip GPG verification
* @OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI: Skip all other signature verification methods
- *
+ *
* Since: 2021.4
*/
typedef enum {
@@ -1585,6 +1585,13 @@ gboolean ostree_repo_regenerate_summary (OstreeRepo *self,
GCancellable *cancellable,
GError **error);
+_OSTREE_PUBLIC
+gboolean ostree_repo_regenerate_metadata (OstreeRepo *self,
+ GVariant *additional_metadata,
+ GVariant *options,
+ GCancellable *cancellable,
+ GError **error);
+
/**
* OstreeRepoLockType:
diff --git a/src/libostree/ostree-rollsum.c b/src/libostree/ostree-rollsum.c
index 805c156c..a13688cf 100644
--- a/src/libostree/ostree-rollsum.c
+++ b/src/libostree/ostree-rollsum.c
@@ -49,7 +49,7 @@ rollsum_chunks_crc32 (GBytes *bytes)
if (!rollsum_end)
{
- offset = bupsplit_find_ofs (buf + start, MIN(G_MAXINT32, remaining), &bits);
+ offset = bupsplit_find_ofs (buf + start, MIN(G_MAXINT32, remaining), &bits);
if (offset == 0)
{
rollsum_end = TRUE;
@@ -94,7 +94,7 @@ compare_matches (const void *app,
GVariant **bvpp = (GVariant**)bpp;
GVariant *b = *bvpp;
guint64 a_start, b_start;
-
+
g_variant_get_child (a, 2, "t", &a_start);
g_variant_get_child (b, 2, "t", &b_start);
@@ -165,7 +165,7 @@ _ostree_compute_rollsum_matches (GBytes *from,
/* Same crc32 but different length, skip it. */
if (to_offset != from_offset)
continue;
-
+
/* Rsync uses a cryptographic checksum, but let's be
* very conservative here and just memcmp.
*/
@@ -176,7 +176,7 @@ _ostree_compute_rollsum_matches (GBytes *from,
ret_rollsum->match_size += to_offset;
g_ptr_array_add (matches, g_variant_ref_sink (match));
break; /* Don't need any more matches */
- }
+ }
}
}
}
diff --git a/src/libostree/ostree-sepolicy.c b/src/libostree/ostree-sepolicy.c
index 5fd59a82..7815744b 100644
--- a/src/libostree/ostree-sepolicy.c
+++ b/src/libostree/ostree-sepolicy.c
@@ -307,7 +307,7 @@ ostree_sepolicy_new_from_commit (OstreeRepo *repo,
OstreeRepoCheckoutAtOptions coopts = {0,};
coopts.mode = OSTREE_REPO_CHECKOUT_MODE_USER;
coopts.subpath = glnx_strjoina ("/", policypath);
-
+
if (!ostree_repo_checkout_at (repo, &coopts, tmpdir.fd, policypath, commit, cancellable, error))
return glnx_prefix_error_null (error, "policy checkout");
}
diff --git a/src/libostree/ostree-sign-ed25519.c b/src/libostree/ostree-sign-ed25519.c
index b7d87c6c..5839a0a1 100644
--- a/src/libostree/ostree-sign-ed25519.c
+++ b/src/libostree/ostree-sign-ed25519.c
@@ -504,7 +504,7 @@ _load_pk_from_stream (OstreeSign *self,
if (line == NULL)
return ret;
-
+
/* Read the key itself */
/* base64 encoded key */
pk = g_variant_new_string (line);
@@ -549,14 +549,14 @@ _load_pk_from_file (OstreeSign *self,
key_stream_in = g_file_read (keyfile, NULL, error);
if (key_stream_in == NULL)
return FALSE;
-
+
key_data_in = g_data_input_stream_new (G_INPUT_STREAM(key_stream_in));
g_assert (key_data_in != NULL);
if (!_load_pk_from_stream (self, key_data_in, trusted, error))
{
if (error == NULL || *error == NULL)
- return glnx_throw (error,
+ return glnx_throw (error,
"signature: ed25519: no valid keys in file '%s'",
filename);
else
@@ -598,7 +598,7 @@ _ed25519_load_pk (OstreeSign *self,
g_autofree gchar *base_dir = NULL;
g_autoptr (GDir) dir = NULL;
- base_name = g_build_filename ((gchar *)g_ptr_array_index (base_dirs, i),
+ base_name = g_build_filename ((gchar *)g_ptr_array_index (base_dirs, i),
trusted ? "trusted.ed25519" : "revoked.ed25519",
NULL);
diff --git a/src/libostree/ostree-sign-private.h b/src/libostree/ostree-sign-private.h
new file mode 100644
index 00000000..c3826d47
--- /dev/null
+++ b/src/libostree/ostree-sign-private.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright © 2023 Endless OS Foundation LLC
+ *
+ * SPDX-License-Identifier: LGPL-2.0+
+ *
+ * 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, see <https://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * - Dan Nicholson <dbn@endlessos.org>
+ */
+
+#pragma once
+
+#include <glib.h>
+
+#include "ostree-sign.h"
+#include "ostree-types.h"
+
+G_BEGIN_DECLS
+
+gboolean _ostree_sign_summary_at (OstreeSign *self,
+ OstreeRepo *repo,
+ int dir_fd,
+ GVariant *keys,
+ GCancellable *cancellable,
+ GError **error);
+
+G_END_DECLS
diff --git a/src/libostree/ostree-sign.c b/src/libostree/ostree-sign.c
index 587d7164..305250de 100644
--- a/src/libostree/ostree-sign.c
+++ b/src/libostree/ostree-sign.c
@@ -40,6 +40,7 @@
#include "ostree-autocleanups.h"
#include "ostree-core.h"
#include "ostree-sign.h"
+#include "ostree-sign-private.h"
#include "ostree-sign-dummy.h"
#ifdef HAVE_LIBSODIUM
#include "ostree-sign-ed25519.h"
@@ -460,7 +461,7 @@ ostree_sign_commit_verify (OstreeSign *self,
*
* Since: 2020.2
*/
-const gchar *
+const gchar *
ostree_sign_get_name (OstreeSign *self)
{
g_assert (OSTREE_IS_SIGN (self));
@@ -601,27 +602,13 @@ ostree_sign_get_by_name (const gchar *name, GError **error)
return sign;
}
-/**
- * ostree_sign_summary:
- * @self: Self
- * @repo: ostree repository
- * @keys: keys -- GVariant containing keys as GVarints specific to signature type.
- * @cancellable: A #GCancellable
- * @error: a #GError
- *
- * Add a signature to a summary file.
- * Based on ostree_repo_add_gpg_signature_summary implementation.
- *
- * Returns: @TRUE if summary file has been signed with all provided keys
- *
- * Since: 2020.2
- */
gboolean
-ostree_sign_summary (OstreeSign *self,
- OstreeRepo *repo,
- GVariant *keys,
- GCancellable *cancellable,
- GError **error)
+_ostree_sign_summary_at (OstreeSign *self,
+ OstreeRepo *repo,
+ int dir_fd,
+ GVariant *keys,
+ GCancellable *cancellable,
+ GError **error)
{
g_assert (OSTREE_IS_SIGN (self));
g_assert (OSTREE_IS_REPO (repo));
@@ -631,7 +618,7 @@ ostree_sign_summary (OstreeSign *self,
g_autoptr(GVariant) metadata = NULL;
glnx_autofd int fd = -1;
- if (!glnx_openat_rdonly (repo->repo_dir_fd, "summary", TRUE, &fd, error))
+ if (!glnx_openat_rdonly (dir_fd, "summary", TRUE, &fd, error))
return FALSE;
summary_data = ot_fd_readall_or_mmap (fd, 0, error);
if (!summary_data)
@@ -640,7 +627,7 @@ ostree_sign_summary (OstreeSign *self,
/* Note that fd is reused below */
glnx_close_fd (&fd);
- if (!ot_openat_ignore_enoent (repo->repo_dir_fd, "summary.sig", &fd, error))
+ if (!ot_openat_ignore_enoent (dir_fd, "summary.sig", &fd, error))
return FALSE;
if (fd >= 0)
@@ -681,7 +668,7 @@ ostree_sign_summary (OstreeSign *self,
normalized = g_variant_get_normal_form (metadata);
if (!_ostree_repo_file_replace_contents (repo,
- repo->repo_dir_fd,
+ dir_fd,
"summary.sig",
g_variant_get_data (normalized),
g_variant_get_size (normalized),
@@ -690,3 +677,29 @@ ostree_sign_summary (OstreeSign *self,
return TRUE;
}
+
+/**
+ * ostree_sign_summary:
+ * @self: Self
+ * @repo: ostree repository
+ * @keys: keys -- GVariant containing keys as GVarints specific to signature type.
+ * @cancellable: A #GCancellable
+ * @error: a #GError
+ *
+ * Add a signature to a summary file.
+ * Based on ostree_repo_add_gpg_signature_summary implementation.
+ *
+ * Returns: @TRUE if summary file has been signed with all provided keys
+ *
+ * Since: 2020.2
+ */
+gboolean
+ostree_sign_summary (OstreeSign *self,
+ OstreeRepo *repo,
+ GVariant *keys,
+ GCancellable *cancellable,
+ GError **error)
+{
+ return _ostree_sign_summary_at (self, repo, repo->repo_dir_fd, keys,
+ cancellable, error);
+}
diff --git a/src/libostree/ostree-sysroot-cleanup.c b/src/libostree/ostree-sysroot-cleanup.c
index 51f87b03..181dbd16 100644
--- a/src/libostree/ostree-sysroot-cleanup.c
+++ b/src/libostree/ostree-sysroot-cleanup.c
@@ -161,7 +161,7 @@ list_all_boot_directories (OstreeSysroot *self,
{
g_clear_error (&temp_error);
goto done;
- }
+ }
else
{
g_propagate_error (error, temp_error);
@@ -190,10 +190,10 @@ list_all_boot_directories (OstreeSysroot *self,
name = g_file_info_get_name (file_info);
if (!parse_bootdir_name (name, NULL, NULL))
continue;
-
+
g_ptr_array_add (ret_bootdirs, g_object_ref (child));
}
-
+
done:
ret = TRUE;
ot_transfer_out_value (out_bootdirs, &ret_bootdirs);
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index 7554e56c..cd191d39 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -3561,7 +3561,7 @@ _ostree_sysroot_finalize_staged (OstreeSysroot *self,
{
g_autoptr(GError) writing_error = NULL;
g_assert_cmpint (self->boot_fd, !=, -1);
- if (!glnx_file_replace_contents_at (self->boot_fd, _OSTREE_FINALIZE_STAGED_FAILURE_PATH,
+ if (!glnx_file_replace_contents_at (self->boot_fd, _OSTREE_FINALIZE_STAGED_FAILURE_PATH,
(guint8*)finalization_error->message, -1,
0, cancellable, &writing_error))
{
@@ -3687,15 +3687,15 @@ ostree_sysroot_deployment_set_kargs_in_place (OstreeSysroot *self,
g_variant_new_from_bytes ((GVariantType*)"a{sv}", contents, TRUE);
g_autoptr(GVariantDict) staged_deployment_dict =
g_variant_dict_new (staged_deployment_data);
-
+
g_autoptr(OstreeKernelArgs) kargs = ostree_kernel_args_from_string (kargs_str);
g_auto(GStrv) kargs_strv = ostree_kernel_args_to_strv (kargs);
-
+
g_variant_dict_insert (staged_deployment_dict, "kargs", "^a&s", kargs_strv);
g_autoptr(GVariant) new_staged_deployment_data = g_variant_dict_end (staged_deployment_dict);
-
+
if (!glnx_file_replace_contents_at (fd, _OSTREE_SYSROOT_RUNSTATE_STAGED,
- g_variant_get_data (new_staged_deployment_data),
+ g_variant_get_data (new_staged_deployment_data),
g_variant_get_size (new_staged_deployment_data),
GLNX_FILE_REPLACE_NODATASYNC,
cancellable, error))
diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c
index 63d79b41..b8edcd64 100644
--- a/src/libostree/ostree-sysroot.c
+++ b/src/libostree/ostree-sysroot.c
@@ -308,7 +308,7 @@ ostree_sysroot_initialize_with_mount_namespace (OstreeSysroot *self, GCancellabl
// If the mount namespaces are the same, we need to unshare().
if (strcmp (mntns_pid1, mntns_self) == 0)
- {
+ {
if (unshare (CLONE_NEWNS) < 0)
return glnx_throw_errno_prefix (error, "Failed to invoke unshare(CLONE_NEWNS)");
}
@@ -442,7 +442,7 @@ ostree_sysroot_get_fd (OstreeSysroot *self)
* @self: Sysroot
*
* Can only be invoked after `ostree_sysroot_initialize()`.
- *
+ *
* Returns: %TRUE iff the sysroot points to a booted deployment
* Since: 2020.1
*/
diff --git a/src/libostree/ostree-varint.c b/src/libostree/ostree-varint.c
index 26b5d46b..35e306d0 100644
--- a/src/libostree/ostree-varint.c
+++ b/src/libostree/ostree-varint.c
@@ -75,7 +75,7 @@ _ostree_read_varuint64 (const guint8 *buf,
guint64 result = 0;
int count = 0;
guint8 b;
-
+
/* Adapted from CodedInputStream::ReadVarint64Slow */
do
diff --git a/src/libotutil/ot-checksum-instream.c b/src/libotutil/ot-checksum-instream.c
index e89d68e4..b48b2360 100644
--- a/src/libotutil/ot-checksum-instream.c
+++ b/src/libotutil/ot-checksum-instream.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2017 Colin Walters <walters@verbum.org>
* Copyright (C) 2022 Igalia S.L.
*
diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c
index ef226020..56926fe5 100644
--- a/src/libotutil/ot-gio-utils.c
+++ b/src/libotutil/ot-gio-utils.c
@@ -51,7 +51,7 @@ ot_gfile_resolve_path_printf (GFile *path,
/**
* ot_gfile_replace_contents_fsync:
- *
+ *
* Like g_file_replace_contents(), except always uses fdatasync().
*/
gboolean
diff --git a/src/libotutil/ot-keyfile-utils.c b/src/libotutil/ot-keyfile-utils.c
index de8abd2b..066fe380 100644
--- a/src/libotutil/ot-keyfile-utils.c
+++ b/src/libotutil/ot-keyfile-utils.c
@@ -133,7 +133,7 @@ ot_keyfile_get_value_with_default_group_optional (GKeyFile *keyfile,
* zero or one of the separators and none of the others, read the
* string as a NULL-terminated array out_value. If the value string
* contains multiple of the separators, give an error.
- *
+ *
* Returns TRUE on success, FALSE on error. */
gboolean
ot_keyfile_get_string_list_with_separator_choice (GKeyFile *keyfile,
diff --git a/src/libotutil/zbase32.c b/src/libotutil/zbase32.c
index 39fa97a4..b92168b4 100644
--- a/src/libotutil/zbase32.c
+++ b/src/libotutil/zbase32.c
@@ -127,15 +127,15 @@ zbase32_encode(const unsigned char *data, size_t length)
* distribute, sublicense, and/or sell copies of this software, and to permit
* persons to whom this software is furnished to do so, subject to the following
* conditions:
- *
+ *
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of this software.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THIS SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * OUT OF OR IN CONNECTION WITH THIS SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THIS SOFTWARE.
*/
diff --git a/src/libotutil/zbase32.h b/src/libotutil/zbase32.h
index bf9cf683..162a2c7e 100644
--- a/src/libotutil/zbase32.h
+++ b/src/libotutil/zbase32.h
@@ -44,6 +44,6 @@ char *zbase32_encode(const unsigned char *data, size_t length);
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THIS SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * OUT OF OR IN CONNECTION WITH THIS SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THIS SOFTWARE.
*/
diff --git a/src/ostree/ostree-trivial-httpd.c b/src/ostree/ostree-trivial-httpd.c
index 6f038e9e..6b16737d 100644
--- a/src/ostree/ostree-trivial-httpd.c
+++ b/src/ostree/ostree-trivial-httpd.c
@@ -157,7 +157,7 @@ get_directory_listing (int dfd,
for (i = 0; i < entries->len; i++)
{
g_string_append_printf (listing, "<a href=\"%s\">%s</a><br>\r\n",
- (char *)entries->pdata[i],
+ (char *)entries->pdata[i],
(char *)entries->pdata[i]);
g_free (g_steal_pointer (&entries->pdata[i]));
}
@@ -367,7 +367,7 @@ do_get (OtTrivialHttpd *self,
}
}
}
- else
+ else
{
if (!S_ISREG (stbuf.st_mode))
{
@@ -401,7 +401,7 @@ do_get (OtTrivialHttpd *self,
g_autofree gchar *etag = calculate_etag (mapping);
if (etag != NULL)
soup_message_headers_append (msg->response_headers, "ETag", etag);
-
+
if (msg->method == SOUP_METHOD_GET)
{
gsize buffer_length, file_size;
@@ -729,7 +729,7 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error)
GSList *listeners = soup_server_get_listeners (server);
g_autoptr(GSocket) listener = NULL;
g_autoptr(GSocketAddress) addr = NULL;
-
+
g_assert (listeners);
listener = g_object_ref (listeners->data);
g_slist_free (listeners);
@@ -739,7 +739,7 @@ run (int argc, char **argv, GCancellable *cancellable, GError **error)
goto out;
g_assert (G_IS_INET_SOCKET_ADDRESS (addr));
-
+
portstr = g_strdup_printf ("%u\n", g_inet_socket_address_get_port ((GInetSocketAddress*)addr));
#else
portstr = g_strdup_printf ("%u\n", soup_server_get_port (server));
diff --git a/src/ostree/ot-admin-builtin-set-origin.c b/src/ostree/ot-admin-builtin-set-origin.c
index 1a6bf2e8..91184cd6 100644
--- a/src/ostree/ot-admin-builtin-set-origin.c
+++ b/src/ostree/ot-admin-builtin-set-origin.c
@@ -107,24 +107,24 @@ ot_admin_builtin_set_origin (int argc, char **argv, OstreeCommandInvocation *inv
remote_options = g_variant_ref_sink (g_variant_builder_end (optbuilder));
if (!ostree_repo_remote_change (repo, NULL,
- OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
+ OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
remotename, url,
remote_options,
cancellable, error))
goto out;
}
-
+
{ GKeyFile *old_origin = ostree_deployment_get_origin (target_deployment);
g_autofree char *origin_refspec = g_key_file_get_string (old_origin, "origin", "refspec", NULL);
g_autofree char *origin_remote = NULL;
g_autofree char *origin_ref = NULL;
-
+
if (!ostree_parse_refspec (origin_refspec, &origin_remote, &origin_ref, error))
goto out;
{ g_autofree char *new_refspec = g_strconcat (remotename, ":", branch ? branch : origin_ref, NULL);
g_autoptr(GKeyFile) new_origin = NULL;
-
+
new_origin = ostree_sysroot_origin_new_from_refspec (sysroot, new_refspec);
if (!ostree_sysroot_write_origin_file (sysroot, target_deployment, new_origin,
diff --git a/src/ostree/ot-admin-builtin-status.c b/src/ostree/ot-admin-builtin-status.c
index af1a711c..672882bd 100644
--- a/src/ostree/ot-admin-builtin-status.c
+++ b/src/ostree/ot-admin-builtin-status.c
@@ -197,7 +197,7 @@ deployment_print_status (OstreeSysroot *sysroot,
return glnx_throw (error, "Cannot verify deployment without remote");
g_autoptr(GBytes) commit_data = g_variant_get_data_as_bytes (commit);
- g_autoptr(GBytes) commit_detached_metadata_bytes =
+ g_autoptr(GBytes) commit_detached_metadata_bytes =
commit_detached_metadata ? g_variant_get_data_as_bytes (commit_detached_metadata) : NULL;
g_autofree char *verify_text = NULL;
if (!ostree_repo_signature_verify_commit_data (repo, remote, commit_data, commit_detached_metadata_bytes, 0, &verify_text, error))
diff --git a/src/ostree/ot-admin-builtin-unlock.c b/src/ostree/ot-admin-builtin-unlock.c
index f438a13e..393d6be3 100644
--- a/src/ostree/ot-admin-builtin-unlock.c
+++ b/src/ostree/ot-admin-builtin-unlock.c
@@ -47,7 +47,7 @@ ot_admin_builtin_unlock (int argc, char **argv, OstreeCommandInvocation *invocat
OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER,
invocation, &sysroot, cancellable, error))
return FALSE;
-
+
if (argc > 1)
{
ot_util_usage_error (context, "This command takes no extra arguments", error);
diff --git a/src/ostree/ot-admin-functions.c b/src/ostree/ot-admin-functions.c
index e2309f6e..8c7cd135 100644
--- a/src/ostree/ot-admin-functions.c
+++ b/src/ostree/ot-admin-functions.c
@@ -84,7 +84,7 @@ ot_admin_get_indexed_deployment (OstreeSysroot *sysroot,
current_deployments->len);
return NULL;
}
-
+
return g_object_ref (current_deployments->pdata[index]);
}
diff --git a/src/ostree/ot-admin-instutil-builtin-grub2-generate.c b/src/ostree/ot-admin-instutil-builtin-grub2-generate.c
index d3598460..0f259bee 100644
--- a/src/ostree/ot-admin-instutil-builtin-grub2-generate.c
+++ b/src/ostree/ot-admin-instutil-builtin-grub2-generate.c
@@ -55,7 +55,7 @@ ot_admin_instutil_builtin_grub2_generate (int argc, char **argv, OstreeCommandIn
goto out;
}
}
- else
+ else
{
const char *bootversion_env = g_getenv ("_OSTREE_GRUB2_BOOTVERSION");
if (bootversion_env)
diff --git a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
index 017ae5cb..e324da9e 100644
--- a/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
+++ b/src/ostree/ot-admin-instutil-builtin-selinux-ensure-labeled.c
@@ -104,7 +104,7 @@ relabel_recursively (OstreeSePolicy *sepolicy,
cancellable, error);
if (!direnum)
goto out;
-
+
while (TRUE)
{
GFileInfo *file_info;
@@ -157,7 +157,7 @@ selinux_relabel_dir (OstreeSePolicy *sepolicy,
cancellable, error);
if (!root_info)
goto out;
-
+
g_ptr_array_add (path_parts, (char*)prefix);
if (!relabel_recursively (sepolicy, dir, root_info, path_parts,
cancellable, error))
@@ -220,7 +220,7 @@ ot_admin_instutil_builtin_selinux_ensure_labeled (int argc, char **argv, OstreeC
sepolicy = ostree_sepolicy_new (deployment_path, cancellable, error);
if (!sepolicy)
goto out;
-
+
policy_name = ostree_sepolicy_get_name (sepolicy);
if (policy_name)
{
diff --git a/src/ostree/ot-admin-kargs-builtin-edit-in-place.c b/src/ostree/ot-admin-kargs-builtin-edit-in-place.c
index 2a16da9c..f7125e2c 100644
--- a/src/ostree/ot-admin-kargs-builtin-edit-in-place.c
+++ b/src/ostree/ot-admin-kargs-builtin-edit-in-place.c
@@ -66,13 +66,13 @@ ot_admin_kargs_builtin_edit_in_place (int argc, char **argv, OstreeCommandInvoca
ostree_kernel_args_append_if_missing (kargs, arg);
}
}
-
+
g_autofree char *new_options = ostree_kernel_args_to_string (kargs);
-
- if (!ostree_sysroot_deployment_set_kargs_in_place (sysroot, deployment, new_options,
+
+ if (!ostree_sysroot_deployment_set_kargs_in_place (sysroot, deployment, new_options,
cancellable, error))
return FALSE;
-
+
}
return TRUE;
diff --git a/src/ostree/ot-builtin-admin.c b/src/ostree/ot-builtin-admin.c
index 503fb9a7..73e18d15 100644
--- a/src/ostree/ot-builtin-admin.c
+++ b/src/ostree/ot-builtin-admin.c
@@ -188,7 +188,7 @@ ostree_builtin_admin (int argc, char **argv, OstreeCommandInvocation *invocation
OstreeCommandInvocation sub_invocation = { .command = subcommand };
if (!subcommand->fn (argc, argv, &sub_invocation, cancellable, error))
goto out;
-
+
ret = TRUE;
out:
return ret;
diff --git a/src/ostree/ot-builtin-diff.c b/src/ostree/ot-builtin-diff.c
index bd9c357a..9c918348 100644
--- a/src/ostree/ot-builtin-diff.c
+++ b/src/ostree/ot-builtin-diff.c
@@ -164,11 +164,11 @@ ostree_builtin_diff (int argc, char **argv, OstreeCommandInvocation *invocation,
if (opt_fs_diff)
{
- OstreeDiffFlags diff_flags = OSTREE_DIFF_FLAGS_NONE;
+ OstreeDiffFlags diff_flags = OSTREE_DIFF_FLAGS_NONE;
if (opt_no_xattrs)
diff_flags |= OSTREE_DIFF_FLAGS_IGNORE_XATTRS;
-
+
if (!parse_file_or_commit (repo, src, &srcf, cancellable, error))
return FALSE;
if (!parse_file_or_commit (repo, target, &targetf, cancellable, error))
diff --git a/src/ostree/ot-builtin-export.c b/src/ostree/ot-builtin-export.c
index bcf7da56..a8929ec1 100644
--- a/src/ostree/ot-builtin-export.c
+++ b/src/ostree/ot-builtin-export.c
@@ -82,7 +82,7 @@ ostree_builtin_export (int argc, char **argv, OstreeCommandInvocation *invocatio
if (!ostree_option_context_parse (context, options, &argc, &argv, invocation, &repo, cancellable, error))
goto out;
-#ifdef HAVE_LIBARCHIVE
+#ifdef HAVE_LIBARCHIVE
if (argc <= 1)
{
@@ -157,8 +157,8 @@ ostree_builtin_export (int argc, char **argv, OstreeCommandInvocation *invocatio
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"This version of ostree is not compiled with libarchive support");
goto out;
-#endif
-
+#endif
+
ret = TRUE;
out:
return ret;
diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c
index 60c78090..bb9e8563 100644
--- a/src/ostree/ot-builtin-fsck.c
+++ b/src/ostree/ot-builtin-fsck.c
@@ -452,7 +452,7 @@ ostree_builtin_fsck (int argc, char **argv, OstreeCommandInvocation *invocation,
if (n_fsck_partial > 0)
return glnx_throw (error, "%u partial commits from fsck-detected corruption", n_partial);
- g_print ("object fsck of %d commits completed successfully - no errors found.\n",
+ g_print ("object fsck of %d commits completed successfully - no errors found.\n",
(guint)g_hash_table_size (commits));
return TRUE;
diff --git a/src/ostree/ot-builtin-ls.c b/src/ostree/ot-builtin-ls.c
index 5fa080ae..2a7d1cdc 100644
--- a/src/ostree/ot-builtin-ls.c
+++ b/src/ostree/ot-builtin-ls.c
@@ -92,7 +92,7 @@ print_one_file_text (GFile *f,
g_file_info_get_attribute_uint32 (file_info, "unix::uid"),
g_file_info_get_attribute_uint32 (file_info, "unix::gid"),
g_file_info_get_attribute_uint64 (file_info, "standard::size"));
-
+
if (opt_checksum)
{
if (type == G_FILE_TYPE_DIRECTORY)
@@ -107,7 +107,7 @@ print_one_file_text (GFile *f,
if (!ostree_repo_file_get_xattrs ((OstreeRepoFile*)f, &xattrs, cancellable, error))
return FALSE;
-
+
formatted = g_variant_print (xattrs, TRUE);
g_string_append (buf, "{ ");
g_string_append (buf, formatted);
@@ -120,7 +120,7 @@ print_one_file_text (GFile *f,
if (type == G_FILE_TYPE_SYMBOLIC_LINK)
g_string_append_printf (buf, " -> %s", g_file_info_get_attribute_byte_string (file_info, "standard::symlink-target"));
-
+
g_print ("%s\n", buf->str);
return TRUE;
@@ -175,13 +175,13 @@ print_directory_recurse (GFile *f,
else
g_assert (depth == -1);
- dir_enum = g_file_enumerate_children (f, OSTREE_GIO_FAST_QUERYINFO,
+ dir_enum = g_file_enumerate_children (f, OSTREE_GIO_FAST_QUERYINFO,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
- NULL,
+ NULL,
error);
if (dir_enum == NULL)
return FALSE;
-
+
while ((child_info = g_file_enumerator_next_file (dir_enum, NULL, &temp_error)) != NULL)
{
g_clear_object (&child);
@@ -227,10 +227,10 @@ print_one_argument (OstreeRepo *repo,
cancellable, error);
if (file_info == NULL)
return FALSE;
-
+
if (!print_one_file (f, file_info, cancellable, error))
return FALSE;
-
+
if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
{
if (opt_recursive)
@@ -244,7 +244,7 @@ print_one_argument (OstreeRepo *repo,
return FALSE;
}
}
-
+
return TRUE;
}
@@ -285,6 +285,6 @@ ostree_builtin_ls (int argc, char **argv, OstreeCommandInvocation *invocation, G
if (!print_one_argument (repo, root, "/", cancellable, error))
return FALSE;
}
-
+
return TRUE;
}
diff --git a/src/ostree/ot-builtin-prune.c b/src/ostree/ot-builtin-prune.c
index 0b4e8698..e641c18b 100644
--- a/src/ostree/ot-builtin-prune.c
+++ b/src/ostree/ot-builtin-prune.c
@@ -354,7 +354,7 @@ ostree_builtin_prune (int argc, char **argv, OstreeCommandInvocation *invocation
}
g_autofree char *formatted_freed_size = g_format_size_full (objsize_total, 0);
- if (opt_commit_only)
+ if (opt_commit_only)
g_print("Total (commit only) objects: %u\n", n_objects_total);
else
g_print ("Total objects: %u\n", n_objects_total);
diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c
index 5dfaf887..a49445da 100644
--- a/src/ostree/ot-builtin-pull-local.c
+++ b/src/ostree/ot-builtin-pull-local.c
@@ -105,7 +105,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeCommandInvocation *invoc
if (src_repo_arg[0] == '/')
src_repo_uri = g_strconcat ("file://", src_repo_arg, NULL);
else
- {
+ {
g_autofree char *cwd = g_get_current_dir ();
src_repo_uri = g_strconcat ("file://", cwd, "/", src_repo_arg, NULL);
}
@@ -139,7 +139,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeCommandInvocation *invoc
{ GHashTableIter hashiter;
gpointer hkey, hvalue;
-
+
g_hash_table_iter_init (&hashiter, refs_to_clone);
while (g_hash_table_iter_next (&hashiter, &hkey, &hvalue))
g_ptr_array_add (refs_to_fetch, g_strdup (hkey));
@@ -152,7 +152,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeCommandInvocation *invoc
for (i = 2; i < argc; i++)
{
const char *ref = argv[i];
-
+
g_ptr_array_add (refs_to_fetch, (char*)ref);
}
g_ptr_array_add (refs_to_fetch, NULL);
@@ -202,7 +202,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeCommandInvocation *invoc
progress = ostree_async_progress_new_and_connect (noninteractive_console_progress_changed, &console);
opts = g_variant_ref_sink (g_variant_builder_end (&builder));
- if (!ostree_repo_pull_with_options (repo, src_repo_uri,
+ if (!ostree_repo_pull_with_options (repo, src_repo_uri,
opts,
progress,
cancellable, error))
diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c
index e6cc053b..07671e54 100644
--- a/src/ostree/ot-builtin-pull.c
+++ b/src/ostree/ot-builtin-pull.c
@@ -298,10 +298,10 @@ ostree_builtin_pull (int argc, char **argv, OstreeCommandInvocation *invocation,
g_variant_new_variant (g_variant_new_strv ((const char *const*) refs_to_fetch->pdata, -1)));
g_variant_builder_add (&builder, "{s@v}", "depth",
g_variant_new_variant (g_variant_new_int32 (opt_depth)));
-
+
g_variant_builder_add (&builder, "{s@v}", "update-frequency",
g_variant_new_variant (g_variant_new_uint32 (opt_frequency)));
-
+
if (opt_network_retries >= 0)
g_variant_builder_add (&builder, "{s@v}", "n-network-retries",
g_variant_new_variant (g_variant_new_uint32 (opt_network_retries)));
diff --git a/src/ostree/ot-builtin-rev-parse.c b/src/ostree/ot-builtin-rev-parse.c
index 95cb45ab..7da0a01b 100644
--- a/src/ostree/ot-builtin-rev-parse.c
+++ b/src/ostree/ot-builtin-rev-parse.c
@@ -92,6 +92,6 @@ ostree_builtin_rev_parse (int argc, char **argv, OstreeCommandInvocation *invoca
return FALSE;
g_print ("%s\n", resolved_rev);
}
-
+
return TRUE;
}
diff --git a/src/ostree/ot-builtin-summary.c b/src/ostree/ot-builtin-summary.c
index cdfc11e6..b0a2a6ed 100644
--- a/src/ostree/ot-builtin-summary.c
+++ b/src/ostree/ot-builtin-summary.c
@@ -146,151 +146,39 @@ ostree_builtin_summary (int argc, char **argv, OstreeCommandInvocation *invocati
return FALSE;
}
- const char *collection_id = ostree_repo_get_collection_id (repo);
-
- /* Write out a new metadata commit for the repository. */
- if (collection_id != NULL)
+ /* Regenerate and sign the repo metadata. */
+ g_auto(GVariantBuilder) metadata_opts_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_VARDICT);
+ g_autoptr(GVariant) metadata_opts = NULL;
+ if (opt_gpg_key_ids != NULL)
+ g_variant_builder_add (&metadata_opts_builder, "{sv}", "gpg-key-ids",
+ g_variant_new_strv ((const char * const *) opt_gpg_key_ids, -1));
+ if (opt_gpg_homedir != NULL)
+ g_variant_builder_add (&metadata_opts_builder, "{sv}", "gpg-homedir",
+ g_variant_new_string (opt_gpg_homedir));
+ if (opt_key_ids != NULL)
{
- OstreeCollectionRef collection_ref = { (gchar *) collection_id, (gchar *) OSTREE_REPO_METADATA_REF };
- g_autofree char *old_ostree_metadata_checksum = NULL;
- g_autofree gchar *new_ostree_metadata_checksum = NULL;
- g_autoptr(OstreeMutableTree) mtree = NULL;
- g_autoptr(OstreeRepoFile) repo_file = NULL;
- g_autoptr(GVariantDict) new_summary_commit_dict = NULL;
- g_autoptr(GVariant) new_summary_commit = NULL;
-
- if (!ostree_repo_resolve_rev (repo, OSTREE_REPO_METADATA_REF,
- TRUE, &old_ostree_metadata_checksum, error))
- return FALSE;
-
- /* Add bindings to the metadata. */
- new_summary_commit_dict = g_variant_dict_new (additional_metadata);
- g_variant_dict_insert (new_summary_commit_dict, OSTREE_COMMIT_META_KEY_COLLECTION_BINDING,
- "s", collection_ref.collection_id);
- g_variant_dict_insert_value (new_summary_commit_dict, OSTREE_COMMIT_META_KEY_REF_BINDING,
- g_variant_new_strv ((const gchar * const *) &collection_ref.ref_name, 1));
- new_summary_commit = g_variant_dict_end (new_summary_commit_dict);
-
- if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
- return FALSE;
-
- /* Set up an empty mtree. */
- mtree = ostree_mutable_tree_new ();
-
- glnx_unref_object GFileInfo *fi = g_file_info_new ();
- g_file_info_set_attribute_uint32 (fi, "unix::uid", 0);
- g_file_info_set_attribute_uint32 (fi, "unix::gid", 0);
- g_file_info_set_attribute_uint32 (fi, "unix::mode", (0755 | S_IFDIR));
-
- g_autofree guchar *csum_raw = NULL;
- g_autofree char *csum = NULL;
-
- g_autoptr(GVariant) dirmeta = ostree_create_directory_metadata (fi, NULL /* xattrs */);
-
- if (!ostree_repo_write_metadata (repo, OSTREE_OBJECT_TYPE_DIR_META, NULL,
- dirmeta, &csum_raw, cancellable, error))
- return FALSE;
-
- csum = ostree_checksum_from_bytes (csum_raw);
- ostree_mutable_tree_set_metadata_checksum (mtree, csum);
-
- if (!ostree_repo_write_mtree (repo, mtree, (GFile **) &repo_file, NULL, error))
- return FALSE;
-
- if (!ostree_repo_write_commit (repo, old_ostree_metadata_checksum,
- NULL /* subject */, NULL /* body */,
- new_summary_commit, repo_file, &new_ostree_metadata_checksum,
- NULL, error))
- return FALSE;
- if (opt_gpg_key_ids != NULL)
- {
- for (const char * const *iter = (const char * const *) opt_gpg_key_ids;
- iter != NULL && *iter != NULL; iter++)
- {
- const char *key_id = *iter;
-
- if (!ostree_repo_sign_commit (repo,
- new_ostree_metadata_checksum,
- key_id,
- opt_gpg_homedir,
- cancellable,
- error))
- return FALSE;
- }
- }
+ g_auto(GVariantBuilder) sk_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_ARRAY);
- if (opt_key_ids)
+ /* Currently only strings are used as keys for supported
+ * signature types. */
+ for (const char * const *iter = (const char * const *) opt_key_ids;
+ iter != NULL && *iter != NULL; iter++)
{
- char **iter;
- for (iter = opt_key_ids; iter && *iter; iter++)
- {
- const char *keyid = *iter;
- g_autoptr (GVariant) secret_key = NULL;
-
- secret_key = g_variant_new_string (keyid);
- if (!ostree_sign_set_sk (sign, secret_key, error))
- return FALSE;
-
- if (!ostree_sign_commit (sign,
- repo,
- new_ostree_metadata_checksum,
- cancellable,
- error))
- return FALSE;
- }
+ const char *key_id = *iter;
+ g_variant_builder_add (&sk_builder, "v", g_variant_new_string (key_id));
}
- ostree_repo_transaction_set_collection_ref (repo, &collection_ref,
- new_ostree_metadata_checksum);
-
- if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
- return FALSE;
+ g_variant_builder_add (&metadata_opts_builder, "{sv}", "sign-keys",
+ g_variant_builder_end (&sk_builder));
}
+ if (opt_sign_name != NULL)
+ g_variant_builder_add (&metadata_opts_builder, "{sv}", "sign-type",
+ g_variant_new_string (opt_sign_name));
- /* Regenerate and sign the conventional summary file. */
- if (!ostree_repo_regenerate_summary (repo, additional_metadata, cancellable, error))
+ metadata_opts = g_variant_ref_sink (g_variant_builder_end (&metadata_opts_builder));
+ if (!ostree_repo_regenerate_metadata (repo, additional_metadata, metadata_opts,
+ cancellable, error))
return FALSE;
-
-#ifndef OSTREE_DISABLE_GPGME
- if (opt_gpg_key_ids)
- {
- if (!ostree_repo_add_gpg_signature_summary (repo,
- (const gchar **) opt_gpg_key_ids,
- opt_gpg_homedir,
- cancellable,
- error))
- return FALSE;
- }
-#endif
- if (opt_key_ids)
- {
- g_autoptr (GVariant) secret_keys = NULL;
- g_autoptr (GVariantBuilder) sk_builder = NULL;
-
- sk_builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
-
- char **iter;
- for (iter = opt_key_ids; iter && *iter; iter++)
- {
- const char *keyid = *iter;
- GVariant *secret_key = NULL;
-
- /* Currently only strings are used as keys
- * for supported signature types */
- secret_key = g_variant_new_string (keyid);
-
- g_variant_builder_add (sk_builder, "v", secret_key);
- }
-
- secret_keys = g_variant_builder_end (sk_builder);
-
- if (! ostree_sign_summary (sign,
- repo,
- secret_keys,
- cancellable,
- error))
- return FALSE;
- }
}
else if (opt_view || opt_raw)
{
diff --git a/src/ostree/ot-editor.c b/src/ostree/ot-editor.c
index f6e8e6a6..706a5299 100644
--- a/src/ostree/ot-editor.c
+++ b/src/ostree/ot-editor.c
@@ -91,7 +91,7 @@ ot_editor_prompt (OstreeRepo *repo,
args = g_strconcat (editor, " ", quoted_file, NULL);
}
- proc = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_INHERIT, error,
+ proc = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_INHERIT, error,
"/bin/sh", "-c", args, NULL);
if (!g_subprocess_wait_check (proc, cancellable, error))
diff --git a/src/switchroot/ostree-remount.c b/src/switchroot/ostree-remount.c
index 4044b5ac..a81c1b41 100644
--- a/src/switchroot/ostree-remount.c
+++ b/src/switchroot/ostree-remount.c
@@ -70,7 +70,7 @@ do_remount (const char *target,
/* Also ignore EINVAL - if the target isn't a mountpoint
* already, then assume things are OK.
*/
- if (errno != EINVAL)
+ if (errno != EINVAL)
err (EXIT_FAILURE, "failed to remount(%s) %s", writable ? "rw" : "ro", target);
else
return;
diff --git a/tests/test-basic-c.c b/tests/test-basic-c.c
index fc995298..99e1c547 100644
--- a/tests/test-basic-c.c
+++ b/tests/test-basic-c.c
@@ -512,7 +512,7 @@ test_read_xattrs (void)
{
g_autoptr(GVariant) current_xattrs = ostree_fs_get_all_xattrs (tmpd.fd, NULL, error);
g_assert_no_error (local_error);
-
+
int r = fsetxattr (tmpd.fd, "user.ostreetesting", value, sizeof (value), 0);
if (r != 0)
@@ -525,7 +525,7 @@ test_read_xattrs (void)
g_autoptr(GVariant) new_xattrs = ostree_fs_get_all_xattrs (tmpd.fd, NULL, error);
g_assert_no_error (local_error);
-
+
compare_xattrs (current_xattrs, new_xattrs);
}
@@ -546,10 +546,10 @@ test_read_xattrs (void)
// if (r < 0)
// glnx_throw_errno_prefix (error, "lsetxattr");
// g_assert_no_error (local_error);
-
+
// g_autoptr(GVariant) new_xattrs = ostree_fs_get_all_xattrs_at (tmpd.fd, "somelink", NULL, error);
// g_assert_no_error (local_error);
-
+
// compare_xattrs (current_xattrs, new_xattrs);
}
}
diff --git a/tests/test-commit-sign-sh-ext.c b/tests/test-commit-sign-sh-ext.c
index 22b6deca..c11bd0f1 100644
--- a/tests/test-commit-sign-sh-ext.c
+++ b/tests/test-commit-sign-sh-ext.c
@@ -73,31 +73,31 @@ run (GError **error)
g_autoptr(GBytes) commit_bytes = g_variant_get_data_as_bytes (commit);
g_autoptr(GBytes) detached_meta_bytes = g_variant_get_data_as_bytes (detached_meta);
g_autofree char *verify_report = NULL;
- if (!ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes, 0,
+ if (!ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes, 0,
&verify_report, error))
return FALSE;
- if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes,
- OSTREE_REPO_VERIFY_FLAGS_NO_GPG | OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI,
+ if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, detached_meta_bytes,
+ OSTREE_REPO_VERIFY_FLAGS_NO_GPG | OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI,
&verify_report, error))
return glnx_throw (error, "Should not have validated");
assert_error_contains (error, "No commit verification types enabled");
// No signatures
g_autoptr(GBytes) empty = g_bytes_new_static ("", 0);
- if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, empty, 0,
+ if (ostree_repo_signature_verify_commit_data (repo, "origin", commit_bytes, empty, 0,
&verify_report, error))
return glnx_throw (error, "Should not have validated");
assert_error_contains (error, "no signatures found");
// No such remote
- if (ostree_repo_signature_verify_commit_data (repo, "nosuchremote", commit_bytes, detached_meta_bytes, 0,
+ if (ostree_repo_signature_verify_commit_data (repo, "nosuchremote", commit_bytes, detached_meta_bytes, 0,
&verify_report, error))
return glnx_throw (error, "Should not have validated");
assert_error_contains (error, "Remote \"nosuchremote\" not found");
// Corrupted commit
g_autoptr(GBytes) corrupted_commit = corrupt (commit_bytes);
- if (ostree_repo_signature_verify_commit_data (repo, "origin", corrupted_commit, detached_meta_bytes, 0,
+ if (ostree_repo_signature_verify_commit_data (repo, "origin", corrupted_commit, detached_meta_bytes, 0,
&verify_report, error))
return glnx_throw (error, "Should not have validated");
assert_error_contains (error, "BAD signature");
diff --git a/tests/test-libarchive-import.c b/tests/test-libarchive-import.c
index 716aa306..a89fcc24 100644
--- a/tests/test-libarchive-import.c
+++ b/tests/test-libarchive-import.c
@@ -54,7 +54,7 @@ test_data_init (TestData *td)
g_assert_no_error (error);
g_assert (td->fd >= 0);
-
+
g_assert_cmpint (0, ==, archive_write_set_format_pax (a));
g_assert_cmpint (0, ==, archive_write_add_filter_gzip (a));
g_assert_cmpint (0, ==, archive_write_open_fd (a, td->fd));
diff --git a/tests/test-pull-c.c b/tests/test-pull-c.c
index 3957e43b..037a1789 100644
--- a/tests/test-pull-c.c
+++ b/tests/test-pull-c.c
@@ -81,7 +81,7 @@ test_pull_multi_nochange (gconstpointer data)
goto out;
if (!ostree_repo_pull (td->repo, "origin", (char**)&refs, 0, NULL, NULL, error))
goto out;
-
+
out:
g_assert_no_error (local_error);
}
@@ -91,7 +91,7 @@ test_pull_multi_error_then_ok (gconstpointer data)
{
GError *local_error = NULL;
GError **error = &local_error;
-
+
TestData *td = (void*)data;
char *ok_refs[] = { "main", NULL };
char *bad_refs[] = { "nosuchbranch", NULL };
@@ -110,7 +110,7 @@ test_pull_multi_error_then_ok (gconstpointer data)
if (!ostree_repo_pull (td->repo, "origin", (char**)&ok_refs, 0, NULL, NULL, error))
goto out;
}
-
+
out:
g_assert_no_error (local_error);
}
diff --git a/tests/test-repo.c b/tests/test-repo.c
index 4a7a44a0..b8365ea9 100644
--- a/tests/test-repo.c
+++ b/tests/test-repo.c
@@ -245,13 +245,13 @@ test_write_regfile_api (Fixture *fixture,
g_clear_pointer (&checksum, g_free);
// Invalid checksum
- checksum = ostree_repo_write_regfile_inline (repo, "3272139f889f6a7007b3d64adc74be9e2979bf6bbe663d1512e5bd43f4de24a1",
+ checksum = ostree_repo_write_regfile_inline (repo, "3272139f889f6a7007b3d64adc74be9e2979bf6bbe663d1512e5bd43f4de24a1",
0, 0, S_IFREG | 0644, NULL, (const guint8*)contents, sizeof (contents)-1, NULL, &error);
g_assert (checksum == NULL);
g_assert (error != NULL);
g_clear_error (&error);
-
- // Now with xattrs
+
+ // Now with xattrs
g_clear_pointer (&checksum, g_free);
checksum = ostree_repo_write_regfile_inline (repo, NULL, 0, 0, S_IFREG | 0644, xattrs, (const guint8*)contents, sizeof (contents)-1, NULL, &error);
g_assert_no_error (error);
diff --git a/tests/test-sysroot-c.c b/tests/test-sysroot-c.c
index 2b1fc710..82b4b1bf 100644
--- a/tests/test-sysroot-c.c
+++ b/tests/test-sysroot-c.c
@@ -77,10 +77,10 @@ int main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
- sysroot = ot_test_setup_sysroot (NULL, &error);
+ sysroot = ot_test_setup_sysroot (NULL, &error);
if (!sysroot)
goto out;
-
+
g_test_add_data_func ("/sysroot-reload", sysroot, test_sysroot_reload);
return g_test_run();