summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml4
-rw-r--r--Makefile-libostree.am7
-rw-r--r--Makefile-tests.am2
-rw-r--r--apidoc/ostree-sections.txt1
-rw-r--r--bash/ostree20
-rw-r--r--configure.ac4
-rw-r--r--docs/_config.yml2
m---------libglnx0
-rw-r--r--man/ostree-find-remotes.xml8
-rw-r--r--man/ostree-pull.xml8
-rw-r--r--man/ostree-refs.xml9
-rw-r--r--man/ostree-remote.xml33
-rw-r--r--man/ostree-show.xml16
-rw-r--r--man/ostree.repo-config.xml9
-rw-r--r--rust-bindings/conf/ostree.toml2
-rw-r--r--rust-bindings/src/auto/bootconfig_parser.rs2
-rw-r--r--rust-bindings/src/auto/collection_ref.rs2
-rw-r--r--rust-bindings/src/auto/deployment.rs12
-rw-r--r--rust-bindings/src/auto/functions.rs16
-rw-r--r--rust-bindings/src/auto/gpg_verify_result.rs4
-rw-r--r--rust-bindings/src/auto/mutable_tree.rs6
-rw-r--r--rust-bindings/src/auto/remote.rs12
-rw-r--r--rust-bindings/src/auto/repo.rs26
-rw-r--r--rust-bindings/src/auto/repo_file.rs14
-rw-r--r--rust-bindings/src/auto/se_policy.rs17
-rw-r--r--rust-bindings/src/auto/sign.rs12
-rw-r--r--rust-bindings/src/auto/sysroot.rs18
-rw-r--r--rust-bindings/src/auto/versions.txt2
-rw-r--r--rust-bindings/src/collection_ref.rs6
-rw-r--r--rust-bindings/src/object_name.rs4
-rw-r--r--rust-bindings/src/sysroot.rs4
-rw-r--r--rust-bindings/src/tests/collection_ref.rs38
-rw-r--r--rust-bindings/sys/Cargo.toml6
-rw-r--r--rust-bindings/sys/src/auto/versions.txt2
-rw-r--r--rust-bindings/sys/src/lib.rs33
-rw-r--r--rust-bindings/tests/sign/mod.rs4
-rw-r--r--src/libostree/bupsplit.c12
-rw-r--r--src/libostree/bupsplit.h12
-rw-r--r--src/libostree/libostree-released.sym5
-rw-r--r--src/libostree/ostree-async-progress.c8
-rw-r--r--src/libostree/ostree-bootconfig-parser.c20
-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-core.c17
-rw-r--r--src/libostree/ostree-deployment.c11
-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-fetcher-util.c4
-rw-r--r--src/libostree/ostree-kernel-args.c10
-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-mutable-tree.c10
-rw-r--r--src/libostree/ostree-ref.c8
-rw-r--r--src/libostree/ostree-ref.h2
-rw-r--r--src/libostree/ostree-remote.c2
-rw-r--r--src/libostree/ostree-repo-commit.c125
-rw-r--r--src/libostree/ostree-repo-file-enumerator.c8
-rw-r--r--src/libostree/ostree-repo-file.c79
-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.h9
-rw-r--r--src/libostree/ostree-repo-prune.c12
-rw-r--r--src/libostree/ostree-repo-pull-verify.c4
-rw-r--r--src/libostree/ostree-repo-pull.c13
-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.c376
-rw-r--r--src/libostree/ostree-repo.h21
-rw-r--r--src/libostree/ostree-rollsum.c8
-rw-r--r--src/libostree/ostree-sepolicy.c13
-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.c52
-rw-r--r--src/libostree/ostree-sysroot-upgrader.c6
-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-fs-utils.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-refs.c52
-rw-r--r--src/ostree/ot-builtin-rev-parse.c2
-rw-r--r--src/ostree/ot-builtin-show.c77
-rw-r--r--src/ostree/ot-builtin-summary.c211
-rw-r--r--src/ostree/ot-dump.c60
-rw-r--r--src/ostree/ot-dump.h6
-rw-r--r--src/ostree/ot-editor.c2
-rw-r--r--src/ostree/ot-remote-builtin-refs.c14
-rw-r--r--src/ostree/ot-remote-builtin-summary.c78
-rw-r--r--src/switchroot/ostree-remount.c2
-rw-r--r--tests/basic-test.sh7
-rwxr-xr-xtests/kolainst/nondestructive/itest-pull-space.sh8
-rwxr-xr-xtests/libtest.sh3
-rwxr-xr-xtests/test-admin-deploy-bootprefix.sh35
-rw-r--r--tests/test-basic-c.c12
-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
-rwxr-xr-xtests/test-pull-summary-sigs.sh10
-rwxr-xr-xtests/test-refs.sh12
-rwxr-xr-xtests/test-remote-refs.sh49
-rw-r--r--tests/test-repo-finder-mount.c2
-rw-r--r--tests/test-repo.c6
-rwxr-xr-xtests/test-signed-pull-summary.sh10
-rwxr-xr-xtests/test-summary-update.sh4
-rwxr-xr-xtests/test-symbols.sh2
-rw-r--r--tests/test-sysroot-c.c4
137 files changed, 1526 insertions, 690 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 726cf10b..d6d62534 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,7 +9,7 @@ name = "ostree"
readme = "rust-bindings/README.md"
repository = "https://github.com/ostreedev/ostree"
rust-version = "1.63.0"
-version = "0.17.0"
+version = "0.18.0"
exclude = [
"/*.am", "/apidoc", "/autogen.sh", "/bash", "/bsdiff",
@@ -42,7 +42,7 @@ base64 = "0.20.0"
bitflags = "1.2.1"
cap-std = { version = "1.0", optional = true}
io-lifetimes = { version = "1.0", optional = true}
-ffi = { package = "ostree-sys", path = "rust-bindings/sys", version = "0.12.0" }
+ffi = { package = "ostree-sys", path = "rust-bindings/sys", version = "0.13.0" }
gio = "0.16"
glib = "0.16"
hex = "0.4.2"
diff --git a/Makefile-libostree.am b/Makefile-libostree.am
index 578c7091..52ea49d4 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/Makefile-tests.am b/Makefile-tests.am
index 470eec25..a30b86dd 100644
--- a/Makefile-tests.am
+++ b/Makefile-tests.am
@@ -68,6 +68,7 @@ _installed_or_uninstalled_test_scripts = \
tests/test-archivez.sh \
tests/test-remote-add.sh \
tests/test-remote-headers.sh \
+ tests/test-remote-refs.sh \
tests/test-commit-sign.sh \
tests/test-commit-timestamp.sh \
tests/test-export.sh \
@@ -98,6 +99,7 @@ _installed_or_uninstalled_test_scripts = \
tests/test-admin-upgrade-endoflife.sh \
tests/test-admin-upgrade-systemd-update.sh \
tests/test-admin-deploy-syslinux.sh \
+ tests/test-admin-deploy-bootprefix.sh \
tests/test-admin-deploy-2.sh \
tests/test-admin-deploy-karg.sh \
tests/test-admin-deploy-switch.sh \
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/bash/ostree b/bash/ostree
index 6f3b86ea..875b34ff 100644
--- a/bash/ostree
+++ b/bash/ostree
@@ -900,7 +900,6 @@ _ostree_pull() {
local boolean_options="
$main_boolean_options
--commit-metadata-only
- --cache-dir
--disable-fsync
--disable-static-deltas
--require-static-deltas
@@ -912,6 +911,7 @@ _ostree_pull() {
"
local options_with_args="
+ --cache-dir
--depth
--http-header
--localcache-repo -L
@@ -925,7 +925,7 @@ _ostree_pull() {
local options_with_args_glob=$( __ostree_to_extglob "$options_with_args" )
case "$prev" in
- --localcache-repo|-L|--repo|--subpath)
+ --cache-dir|--localcache-repo|-L|--repo|--subpath)
__ostree_compreply_dirs_only
return 0
;;
@@ -953,6 +953,7 @@ _ostree_pull() {
_ostree_refs() {
local boolean_options="
$main_boolean_options
+ --revision -r
--alias -A
--collections -c
--delete
@@ -1274,17 +1275,18 @@ _ostree_remote_list_gpg_keys() {
_ostree_remote_refs() {
local boolean_options="
$main_boolean_options
- --cache-dir
+ --revision -r
"
local options_with_args="
+ --cache-dir
--repo
"
local options_with_args_glob=$( __ostree_to_extglob "$options_with_args" )
case "$prev" in
- --repo)
+ --cache-dir|--repo)
__ostree_compreply_dirs_only
return 0
;;
@@ -1343,18 +1345,20 @@ _ostree_remote_show_url() {
_ostree_remote_summary() {
local boolean_options="
$main_boolean_options
- --cache-dir
+ --list-metadata-keys
--raw
"
local options_with_args="
+ --cache-dir
+ --print-metadata-key
--repo
"
local options_with_args_glob=$( __ostree_to_extglob "$options_with_args" )
case "$prev" in
- --repo)
+ --cache-dir|--repo)
__ostree_compreply_dirs_only
return 0
;;
@@ -1484,6 +1488,8 @@ _ostree_rev_parse() {
_ostree_show() {
local boolean_options="
$main_boolean_options
+ --list-detached-metadata-keys
+ --list-metadata-keys
--print-related
--print-sizes
--raw
@@ -1812,6 +1818,7 @@ _ostree_static_delta() {
_ostree_summary() {
local boolean_options="
$main_boolean_options
+ --list-metadata-keys
--raw
--update -u
--view -v
@@ -1821,6 +1828,7 @@ _ostree_summary() {
--add-metadata -m
--gpg-homedir
--gpg-sign
+ --print-metadata-key
--repo
"
diff --git a/configure.ac b/configure.ac
index 7406c247..350df344 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
AC_PREREQ([2.63])
dnl To perform a release, follow the instructions in `docs/CONTRIBUTING.md`.
-m4_define([year_version], [2022])
-m4_define([release_version], [8])
+m4_define([year_version], [2023])
+m4_define([release_version], [2])
m4_define([package_version], [year_version.release_version])
AC_INIT([libostree], [package_version], [walters@verbum.org])
is_release_build=no
diff --git a/docs/_config.yml b/docs/_config.yml
index 991d2adc..4af7c390 100644
--- a/docs/_config.yml
+++ b/docs/_config.yml
@@ -24,7 +24,7 @@ exclude:
# prep-docs.sh before jekyll to put it in place.
include: [reference, man]
-remote_theme: coreos/just-the-docs
+remote_theme: just-the-docs/just-the-docs@v0.4.1
plugins:
- jekyll-remote-theme
diff --git a/libglnx b/libglnx
-Subproject 4e44fd9c174e4196a86fb6d954722feaff612c8
+Subproject 07e3e49d3e47dfd4265ffb5495111439131715c
diff --git a/man/ostree-find-remotes.xml b/man/ostree-find-remotes.xml
index 5c5b2412..eee0d123 100644
--- a/man/ostree-find-remotes.xml
+++ b/man/ostree-find-remotes.xml
@@ -87,6 +87,14 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
<variablelist>
<varlistentry>
+ <term><option>--cache-dir</option>=DIR</term>
+
+ <listitem><para>
+ Use an alternate cache directory in <literal>DIR</literal>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--disable-fsync</option></term>
<listitem><para>
diff --git a/man/ostree-pull.xml b/man/ostree-pull.xml
index 0915dd27..b86987ba 100644
--- a/man/ostree-pull.xml
+++ b/man/ostree-pull.xml
@@ -66,6 +66,14 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
+ <term><option>--cache-dir</option>=DIR</term>
+
+ <listitem><para>
+ Use an alternate cache directory in <literal>DIR</literal>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--disable-fsync</option></term>
<listitem><para>
diff --git a/man/ostree-refs.xml b/man/ostree-refs.xml
index 97d69fd7..b54039a3 100644
--- a/man/ostree-refs.xml
+++ b/man/ostree-refs.xml
@@ -99,6 +99,15 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
+ <term><option>--revision</option>, <option>-r</option></term>
+
+ <listitem><para>
+ When listing refs, also print their revisions. The revisions
+ will be separated by a tab character.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--alias</option>, <option>-A</option></term>
<listitem><para>
diff --git a/man/ostree-remote.xml b/man/ostree-remote.xml
index b14fc6d4..d107ce91 100644
--- a/man/ostree-remote.xml
+++ b/man/ostree-remote.xml
@@ -195,6 +195,31 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</refsect1>
<refsect1>
+ <title>'Refs' Options</title>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--revision</option>, <option>-r</option></term>
+
+ <listitem><para>
+ Also print the revisions for each ref. The revisions will
+ be separated by a tab character.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+
+ <variablelist>
+ <varlistentry>
+ <term><option>--cache-dir</option>=DIR</term>
+
+ <listitem><para>
+ Use an alternate cache directory in <literal>DIR</literal>.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1>
<title>'GPG-Import' Options</title>
<variablelist>
@@ -227,6 +252,14 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
<variablelist>
<varlistentry>
+ <term><option>--cache-dir</option>=DIR</term>
+
+ <listitem><para>
+ Use an alternate cache directory in <literal>DIR</literal>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--raw</option></term>
<listitem><para>
diff --git a/man/ostree-show.xml b/man/ostree-show.xml
index 4495b1e6..8d134cc4 100644
--- a/man/ostree-show.xml
+++ b/man/ostree-show.xml
@@ -82,6 +82,14 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
+ <term><option>--list-metadata-keys</option></term>
+
+ <listitem><para>
+ List the available metadata keys.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--print-metadata-key</option>="KEY"</term>
<listitem><para>
@@ -90,6 +98,14 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</varlistentry>
<varlistentry>
+ <term><option>--list-detached-metadata-keys</option></term>
+
+ <listitem><para>
+ List the available detached metadata keys.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>--print-detached-metadata-key</option>="KEY"</term>
<listitem><para>
diff --git a/man/ostree.repo-config.xml b/man/ostree.repo-config.xml
index 5afeac8a..5e6d9d89 100644
--- a/man/ostree.repo-config.xml
+++ b/man/ostree.repo-config.xml
@@ -415,6 +415,15 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><varname>bootprefix</varname></term>
+ <listitem><para>A boolean value; defaults to false. If set to true, the bootloader entries
+ generated will include <literal>/boot</literal> as a prefix. This will likely be turned
+ on by default in the future.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
diff --git a/rust-bindings/conf/ostree.toml b/rust-bindings/conf/ostree.toml
index b0f0f60f..57314db4 100644
--- a/rust-bindings/conf/ostree.toml
+++ b/rust-bindings/conf/ostree.toml
@@ -11,6 +11,7 @@ target_path = ".."
doc_target_path = "../target/vendor.md"
deprecate_by_min_version = true
single_version_file = true
+trust_return_value_nullability = true
generate_display_trait = true
girs_directories = [ "../gir-files" ]
@@ -217,6 +218,7 @@ status = "generate"
[[object]]
name = "OSTree.Sysroot"
status = "generate"
+concurrency = "send"
[[object.function]]
name = "deploy_tree_with_options"
[[object.function.parameter]]
diff --git a/rust-bindings/src/auto/bootconfig_parser.rs b/rust-bindings/src/auto/bootconfig_parser.rs
index 042824c3..0f59255f 100644
--- a/rust-bindings/src/auto/bootconfig_parser.rs
+++ b/rust-bindings/src/auto/bootconfig_parser.rs
@@ -26,7 +26,7 @@ impl BootconfigParser {
#[doc(alias = "ostree_bootconfig_parser_clone")]
#[must_use]
- pub fn clone(&self) -> Option<BootconfigParser> {
+ pub fn clone(&self) -> BootconfigParser {
unsafe {
from_glib_full(ffi::ostree_bootconfig_parser_clone(self.to_glib_none().0))
}
diff --git a/rust-bindings/src/auto/collection_ref.rs b/rust-bindings/src/auto/collection_ref.rs
index 603b0156..cb3bf409 100644
--- a/rust-bindings/src/auto/collection_ref.rs
+++ b/rust-bindings/src/auto/collection_ref.rs
@@ -18,7 +18,7 @@ glib::wrapper! {
impl CollectionRef {
#[doc(alias = "ostree_collection_ref_new")]
- pub fn new(collection_id: Option<&str>, ref_name: &str) -> Option<CollectionRef> {
+ pub fn new(collection_id: Option<&str>, ref_name: &str) -> CollectionRef {
unsafe {
from_glib_full(ffi::ostree_collection_ref_new(collection_id.to_glib_none().0, ref_name.to_glib_none().0))
}
diff --git a/rust-bindings/src/auto/deployment.rs b/rust-bindings/src/auto/deployment.rs
index cba219c3..984bbb25 100644
--- a/rust-bindings/src/auto/deployment.rs
+++ b/rust-bindings/src/auto/deployment.rs
@@ -28,7 +28,7 @@ impl Deployment {
#[doc(alias = "ostree_deployment_clone")]
#[must_use]
- pub fn clone(&self) -> Option<Deployment> {
+ pub fn clone(&self) -> Deployment {
unsafe {
from_glib_full(ffi::ostree_deployment_clone(self.to_glib_none().0))
}
@@ -51,7 +51,7 @@ impl Deployment {
#[doc(alias = "ostree_deployment_get_bootcsum")]
#[doc(alias = "get_bootcsum")]
- pub fn bootcsum(&self) -> Option<glib::GString> {
+ pub fn bootcsum(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_deployment_get_bootcsum(self.to_glib_none().0))
}
@@ -67,7 +67,7 @@ impl Deployment {
#[doc(alias = "ostree_deployment_get_csum")]
#[doc(alias = "get_csum")]
- pub fn csum(&self) -> Option<glib::GString> {
+ pub fn csum(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_deployment_get_csum(self.to_glib_none().0))
}
@@ -99,7 +99,7 @@ impl Deployment {
#[doc(alias = "ostree_deployment_get_origin_relpath")]
#[doc(alias = "get_origin_relpath")]
- pub fn origin_relpath(&self) -> Option<glib::GString> {
+ pub fn origin_relpath(&self) -> glib::GString {
unsafe {
from_glib_full(ffi::ostree_deployment_get_origin_relpath(self.to_glib_none().0))
}
@@ -107,7 +107,7 @@ impl Deployment {
#[doc(alias = "ostree_deployment_get_osname")]
#[doc(alias = "get_osname")]
- pub fn osname(&self) -> Option<glib::GString> {
+ pub fn osname(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_deployment_get_osname(self.to_glib_none().0))
}
@@ -188,7 +188,7 @@ impl Deployment {
#[cfg(any(feature = "v2016_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))]
#[doc(alias = "ostree_deployment_unlocked_state_to_string")]
- pub fn unlocked_state_to_string(state: DeploymentUnlockedState) -> Option<glib::GString> {
+ pub fn unlocked_state_to_string(state: DeploymentUnlockedState) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_deployment_unlocked_state_to_string(state.into_glib()))
}
diff --git a/rust-bindings/src/auto/functions.rs b/rust-bindings/src/auto/functions.rs
index 26f9fd5a..9f895217 100644
--- a/rust-bindings/src/auto/functions.rs
+++ b/rust-bindings/src/auto/functions.rs
@@ -46,14 +46,14 @@ pub fn check_version(required_year: u32, required_release: u32) -> bool {
//}
#[doc(alias = "ostree_checksum_from_bytes_v")]
-pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option<glib::GString> {
+pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> glib::GString {
unsafe {
from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0))
}
}
#[doc(alias = "ostree_checksum_to_bytes_v")]
-pub fn checksum_to_bytes_v(checksum: &str) -> Option<glib::Variant> {
+pub fn checksum_to_bytes_v(checksum: &str) -> glib::Variant {
unsafe {
from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0))
}
@@ -82,7 +82,7 @@ pub fn commit_get_object_sizes(commit_variant: &glib::Variant) -> Result<Vec<Com
}
#[doc(alias = "ostree_commit_get_parent")]
-pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option<glib::GString> {
+pub fn commit_get_parent(commit_variant: &glib::Variant) -> glib::GString {
unsafe {
from_glib_full(ffi::ostree_commit_get_parent(commit_variant.to_glib_none().0))
}
@@ -144,7 +144,7 @@ pub fn content_stream_parse(compressed: bool, input: &impl IsA<gio::InputStream>
}
#[doc(alias = "ostree_create_directory_metadata")]
-pub fn create_directory_metadata(dir_info: &gio::FileInfo, xattrs: Option<&glib::Variant>) -> Option<glib::Variant> {
+pub fn create_directory_metadata(dir_info: &gio::FileInfo, xattrs: Option<&glib::Variant>) -> glib::Variant {
unsafe {
from_glib_full(ffi::ostree_create_directory_metadata(dir_info.to_glib_none().0, xattrs.to_glib_none().0))
}
@@ -202,7 +202,7 @@ pub fn gpg_error_quark() -> glib::Quark {
}
#[doc(alias = "ostree_metadata_variant_type")]
-pub fn metadata_variant_type(objtype: ObjectType) -> Option<glib::VariantType> {
+pub fn metadata_variant_type(objtype: ObjectType) -> glib::VariantType {
unsafe {
from_glib_none(ffi::ostree_metadata_variant_type(objtype.into_glib()))
}
@@ -229,14 +229,14 @@ pub fn object_name_deserialize(variant: &glib::Variant) -> (glib::GString, Objec
}
#[doc(alias = "ostree_object_name_serialize")]
-pub fn object_name_serialize(checksum: &str, objtype: ObjectType) -> Option<glib::Variant> {
+pub fn object_name_serialize(checksum: &str, objtype: ObjectType) -> glib::Variant {
unsafe {
from_glib_none(ffi::ostree_object_name_serialize(checksum.to_glib_none().0, objtype.into_glib()))
}
}
#[doc(alias = "ostree_object_to_string")]
-pub fn object_to_string(checksum: &str, objtype: ObjectType) -> Option<glib::GString> {
+pub fn object_to_string(checksum: &str, objtype: ObjectType) -> glib::GString {
unsafe {
from_glib_full(ffi::ostree_object_to_string(checksum.to_glib_none().0, objtype.into_glib()))
}
@@ -250,7 +250,7 @@ pub fn object_type_from_string(str: &str) -> ObjectType {
}
#[doc(alias = "ostree_object_type_to_string")]
-pub fn object_type_to_string(objtype: ObjectType) -> Option<glib::GString> {
+pub fn object_type_to_string(objtype: ObjectType) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_object_type_to_string(objtype.into_glib()))
}
diff --git a/rust-bindings/src/auto/gpg_verify_result.rs b/rust-bindings/src/auto/gpg_verify_result.rs
index 048037d9..f4c139fc 100644
--- a/rust-bindings/src/auto/gpg_verify_result.rs
+++ b/rust-bindings/src/auto/gpg_verify_result.rs
@@ -34,13 +34,13 @@ impl GpgVerifyResult {
}
//#[doc(alias = "ostree_gpg_verify_result_get")]
- //pub fn get(&self, signature_index: u32, attrs: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 28 }) -> Option<glib::Variant> {
+ //pub fn get(&self, signature_index: u32, attrs: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 29 }) -> glib::Variant {
// unsafe { TODO: call ffi:ostree_gpg_verify_result_get() }
//}
#[doc(alias = "ostree_gpg_verify_result_get_all")]
#[doc(alias = "get_all")]
- pub fn all(&self, signature_index: u32) -> Option<glib::Variant> {
+ pub fn all(&self, signature_index: u32) -> glib::Variant {
unsafe {
from_glib_none(ffi::ostree_gpg_verify_result_get_all(self.to_glib_none().0, signature_index))
}
diff --git a/rust-bindings/src/auto/mutable_tree.rs b/rust-bindings/src/auto/mutable_tree.rs
index ca3ba8d1..d70941c7 100644
--- a/rust-bindings/src/auto/mutable_tree.rs
+++ b/rust-bindings/src/auto/mutable_tree.rs
@@ -93,7 +93,7 @@ impl MutableTree {
#[doc(alias = "ostree_mutable_tree_get_contents_checksum")]
#[doc(alias = "get_contents_checksum")]
- pub fn contents_checksum(&self) -> Option<glib::GString> {
+ pub fn contents_checksum(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum(self.to_glib_none().0))
}
@@ -107,7 +107,7 @@ impl MutableTree {
#[doc(alias = "ostree_mutable_tree_get_metadata_checksum")]
#[doc(alias = "get_metadata_checksum")]
- pub fn metadata_checksum(&self) -> Option<glib::GString> {
+ pub fn metadata_checksum(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum(self.to_glib_none().0))
}
@@ -115,7 +115,7 @@ impl MutableTree {
//#[doc(alias = "ostree_mutable_tree_get_subdirs")]
//#[doc(alias = "get_subdirs")]
- //pub fn subdirs(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 1, id: 41 } {
+ //pub fn subdirs(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 1, id: 42 } {
// unsafe { TODO: call ffi:ostree_mutable_tree_get_subdirs() }
//}
diff --git a/rust-bindings/src/auto/remote.rs b/rust-bindings/src/auto/remote.rs
index 95939f25..9b80a8c3 100644
--- a/rust-bindings/src/auto/remote.rs
+++ b/rust-bindings/src/auto/remote.rs
@@ -3,6 +3,7 @@
// DO NOT EDIT
use glib::translate::*;
+use std::fmt;
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -18,7 +19,7 @@ glib::wrapper! {
impl Remote {
#[doc(alias = "ostree_remote_get_name")]
#[doc(alias = "get_name")]
- pub fn name(&self) -> Option<glib::GString> {
+ pub fn name(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0))
}
@@ -26,9 +27,16 @@ impl Remote {
#[doc(alias = "ostree_remote_get_url")]
#[doc(alias = "get_url")]
- pub fn url(&self) -> Option<glib::GString> {
+ pub fn url(&self) -> glib::GString {
unsafe {
from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0))
}
}
}
+
+impl fmt::Display for Remote {
+ #[inline]
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.write_str(&self.name())
+ }
+}
diff --git a/rust-bindings/src/auto/repo.rs b/rust-bindings/src/auto/repo.rs
index 3d9bf74a..39bead09 100644
--- a/rust-bindings/src/auto/repo.rs
+++ b/rust-bindings/src/auto/repo.rs
@@ -161,7 +161,7 @@ impl Repo {
}
#[doc(alias = "ostree_repo_copy_config")]
- pub fn copy_config(&self) -> Option<glib::KeyFile> {
+ pub fn copy_config(&self) -> glib::KeyFile {
unsafe {
from_glib_full(ffi::ostree_repo_copy_config(self.to_glib_none().0))
}
@@ -217,7 +217,7 @@ impl Repo {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_2")))]
#[doc(alias = "ostree_repo_get_bootloader")]
#[doc(alias = "get_bootloader")]
- pub fn bootloader(&self) -> Option<glib::GString> {
+ pub fn bootloader(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_repo_get_bootloader(self.to_glib_none().0))
}
@@ -235,7 +235,7 @@ impl Repo {
#[doc(alias = "ostree_repo_get_config")]
#[doc(alias = "get_config")]
- pub fn config(&self) -> Option<glib::KeyFile> {
+ pub fn config(&self) -> glib::KeyFile {
unsafe {
from_glib_none(ffi::ostree_repo_get_config(self.to_glib_none().0))
}
@@ -302,7 +302,7 @@ impl Repo {
#[doc(alias = "ostree_repo_get_path")]
#[doc(alias = "get_path")]
- pub fn path(&self) -> Option<gio::File> {
+ pub fn path(&self) -> gio::File {
unsafe {
from_glib_none(ffi::ostree_repo_get_path(self.to_glib_none().0))
}
@@ -340,7 +340,7 @@ impl Repo {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))]
#[doc(alias = "ostree_repo_get_remote_option")]
#[doc(alias = "get_remote_option")]
- pub fn remote_option(&self, remote_name: &str, option_name: &str, default_value: Option<&str>) -> Result<glib::GString, glib::Error> {
+ pub fn remote_option(&self, remote_name: &str, option_name: &str, default_value: Option<&str>) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_value = ptr::null_mut();
let mut error = ptr::null_mut();
@@ -353,7 +353,7 @@ impl Repo {
#[cfg(any(feature = "v2020_8", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))]
#[doc(alias = "ostree_repo_gpg_sign_data")]
- pub fn gpg_sign_data(&self, data: &glib::Bytes, old_signatures: &glib::Bytes, key_id: &[&str], homedir: Option<&str>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<glib::Bytes, glib::Error> {
+ pub fn gpg_sign_data(&self, data: &glib::Bytes, old_signatures: Option<&glib::Bytes>, key_id: &[&str], homedir: Option<&str>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<glib::Bytes, glib::Error> {
unsafe {
let mut out_signatures = ptr::null_mut();
let mut error = ptr::null_mut();
@@ -687,6 +687,18 @@ impl Repo {
}
}
+ #[cfg(any(feature = "v2023_1", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2023_1")))]
+ #[doc(alias = "ostree_repo_regenerate_metadata")]
+ pub fn regenerate_metadata(&self, additional_metadata: Option<&glib::Variant>, options: Option<&glib::Variant>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
+ unsafe {
+ let mut error = ptr::null_mut();
+ let is_ok = ffi::ostree_repo_regenerate_metadata(self.to_glib_none().0, additional_metadata.to_glib_none().0, options.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
+ assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
+ if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
+ }
+ }
+
#[doc(alias = "ostree_repo_regenerate_summary")]
pub fn regenerate_summary(&self, additional_metadata: Option<&glib::Variant>, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<(), glib::Error> {
unsafe {
@@ -989,7 +1001,7 @@ impl Repo {
#[cfg(any(feature = "v2021_4", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))]
#[doc(alias = "ostree_repo_signature_verify_commit_data")]
- pub fn signature_verify_commit_data(&self, remote_name: &str, commit_data: &glib::Bytes, commit_metadata: &glib::Bytes, flags: RepoVerifyFlags) -> Result<Option<glib::GString>, glib::Error> {
+ pub fn signature_verify_commit_data(&self, remote_name: &str, commit_data: &glib::Bytes, commit_metadata: &glib::Bytes, flags: RepoVerifyFlags) -> Result<glib::GString, glib::Error> {
unsafe {
let mut out_results = ptr::null_mut();
let mut error = ptr::null_mut();
diff --git a/rust-bindings/src/auto/repo_file.rs b/rust-bindings/src/auto/repo_file.rs
index 3631c3ad..31fe363c 100644
--- a/rust-bindings/src/auto/repo_file.rs
+++ b/rust-bindings/src/auto/repo_file.rs
@@ -31,7 +31,7 @@ impl RepoFile {
#[doc(alias = "ostree_repo_file_get_checksum")]
#[doc(alias = "get_checksum")]
- pub fn checksum(&self) -> Option<glib::GString> {
+ pub fn checksum(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_repo_file_get_checksum(self.to_glib_none().0))
}
@@ -39,7 +39,7 @@ impl RepoFile {
#[doc(alias = "ostree_repo_file_get_repo")]
#[doc(alias = "get_repo")]
- pub fn repo(&self) -> Option<Repo> {
+ pub fn repo(&self) -> Repo {
unsafe {
from_glib_none(ffi::ostree_repo_file_get_repo(self.to_glib_none().0))
}
@@ -48,7 +48,7 @@ impl RepoFile {
#[doc(alias = "ostree_repo_file_get_root")]
#[doc(alias = "get_root")]
#[must_use]
- pub fn root(&self) -> Option<RepoFile> {
+ pub fn root(&self) -> RepoFile {
unsafe {
from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0))
}
@@ -77,28 +77,28 @@ impl RepoFile {
}
#[doc(alias = "ostree_repo_file_tree_get_contents")]
- pub fn tree_get_contents(&self) -> Option<glib::Variant> {
+ pub fn tree_get_contents(&self) -> glib::Variant {
unsafe {
from_glib_full(ffi::ostree_repo_file_tree_get_contents(self.to_glib_none().0))
}
}
#[doc(alias = "ostree_repo_file_tree_get_contents_checksum")]
- pub fn tree_get_contents_checksum(&self) -> Option<glib::GString> {
+ pub fn tree_get_contents_checksum(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum(self.to_glib_none().0))
}
}
#[doc(alias = "ostree_repo_file_tree_get_metadata")]
- pub fn tree_get_metadata(&self) -> Option<glib::Variant> {
+ pub fn tree_get_metadata(&self) -> glib::Variant {
unsafe {
from_glib_full(ffi::ostree_repo_file_tree_get_metadata(self.to_glib_none().0))
}
}
#[doc(alias = "ostree_repo_file_tree_get_metadata_checksum")]
- pub fn tree_get_metadata_checksum(&self) -> Option<glib::GString> {
+ pub fn tree_get_metadata_checksum(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum(self.to_glib_none().0))
}
diff --git a/rust-bindings/src/auto/se_policy.rs b/rust-bindings/src/auto/se_policy.rs
index 386e5bee..13199326 100644
--- a/rust-bindings/src/auto/se_policy.rs
+++ b/rust-bindings/src/auto/se_policy.rs
@@ -55,7 +55,7 @@ impl SePolicy {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))]
#[doc(alias = "ostree_sepolicy_get_csum")]
#[doc(alias = "get_csum")]
- pub fn csum(&self) -> Option<glib::GString> {
+ pub fn csum(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_sepolicy_get_csum(self.to_glib_none().0))
}
@@ -63,7 +63,7 @@ impl SePolicy {
#[doc(alias = "ostree_sepolicy_get_label")]
#[doc(alias = "get_label")]
- pub fn label(&self, relpath: &str, unix_mode: u32, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<glib::GString, glib::Error> {
+ pub fn label(&self, relpath: &str, unix_mode: u32, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_label = ptr::null_mut();
let mut error = ptr::null_mut();
@@ -75,7 +75,7 @@ impl SePolicy {
#[doc(alias = "ostree_sepolicy_get_name")]
#[doc(alias = "get_name")]
- pub fn name(&self) -> Option<glib::GString> {
+ pub fn name(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0))
}
@@ -83,14 +83,14 @@ impl SePolicy {
#[doc(alias = "ostree_sepolicy_get_path")]
#[doc(alias = "get_path")]
- pub fn path(&self) -> Option<gio::File> {
+ pub fn path(&self) -> gio::File {
unsafe {
from_glib_none(ffi::ostree_sepolicy_get_path(self.to_glib_none().0))
}
}
#[doc(alias = "ostree_sepolicy_restorecon")]
- pub fn restorecon(&self, path: &str, info: Option<&gio::FileInfo>, target: &impl IsA<gio::File>, flags: SePolicyRestoreconFlags, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<glib::GString, glib::Error> {
+ pub fn restorecon(&self, path: &str, info: Option<&gio::FileInfo>, target: &impl IsA<gio::File>, flags: SePolicyRestoreconFlags, cancellable: Option<&impl IsA<gio::Cancellable>>) -> Result<Option<glib::GString>, glib::Error> {
unsafe {
let mut out_new_label = ptr::null_mut();
let mut error = ptr::null_mut();
@@ -116,10 +116,11 @@ impl SePolicy {
}
}
-unsafe impl Send for SePolicy {}
-
impl fmt::Display for SePolicy {
+ #[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.write_str("SePolicy")
+ f.write_str(&self.name())
}
}
+
+unsafe impl Send for SePolicy {}
diff --git a/rust-bindings/src/auto/sign.rs b/rust-bindings/src/auto/sign.rs
index 64b1da6c..90fa1ded 100644
--- a/rust-bindings/src/auto/sign.rs
+++ b/rust-bindings/src/auto/sign.rs
@@ -85,7 +85,7 @@ pub trait SignExt: 'static {
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_get_name")]
#[doc(alias = "get_name")]
- fn name(&self) -> Option<glib::GString>;
+ fn name(&self) -> glib::GString;
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
@@ -95,12 +95,12 @@ pub trait SignExt: 'static {
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_metadata_format")]
- fn metadata_format(&self) -> Option<glib::GString>;
+ fn metadata_format(&self) -> glib::GString;
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
#[doc(alias = "ostree_sign_metadata_key")]
- fn metadata_key(&self) -> Option<glib::GString>;
+ fn metadata_key(&self) -> glib::GString;
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
@@ -190,7 +190,7 @@ impl<O: IsA<Sign>> SignExt for O {
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
- fn name(&self) -> Option<glib::GString> {
+ fn name(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_sign_get_name(self.as_ref().to_glib_none().0))
}
@@ -209,7 +209,7 @@ impl<O: IsA<Sign>> SignExt for O {
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
- fn metadata_format(&self) -> Option<glib::GString> {
+ fn metadata_format(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_sign_metadata_format(self.as_ref().to_glib_none().0))
}
@@ -217,7 +217,7 @@ impl<O: IsA<Sign>> SignExt for O {
#[cfg(any(feature = "v2020_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))]
- fn metadata_key(&self) -> Option<glib::GString> {
+ fn metadata_key(&self) -> glib::GString {
unsafe {
from_glib_none(ffi::ostree_sign_metadata_key(self.as_ref().to_glib_none().0))
}
diff --git a/rust-bindings/src/auto/sysroot.rs b/rust-bindings/src/auto/sysroot.rs
index abb80387..020a8a1b 100644
--- a/rust-bindings/src/auto/sysroot.rs
+++ b/rust-bindings/src/auto/sysroot.rs
@@ -185,7 +185,7 @@ impl Sysroot {
#[doc(alias = "ostree_sysroot_get_deployment_directory")]
#[doc(alias = "get_deployment_directory")]
- pub fn deployment_directory(&self, deployment: &Deployment) -> Option<gio::File> {
+ pub fn deployment_directory(&self, deployment: &Deployment) -> gio::File {
unsafe {
from_glib_full(ffi::ostree_sysroot_get_deployment_directory(self.to_glib_none().0, deployment.to_glib_none().0))
}
@@ -193,7 +193,7 @@ impl Sysroot {
#[doc(alias = "ostree_sysroot_get_deployment_dirpath")]
#[doc(alias = "get_deployment_dirpath")]
- pub fn deployment_dirpath(&self, deployment: &Deployment) -> Option<glib::GString> {
+ pub fn deployment_dirpath(&self, deployment: &Deployment) -> glib::GString {
unsafe {
from_glib_full(ffi::ostree_sysroot_get_deployment_dirpath(self.to_glib_none().0, deployment.to_glib_none().0))
}
@@ -225,7 +225,7 @@ impl Sysroot {
#[doc(alias = "ostree_sysroot_get_path")]
#[doc(alias = "get_path")]
- pub fn path(&self) -> Option<gio::File> {
+ pub fn path(&self) -> gio::File {
unsafe {
from_glib_none(ffi::ostree_sysroot_get_path(self.to_glib_none().0))
}
@@ -369,7 +369,7 @@ impl Sysroot {
}
#[doc(alias = "ostree_sysroot_origin_new_from_refspec")]
- pub fn origin_new_from_refspec(&self, refspec: &str) -> Option<glib::KeyFile> {
+ pub fn origin_new_from_refspec(&self, refspec: &str) -> glib::KeyFile {
unsafe {
from_glib_full(ffi::ostree_sysroot_origin_new_from_refspec(self.to_glib_none().0, refspec.to_glib_none().0))
}
@@ -400,7 +400,7 @@ impl Sysroot {
#[cfg(any(feature = "v2017_7", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))]
#[doc(alias = "ostree_sysroot_repo")]
- pub fn repo(&self) -> Option<Repo> {
+ pub fn repo(&self) -> Repo {
unsafe {
from_glib_none(ffi::ostree_sysroot_repo(self.to_glib_none().0))
}
@@ -534,7 +534,7 @@ impl Sysroot {
#[doc(alias = "ostree_sysroot_get_deployment_origin_path")]
#[doc(alias = "get_deployment_origin_path")]
- pub fn deployment_origin_path(deployment_path: &impl IsA<gio::File>) -> Option<gio::File> {
+ pub fn deployment_origin_path(deployment_path: &impl IsA<gio::File>) -> gio::File {
unsafe {
from_glib_full(ffi::ostree_sysroot_get_deployment_origin_path(deployment_path.as_ref().to_glib_none().0))
}
@@ -543,8 +543,8 @@ impl Sysroot {
#[cfg(any(feature = "v2017_10", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))]
#[doc(alias = "journal-msg")]
- pub fn connect_journal_msg<F: Fn(&Self, &str) + 'static>(&self, f: F) -> SignalHandlerId {
- unsafe extern "C" fn journal_msg_trampoline<F: Fn(&Sysroot, &str) + 'static>(this: *mut ffi::OstreeSysroot, msg: *mut libc::c_char, f: glib::ffi::gpointer) {
+ pub fn connect_journal_msg<F: Fn(&Self, &str) + Send + 'static>(&self, f: F) -> SignalHandlerId {
+ unsafe extern "C" fn journal_msg_trampoline<F: Fn(&Sysroot, &str) + Send + 'static>(this: *mut ffi::OstreeSysroot, msg: *mut libc::c_char, f: glib::ffi::gpointer) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(msg))
}
@@ -556,6 +556,8 @@ impl Sysroot {
}
}
+unsafe impl Send for Sysroot {}
+
impl fmt::Display for Sysroot {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("Sysroot")
diff --git a/rust-bindings/src/auto/versions.txt b/rust-bindings/src/auto/versions.txt
index 97f80dcd..0e56c33d 100644
--- a/rust-bindings/src/auto/versions.txt
+++ b/rust-bindings/src/auto/versions.txt
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 0eeebbdf9d4d)
-from gir-files (@ 8c831311be59)
+from gir-files (@ 1b758c141dda)
diff --git a/rust-bindings/src/collection_ref.rs b/rust-bindings/src/collection_ref.rs
index 0fb28deb..47daaaca 100644
--- a/rust-bindings/src/collection_ref.rs
+++ b/rust-bindings/src/collection_ref.rs
@@ -54,7 +54,7 @@ mod tests {
#[test]
fn should_get_collection_id() {
- let collection_ref = CollectionRef::new(Some("collection.id"), "ref").unwrap();
+ let collection_ref = CollectionRef::new(Some("collection.id"), "ref");
let id = collection_ref.collection_id().unwrap().to_str().unwrap();
assert_eq!(id, "collection.id");
@@ -62,7 +62,7 @@ mod tests {
#[test]
fn should_get_none_collection_id() {
- let collection_ref = CollectionRef::new(None, "ref").unwrap();
+ let collection_ref = CollectionRef::new(None, "ref");
let id = collection_ref.collection_id();
assert_eq!(id, None);
@@ -70,7 +70,7 @@ mod tests {
#[test]
fn should_get_ref_name() {
- let collection_ref = CollectionRef::new(Some("collection.id"), "ref-name").unwrap();
+ let collection_ref = CollectionRef::new(Some("collection.id"), "ref-name");
let ref_name = collection_ref.ref_name().to_str().unwrap();
assert_eq!(ref_name, "ref-name");
diff --git a/rust-bindings/src/object_name.rs b/rust-bindings/src/object_name.rs
index d6071780..772b0d88 100644
--- a/rust-bindings/src/object_name.rs
+++ b/rust-bindings/src/object_name.rs
@@ -34,8 +34,7 @@ impl ObjectName {
/// Create a new `ObjectName` with the given checksum and `ObjectType`.
pub fn new<S: Into<GString>>(checksum: S, object_type: ObjectType) -> ObjectName {
let checksum = checksum.into();
- let variant = object_name_serialize(checksum.as_str(), object_type)
- .expect("type checks should make this safe");
+ let variant = object_name_serialize(checksum.as_str(), object_type);
ObjectName {
variant,
checksum,
@@ -56,7 +55,6 @@ impl ObjectName {
/// Format this `ObjectName` as a string.
fn to_string(&self) -> GString {
object_to_string(self.checksum(), self.object_type())
- .expect("type checks should make this safe")
}
}
diff --git a/rust-bindings/src/sysroot.rs b/rust-bindings/src/sysroot.rs
index d7b2b767..ea8c3cb1 100644
--- a/rust-bindings/src/sysroot.rs
+++ b/rust-bindings/src/sysroot.rs
@@ -85,7 +85,7 @@ mod tests {
assert_eq!(sysroot.subbootversion(), 0);
sysroot.cleanup(gio::Cancellable::NONE).unwrap();
- sysroot.path().unwrap()
+ sysroot.path()
};
let path_loaded = {
let tmp_path = Some(tmpdir.path().to_path_buf());
@@ -100,7 +100,7 @@ mod tests {
assert_eq!(sysroot.subbootversion(), 0);
sysroot.cleanup(gio::Cancellable::NONE).unwrap();
- sysroot.path().unwrap()
+ sysroot.path()
};
assert_eq!(path_created.to_string(), path_loaded.to_string());
}
diff --git a/rust-bindings/src/tests/collection_ref.rs b/rust-bindings/src/tests/collection_ref.rs
index b6bf050e..515bd385 100644
--- a/rust-bindings/src/tests/collection_ref.rs
+++ b/rust-bindings/src/tests/collection_ref.rs
@@ -12,68 +12,62 @@ fn hash(v: &impl Hash) -> u64 {
#[test]
fn same_value_should_be_equal() {
- let r = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
+ let r = CollectionRef::new(Some("io.gitlab.fkrull"), "ref");
assert_eq!(r, r);
}
#[test]
fn equal_values_should_be_equal() {
- let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
- let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
+ let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref");
+ let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref");
assert_eq!(a, b);
}
#[test]
fn equal_values_without_collection_id_should_be_equal() {
- let a = CollectionRef::new(None, "ref-name").unwrap();
- let b = CollectionRef::new(None, "ref-name").unwrap();
+ let a = CollectionRef::new(None, "ref-name");
+ let b = CollectionRef::new(None, "ref-name");
assert_eq!(a, b);
}
#[test]
fn different_values_should_not_be_equal() {
- let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref1").unwrap();
- let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref2").unwrap();
+ let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref1");
+ let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref2");
assert_ne!(a, b);
}
#[test]
-fn new_with_invalid_collection_id_should_return_none() {
- let r = CollectionRef::new(Some(".abc"), "ref");
- assert_eq!(r, None);
-}
-
-#[test]
fn hash_for_equal_values_should_be_equal() {
- let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
- let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
+ let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref");
+ let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref");
assert_eq!(hash(&a), hash(&b));
}
#[test]
fn hash_for_values_with_different_collection_id_should_be_different() {
- let a = CollectionRef::new(Some("io.gitlab.fkrull1"), "ref").unwrap();
- let b = CollectionRef::new(Some("io.gitlab.fkrull2"), "ref").unwrap();
+ let a = CollectionRef::new(Some("io.gitlab.fkrull1"), "ref");
+ let b = CollectionRef::new(Some("io.gitlab.fkrull2"), "ref");
assert_ne!(hash(&a), hash(&b));
}
#[test]
fn hash_for_values_with_different_ref_id_should_be_different() {
- let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-1").unwrap();
- let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-2").unwrap();
+ let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-1");
+ let b = CollectionRef::new(Some("io.gitlab.fkrull"), "ref-2");
assert_ne!(hash(&a), hash(&b));
}
#[test]
fn hash_should_be_different_if_collection_id_is_absent() {
- let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
- let b = CollectionRef::new(None, "ref").unwrap();
+ let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref");
+ let b = CollectionRef::new(None, "ref");
assert_ne!(hash(&a), hash(&b));
}
#[test]
fn clone_should_be_equal_to_original_value() {
- let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref").unwrap();
+ let a = CollectionRef::new(Some("io.gitlab.fkrull"), "ref");
let b = a.clone();
assert_eq!(a, b);
}
diff --git a/rust-bindings/sys/Cargo.toml b/rust-bindings/sys/Cargo.toml
index d77055a0..30384712 100644
--- a/rust-bindings/sys/Cargo.toml
+++ b/rust-bindings/sys/Cargo.toml
@@ -68,6 +68,7 @@ v2022_2 = ["v2021_5"]
v2022_5 = ["v2022_2"]
v2022_6 = ["v2022_5"]
v2022_7 = ["v2022_5"]
+v2023_1 = ["v2022_7"]
[lib]
name = "ostree_sys"
@@ -83,7 +84,7 @@ license = "MIT"
links = "ostree-1"
name = "ostree-sys"
repository = "https://github.com/ostreedev/ostree-rs"
-version = "0.12.0"
+version = "0.13.0"
edition = "2021"
[package.metadata.docs.rs]
features = ["dox"]
@@ -228,3 +229,6 @@ version = "2022.6"
[package.metadata.system-deps.ostree_1.v2022_7]
version = "2022.7"
+
+[package.metadata.system-deps.ostree_1.v2023_1]
+version = "2023.1"
diff --git a/rust-bindings/sys/src/auto/versions.txt b/rust-bindings/sys/src/auto/versions.txt
index 97f80dcd..0e56c33d 100644
--- a/rust-bindings/sys/src/auto/versions.txt
+++ b/rust-bindings/sys/src/auto/versions.txt
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 0eeebbdf9d4d)
-from gir-files (@ 8c831311be59)
+from gir-files (@ 1b758c141dda)
diff --git a/rust-bindings/sys/src/lib.rs b/rust-bindings/sys/src/lib.rs
index 9c270d3d..fe17c5d5 100644
--- a/rust-bindings/sys/src/lib.rs
+++ b/rust-bindings/sys/src/lib.rs
@@ -318,28 +318,28 @@ pub struct _OstreeBootloader {
pub type OstreeBootloader = *mut _OstreeBootloader;
#[repr(C)]
-pub struct _OstreeBootloaderGrub2 {
+pub struct _OstreeBootloaderAboot {
_data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}
-pub type OstreeBootloaderGrub2 = *mut _OstreeBootloaderGrub2;
+pub type OstreeBootloaderAboot = *mut _OstreeBootloaderAboot;
#[repr(C)]
-pub struct _OstreeBootloaderSyslinux {
+pub struct _OstreeBootloaderGrub2 {
_data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}
-pub type OstreeBootloaderSyslinux = *mut _OstreeBootloaderSyslinux;
+pub type OstreeBootloaderGrub2 = *mut _OstreeBootloaderGrub2;
#[repr(C)]
-pub struct _OstreeBootloaderAboot {
+pub struct _OstreeBootloaderSyslinux {
_data: [u8; 0],
_marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>,
}
-pub type OstreeBootloaderAboot = *mut _OstreeBootloaderAboot;
+pub type OstreeBootloaderSyslinux = *mut _OstreeBootloaderSyslinux;
#[repr(C)]
pub struct _OstreeBootloaderUboot {
@@ -1255,21 +1255,21 @@ extern "C" {
pub fn ostree_collection_ref_dup(ref_: *const OstreeCollectionRef) -> *mut OstreeCollectionRef;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
+ pub fn ostree_collection_ref_equal(ref1: gconstpointer, ref2: gconstpointer) -> gboolean;
+ #[cfg(any(feature = "v2018_6", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
pub fn ostree_collection_ref_free(ref_: *mut OstreeCollectionRef);
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
+ pub fn ostree_collection_ref_hash(ref_: gconstpointer) -> c_uint;
+ #[cfg(any(feature = "v2018_6", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
pub fn ostree_collection_ref_dupv(
refs: *const *const OstreeCollectionRef,
) -> *mut *mut OstreeCollectionRef;
#[cfg(any(feature = "v2018_6", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
- pub fn ostree_collection_ref_equal(ref1: gconstpointer, ref2: gconstpointer) -> gboolean;
- #[cfg(any(feature = "v2018_6", feature = "dox"))]
- #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
pub fn ostree_collection_ref_freev(refs: *mut *mut OstreeCollectionRef);
- #[cfg(any(feature = "v2018_6", feature = "dox"))]
- #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))]
- pub fn ostree_collection_ref_hash(ref_: gconstpointer) -> c_uint;
//=========================================================================
// OstreeCommitSizesEntry
@@ -2382,6 +2382,15 @@ extern "C" {
cancellable: *mut gio::GCancellable,
error: *mut *mut glib::GError,
) -> gboolean;
+ #[cfg(any(feature = "v2023_1", feature = "dox"))]
+ #[cfg_attr(feature = "dox", doc(cfg(feature = "v2023_1")))]
+ pub fn ostree_repo_regenerate_metadata(
+ self_: *mut OstreeRepo,
+ additional_metadata: *mut glib::GVariant,
+ options: *mut glib::GVariant,
+ cancellable: *mut gio::GCancellable,
+ error: *mut *mut glib::GError,
+ ) -> gboolean;
pub fn ostree_repo_regenerate_summary(
self_: *mut OstreeRepo,
additional_metadata: *mut glib::GVariant,
diff --git a/rust-bindings/tests/sign/mod.rs b/rust-bindings/tests/sign/mod.rs
index aa2a59a0..745076cb 100644
--- a/rust-bindings/tests/sign/mod.rs
+++ b/rust-bindings/tests/sign/mod.rs
@@ -8,7 +8,7 @@ use ostree::{gio, glib};
#[test]
fn sign_api_should_work() {
let dummy_sign = ostree::Sign::by_name("dummy").unwrap();
- assert_eq!(dummy_sign.name().unwrap(), "dummy");
+ assert_eq!(dummy_sign.name(), "dummy");
let result = ostree::prelude::SignExt::data(
&dummy_sign,
@@ -25,7 +25,7 @@ fn sign_api_should_work() {
}
fn inner_sign_ed25519<T: SignExt>(signer: T) {
- assert_eq!(signer.name().unwrap(), "ed25519");
+ assert_eq!(signer.name(), "ed25519");
let td = tempfile::tempdir().unwrap();
let path = td.path();
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-released.sym b/src/libostree/libostree-released.sym
index ee4e3fde..f210a1a0 100644
--- a/src/libostree/libostree-released.sym
+++ b/src/libostree/libostree-released.sym
@@ -696,6 +696,11 @@ global:
ostree_sysroot_initialize_with_mount_namespace;
} LIBOSTREE_2022.5;
+LIBOSTREE_2023.1 {
+global:
+ ostree_repo_regenerate_metadata;
+} LIBOSTREE_2022.7;
+
/* NOTE: Only add more content here in release commits! See the
* comments at the top of this file.
*/
diff --git a/src/libostree/ostree-async-progress.c b/src/libostree/ostree-async-progress.c
index 8a780372..a6e91c1d 100644
--- a/src/libostree/ostree-async-progress.c
+++ b/src/libostree/ostree-async-progress.c
@@ -469,7 +469,13 @@ ostree_async_progress_new (void)
return (OstreeAsyncProgress*)g_object_new (OSTREE_TYPE_ASYNC_PROGRESS, NULL);
}
-
+/**
+ * ostree_async_progress_new_and_connect: (skip)
+ * @changed: a notification callback
+ * @user_data: data to pass to @changed
+ *
+ * Returns: (transfer full): A new progress object
+ */
OstreeAsyncProgress *
ostree_async_progress_new_and_connect (void (*changed) (OstreeAsyncProgress *self, gpointer user_data),
gpointer user_data)
diff --git a/src/libostree/ostree-bootconfig-parser.c b/src/libostree/ostree-bootconfig-parser.c
index 08259ebf..a8ca04d6 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 *
@@ -134,6 +134,14 @@ ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
cancellable, error);
}
+/**
+ * ostree_bootconfig_parser_set:
+ * @self: Parser
+ * @key: the key
+ * @value: the key
+ *
+ * Set the @key/@value pair to the boot configuration dictionary.
+ */
void
ostree_bootconfig_parser_set (OstreeBootconfigParser *self,
const char *key,
@@ -142,6 +150,16 @@ ostree_bootconfig_parser_set (OstreeBootconfigParser *self,
g_hash_table_replace (self->options, g_strdup (key), g_strdup (value));
}
+/**
+ * ostree_bootconfig_parser_get:
+ * @self: Parser
+ * @key: the key name to retrieve
+ *
+ * Get the value corresponding to @key from the boot configuration dictionary.
+ *
+ * Returns: (nullable): The corresponding value, or %NULL if the key hasn't been
+ * found.
+ */
const char *
ostree_bootconfig_parser_get (OstreeBootconfigParser *self,
const char *key)
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-core.c b/src/libostree/ostree-core.c
index 56b381d9..adb9d70c 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -355,7 +355,7 @@ GBytes *
_ostree_zlib_file_header_new (GFileInfo *file_info,
GVariant *xattrs)
{
- guint64 size = g_file_info_get_size (file_info);
+ guint64 size = 0;
guint32 uid = g_file_info_get_attribute_uint32 (file_info, "unix::uid");
guint32 gid = g_file_info_get_attribute_uint32 (file_info, "unix::gid");
guint32 mode = g_file_info_get_attribute_uint32 (file_info, "unix::mode");
@@ -366,6 +366,9 @@ _ostree_zlib_file_header_new (GFileInfo *file_info,
else
symlink_target = "";
+ if (g_file_info_has_attribute (file_info, "standard::size"))
+ size = g_file_info_get_size (file_info);
+
g_autoptr(GVariant) tmp_xattrs = NULL;
if (xattrs == NULL)
tmp_xattrs = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("(ayay)"), NULL, 0));
@@ -550,7 +553,9 @@ ostree_raw_file_to_content_stream (GInputStream *input,
g_autoptr(GBytes) file_header = _ostree_file_header_new (file_info, xattrs);
*out_input = header_and_input_to_stream (file_header, input);
if (out_length)
- *out_length = g_bytes_get_size (file_header) + g_file_info_get_size (file_info);
+ *out_length = g_bytes_get_size (file_header);
+ if (out_length && g_file_info_has_attribute (file_info, "standard::size"))
+ *out_length += g_file_info_get_size (file_info);
return TRUE;
}
@@ -687,7 +692,7 @@ ostree_content_file_parse_at (gboolean compressed,
if (!glnx_fstat (fd, &stbuf, error))
return FALSE;
- g_autoptr(GInputStream) file_input = g_unix_input_stream_new (glnx_steal_fd (&fd), TRUE);
+ g_autoptr(GInputStream) file_input = g_unix_input_stream_new (g_steal_fd (&fd), TRUE);
g_autoptr(GFileInfo) ret_file_info = NULL;
g_autoptr(GVariant) ret_xattrs = NULL;
@@ -1038,7 +1043,7 @@ ostree_checksum_file_at (int dfd,
glnx_autofd int fd = -1;
if (!glnx_openat_rdonly (dfd, path, FALSE, &fd, error))
return FALSE;
- in = g_unix_input_stream_new (glnx_steal_fd (&fd), TRUE);
+ in = g_unix_input_stream_new (g_steal_fd (&fd), TRUE);
if (canonicalize_perms)
{
g_file_info_set_attribute_uint32 (file_info, "unix::uid", 0);
@@ -1739,6 +1744,8 @@ _ostree_stbuf_to_gfileinfo (const struct stat *stbuf)
if (S_ISREG (mode))
g_file_info_set_attribute_uint64 (ret, "standard::size", stbuf->st_size);
+ else
+ g_file_info_set_attribute_uint64 (ret, "standard::size", 0);
return ret;
}
@@ -2443,7 +2450,7 @@ ostree_validate_structureof_dirmeta (GVariant *dirmeta,
* ostree_commit_get_parent:
* @commit_variant: Variant of type %OSTREE_OBJECT_TYPE_COMMIT
*
- * Returns: Checksum of the parent commit of @commit_variant, or %NULL
+ * Returns: (nullable): Checksum of the parent commit of @commit_variant, or %NULL
* if none
*/
gchar *
diff --git a/src/libostree/ostree-deployment.c b/src/libostree/ostree-deployment.c
index 30e82a63..bfd0b2e6 100644
--- a/src/libostree/ostree-deployment.c
+++ b/src/libostree/ostree-deployment.c
@@ -89,7 +89,7 @@ ostree_deployment_get_bootserial (OstreeDeployment *self)
* ostree_deployment_get_bootconfig:
* @self: Deployment
*
- * Returns: (transfer none): Boot configuration
+ * Returns: (transfer none) (nullable): Boot configuration
*/
OstreeBootconfigParser *
ostree_deployment_get_bootconfig (OstreeDeployment *self)
@@ -101,7 +101,7 @@ ostree_deployment_get_bootconfig (OstreeDeployment *self)
* ostree_deployment_get_origin:
* @self: Deployment
*
- * Returns: (transfer none): Origin
+ * Returns: (transfer none) (nullable): Origin
*/
GKeyFile *
ostree_deployment_get_origin (OstreeDeployment *self)
@@ -157,9 +157,7 @@ ostree_deployment_set_bootserial (OstreeDeployment *self, int index)
void
ostree_deployment_set_bootconfig (OstreeDeployment *self, OstreeBootconfigParser *bootconfig)
{
- g_clear_object (&self->bootconfig);
- if (bootconfig)
- self->bootconfig = g_object_ref (bootconfig);
+ g_set_object (&self->bootconfig, bootconfig);
}
/**
@@ -173,6 +171,9 @@ ostree_deployment_set_bootconfig (OstreeDeployment *self, OstreeBootconfigParser
void
ostree_deployment_set_origin (OstreeDeployment *self, GKeyFile *origin)
{
+ if (self->origin == origin)
+ return;
+
g_clear_pointer (&self->origin, g_key_file_unref);
if (origin)
self->origin = g_key_file_ref (origin);
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-fetcher-util.c b/src/libostree/ostree-fetcher-util.c
index 1b317630..ecd6bc23 100644
--- a/src/libostree/ostree-fetcher-util.c
+++ b/src/libostree/ostree-fetcher-util.c
@@ -37,6 +37,7 @@ typedef struct
char *result_etag;
guint64 result_last_modified; /* second since the epoch */
gboolean done;
+ GMainContext *main_context; /* (owned) */
GError **error;
}
FetchUriSyncData;
@@ -54,6 +55,7 @@ fetch_uri_sync_on_complete (GObject *object,
&data->result_etag, &data->result_last_modified,
data->error);
data->done = TRUE;
+ g_main_context_wakeup (data->main_context);
}
static gboolean
@@ -84,6 +86,7 @@ _ostree_fetcher_mirrored_request_to_membuf_once (OstreeFetcher *fe
mainctx = g_main_context_new ();
g_main_context_push_thread_default (mainctx);
+ data.main_context = g_main_context_ref (mainctx);
data.done = FALSE;
data.error = error;
@@ -127,6 +130,7 @@ _ostree_fetcher_mirrored_request_to_membuf_once (OstreeFetcher *fe
g_main_context_pop_thread_default (mainctx);
g_clear_pointer (&data.result_buf, g_bytes_unref);
g_clear_pointer (&data.result_etag, g_free);
+ g_clear_pointer (&data.main_context, g_main_context_unref);
return ret;
}
diff --git a/src/libostree/ostree-kernel-args.c b/src/libostree/ostree-kernel-args.c
index d15d28a7..582cab0f 100644
--- a/src/libostree/ostree-kernel-args.c
+++ b/src/libostree/ostree-kernel-args.c
@@ -566,8 +566,8 @@ ostree_kernel_args_replace_argv (OstreeKernelArgs *kargs,
/**
* ostree_kernel_args_append_argv_filtered:
* @kargs: a OstreeKernelArgs instance
- * @argv: an array of key=value argument pairs
- * @prefixes: an array of prefix strings
+ * @argv: (array zero-terminated=1): an array of key=value argument pairs
+ * @prefixes: (array zero-terminated=1): an array of prefix strings
*
* Appends each argument that does not have one of the @prefixes as prefix to the @kargs
*
@@ -592,7 +592,7 @@ ostree_kernel_args_append_argv_filtered (OstreeKernelArgs *kargs,
/**
* ostree_kernel_args_append_argv:
* @kargs: a OstreeKernelArgs instance
- * @argv: an array of key=value argument pairs
+ * @argv: (array zero-terminated=1): an array of key=value argument pairs
*
* Appends each value in @argv to the corresponding value array and
* appends key to kargs->order if it is not in the hash table already.
@@ -787,7 +787,7 @@ ostree_kernel_args_to_string (OstreeKernelArgs *kargs)
* corresponding to the @key in @kargs hash table. Note that the application
* will be terminated if the @key is found but the value array is empty
*
- * Returns: NULL if @key is not found in the @kargs hash table,
+ * Returns: (nullable): %NULL if @key is not found in the @kargs hash table,
* otherwise returns last element of value array corresponding to @key
*
* Since: 2019.3
@@ -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-mutable-tree.c b/src/libostree/ostree-mutable-tree.c
index 60e3be2f..d0002c4e 100644
--- a/src/libostree/ostree-mutable-tree.c
+++ b/src/libostree/ostree-mutable-tree.c
@@ -358,7 +358,7 @@ ostree_mutable_tree_remove (OstreeMutableTree *self,
* ostree_mutable_tree_ensure_dir:
* @self: Tree
* @name: Name of subdirectory of self to retrieve/creates
- * @out_subdir: (out) (transfer full): the subdirectory
+ * @out_subdir: (out) (transfer full) (optional): the subdirectory
* @error: a #GError
*
* Returns the subdirectory of self with filename @name, creating an empty one
@@ -400,6 +400,12 @@ ostree_mutable_tree_ensure_dir (OstreeMutableTree *self,
* @out_file_checksum: (out) (transfer full) (nullable) (optional): checksum
* @out_subdir: (out) (transfer full) (nullable) (optional): subdirectory
* @error: a #GError
+ *
+ * Lookup @name and returns @out_file_checksum or @out_subdir depending on its
+ * file type.
+ *
+ * Returns: %TRUE on success and either @out_file_checksum or @out_subdir are
+ * filled, %FALSE otherwise.
*/
gboolean
ostree_mutable_tree_lookup (OstreeMutableTree *self,
@@ -433,7 +439,7 @@ ostree_mutable_tree_lookup (OstreeMutableTree *self,
* @self: Tree
* @split_path: (element-type utf8): File path components
* @metadata_checksum: SHA256 checksum for metadata
- * @out_parent: (out) (transfer full): The parent tree
+ * @out_parent: (out) (transfer full) (optional): The parent tree
* @error: a #GError
*
* Create all parent trees necessary for the given @split_path to
diff --git a/src/libostree/ostree-ref.c b/src/libostree/ostree-ref.c
index eb77d97c..5a2f44e3 100644
--- a/src/libostree/ostree-ref.c
+++ b/src/libostree/ostree-ref.c
@@ -45,7 +45,7 @@ G_DEFINE_BOXED_TYPE (OstreeCollectionRef, ostree_collection_ref,
* refspec; no remote name is included), which can be used for non-P2P
* operations.
*
- * Returns: (transfer full) (nullable): a new #OstreeCollectionRef
+ * Returns: (transfer full): a new #OstreeCollectionRef
* Since: 2018.6
*/
OstreeCollectionRef *
@@ -102,7 +102,7 @@ ostree_collection_ref_free (OstreeCollectionRef *ref)
/**
* ostree_collection_ref_hash:
- * @ref: (not nullable): an #OstreeCollectionRef
+ * @ref: (not nullable) (type OstreeCollectionRef): an #OstreeCollectionRef
*
* Hash the given @ref. This function is suitable for use with #GHashTable.
* @ref must be non-%NULL.
@@ -123,8 +123,8 @@ ostree_collection_ref_hash (gconstpointer ref)
/**
* ostree_collection_ref_equal:
- * @ref1: (not nullable): an #OstreeCollectionRef
- * @ref2 : (not nullable): another #OstreeCollectionRef
+ * @ref1: (not nullable) (type OstreeCollectionRef): an #OstreeCollectionRef
+ * @ref2 : (not nullable) (type OstreeCollectionRef): another #OstreeCollectionRef
*
* Compare @ref1 and @ref2 and return %TRUE if they have the same collection ID and
* ref name, and %FALSE otherwise. Both @ref1 and @ref2 must be non-%NULL.
diff --git a/src/libostree/ostree-ref.h b/src/libostree/ostree-ref.h
index 384b8480..5e5c0ed3 100644
--- a/src/libostree/ostree-ref.h
+++ b/src/libostree/ostree-ref.h
@@ -71,7 +71,7 @@ _OSTREE_PUBLIC
void ostree_collection_ref_freev (OstreeCollectionRef **refs);
/**
- * OstreeCollectionRefv:
+ * OstreeCollectionRefv: (skip)
*
* A %NULL-terminated array of #OstreeCollectionRef instances, designed to
* be used with g_auto():
diff --git a/src/libostree/ostree-remote.c b/src/libostree/ostree-remote.c
index 04f08352..3695e0f4 100644
--- a/src/libostree/ostree-remote.c
+++ b/src/libostree/ostree-remote.c
@@ -186,7 +186,7 @@ ostree_remote_get_name (OstreeRemote *remote)
*
* Get the URL from the remote.
*
- * Returns: (transfer full): the remote's URL
+ * Returns: (transfer full) (nullable): the remote's URL
* Since: 2018.6
*/
gchar *
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c
index de79d64a..32119c47 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"
@@ -678,12 +678,13 @@ create_regular_tmpfile_linkable_with_content (OstreeRepo *self,
* e.g. 10 bytes but is actually gigabytes.
* - Due to GLib bugs that pointlessly calls `poll()` on the output fd for every write
*/
- char buf[8192];
+ gsize buf_size = MIN(length, 1048576);
+ g_autofree gchar * buf = g_malloc(buf_size);
guint64 remaining = length;
while (remaining > 0)
{
const gssize bytes_read =
- g_input_stream_read (input, buf, MIN (remaining, sizeof (buf)), cancellable, error);
+ g_input_stream_read (input, buf, MIN (remaining, buf_size), cancellable, error);
if (bytes_read < 0)
return FALSE;
else if (bytes_read == 0)
@@ -1210,7 +1211,8 @@ write_content_object (OstreeRepo *self,
/* Update statistics */
g_mutex_lock (&self->txn_lock);
self->txn.stats.content_objects_written++;
- self->txn.stats.content_bytes_written += g_file_info_get_size (file_info);
+ if (g_file_info_has_attribute (file_info, "standard::size"))
+ self->txn.stats.content_bytes_written += g_file_info_get_size (file_info);
self->txn.stats.content_objects_total++;
g_mutex_unlock (&self->txn_lock);
@@ -2350,7 +2352,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;
@@ -2444,9 +2447,9 @@ ostree_repo_abort_transaction (OstreeRepo *self,
* ostree_repo_write_metadata:
* @self: Repo
* @objtype: Object type
- * @expected_checksum: (allow-none): If provided, validate content against this checksum
+ * @expected_checksum: (nullable): If provided, validate content against this checksum
* @object: Metadata
- * @out_csum: (out) (array fixed-size=32) (allow-none): Binary checksum
+ * @out_csum: (out) (array fixed-size=32) (optional): Binary checksum
* @cancellable: Cancellable
* @error: Error
*
@@ -2619,7 +2622,7 @@ write_metadata_thread (GTask *task,
* ostree_repo_write_metadata_async:
* @self: Repo
* @objtype: Object type
- * @expected_checksum: (allow-none): If provided, validate content against this checksum
+ * @expected_checksum: (nullable): If provided, validate content against this checksum
* @object: Metadata
* @cancellable: Cancellable
* @callback: Invoked when metadata is writed
@@ -2739,7 +2742,7 @@ ostree_repo_write_content_trusted (OstreeRepo *self,
* @expected_checksum: (allow-none): If provided, validate content against this checksum
* @object_input: Content object stream
* @length: Length of @object_input
- * @out_csum: (out) (array fixed-size=32) (allow-none): Binary checksum
+ * @out_csum: (out) (array fixed-size=32) (optional) (nullable): Binary checksum
* @cancellable: Cancellable
* @error: Error
*
@@ -2856,7 +2859,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 +2891,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,
@@ -2994,7 +2997,8 @@ ostree_repo_write_content_async (OstreeRepo *self,
* ostree_repo_write_content_finish:
* @self: a #OstreeRepo
* @result: a #GAsyncResult
- * @out_csum: (out) (transfer full): A binary SHA256 checksum of the content object
+ * @out_csum: (out) (transfer full) (optional): A binary SHA256
+ * checksum of the content object
* @error: a #GError
*
* Completes an invocation of ostree_repo_write_content_async().
@@ -3032,12 +3036,13 @@ create_empty_gvariant_dict (void)
/**
* ostree_repo_write_commit:
* @self: Repo
- * @parent: (allow-none): ASCII SHA256 checksum for parent, or %NULL for none
- * @subject: (allow-none): Subject
- * @body: (allow-none): Body
- * @metadata: (allow-none): GVariant of type a{sv}, or %NULL for none
+ * @parent: (nullable): ASCII SHA256 checksum for parent, or %NULL for none
+ * @subject: (nullable): Subject
+ * @body: (nullable): Body
+ * @metadata: (nullable): GVariant of type a{sv}, or %NULL for none
* @root: The tree to point the commit to
- * @out_commit: (out): Resulting ASCII SHA256 checksum for commit
+ * @out_commit: (out) (optional): Resulting ASCII SHA256 checksum for
+ * commit
* @cancellable: Cancellable
* @error: Error
*
@@ -3085,13 +3090,14 @@ ostree_repo_write_commit (OstreeRepo *self,
/**
* ostree_repo_write_commit_with_time:
* @self: Repo
- * @parent: (allow-none): ASCII SHA256 checksum for parent, or %NULL for none
- * @subject: (allow-none): Subject
- * @body: (allow-none): Body
- * @metadata: (allow-none): GVariant of type a{sv}, or %NULL for none
+ * @parent: (nullable): ASCII SHA256 checksum for parent, or %NULL for none
+ * @subject: (nullable): Subject
+ * @body: (nullable): Body
+ * @metadata: (nullable): GVariant of type a{sv}, or %NULL for none
* @root: The tree to point the commit to
* @time: The time to use to stamp the commit
- * @out_commit: (out): Resulting ASCII SHA256 checksum for commit
+ * @out_commit: (out) (optional): Resulting ASCII SHA256 checksum for
+ * commit
* @cancellable: Cancellable
* @error: Error
*
@@ -3190,7 +3196,7 @@ ostree_repo_read_commit_detached_metadata (OstreeRepo *self,
* ostree_repo_write_commit_detached_metadata:
* @self: Repo
* @checksum: ASCII SHA256 commit checksum
- * @metadata: (allow-none): Metadata to associate with commit in with format "a{sv}", or %NULL to delete
+ * @metadata: (nullable): Metadata to associate with commit in with format "a{sv}", or %NULL to delete
* @cancellable: Cancellable
* @error: Error
*
@@ -4402,7 +4408,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 +4876,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..de606b0a 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);
@@ -269,6 +269,15 @@ do_resolve_nonroot (OstreeRepoFile *self,
return TRUE;
}
+/**
+ * ostree_repo_file_ensure_resolved:
+ * @self: A repo file
+ * @error: Error
+ *
+ * Ensure that the backing metadata is loaded.
+ *
+ * Returns: %FALSE if the operation failed, %TRUE otherwise
+ */
gboolean
ostree_repo_file_ensure_resolved (OstreeRepoFile *self,
GError **error)
@@ -321,18 +330,42 @@ ostree_repo_file_get_xattrs (OstreeRepoFile *self,
return TRUE;
}
+/**
+ * ostree_repo_file_tree_get_contents:
+ * @self: A repo file
+ *
+ * This API will return %NULL if the file is not "resolved" i.e. in a loaded
+ * state. It will also return %NULL if this path is not a directory tree.
+ *
+ * Returns: (nullable): The GVariant representing the children of this directory.
+ */
GVariant *
ostree_repo_file_tree_get_contents (OstreeRepoFile *self)
{
return self->tree_contents;
}
+/**
+ * ostree_repo_file_tree_get_metadata:
+ * @self: A repo file
+ *
+ * This API will return %NULL if the file is not "resolved" i.e. in a loaded
+ * state. It will also return %NULL if this path is not a directory tree.
+ *
+ * Returns: (nullable): The GVariant representing the metadata for this directory.
+ */
GVariant *
ostree_repo_file_tree_get_metadata (OstreeRepoFile *self)
{
return self->tree_metadata;
}
+/**
+ * ostree_repo_file_tree_set_metadata:
+ * @self: A repo file
+ *
+ * Replace the metadata checksum and metadata object.
+ */
void
ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
const char *checksum,
@@ -344,12 +377,24 @@ ostree_repo_file_tree_set_metadata (OstreeRepoFile *self,
self->tree_metadata_checksum = g_strdup (checksum);
}
+/**
+ * ostree_repo_file_tree_get_contents_checksum:
+ * @self: A repo file
+ *
+ * Returns: (nullable): The SHA256 digest of the content object, or %NULL if this is not a directory.
+ */
const char *
ostree_repo_file_tree_get_contents_checksum (OstreeRepoFile *self)
{
return self->tree_contents_checksum;
}
+/**
+ * ostree_repo_file_tree_get_metadata_checksum:
+ * @self: A repo file
+ *
+ * Returns: (nullable): The SHA256 digest of the metadata object, or %NULL if this is not a directory.
+ */
const char *
ostree_repo_file_tree_get_metadata_checksum (OstreeRepoFile *self)
{
@@ -384,6 +429,12 @@ ostree_repo_file_get_root (OstreeRepoFile *self)
return parent;
}
+/**
+ * ostree_repo_file_tree_get_checksum:
+ * @self: A repo file
+ *
+ * Returns: For non-directories, the SHA-256 digest of the object. For directories, the metadata digest will be returned.
+ */
const char *
ostree_repo_file_get_checksum (OstreeRepoFile *self)
{
@@ -534,7 +585,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 +614,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 +622,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 +659,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 +700,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
@@ -785,12 +836,14 @@ ostree_repo_file_tree_find_child (OstreeRepoFile *self,
/**
* ostree_repo_file_tree_query_child:
* @self: #OstreeRepoFile
- * @n:
- * @attributes:
- * @flags:
- * @out_info: (out):
- * @cancellable: Cancellable
- * @error: Error
+ * @n: the child number
+ * @attributes: an attribute string to match, see g_file_attribute_matcher_new()
+ * @flags: a #GFileQueryInfoFlags
+ * @out_info: (out) (transfer full) (optional): the #GFileInfo of the child.
+ * @cancellable: a #GCancellable or %NULL
+ * @error: a #GError or %NULL
+ *
+ * Returns: %TRUE on success and the @out_info is set, %FALSE otherwise.
*/
gboolean
ostree_repo_file_tree_query_child (OstreeRepoFile *self,
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..5f21807e 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 {
@@ -227,6 +228,7 @@ struct OstreeRepo {
gchar **repo_finders;
OstreeCfgSysrootBootloaderOpt bootloader; /* Configure which bootloader to use. */
GHashTable *bls_append_values; /* Parsed key-values from bls-append-except-default key in config. */
+ gboolean enable_bootprefix; /* If true, prepend bootloader entries with /boot */
OstreeRepo *parent_repo;
};
@@ -522,6 +524,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..658367fa 100644
--- a/src/libostree/ostree-repo-pull-verify.c
+++ b/src/libostree/ostree-repo-pull-verify.c
@@ -361,14 +361,14 @@ validate_metadata_size (const char *prefix, GBytes *buf, GError **error)
* @commit_data: Commit object data (GVariant)
* @commit_metadata: Commit metadata (GVariant `a{sv}`), must contain at least one valid signature
* @flags: Optionally disable GPG or signapi
- * @out_results: (nullable) (out) (transfer full): Textual description of results
+ * @out_results: (optional) (out) (transfer full): Textual description of results
* @error: Error
*
* Validate the commit data using the commit metadata which must
* 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..77aa452e 100644
--- a/src/libostree/ostree-repo-pull.c
+++ b/src/libostree/ostree-repo-pull.c
@@ -1031,7 +1031,7 @@ content_fetch_on_complete (GObject *object,
if (!glnx_fstat (tmpf.fd, &stbuf, error))
goto out;
/* Non-mirroring path */
- tmpf_input = g_unix_input_stream_new (glnx_steal_fd (&tmpf.fd), TRUE);
+ tmpf_input = g_unix_input_stream_new (g_steal_fd (&tmpf.fd), TRUE);
/* If it appears corrupted, we'll delete it below */
if (!ostree_content_stream_parse (TRUE, tmpf_input, stbuf.st_size, FALSE,
@@ -1338,7 +1338,7 @@ static_deltapart_fetch_on_complete (GObject *object,
goto out;
/* Transfer ownership of the fd */
- in = g_unix_input_stream_new (glnx_steal_fd (&tmpf.fd), TRUE);
+ in = g_unix_input_stream_new (g_steal_fd (&tmpf.fd), TRUE);
/* TODO - make async */
if (!_ostree_static_delta_part_open (in, NULL, 0, fetch_data->expected_checksum,
@@ -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;
}
@@ -6564,10 +6564,9 @@ ostree_repo_pull_from_remotes_finish (OstreeRepo *self,
* @self: Self
* @name: name of a remote
* @options: (nullable): A GVariant a{sv} with an extensible set of flags
- * @out_summary: (out) (optional): return location for raw summary data, or
- * %NULL
- * @out_signatures: (out) (optional): return location for raw summary
- * signature data, or %NULL
+ * @out_summary: (out) (optional): return location for raw summary data, or %NULL
+ * @out_signatures: (out) (optional): return location for raw summary signature
+ * data, or %NULL
* @cancellable: a #GCancellable
* @error: a #GError
*
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..15bfb4ef 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>
@@ -972,8 +973,8 @@ _ostree_repo_remote_name_is_file (const char *remote_name)
* @self: A OstreeRepo
* @remote_name: Name
* @option_name: Option
- * @default_value: (allow-none): Value returned if @option_name is not present
- * @out_value: (out): Return location for value
+ * @default_value: (nullable): Value returned if @option_name is not present
+ * @out_value: (out) (nullable): Return location for value
* @error: Error
*
* OSTree remotes are represented by keyfile groups, formatted like:
@@ -981,7 +982,7 @@ _ostree_repo_remote_name_is_file (const char *remote_name)
* underneath that group, or @default_value if the remote exists but not the
* option name. If an error is returned, @out_value will be set to %NULL.
*
- * Returns: %TRUE on success, otherwise %FALSE with @error set
+ * Returns: (nullable): %TRUE on success, otherwise %FALSE with @error set
*
* Since: 2016.5
*/
@@ -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);
@@ -1445,7 +1446,7 @@ repo_open_at_take_fd (int *dfd,
GError **error)
{
g_autoptr(OstreeRepo) repo = g_object_new (OSTREE_TYPE_REPO, NULL);
- repo->repo_dir_fd = glnx_steal_fd (dfd);
+ repo->repo_dir_fd = g_steal_fd (dfd);
if (!ostree_repo_open (repo, cancellable, error))
return NULL;
@@ -2157,7 +2158,7 @@ ostree_repo_remote_list (OstreeRepo *self,
* ostree_repo_remote_get_url:
* @self: Repo
* @name: Name of remote
- * @out_url: (out) (allow-none): Remote's URL
+ * @out_url: (out) (optional): Remote's URL
* @error: Error
*
* Return the URL of the remote named @name through @out_url. It is an
@@ -2200,7 +2201,7 @@ ostree_repo_remote_get_url (OstreeRepo *self,
* ostree_repo_remote_get_gpg_verify:
* @self: Repo
* @name: Name of remote
- * @out_gpg_verify: (out) (allow-none): Remote's GPG option
+ * @out_gpg_verify: (out) (optional): Remote's GPG option
* @error: Error
*
* Return whether GPG verification is enabled for the remote named @name
@@ -2808,7 +2809,7 @@ repo_create_at_internal (int dfd,
return FALSE;
/* Note early return */
- *out_dfd = glnx_steal_fd (&repo_dfd);
+ *out_dfd = g_steal_fd (&repo_dfd);
return TRUE;
}
}
@@ -2871,7 +2872,7 @@ repo_create_at_internal (int dfd,
return FALSE;
}
- *out_dfd = glnx_steal_fd (&repo_dfd);
+ *out_dfd = g_steal_fd (&repo_dfd);
return TRUE;
}
@@ -2917,7 +2918,7 @@ ostree_repo_create (OstreeRepo *self,
&repo_dir_fd,
cancellable, error))
return FALSE;
- self->repo_dir_fd = glnx_steal_fd (&repo_dir_fd);
+ self->repo_dir_fd = g_steal_fd (&repo_dir_fd);
if (!ostree_repo_open (self, cancellable, error))
return FALSE;
return TRUE;
@@ -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,9 +3549,14 @@ 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);
}
+ if (!ot_keyfile_get_boolean_with_default (self->config, "sysroot",
+ "bootprefix", FALSE,
+ &self->enable_bootprefix, error))
+ return FALSE;
+
return TRUE;
}
@@ -3742,7 +3748,7 @@ ostree_repo_set_cache_dir (OstreeRepo *self,
return FALSE;
glnx_close_fd (&self->cache_dir_fd);
- self->cache_dir_fd = glnx_steal_fd (&fd);
+ self->cache_dir_fd = g_steal_fd (&fd);
return TRUE;
}
@@ -3917,7 +3923,7 @@ ostree_repo_get_min_free_space_bytes (OstreeRepo *self, guint64 *out_reserved_b
* Before this function can be used, ostree_repo_init() must have been
* called.
*
- * Returns: (transfer none): Parent repository, or %NULL if none
+ * Returns: (transfer none) (nullable): Parent repository, or %NULL if none
*/
OstreeRepo *
ostree_repo_get_parent (OstreeRepo *self)
@@ -4217,7 +4223,7 @@ repo_load_file_archive (OstreeRepo *self,
if (!glnx_fstat (fd, &stbuf, error))
return FALSE;
- g_autoptr(GInputStream) tmp_stream = g_unix_input_stream_new (glnx_steal_fd (&fd), TRUE);
+ g_autoptr(GInputStream) tmp_stream = g_unix_input_stream_new (g_steal_fd (&fd), TRUE);
/* Note return here */
return ostree_content_stream_parse (TRUE, tmp_stream, stbuf.st_size, TRUE,
out_input, out_file_info, out_xattrs,
@@ -4383,7 +4389,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)
@@ -4415,7 +4421,7 @@ _ostree_repo_load_file_bare (OstreeRepo *self,
}
if (out_fd)
- *out_fd = glnx_steal_fd (&fd);
+ *out_fd = g_steal_fd (&fd);
if (out_stbuf)
*out_stbuf = stbuf;
ot_transfer_out_value (out_symlink, &ret_symlink);
@@ -4466,7 +4472,7 @@ ostree_repo_load_file (OstreeRepo *self,
if (out_input)
{
if (fd != -1)
- *out_input = g_unix_input_stream_new (glnx_steal_fd (&fd), TRUE);
+ *out_input = g_unix_input_stream_new (g_steal_fd (&fd), TRUE);
else
*out_input = NULL;
}
@@ -5078,8 +5084,8 @@ ostree_repo_list_commit_objects_starting_with (OstreeRepo *self
* ostree_repo_read_commit:
* @self: Repo
* @ref: Ref or ASCII checksum
- * @out_root: (out): An #OstreeRepoFile corresponding to the root
- * @out_commit: (out): The resolved commit checksum
+ * @out_root: (out) (optional): An #OstreeRepoFile corresponding to the root
+ * @out_commit: (out) (optional): The resolved commit checksum
* @cancellable: Cancellable
* @error: Error
*
@@ -5592,26 +5598,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 +5617,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 +5641,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 +5650,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 */
}
@@ -5662,9 +5688,9 @@ ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
* ostree_repo_gpg_sign_data:
* @self: Self
* @data: Data as a #GBytes
- * @old_signatures: Existing signatures to append to (or %NULL)
+ * @old_signatures: (nullable): Existing signatures to append to (or %NULL)
* @key_id: (array zero-terminated=1) (element-type utf8): NULL-terminated array of GPG keys.
- * @homedir: (allow-none): GPG home directory, or %NULL
+ * @homedir: (nullable): GPG home directory, or %NULL
* @out_signatures: (out): in case of success will contain signature
* @cancellable: A #GCancellable
* @error: a #GError
@@ -5675,8 +5701,8 @@ ostree_repo_add_gpg_signature_summary (OstreeRepo *self,
*
* You can use ostree_repo_gpg_verify_data() to verify the signatures.
*
- * Returns: @TRUE if @data has been signed successfully,
- * @FALSE in case of error (@error will contain the reason).
+ * Returns: %TRUE if @data has been signed successfully,
+ * %FALSE in case of error (@error will contain the reason).
*
* Since: 2020.8
*/
@@ -6235,37 +6261,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 +6277,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 +6549,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 +6567,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
@@ -6630,7 +6840,7 @@ _ostree_repo_allocate_tmpdir (int tmpdir_dfd,
g_debug ("Reusing tmpdir %s", dent->d_name);
reusing_dir = TRUE;
ret_tmpdir.src_dfd = tmpdir_dfd;
- ret_tmpdir.fd = glnx_steal_fd (&target_dfd);
+ ret_tmpdir.fd = g_steal_fd (&target_dfd);
ret_tmpdir.path = g_strdup (dent->d_name);
ret_tmpdir.initialized = TRUE;
}
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..a7795a96 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");
}
@@ -502,7 +502,7 @@ ostree_sepolicy_new_at (int rootfs_dfd,
* policy objects to be created from file-descriptor relative paths, which
* may not be globally accessible.
*
- * Returns: (transfer none): Path to rootfs
+ * Returns: (transfer none) (nullable): Path to rootfs
*/
GFile *
ostree_sepolicy_get_path (OstreeSePolicy *self)
@@ -530,7 +530,7 @@ ostree_sepolicy_get_name (OstreeSePolicy *self)
* ostree_sepolicy_get_csum:
* @self:
*
- * Returns: (transfer none): Checksum of current policy
+ * Returns: (transfer none) (nullable): Checksum of current policy
*
* Since: 2016.5
*/
@@ -549,7 +549,7 @@ ostree_sepolicy_get_csum (OstreeSePolicy *self)
* @self: Self
* @relpath: Path
* @unix_mode: Unix mode
- * @out_label: (allow-none) (out) (transfer full): Return location for security context
+ * @out_label: (nullable) (out) (transfer full): Return location for security context
* @cancellable: Cancellable
* @error: Error
*
@@ -565,6 +565,7 @@ ostree_sepolicy_get_label (OstreeSePolicy *self,
GCancellable *cancellable,
GError **error)
{
+ *out_label = NULL;
#ifdef HAVE_SELINUX
/* Early return if no policy */
if (!self->selinux_hnd)
@@ -600,10 +601,10 @@ ostree_sepolicy_get_label (OstreeSePolicy *self,
* ostree_sepolicy_restorecon:
* @self: Self
* @path: Path string to use for policy lookup
- * @info: (allow-none): File attributes
+ * @info: (nullable): File attributes
* @target: Physical path to target file
* @flags: Flags controlling behavior
- * @out_new_label: (allow-none) (out): New label, or %NULL if unchanged
+ * @out_new_label: (nullable) (optional) (out): New label, or %NULL if unchanged
* @cancellable: Cancellable
* @error: Error
*
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..5b126d89 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -273,7 +273,7 @@ checksum_dir_recurse (int dfd,
return FALSE;
if (fd != -1)
{
- g_autoptr(GInputStream) in = g_unix_input_stream_new (glnx_steal_fd (&fd), TRUE);
+ g_autoptr(GInputStream) in = g_unix_input_stream_new (g_steal_fd (&fd), TRUE);
if (!ot_gio_splice_update_checksum (NULL, in, checksum, cancellable, error))
return FALSE;
}
@@ -403,7 +403,7 @@ ensure_directory_from_template (int orig_etc_fd,
return FALSE;
if (out_dfd)
- *out_dfd = glnx_steal_fd (&target_dfd);
+ *out_dfd = g_steal_fd (&target_dfd);
return TRUE;
}
@@ -1875,6 +1875,8 @@ install_deployment_kernel (OstreeSysroot *sysroot,
OstreeRepo *repo = ostree_sysroot_repo (sysroot);
+ const char *bootprefix = repo->enable_bootprefix ? "/boot/" : "/";
+
/* Install (hardlink/copy) the kernel into /boot/ostree/osname-${bootcsum} if
* it doesn't exist already.
*/
@@ -1970,7 +1972,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
* /boot itself and drop the boocsum dir concept entirely. */
g_autofree char *destpath =
- g_strdup_printf ("/" _OSTREE_SYSROOT_BOOT_INITRAMFS_OVERLAYS "/%s.img", checksum);
+ g_strdup_printf ("%s%s/%s.img", bootprefix, _OSTREE_SYSROOT_BOOT_INITRAMFS_OVERLAYS, checksum);
const char *rel_destpath = destpath + 1;
/* lazily allocate array and create dir so we don't pollute /boot if not needed */
@@ -2066,7 +2068,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
g_autofree char *version_key = g_strdup_printf ("%d", n_deployments - ostree_deployment_get_index (deployment));
ostree_bootconfig_parser_set (bootconfig, OSTREE_COMMIT_META_KEY_VERSION, version_key);
- g_autofree char * boot_relpath = g_strconcat ("/", bootcsumdir, "/", kernel_layout->kernel_namever, NULL);
+ g_autofree char * boot_relpath = g_strconcat (bootprefix, bootcsumdir, "/", kernel_layout->kernel_namever, NULL);
ostree_bootconfig_parser_set (bootconfig, "linux", boot_relpath);
val = ostree_bootconfig_parser_get (bootconfig, "options");
@@ -2075,7 +2077,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
if (kernel_layout->initramfs_namever)
{
g_autofree char * initrd_boot_relpath =
- g_strconcat ("/", bootcsumdir, "/", kernel_layout->initramfs_namever, NULL);
+ g_strconcat (bootprefix, bootcsumdir, "/", kernel_layout->initramfs_namever, NULL);
ostree_bootconfig_parser_set (bootconfig, "initrd", initrd_boot_relpath);
if (overlay_initrds)
@@ -2119,7 +2121,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
if (kernel_layout->devicetree_namever)
{
- g_autofree char * dt_boot_relpath = g_strconcat ("/", bootcsumdir, "/", kernel_layout->devicetree_namever, NULL);
+ g_autofree char * dt_boot_relpath = g_strconcat (bootprefix, bootcsumdir, "/", kernel_layout->devicetree_namever, NULL);
ostree_bootconfig_parser_set (bootconfig, "devicetree", dt_boot_relpath);
}
else if (kernel_layout->devicetree_srcpath)
@@ -2128,7 +2130,7 @@ install_deployment_kernel (OstreeSysroot *sysroot,
* want to point to a whole directory of device trees.
* See: https://github.com/ostreedev/ostree/issues/1900
*/
- g_autofree char * dt_boot_relpath = g_strconcat ("/", bootcsumdir, "/", kernel_layout->devicetree_srcpath, NULL);
+ g_autofree char * dt_boot_relpath = g_strconcat (bootprefix, bootcsumdir, "/", kernel_layout->devicetree_srcpath, NULL);
ostree_bootconfig_parser_set (bootconfig, "fdtdir", dt_boot_relpath);
}
@@ -2981,7 +2983,7 @@ sysroot_finalize_selinux_policy (int deployment_dfd, GError **error)
return TRUE;
/*
- * Skip the SELinux policy refresh if the --rebuild-if-modules-changed
+ * Skip the SELinux policy refresh if the --refresh
* flag is not supported by semodule.
*/
static const gchar * const SEMODULE_HELP_ARGV[] = {
@@ -2993,14 +2995,14 @@ sysroot_finalize_selinux_policy (int deployment_dfd, GError **error)
return FALSE;
if (!g_spawn_check_exit_status (exit_status, error))
return glnx_prefix_error (error, "failed to run semodule");
- if (!strstr(stdout, "--rebuild-if-modules-changed"))
+ if (!strstr(stdout, "--refresh"))
{
- ot_journal_print (LOG_INFO, "semodule does not have --rebuild-if-modules-changed");
+ ot_journal_print (LOG_INFO, "semodule does not have --refresh");
return TRUE;
}
static const gchar * const SEMODULE_REBUILD_ARGV[] = {
- "semodule", "-N", "--rebuild-if-modules-changed"
+ "semodule", "-N", "--refresh"
};
static const gsize SEMODULE_REBUILD_ARGC = sizeof (SEMODULE_REBUILD_ARGV) / sizeof (*SEMODULE_REBUILD_ARGV);
@@ -3099,12 +3101,12 @@ sysroot_finalize_deployment (OstreeSysroot *self,
/**
* ostree_sysroot_deploy_tree_with_options:
* @self: Sysroot
- * @osname: (allow-none): osname to use for merge deployment
+ * @osname: (nullable): osname to use for merge deployment
* @revision: Checksum to add
- * @origin: (allow-none): Origin to use for upgrades
- * @provided_merge_deployment: (allow-none): Use this deployment for merge path
- * @opts: (allow-none): Options
- * @out_new_deployment: (out): The new deployment path
+ * @origin: (nullable): Origin to use for upgrades
+ * @provided_merge_deployment: (nullable): Use this deployment for merge path
+ * @opts: (nullable): Options
+ * @out_new_deployment: (out) (transfer full): The new deployment path
* @cancellable: Cancellable
* @error: Error
*
@@ -3146,11 +3148,11 @@ ostree_sysroot_deploy_tree_with_options (OstreeSysroot *self,
/**
* ostree_sysroot_deploy_tree:
* @self: Sysroot
- * @osname: (allow-none): osname to use for merge deployment
+ * @osname: (nullable): osname to use for merge deployment
* @revision: Checksum to add
- * @origin: (allow-none): Origin to use for upgrades
- * @provided_merge_deployment: (allow-none): Use this deployment for merge path
- * @override_kernel_argv: (allow-none) (array zero-terminated=1) (element-type utf8): Use these as kernel arguments; if %NULL, inherit options from provided_merge_deployment
+ * @origin: (nullable): Origin to use for upgrades
+ * @provided_merge_deployment: (nullable): Use this deployment for merge path
+ * @override_kernel_argv: (nullable) (array zero-terminated=1) (element-type utf8): Use these as kernel arguments; if %NULL, inherit options from provided_merge_deployment
* @out_new_deployment: (out): The new deployment path
* @cancellable: Cancellable
* @error: Error
@@ -3561,7 +3563,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 +3689,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-upgrader.c b/src/libostree/ostree-sysroot-upgrader.c
index b8d2d0c9..bbfed034 100644
--- a/src/libostree/ostree-sysroot-upgrader.c
+++ b/src/libostree/ostree-sysroot-upgrader.c
@@ -323,7 +323,7 @@ ostree_sysroot_upgrader_new_for_os_with_flags (OstreeSysroot *sysro
* ostree_sysroot_upgrader_get_origin:
* @self: Sysroot
*
- * Returns: (transfer none): The origin file, or %NULL if unknown
+ * Returns: (transfer none) (nullable): The origin file, or %NULL if unknown.
*/
GKeyFile *
ostree_sysroot_upgrader_get_origin (OstreeSysrootUpgrader *self)
@@ -335,7 +335,7 @@ ostree_sysroot_upgrader_get_origin (OstreeSysrootUpgrader *self)
* ostree_sysroot_upgrader_dup_origin:
* @self: Sysroot
*
- * Returns: (transfer full): A copy of the origin file, or %NULL if unknown
+ * Returns: (transfer full) (nullable): A copy of the origin file, or %NULL if unknown.
*/
GKeyFile *
ostree_sysroot_upgrader_dup_origin (OstreeSysrootUpgrader *self)
@@ -388,7 +388,7 @@ ostree_sysroot_upgrader_set_origin (OstreeSysrootUpgrader *self,
* ostree_sysroot_upgrader_get_origin_description:
* @self: Upgrader
*
- * Returns: A one-line descriptive summary of the origin, or %NULL if unknown
+ * Returns: (transfer full) (nullable): A one-line descriptive summary of the origin, or %NULL if unknown.
*/
char *
ostree_sysroot_upgrader_get_origin_description (OstreeSysrootUpgrader *self)
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-fs-utils.c b/src/libotutil/ot-fs-utils.c
index 5439c959..64ebc966 100644
--- a/src/libotutil/ot-fs-utils.c
+++ b/src/libotutil/ot-fs-utils.c
@@ -82,7 +82,7 @@ ot_openat_read_stream (int dfd,
glnx_autofd int fd = -1;
if (!glnx_openat_rdonly (dfd, path, follow, &fd, error))
return FALSE;
- *out_istream = g_unix_input_stream_new (glnx_steal_fd (&fd), TRUE);
+ *out_istream = g_unix_input_stream_new (g_steal_fd (&fd), TRUE);
return TRUE;
}
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-refs.c b/src/ostree/ot-builtin-refs.c
index c687a5ff..c49d7507 100644
--- a/src/ostree/ot-builtin-refs.c
+++ b/src/ostree/ot-builtin-refs.c
@@ -27,6 +27,7 @@
static gboolean opt_delete;
static gboolean opt_list;
+static gboolean opt_revision;
static gboolean opt_alias;
static char *opt_create;
static gboolean opt_collections;
@@ -40,6 +41,7 @@ static gboolean opt_force;
static GOptionEntry options[] = {
{ "delete", 0, 0, G_OPTION_ARG_NONE, &opt_delete, "Delete refs which match PREFIX, rather than listing them", NULL },
{ "list", 0, 0, G_OPTION_ARG_NONE, &opt_list, "Do not remove the prefix from the refs", NULL },
+ { "revision", 'r', 0, G_OPTION_ARG_NONE, &opt_revision, "Show revisions in listing", NULL },
{ "alias", 'A', 0, G_OPTION_ARG_NONE, &opt_alias, "If used with --create, create an alias, otherwise just list aliases", NULL },
{ "create", 0, 0, G_OPTION_ARG_STRING, &opt_create, "Create a new ref for an existing commit", "NEWREF" },
{ "collections", 'c', 0, G_OPTION_ARG_NONE, &opt_collections, "Enable listing collection IDs for refs", NULL },
@@ -47,6 +49,16 @@ static GOptionEntry options[] = {
{ NULL }
};
+static int
+collection_ref_cmp (OstreeCollectionRef *a,
+ OstreeCollectionRef *b)
+{
+ int ret = g_strcmp0 (a->collection_id, b->collection_id);
+ if (ret == 0)
+ ret = g_strcmp0 (a->ref_name, b->ref_name);
+ return ret;
+}
+
static gboolean
do_ref_with_collections (OstreeRepo *repo,
const char *refspec_prefix,
@@ -66,11 +78,22 @@ do_ref_with_collections (OstreeRepo *repo,
if (!opt_delete && !opt_create)
{
- g_hash_table_iter_init (&hashiter, refs);
- while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
+ g_autoptr(GList) ordered_keys = g_hash_table_get_keys (refs);
+ ordered_keys = g_list_sort (ordered_keys, (GCompareFunc) collection_ref_cmp);
+
+ for (GList *iter = ordered_keys; iter != NULL; iter = iter->next)
{
- const OstreeCollectionRef *ref = hashkey;
- g_print ("(%s, %s)\n", ref->collection_id, ref->ref_name);
+ OstreeCollectionRef *ref = iter->data;
+
+ if (opt_revision)
+ {
+ const char *rev = g_hash_table_lookup (refs, ref);
+ g_print ("(%s, %s)\t%s\n", ref->collection_id, ref->ref_name, rev);
+ }
+ else
+ {
+ g_print ("(%s, %s)\n", ref->collection_id, ref->ref_name);
+ }
}
}
else if (opt_create)
@@ -179,12 +202,27 @@ static gboolean do_ref (OstreeRepo *repo, const char *refspec_prefix, GCancellab
if (is_list)
{
- GLNX_HASH_TABLE_FOREACH_KV (refs, const char *, ref, const char *, value)
+ g_autoptr(GList) ordered_keys = g_hash_table_get_keys (refs);
+ ordered_keys = g_list_sort (ordered_keys, (GCompareFunc) g_strcmp0);
+
+ for (GList *iter = ordered_keys; iter != NULL; iter = iter->next)
{
+ const char *ref = iter->data;
+
if (opt_alias)
- g_print ("%s -> %s\n", ref, value);
+ {
+ const char *alias = g_hash_table_lookup (refs, ref);
+ g_print ("%s -> %s\n", ref, alias);
+ }
+ else if (opt_revision)
+ {
+ const char *rev = g_hash_table_lookup (refs, ref);
+ g_print ("%s\t%s\n", ref, rev);
+ }
else
- g_print ("%s\n", ref);
+ {
+ g_print ("%s\n", ref);
+ }
}
}
else if (opt_create)
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-show.c b/src/ostree/ot-builtin-show.c
index 55f2b47e..9346a7b3 100644
--- a/src/ostree/ot-builtin-show.c
+++ b/src/ostree/ot-builtin-show.c
@@ -31,6 +31,8 @@ static gboolean opt_print_related;
static char* opt_print_variant_type;
static char* opt_print_metadata_key;
static char* opt_print_detached_metadata_key;
+static gboolean opt_list_metadata_keys;
+static gboolean opt_list_detached_metadata_keys;
static gboolean opt_print_sizes;
static gboolean opt_raw;
static gboolean opt_no_byteswap;
@@ -45,7 +47,9 @@ static char *opt_gpg_verify_remote;
static GOptionEntry options[] = {
{ "print-related", 0, 0, G_OPTION_ARG_NONE, &opt_print_related, "Show the \"related\" commits", NULL },
{ "print-variant-type", 0, 0, G_OPTION_ARG_STRING, &opt_print_variant_type, "Memory map OBJECT (in this case a filename) to the GVariant type string", "TYPE" },
+ { "list-metadata-keys", 0, 0, G_OPTION_ARG_NONE, &opt_list_metadata_keys, "List the available metadata keys", NULL },
{ "print-metadata-key", 0, 0, G_OPTION_ARG_STRING, &opt_print_metadata_key, "Print string value of metadata key", "KEY" },
+ { "list-detached-metadata-keys", 0, 0, G_OPTION_ARG_NONE, &opt_list_detached_metadata_keys, "List the available detached metadata keys", NULL },
{ "print-detached-metadata-key", 0, 0, G_OPTION_ARG_STRING, &opt_print_detached_metadata_key, "Print string value of detached metadata key", "KEY" },
{ "print-sizes", 0, 0, G_OPTION_ARG_NONE, &opt_print_sizes, "Show the commit size metadata", NULL },
{ "raw", 0, 0, G_OPTION_ARG_NONE, &opt_raw, "Show raw variant data" },
@@ -98,12 +102,14 @@ do_print_related (OstreeRepo *repo,
}
static gboolean
-do_print_metadata_key (OstreeRepo *repo,
- const char *resolved_rev,
- gboolean detached,
- const char *key,
- GError **error)
+get_metadata (OstreeRepo *repo,
+ const char *resolved_rev,
+ gboolean detached,
+ GVariant **out_metadata,
+ GError **error)
{
+ g_assert (out_metadata != NULL);
+
g_autoptr(GVariant) commit = NULL;
g_autoptr(GVariant) metadata = NULL;
@@ -128,6 +134,59 @@ do_print_metadata_key (OstreeRepo *repo,
}
}
+ *out_metadata = g_steal_pointer (&metadata);
+
+ return TRUE;
+}
+
+static gint
+strptr_cmp (gconstpointer a,
+ gconstpointer b)
+{
+ const char *a_str = *((const char **) a);
+ const char *b_str = *((const char **) b);
+
+ return g_strcmp0 (a_str, b_str);
+}
+
+static gboolean
+do_list_metadata_keys (OstreeRepo *repo,
+ const char *resolved_rev,
+ gboolean detached,
+ GError **error)
+{
+ g_autoptr(GVariant) metadata = NULL;
+ if (!get_metadata (repo, resolved_rev, detached, &metadata, error))
+ return FALSE;
+
+ GVariantIter iter;
+ const char *key = NULL;
+ g_autoptr(GPtrArray) keys = g_ptr_array_new ();
+ g_variant_iter_init (&iter, metadata);
+ while (g_variant_iter_loop (&iter, "{&s@v}", &key, NULL))
+ g_ptr_array_add (keys, (gpointer) key);
+
+ g_ptr_array_sort (keys, strptr_cmp);
+ for (guint i = 0; i < keys-> len; i++)
+ {
+ key = keys->pdata[i];
+ g_print ("%s\n", key);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+do_print_metadata_key (OstreeRepo *repo,
+ const char *resolved_rev,
+ gboolean detached,
+ const char *key,
+ GError **error)
+{
+ g_autoptr(GVariant) metadata = NULL;
+ if (!get_metadata (repo, resolved_rev, detached, &metadata, error))
+ return FALSE;
+
g_autoptr(GVariant) value = g_variant_lookup_value (metadata, key, NULL);
if (!value)
{
@@ -321,10 +380,16 @@ ostree_builtin_show (int argc, char **argv, OstreeCommandInvocation *invocation,
const char *key = detached ? opt_print_detached_metadata_key : opt_print_metadata_key;
if (!ostree_repo_resolve_rev (repo, rev, FALSE, &resolved_rev, error))
return FALSE;
-
if (!do_print_metadata_key (repo, resolved_rev, detached, key, error))
return FALSE;
}
+ else if (opt_list_metadata_keys || opt_list_detached_metadata_keys)
+ {
+ if (!ostree_repo_resolve_rev (repo, rev, FALSE, &resolved_rev, error))
+ return FALSE;
+ if (!do_list_metadata_keys (repo, resolved_rev, opt_list_detached_metadata_keys, error))
+ return FALSE;
+ }
else if (opt_print_related)
{
if (!ostree_repo_resolve_rev (repo, rev, FALSE, &resolved_rev, error))
diff --git a/src/ostree/ot-builtin-summary.c b/src/ostree/ot-builtin-summary.c
index 2d6306a4..b0a2a6ed 100644
--- a/src/ostree/ot-builtin-summary.c
+++ b/src/ostree/ot-builtin-summary.c
@@ -28,6 +28,8 @@
#include "ostree-sign.h"
static gboolean opt_update, opt_view, opt_raw;
+static gboolean opt_list_metadata_keys;
+static char *opt_print_metadata_key;
static char **opt_gpg_key_ids;
static char *opt_gpg_homedir;
static char **opt_key_ids;
@@ -43,6 +45,8 @@ static GOptionEntry options[] = {
{ "update", 'u', 0, G_OPTION_ARG_NONE, &opt_update, "Update the summary", NULL },
{ "view", 'v', 0, G_OPTION_ARG_NONE, &opt_view, "View the local summary file", NULL },
{ "raw", 0, 0, G_OPTION_ARG_NONE, &opt_raw, "View the raw bytes of the summary file", NULL },
+ { "list-metadata-keys", 0, 0, G_OPTION_ARG_NONE, &opt_list_metadata_keys, "List the available metadata keys", NULL },
+ { "print-metadata-key", 0, 0, G_OPTION_ARG_STRING, &opt_print_metadata_key, "Print string value of metadata key", "KEY" },
{ "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, "GPG Key ID to sign the summary with", "KEY-ID"},
{ "gpg-homedir", 0, 0, G_OPTION_ARG_FILENAME, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "HOMEDIR"},
{ "sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_key_ids, "Key ID to sign the summary with", "KEY-ID"},
@@ -85,6 +89,26 @@ build_additional_metadata (const char * const *args,
return g_variant_ref_sink (g_variant_builder_end (builder));
}
+static gboolean
+get_summary_data (OstreeRepo *repo,
+ GBytes **out_summary_data,
+ GError **error)
+{
+ g_assert (out_summary_data != NULL);
+
+ g_autoptr(GBytes) summary_data = NULL;
+ glnx_autofd int fd = -1;
+ if (!glnx_openat_rdonly (repo->repo_dir_fd, "summary", TRUE, &fd, error))
+ return FALSE;
+ summary_data = ot_fd_readall_or_mmap (fd, 0, error);
+ if (!summary_data)
+ return FALSE;
+
+ *out_summary_data = g_steal_pointer (&summary_data);
+
+ return TRUE;
+}
+
gboolean
ostree_builtin_summary (int argc, char **argv, OstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error)
{
@@ -122,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 ();
+ g_auto(GVariantBuilder) sk_builder = G_VARIANT_BUILDER_INIT (G_VARIANT_TYPE_ARRAY);
- 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)
+ /* 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++)
{
- 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;
- }
+ const char *key_id = *iter;
+ g_variant_builder_add (&sk_builder, "v", g_variant_new_string (key_id));
}
- if (opt_key_ids)
- {
- 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;
- }
- }
-
- 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)
{
@@ -275,15 +187,30 @@ ostree_builtin_summary (int argc, char **argv, OstreeCommandInvocation *invocati
if (opt_raw)
flags |= OSTREE_DUMP_RAW;
- glnx_autofd int fd = -1;
- if (!glnx_openat_rdonly (repo->repo_dir_fd, "summary", TRUE, &fd, error))
- return FALSE;
- summary_data = ot_fd_readall_or_mmap (fd, 0, error);
- if (!summary_data)
+ if (!get_summary_data (repo, &summary_data, error))
return FALSE;
ot_dump_summary_bytes (summary_data, flags);
}
+ else if (opt_list_metadata_keys)
+ {
+ g_autoptr(GBytes) summary_data = NULL;
+
+ if (!get_summary_data (repo, &summary_data, error))
+ return FALSE;
+
+ ot_dump_summary_metadata_keys (summary_data);
+ }
+ else if (opt_print_metadata_key)
+ {
+ g_autoptr(GBytes) summary_data = NULL;
+
+ if (!get_summary_data (repo, &summary_data, error))
+ return FALSE;
+
+ if (!ot_dump_summary_metadata_key (summary_data, opt_print_metadata_key, error))
+ return FALSE;
+ }
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
diff --git a/src/ostree/ot-dump.c b/src/ostree/ot-dump.c
index 509eb792..4cfac811 100644
--- a/src/ostree/ot-dump.c
+++ b/src/ostree/ot-dump.c
@@ -407,6 +407,66 @@ ot_dump_summary_bytes (GBytes *summary_bytes,
}
}
+static gint
+strptr_cmp (gconstpointer a,
+ gconstpointer b)
+{
+ const char *a_str = *((const char **) a);
+ const char *b_str = *((const char **) b);
+
+ return g_strcmp0 (a_str, b_str);
+}
+
+void
+ot_dump_summary_metadata_keys (GBytes *summary_bytes)
+{
+ g_autoptr(GVariant) summary = NULL;
+ g_autoptr(GVariant) metadata = NULL;
+
+ summary = g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
+ summary_bytes, FALSE);
+ metadata = g_variant_get_child_value (summary, 1);
+
+ GVariantIter iter;
+ const char *key = NULL;
+ g_autoptr(GPtrArray) keys = g_ptr_array_new ();
+ g_variant_iter_init (&iter, metadata);
+ while (g_variant_iter_loop (&iter, "{&s@v}", &key, NULL))
+ g_ptr_array_add (keys, (gpointer) key);
+
+ g_ptr_array_sort (keys, strptr_cmp);
+ for (guint i = 0; i < keys-> len; i++)
+ {
+ key = keys->pdata[i];
+ g_print ("%s\n", key);
+ }
+}
+
+gboolean
+ot_dump_summary_metadata_key (GBytes *summary_bytes,
+ const char *key,
+ GError **error)
+{
+ g_autoptr(GVariant) summary = NULL;
+ g_autoptr(GVariant) metadata = NULL;
+ g_autoptr(GVariant) value = NULL;
+
+ summary = g_variant_new_from_bytes (OSTREE_SUMMARY_GVARIANT_FORMAT,
+ summary_bytes, FALSE);
+ metadata = g_variant_get_child_value (summary, 1);
+ value = g_variant_lookup_value (metadata, key, NULL);
+ if (!value)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND,
+ "No such metadata key '%s'", key);
+ return FALSE;
+ }
+
+ ot_dump_variant (value);
+
+ return TRUE;
+}
+
static gboolean
dump_gpg_subkey (GVariant *subkey,
gboolean primary,
diff --git a/src/ostree/ot-dump.h b/src/ostree/ot-dump.h
index 217a3964..da1a2cb2 100644
--- a/src/ostree/ot-dump.h
+++ b/src/ostree/ot-dump.h
@@ -41,5 +41,11 @@ void ot_dump_object (OstreeObjectType objtype,
void ot_dump_summary_bytes (GBytes *summary_bytes,
OstreeDumpFlags flags);
+void ot_dump_summary_metadata_keys (GBytes *summary_bytes);
+
+gboolean ot_dump_summary_metadata_key (GBytes *summary_bytes,
+ const char *key,
+ GError **error);
+
gboolean ot_dump_gpg_key (GVariant *key,
GError **error);
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/ostree/ot-remote-builtin-refs.c b/src/ostree/ot-remote-builtin-refs.c
index 29c39328..24ad0776 100644
--- a/src/ostree/ot-remote-builtin-refs.c
+++ b/src/ostree/ot-remote-builtin-refs.c
@@ -24,6 +24,7 @@
#include "ot-main.h"
#include "ot-remote-builtins.h"
+static gboolean opt_revision;
static char* opt_cache_dir;
/* ATTENTION:
@@ -32,6 +33,7 @@ static char* opt_cache_dir;
*/
static GOptionEntry option_entries[] = {
+ { "revision", 'r', 0, G_OPTION_ARG_NONE, &opt_revision, "Show revisions in listing", NULL },
{ "cache-dir", 0, 0, G_OPTION_ARG_FILENAME, &opt_cache_dir, "Use custom cache dir", NULL },
{ NULL }
};
@@ -73,7 +75,17 @@ ot_remote_builtin_refs (int argc, char **argv, OstreeCommandInvocation *invocati
for (iter = ordered_keys; iter; iter = iter->next)
{
- g_print ("%s:%s\n", remote_name, (const char *) iter->data);
+ const char *ref = iter->data;
+
+ if (opt_revision)
+ {
+ const char *rev = g_hash_table_lookup (refs, ref);
+ g_print ("%s:%s\t%s\n", remote_name, ref, rev);
+ }
+ else
+ {
+ g_print ("%s:%s\n", remote_name, ref);
+ }
}
}
diff --git a/src/ostree/ot-remote-builtin-summary.c b/src/ostree/ot-remote-builtin-summary.c
index fb2c45a3..55ccc396 100644
--- a/src/ostree/ot-remote-builtin-summary.c
+++ b/src/ostree/ot-remote-builtin-summary.c
@@ -25,8 +25,10 @@
#include "ot-dump.h"
#include "ot-remote-builtins.h"
+static gboolean opt_list_metadata_keys;
static gboolean opt_raw;
+static char *opt_print_metadata_key;
static char* opt_cache_dir;
/* ATTENTION:
@@ -35,6 +37,8 @@ static char* opt_cache_dir;
*/
static GOptionEntry option_entries[] = {
+ { "list-metadata-keys", 0, 0, G_OPTION_ARG_NONE, &opt_list_metadata_keys, "List the available metadata keys", NULL },
+ { "print-metadata-key", 0, 0, G_OPTION_ARG_STRING, &opt_print_metadata_key, "Print string value of metadata key", "KEY" },
{ "cache-dir", 0, 0, G_OPTION_ARG_FILENAME, &opt_cache_dir, "Use custom cache dir", NULL },
{ "raw", 0, 0, G_OPTION_ARG_NONE, &opt_raw, "Show raw variant data", NULL },
{ NULL }
@@ -90,42 +94,54 @@ ot_remote_builtin_summary (int argc, char **argv, OstreeCommandInvocation *invoc
goto out;
}
- ot_dump_summary_bytes (summary_bytes, flags);
+ if (opt_list_metadata_keys)
+ {
+ ot_dump_summary_metadata_keys (summary_bytes);
+ }
+ else if (opt_print_metadata_key)
+ {
+ if (!ot_dump_summary_metadata_key (summary_bytes, opt_print_metadata_key, error))
+ goto out;
+ }
+ else
+ {
+ ot_dump_summary_bytes (summary_bytes, flags);
#ifndef OSTREE_DISABLE_GPGME
- if (!ostree_repo_remote_get_gpg_verify_summary (repo, remote_name,
- &gpg_verify_summary,
- error))
- goto out;
-
- if (!gpg_verify_summary)
- g_clear_pointer (&signature_bytes, g_bytes_unref);
-
- /* XXX Note we don't show signatures for "--raw". My intuition is
- * if someone needs to see or parse raw summary data, including
- * signatures in the output would probably just interfere.
- * If there's demand for it I suppose we could introduce a new
- * option for raw signature data like "--raw-signatures". */
- if (signature_bytes != NULL && !opt_raw)
- {
- g_autoptr(OstreeGpgVerifyResult) result = NULL;
-
- /* The actual signed summary verification happens above in
- * ostree_repo_remote_fetch_summary(). Here we just parse
- * the signatures again for the purpose of printing. */
- result = ostree_repo_verify_summary (repo,
- remote_name,
- summary_bytes,
- signature_bytes,
- cancellable,
- error);
- if (result == NULL)
+ if (!ostree_repo_remote_get_gpg_verify_summary (repo, remote_name,
+ &gpg_verify_summary,
+ error))
goto out;
- g_print ("\n");
- ostree_print_gpg_verify_result (result);
- }
+ if (!gpg_verify_summary)
+ g_clear_pointer (&signature_bytes, g_bytes_unref);
+
+ /* XXX Note we don't show signatures for "--raw". My intuition is
+ * if someone needs to see or parse raw summary data, including
+ * signatures in the output would probably just interfere.
+ * If there's demand for it I suppose we could introduce a new
+ * option for raw signature data like "--raw-signatures". */
+ if (signature_bytes != NULL && !opt_raw)
+ {
+ g_autoptr(OstreeGpgVerifyResult) result = NULL;
+
+ /* The actual signed summary verification happens above in
+ * ostree_repo_remote_fetch_summary(). Here we just parse
+ * the signatures again for the purpose of printing. */
+ result = ostree_repo_verify_summary (repo,
+ remote_name,
+ summary_bytes,
+ signature_bytes,
+ cancellable,
+ error);
+ if (result == NULL)
+ goto out;
+
+ g_print ("\n");
+ ostree_print_gpg_verify_result (result);
+ }
#endif /* OSTREE_DISABLE_GPGME */
+ }
ret = TRUE;
out:
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/basic-test.sh b/tests/basic-test.sh
index f97f6fc3..e2a7d70c 100644
--- a/tests/basic-test.sh
+++ b/tests/basic-test.sh
@@ -1006,6 +1006,13 @@ $OSTREE show -B --print-metadata-key=SOMENUM test2 > test2-meta
assert_file_has_content test2-meta "uint64 42"
$OSTREE show --print-detached-metadata-key=SIGNATURE test2 > test2-meta
assert_file_has_content test2-meta "HANCOCK"
+
+$OSTREE show --list-metadata-keys test2 > test2-meta
+assert_file_has_content test2-meta "FOO"
+assert_file_has_content test2-meta "KITTENS"
+assert_file_has_content test2-meta "SOMENUM"
+$OSTREE show --list-detached-metadata-keys test2 > test2-meta
+assert_file_has_content test2-meta "SIGNATURE"
echo "ok metadata commit with strings"
$OSTREE commit ${COMMIT_ARGS} -b test2 --tree=ref=test2 \
diff --git a/tests/kolainst/nondestructive/itest-pull-space.sh b/tests/kolainst/nondestructive/itest-pull-space.sh
index 97524f67..6c6404e4 100755
--- a/tests/kolainst/nondestructive/itest-pull-space.sh
+++ b/tests/kolainst/nondestructive/itest-pull-space.sh
@@ -7,9 +7,9 @@ set -xeuo pipefail
date
prepare_tmpdir
-truncate -s 20MB testblk.img
+truncate -s 20MiB testblk.img
blkdev=$(losetup --find --show $(pwd)/testblk.img)
-mkfs.xfs ${blkdev}
+mkfs.ext4 -m 0 ${blkdev}
mkdir mnt
mount ${blkdev} mnt
@@ -89,7 +89,7 @@ host_commit=$(ostree --repo=mnt/repo1 commit -b test -s test --tree=dir=files)
origrev=$(ostree --repo=mnt/repo1 rev-parse test)
ostree --repo=mnt/repo1 static-delta generate --empty --to=${origrev}
echo 'fsync=false' >> mnt/repo2/config
-echo 'min-free-space-size=12MB' >> mnt/repo2/config
+echo 'min-free-space-size=14MB' >> mnt/repo2/config
deltaprefix=$(get_assert_one_direntry_matching mnt/repo1/deltas '.')
deltadir=$(get_assert_one_direntry_matching mnt/repo1/deltas/${deltaprefix} '.')
@@ -102,7 +102,7 @@ assert_file_has_content err.txt "min-free-space-size"
echo "OK min-free-space-size delta pull (error)"
# Re-adjust min-free-space-size so that delta pull succeeds
-sed -i s/min-free-space-size=12MB/min-free-space-size=1MB/g mnt/repo2/config
+sed -i s/min-free-space-size=14MB/min-free-space-size=1MB/g mnt/repo2/config
rm -rf mnt/repo2/deltas
ostree --repo=mnt/repo2 static-delta apply-offline mnt/repo1/deltas/${deltaprefix}/${deltadir}
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 264094b1..963bc923 100755
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -32,6 +32,9 @@ else
fi
. ${test_srcdir}/libtest-core.sh
+# Make sure /sbin/capsh etc. are in our PATH even if non-root
+PATH="$PATH:/usr/sbin:/sbin"
+
# Array of expressions to execute when exiting. Each expression should
# be a single string (quoting if necessary) that will be eval'd. To add
# a command to run on exit, append to the libtest_exit_cmds array like
diff --git a/tests/test-admin-deploy-bootprefix.sh b/tests/test-admin-deploy-bootprefix.sh
new file mode 100755
index 00000000..d80c310b
--- /dev/null
+++ b/tests/test-admin-deploy-bootprefix.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# Copyright (C) 2022 Colin Walters <walters@verbum.org>
+#
+# 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/>.
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+# Exports OSTREE_SYSROOT so --sysroot not needed.
+setup_os_repository "archive" "syslinux"
+
+${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmain/x86_64-runtime
+${CMD_PREFIX} ostree --repo=sysroot/ostree/repo config set sysroot.bootprefix 'true'
+${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=root --os=testos testos:testos/buildmain/x86_64-runtime
+assert_file_has_content_literal sysroot/boot/loader/entries/ostree-1-testos.conf 'linux /boot/ostree/testos-'
+assert_file_has_content_literal sysroot/boot/loader/entries/ostree-1-testos.conf 'initrd /boot/ostree/testos-'
+
+tap_ok "bootprefix"
+
+tap_end
diff --git a/tests/test-basic-c.c b/tests/test-basic-c.c
index fc995298..7a6b8ee7 100644
--- a/tests/test-basic-c.c
+++ b/tests/test-basic-c.c
@@ -176,10 +176,12 @@ static gboolean hi_content_stream_new (GInputStream **out_stream,
GError **error)
{
static const char hi[] = "hi";
- g_autoptr(GMemoryInputStream) hi_memstream = (GMemoryInputStream*)g_memory_input_stream_new_from_data (hi, sizeof(hi)-1, NULL);
+ const size_t len = sizeof(hi)-1;
+ g_autoptr(GMemoryInputStream) hi_memstream = (GMemoryInputStream*)g_memory_input_stream_new_from_data (hi, len, NULL);
g_autoptr(GFileInfo) finfo = g_file_info_new ();
g_file_info_set_attribute_uint32 (finfo, "standard::type", G_FILE_TYPE_REGULAR);
g_file_info_set_attribute_boolean (finfo, "standard::is-symlink", FALSE);
+ g_file_info_set_size (finfo, len);
g_file_info_set_attribute_uint32 (finfo, "unix::uid", 0);
g_file_info_set_attribute_uint32 (finfo, "unix::gid", 0);
g_file_info_set_attribute_uint32 (finfo, "unix::mode", S_IFREG|0644);
@@ -512,7 +514,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 +527,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 +548,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-pull-summary-sigs.sh b/tests/test-pull-summary-sigs.sh
index 03a40e46..e1b0412e 100755
--- a/tests/test-pull-summary-sigs.sh
+++ b/tests/test-pull-summary-sigs.sh
@@ -157,6 +157,16 @@ assert_file_has_content summary.txt "Good signature from \"Ostree Tester <test@t
grep static-deltas summary.txt > static-deltas.txt
assert_file_has_content static-deltas.txt \
$(${OSTREE} --repo=repo rev-parse origin:main)
+${OSTREE} --repo=repo remote summary origin --list-metadata-keys > metadata
+assert_file_has_content metadata "^ostree.static-deltas$"
+assert_file_has_content metadata "^ostree.summary.indexed-deltas$"
+assert_file_has_content metadata "^ostree.summary.last-modified$"
+assert_file_has_content metadata "^ostree.summary.mode$"
+assert_file_has_content metadata "^ostree.summary.tombstone-commits$"
+${OSTREE} --repo=repo remote summary origin --print-metadata-key=ostree.summary.indexed-deltas > metadata
+assert_file_has_content metadata "^true$"
+${OSTREE} --repo=repo remote summary origin --print-metadata-key=ostree.summary.mode > metadata
+assert_file_has_content metadata "^'archive-z2'$"
## Tests for handling of cached summaries while racing with remote summary updates
diff --git a/tests/test-refs.sh b/tests/test-refs.sh
index 3653d035..53b36f6b 100755
--- a/tests/test-refs.sh
+++ b/tests/test-refs.sh
@@ -42,6 +42,10 @@ done
${CMD_PREFIX} ostree --repo=repo refs | wc -l > refscount
assert_file_has_content refscount "^10$"
+${CMD_PREFIX} ostree --repo=repo refs > refs
+sort refs > refs-sorted
+assert_files_equal refs refs-sorted
+
${CMD_PREFIX} ostree --repo=repo refs foo > refs
assert_not_file_has_content refs foo
@@ -51,6 +55,14 @@ assert_file_has_content refs foo
${CMD_PREFIX} ostree --repo=repo refs foo | wc -l > refscount.foo
assert_file_has_content refscount.foo "^5$"
+rm -f expected-refs-revs
+for ref in foo/test-{1..5}; do
+ rev=$(${CMD_PREFIX} ostree --repo=repo rev-parse $ref)
+ echo -e "${ref}\t${rev}" >> expected-refs-revs
+done
+${CMD_PREFIX} ostree --repo=repo refs --list --revision foo > refs-revs
+assert_files_equal refs-revs expected-refs-revs
+
${CMD_PREFIX} ostree --repo=repo refs --delete 2>/dev/null || true
${CMD_PREFIX} ostree --repo=repo refs | wc -l > refscount.delete1
assert_file_has_content refscount.delete1 "^10$"
diff --git a/tests/test-remote-refs.sh b/tests/test-remote-refs.sh
new file mode 100755
index 00000000..b92fb20e
--- /dev/null
+++ b/tests/test-remote-refs.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# 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>
+
+set -euo pipefail
+
+. $(dirname $0)/libtest.sh
+
+echo "1..2"
+
+setup_fake_remote_repo2 "archive"
+${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/repo summary -u
+${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/repo refs > origin-refs
+${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/repo refs --revision > origin-refs-revs
+
+cd ${test_tmpdir}
+rm -rf repo
+ostree_repo_init repo --mode=archive
+${OSTREE} remote add --no-sign-verify origin $(cat httpd-address)/ostree/repo
+
+${OSTREE} remote refs origin > refs
+sed 's/^/origin:/' origin-refs > expected-refs
+assert_files_equal refs expected-refs
+
+echo "ok remote refs listing"
+
+${OSTREE} remote refs origin --revision > refs-revs
+sed 's/^/origin:/' origin-refs-revs > expected-refs-revs
+assert_files_equal refs-revs expected-refs-revs
+
+echo "ok remote refs revisions"
diff --git a/tests/test-repo-finder-mount.c b/tests/test-repo-finder-mount.c
index 3d360182..13797030 100644
--- a/tests/test-repo-finder-mount.c
+++ b/tests/test-repo-finder-mount.c
@@ -166,7 +166,7 @@ assert_create_repos_dir (Fixture *fixture,
g_clear_error (&error);
g_assert_no_error (error);
- *out_repos_dfd = glnx_steal_fd (&repos_dfd);
+ *out_repos_dfd = g_steal_fd (&repos_dfd);
g_autoptr(GFile) mount_root = g_file_get_child (fixture->working_dir, mount_root_name);
*out_mount = G_MOUNT (ostree_mock_mount_new (mount_root_name, mount_root));
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-signed-pull-summary.sh b/tests/test-signed-pull-summary.sh
index 2d6b2552..d2873894 100755
--- a/tests/test-signed-pull-summary.sh
+++ b/tests/test-signed-pull-summary.sh
@@ -194,6 +194,16 @@ assert_file_has_content summary.txt "* yet-another"
grep static-deltas summary.txt > static-deltas.txt
assert_file_has_content static-deltas.txt \
$(${OSTREE} --repo=repo rev-parse origin:main)
+${OSTREE} --repo=repo remote summary origin --list-metadata-keys > metadata
+assert_file_has_content metadata "^ostree.static-deltas$"
+assert_file_has_content metadata "^ostree.summary.indexed-deltas$"
+assert_file_has_content metadata "^ostree.summary.last-modified$"
+assert_file_has_content metadata "^ostree.summary.mode$"
+assert_file_has_content metadata "^ostree.summary.tombstone-commits$"
+${OSTREE} --repo=repo remote summary origin --print-metadata-key=ostree.summary.indexed-deltas > metadata
+assert_file_has_content metadata "^true$"
+${OSTREE} --repo=repo remote summary origin --print-metadata-key=ostree.summary.mode > metadata
+assert_file_has_content metadata "^'archive-z2'$"
## Tests for handling of cached summaries while racing with remote summary updates
diff --git a/tests/test-summary-update.sh b/tests/test-summary-update.sh
index 74c42d10..d85e9c4b 100755
--- a/tests/test-summary-update.sh
+++ b/tests/test-summary-update.sh
@@ -59,6 +59,10 @@ ${CMD_PREFIX} ostree --repo=repo summary --update --add-metadata=map='@a{sv} {}'
# Check the additional metadata turns up in the output.
${CMD_PREFIX} ostree --repo=repo summary --view > summary
assert_file_has_content summary "^map: {}$"
+${CMD_PREFIX} ostree --repo=repo summary --list-metadata-keys > metadata
+assert_file_has_content metadata "^map$"
+${CMD_PREFIX} ostree --repo=repo summary --print-metadata-key=map > metadata
+assert_file_has_content metadata "^@a{sv} {}$"
echo "ok 1 update summary"
diff --git a/tests/test-symbols.sh b/tests/test-symbols.sh
index 1442e2d7..0d459c1a 100755
--- a/tests/test-symbols.sh
+++ b/tests/test-symbols.sh
@@ -54,7 +54,7 @@ echo 'ok documented symbols'
# ONLY update this checksum in release commits!
cat > released-sha256.txt <<EOF
-d7b5a766b1607f7334e9b6f15385ad872879e336a160ae76336243e493f7ceab ${released_syms}
+e300a2e86f4a2ac620af8369f4b0f41dbe53fada187cce1d21d3c48073e9b454 ${released_syms}
EOF
sha256sum -c released-sha256.txt
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();