ostree.git
2 years agofetcher: Always open tmpfiles in repo location
Colin Walters [Tue, 6 Jun 2023 21:09:30 +0000 (17:09 -0400)]
fetcher: Always open tmpfiles in repo location

In an installation environment (like a live ISO) we may
not have significant space outside of the target installation
repository.

There's no reason not to always open a linkable tempfile.  In
the future we should fix the pull path to verify the checksum
and then just directly link in the object instead of copying.

Closes: https://github.com/ostreedev/ostree/issues/2571
2 years agoMerge pull request #2874 from aospan/inode64-fix
Colin Walters [Tue, 6 Jun 2023 16:37:41 +0000 (12:37 -0400)]
Merge pull request #2874 from aospan/inode64-fix

commit: fix ostree deployment on 64-bit inode fs

2 years agocommit: fix ostree deployment on 64-bit inode fs
Abylay Ospan [Tue, 6 Jun 2023 02:13:14 +0000 (02:13 +0000)]
commit: fix ostree deployment on 64-bit inode fs

This commit addresses a bug that was causing ostree deployment
to become corrupted on the large fs, when any package was installed using
'rpm-ostree install'.

In such instances, multiple files were assigned the same inode. For
example, the '/home' directory and a regular file 'pkg-get' were
assigned the same inode (2147484070), making the deployment unusable.

A root cause analysis was performed, running the process under gdb,
which revealed a lossy conversion from guint64 to guint32, for example
6442451366 converted to 2147484070:

(gdb) p name
$10 = 0x7fe9224d2d70 "home"

(gdb) p inode
$73 = 6442451366

(gdb) s
    device=66311, modifier=0x7fe914791840) at
src/libostree/ostree-repo-commit.c:1590

The conversion resulted in entirely independent files potentially
receiving the same inode.

The issue was discovered on PoC machine equipped with a large NVME
(3.4TB), but the bug can be easily reproduced using `cosa run -m 4000
--qemu-size +3TB', followed by installation of any package using
`rpm-ostree install`. The resulting deployment will be unusable due to
many files being "corrupted" by the aforementioned issue.

2 years agoMerge pull request #2640 from alexlarsson/composefs
Colin Walters [Fri, 2 Jun 2023 13:26:04 +0000 (09:26 -0400)]
Merge pull request #2640 from alexlarsson/composefs

Add initial composefs integration

2 years agoMerge pull request #2871 from dustymabe/dusty-fallocate-einval
Colin Walters [Thu, 1 Jun 2023 14:34:13 +0000 (10:34 -0400)]
Merge pull request #2871 from dustymabe/dusty-fallocate-einval

lib/deploy: skip fallocate call when requested size is 0

2 years agolib/deploy: skip fallocate call when requested size is 0
Dusty Mabe [Thu, 1 Jun 2023 13:23:41 +0000 (09:23 -0400)]
lib/deploy: skip fallocate call when requested size is 0

If the requested size is 0 then of course we have enough room ðŸ™‚

This avoids the fallocate call returning an EINVAL.

Closes: #2869
2 years agoMerge pull request #2870 from dustymabe/dusty-log-messages
Colin Walters [Thu, 1 Jun 2023 12:24:48 +0000 (08:24 -0400)]
Merge pull request #2870 from dustymabe/dusty-log-messages

lib/deploy: Disambiguate error messages for early prune space check

2 years agolib/deploy: Disambiguate error messages for early prune space check
Dusty Mabe [Thu, 1 Jun 2023 04:00:28 +0000 (00:00 -0400)]
lib/deploy: Disambiguate error messages for early prune space check

Having the same error message in multiple places means it's not
clear which case failed. Let's make them unique.

2 years agocomposefs: When using signatures, delay application until first boot
Alexander Larsson [Wed, 31 May 2023 16:35:44 +0000 (18:35 +0200)]
composefs: When using signatures, delay application until first boot

We can't safely apply the fs-verity with signature until we have
booted with the new initrd, because the public key that matches the
signature is loaded from it. So, instead we save the .sig file next
to the compoosefs, and on the first boot we detect that it is there, and
the composefs file isn't fs-verity, so we apply it.

Things get a bit more complex due to having to temporarily make
/sysroot read-write for the fsverity operation too.

2 years agoCI: Build with composefs on some versions
Alexander Larsson [Tue, 23 May 2023 14:37:16 +0000 (16:37 +0200)]
CI: Build with composefs on some versions

This enables --with-composefs on:
 * Fedora Latest
 * Debian Testing
 * Ubuntu Latest

These all should have new enough version of dependencies.

2 years agoUpdate submodule: composefs
Alexander Larsson [Tue, 23 May 2023 08:31:23 +0000 (10:31 +0200)]
Update submodule: composefs

Instead of using pkg-config, etc we just include composefs.
In the end the library is just 5 c source files, and it is set up
to be easy to use as a submodule.

For now, composefs support is disabled by default.

2 years agoostree-remount: Don't skip remount if root is composefs
Alexander Larsson [Fri, 26 May 2023 10:53:57 +0000 (12:53 +0200)]
ostree-remount: Don't skip remount if root is composefs

When using composefs the root fs will always be read-only, but in this
case we should still continue remounting /sysroot. So, we record a
/run/ostree-composefs-root.stamp file in ostree-prepare-root if composefs
is used, and then react to it in ostree-remount.

2 years agosysroot: Ensure deployment detection works when using composefs
Alexander Larsson [Tue, 16 May 2023 08:17:32 +0000 (10:17 +0200)]
sysroot: Ensure deployment detection works when using composefs

In the case of composefs, we cannot compare the devino of the rootfs
and the deploy dir, because the root is the composefs mount, not a
bind mount. Instead we check the devino of the etc subdir of the
deploy, because this is a bind mount even when using composefs.

2 years agoprepare-root: Support using composefs as root filesystem
Alexander Larsson [Thu, 30 Jun 2022 12:53:13 +0000 (14:53 +0200)]
prepare-root: Support using composefs as root filesystem

This changes ostree-prepare-root to use the .ostree.cfs image as a
composefs filesystem, instead of the checkout.

By default, composefs is used if support is built in and the .ostree.cfs
file exists in the deploy dir, otherwise we fall back to the old
method. However, if the ot-composefs kernel option is specified this
can be tweaked as per:
 * off: Never use composefsz
 * maybe: Use if possible
 * on: Fail if not possible
 * signed: Fail if the cfs image is not fs-verity signed with
   a key in the keyring.
 * digest=....: Fail if the cfs image does not match the specified
   digest.

The final layout when composefs is active is:

 /        ro overlayfs mount for composefs
 /sysroot "real" root
 /etc     rw bind mount to $deploydir/etc
 /var     rw bind mount to $vardir

We also specify the $deploydir/.ostree-mnt directory as the (internal)
mountpoint for the erofs mount for composefs. This can be used to map
the root fs back to the deploy id/dir in use,

A further note: I didn't test the .usr-ovl-work overlayfs case, but a
comment mentions that you can't mount overlayfs on top of a readonly
mount. That seems incompatible with composefs. If this is needed we
have to merge that with the overlayfs that composefs itself sets up,
which is possible with the libcomposefs APIs.

2 years agoswitchroot: Make read_proc_cmdline_ostree() take a key argument
Alexander Larsson [Thu, 18 May 2023 08:53:22 +0000 (10:53 +0200)]
switchroot: Make read_proc_cmdline_ostree() take a key argument

This changes it into read_proc_cmdline_key(), as this will later be
used to read additional keys.

2 years agocomposefs deploy: Store cfs signature in .ostree.cfs.sig file
Alexander Larsson [Mon, 29 May 2023 10:25:55 +0000 (12:25 +0200)]
composefs deploy: Store cfs signature in .ostree.cfs.sig file

In many cases, such as when using osbuild, we are not preparing the final
deployment but rather a rootfs tree that will eventually be copied to the
final location. In that case we don't want to apply the signature directly
but when the deployment is copied in place.

To make this situateion workable we also write the signature to a file
next to the composefs image file. Then whatever mechanism that does
the final copy can apply the signature.

2 years agodeploy: Write a .ostree.cfs composefs image in the deploy dir
Alexander Larsson [Thu, 30 Jun 2022 12:47:44 +0000 (14:47 +0200)]
deploy: Write a .ostree.cfs composefs image in the deploy dir

This can be used as a composefs source for the root fs instead of
the checkout by pointing the basedir to /ostree/repo/objects.

We only write the file is `composefs` is enabled.

We enable ensure_rootfs_dirs when building the image which adds the
required root dirs to the image. In particular, this includes /etc
which often isn't in ostree commits in use.

We also create an (empty) .ostree.mnt directory, where composefs
will mount the erofs image that will be used as overlayfs lowerdir
for the root overlayfs mount. This way we can find the deploy
dir from the root overlayfs mount options.

If the commit has composefs digests recorded we verify those with the
created file. It also applies the fs-verity signature if it is
recorded, unless this is disabled with the
ex-integrity.composefs-apply-sign=false option.

2 years agoCommit: Add composefs digest and sig to the commit metadata
Alexander Larsson [Mon, 15 May 2023 13:18:16 +0000 (15:18 +0200)]
Commit: Add composefs digest and sig to the commit metadata

If `composefs-apply-sig` is enabled (default no) we add an
ostree.composefs digest to the commit metadata. This can be verified
on deploy.

This is a separate option from the generic `composefs` option which
controls whether composefs is used during deploy. It is separate
because we want to not have to force use of fs-verity, etc during the
build.

If the `composefs-certfile` and `composefs-keyfile` keys in the
ex-integrity group are set, then the commit metadata also gets a
ostree.composefs-sig containing the signature of the composefs file.

2 years agolib: Add (private) API for checking out commits into a composefs image
Alexander Larsson [Thu, 9 Jun 2022 15:15:29 +0000 (17:15 +0200)]
lib: Add (private) API for checking out commits into a composefs image

This supports checking out a commit into a tree which is then
converted into a composefs image containing fs-verity digests for all
the regular files, and payloads that are relative to a the
`repo/objects` directory of a bare ostree repo.

Some specal files are always created in the image. This ensures that
various directories (usr, etc, boot, var, sysroot) exists in the
created image, even if they were not in the source commit. These are
needed (as bindmount targets) if you want to boot from the image. In
the non-composefs case these are just created as needed in the checked
out deploydir, but we can't do that here.

This is all controlled by the new ex-integrity config section, which
has the following layout:

```
[ex-integrity]
fsverity=yes/no/maybe
composefs=yes/no/maybe
composefs-apply-sig=yes/no
composefs-add-metadata=yes/no
composefs-keyfiile=/a/path
composefs-certfile=/a/path
```

The `fsverity` key overrides the old `ex-fsverity` section if
specified.  The default for all these is for the new behaviour to be
disabled. Additionally, enabling composefs implies fsverity defaults
to `maybe`, to avoid having to set both.

2 years agofsverity: Support passing a signature when enabling fs-verity
Alexander Larsson [Tue, 16 May 2023 14:31:34 +0000 (16:31 +0200)]
fsverity: Support passing a signature when enabling fs-verity

The composefs code will need this.

2 years agofsverity: Add _ostree_fsverity_sign helper
Alexander Larsson [Tue, 16 May 2023 14:01:33 +0000 (16:01 +0200)]
fsverity: Add _ostree_fsverity_sign helper

This code signs a fsverity digest (using openssl) such that the
resulting signature can be used with the FS_IOC_ENABLE_VERITY ioctl.

2 years agoAdd ot_keyfile_get_tristate_with_default() helper
Alexander Larsson [Tue, 23 May 2023 07:26:26 +0000 (09:26 +0200)]
Add ot_keyfile_get_tristate_with_default() helper

This parses keys like yes/no/maybe. The introduced OtTristate type
is compatible with the existing _OstreeFeatureSupport type.

2 years agoMerge pull request #2864 from cgwalters/prepare-root-prepare-composefs
Colin Walters [Tue, 30 May 2023 13:15:40 +0000 (09:15 -0400)]
Merge pull request #2864 from cgwalters/prepare-root-prepare-composefs

prepare-root: Move sysroot.tmp creation earlier

2 years agoMerge pull request #2866 from jlebon/pr/autoprune-tweaks
Colin Walters [Tue, 30 May 2023 12:38:16 +0000 (08:38 -0400)]
Merge pull request #2866 from jlebon/pr/autoprune-tweaks

lib/deploy: Use `fallocate` for early prune space check

2 years agolib/deploy: Use `fallocate` for early prune space check
Jonathan Lebon [Sat, 27 May 2023 14:37:30 +0000 (10:37 -0400)]
lib/deploy: Use `fallocate` for early prune space check

The `f_bfree` member of the `statvfs` struct is documented as the
"number of free blocks". However, different filesystems have different
interpretations of this. E.g. on XFS, this is truly the number of blocks
free for allocating data. On ext4 however, it includes blocks that
are actually reserved by the filesystem and cannot be used for file
data. (Note this is separate from the distinction between `f_bfree` and
`f_bavail` which isn't relevant to us here since we're privileged.)

If a kernel and initrd is sized just right so that it's still within the
`f_bfree` limit but above what we can actually allocate, the early prune
code won't kick in since it'll think that there is enough space. So we
end up hitting `ENOSPC` when we actually copy the files in.

Rework the early prune code to instead use `fallocate` which guarantees
us that a file of a certain size can fit on the filesystem. `fallocate`
requires filesystem support, but all the filesystems we care about for
the bootfs support it (including even FAT).

(There's technically a TOCTOU race here that existed also with the
`statvfs` code where free space could change between when we check
and when we copy. Ideally we'd be able to pass down that fd to the
copying bits, but anyway in practice the bootfs is pretty much owned by
libostree and one doesn't expect concurrent writes during a finalization
operation.)

2 years agolib/deploy: Rename variable for clarity
Jonathan Lebon [Sun, 28 May 2023 22:37:48 +0000 (18:37 -0400)]
lib/deploy: Rename variable for clarity

`size_to_remove` looks cryptic in contrast to
`new_new_bootcsum_dirs_total_size`. Rename it in the style of the latter
for easier reading.

2 years agolib/deploy: Log case when auto-pruning is hopeless
Jonathan Lebon [Sat, 27 May 2023 14:35:12 +0000 (10:35 -0400)]
lib/deploy: Log case when auto-pruning is hopeless

For easier diagnostics.

2 years agolib/deploy: Drop unused variable
Jonathan Lebon [Sat, 27 May 2023 14:33:39 +0000 (10:33 -0400)]
lib/deploy: Drop unused variable

Noticed this diagnostic in my editor with clangd hooked up.

2 years agolib/deploy: Initialize var to pacify gcc static analysis
Jonathan Lebon [Sat, 27 May 2023 14:27:55 +0000 (10:27 -0400)]
lib/deploy: Initialize var to pacify gcc static analysis

Classic case of analysis getting confused by variables initialized by
a function.

2 years agoprepare-root: Move sysroot.tmp creation earlier
Colin Walters [Tue, 23 May 2023 18:42:15 +0000 (14:42 -0400)]
prepare-root: Move sysroot.tmp creation earlier

Main motivation is prep for composefs in
https://github.com/ostreedev/ostree/pull/2640
In the interest of that, we add a `bool using_composefs` but
it's currently always `false`.

Co-authored-by: Alexander Larsson <alexl@redhat.com>
2 years agoMerge pull request #2860 from cgwalters/xshell2
Colin Walters [Mon, 22 May 2023 17:37:10 +0000 (13:37 -0400)]
Merge pull request #2860 from cgwalters/xshell2

tests: A bit more xshell porting

2 years agoMerge pull request #2859 from jmarrero/release-2023.3
Joseph Marrero Corchado [Thu, 18 May 2023 21:09:04 +0000 (17:09 -0400)]
Merge pull request #2859 from jmarrero/release-2023.3

Release 2023.3

2 years agotests: A bit more xshell porting
Colin Walters [Thu, 18 May 2023 12:14:50 +0000 (08:14 -0400)]
tests: A bit more xshell porting

Part of https://github.com/ostreedev/ostree/issues/2857

2 years agoconfigure: post-release version bump
Joseph Marrero [Wed, 17 May 2023 20:32:43 +0000 (16:32 -0400)]
configure: post-release version bump

2 years agoRelease 2023.3
Joseph Marrero [Wed, 17 May 2023 20:29:04 +0000 (16:29 -0400)]
Release 2023.3

2 years agoMerge pull request #2856 from cgwalters/port-to-xshell
Colin Walters [Wed, 10 May 2023 19:16:24 +0000 (15:16 -0400)]
Merge pull request #2856 from cgwalters/port-to-xshell

tests/inst: Add xshell and use it in one place

2 years agotests/inst: Add xshell and use it in one place
Colin Walters [Wed, 10 May 2023 13:21:45 +0000 (09:21 -0400)]
tests/inst: Add xshell and use it in one place

I've deprecated sh-inline; in the end I think it is better
to minimize the amount of bash code we have.  xshell solves
the core convenience problem of taking local variables and mapping
them to command arguments.

A full port would be nontrivial; this just starts the ball
rolling.

2 years agoMerge pull request #2565 from cgwalters/clang-format
Colin Walters [Wed, 3 May 2023 12:24:21 +0000 (08:24 -0400)]
Merge pull request #2565 from cgwalters/clang-format

Add .clang-format file + tree-wide: Run `clang-format`

2 years agoci: Validate clang-format
Colin Walters [Mon, 1 May 2023 18:24:23 +0000 (14:24 -0400)]
ci: Validate clang-format

2 years agotree-wide: Run clang-format
Colin Walters [Mon, 1 May 2023 18:24:29 +0000 (14:24 -0400)]
tree-wide: Run clang-format

This is a one-time tree wide reformatting to ensure consistency
going forward.

2 years agoclang-format: Don't align backslashes
Colin Walters [Tue, 2 May 2023 12:41:24 +0000 (08:41 -0400)]
clang-format: Don't align backslashes

This increases compatibility between clang-15 and clang-16.
Also, I don't care about the aesthetics here.

2 years agolib: Fix one include
Colin Walters [Mon, 1 May 2023 21:22:02 +0000 (17:22 -0400)]
lib: Fix one include

We need all the ostree bits here.

2 years agoMerge pull request #2854 from cgwalters/clang-format-prep
Jonathan Lebon [Mon, 1 May 2023 20:48:26 +0000 (16:48 -0400)]
Merge pull request #2854 from cgwalters/clang-format-prep

2 years agotree-wide: Fix various include ordering issues
Colin Walters [Mon, 1 May 2023 18:02:09 +0000 (14:02 -0400)]
tree-wide: Fix various include ordering issues

This fixes the build with `clang-format`.

2 years agolib: clang-format `ostree.h`
Colin Walters [Mon, 1 May 2023 17:51:47 +0000 (13:51 -0400)]
lib: clang-format `ostree.h`

In order to make this work, we need to move the autocleanup
definitions after the other headers.

2 years agoAdd clang formatting infrastructure
Colin Walters [Mon, 1 May 2023 17:43:26 +0000 (13:43 -0400)]
Add clang formatting infrastructure

Prep for reformatting the codebase.

2 years agobuild-sys: Squash automake conditional warning re `.PHONY`
Colin Walters [Mon, 1 May 2023 18:21:19 +0000 (14:21 -0400)]
build-sys: Squash automake conditional warning re `.PHONY`

2 years agoMerge pull request #2847 from jlebon/pr/calculate-and-cleanup
Colin Walters [Mon, 1 May 2023 17:25:25 +0000 (13:25 -0400)]
Merge pull request #2847 from jlebon/pr/calculate-and-cleanup

lib/sysroot-deploy: Add experimental support for automatic early prune

2 years agolib/sysroot-deploy: Add experimental support for automatic early prune
Jonathan Lebon [Thu, 13 Apr 2023 21:22:43 +0000 (17:22 -0400)]
lib/sysroot-deploy: Add experimental support for automatic early prune

During the early design of FCOS and RHCOS, we chose a value of 384M
for the boot partition. This turned out to be too small: some arches
other than x86_64 have larger initrds, kernel binaries, or additional
artifacts (like device tree blobs). We'll likely bump the boot partition
size in the future, but we don't want to abandon all the nodes deployed
with the current size.[[1]]

Because stale entries in `/boot` are cleaned up after new entries are
written, there is a window in the update process during which the bootfs
temporarily must host all the `(kernel, initrd)` pairs for the union of
current and new deployments.

This patch determines if the bootfs is capable of holding all the
pairs. If it can't but it could hold all the pairs from just the new
deployments, the outgoing deployments (e.g. rollbacks) are deleted
*before* new deployments are written. This is done by updating the
bootloader in two steps to maintain atomicity.

Since this is a lot of new logic in an important section of the
code, this feature is gated for now behind an environment variable
(`OSTREE_ENABLE_AUTO_EARLY_PRUNE`). Once we gain more experience with
it, we can consider turning it on by default.

This strategy increases the fallibility of the update system since one
would no longer be able to rollback to the previous deployment if a bug
is present in the bootloader update logic after auto-pruning (see [[2]]
and following). This is however mitigated by the fact that the heuristic
is opportunistic: the rollback is pruned *only if* it's the only way for
the system to update.

[1]: https://github.com/coreos/fedora-coreos-tracker/issues/1247
[2]: https://github.com/ostreedev/ostree/issues/2670#issuecomment-1179341883

Closes: #2670
2 years agoMerge pull request #2853 from cgwalters/bump-msrv
Joseph Marrero Corchado [Sun, 30 Apr 2023 17:42:43 +0000 (13:42 -0400)]
Merge pull request #2853 from cgwalters/bump-msrv

rust: Bump MSRV to 1.64

2 years agorust: Bump MSRV to 1.64
Colin Walters [Sat, 29 Apr 2023 21:11:58 +0000 (17:11 -0400)]
rust: Bump MSRV to 1.64

Since a dependency `winnow` bumped to this in a recent update.

2 years agoMerge pull request #2849 from pwithnall/request-debugging
Colin Walters [Wed, 26 Apr 2023 20:46:43 +0000 (16:46 -0400)]
Merge pull request #2849 from pwithnall/request-debugging

lib/fetcher: Add some debugging messages to the libsoup request path

2 years agolib/fetcher: Add some debugging messages to the libsoup request path
Philip Withnall [Wed, 26 Apr 2023 13:04:03 +0000 (14:04 +0100)]
lib/fetcher: Add some debugging messages to the libsoup request path

This will help with debugging stalled requests in future, such as
issue #605.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #605

2 years agoMerge pull request #2850 from cgwalters/ci-no-error-deprecated-declarations
Joseph Marrero Corchado [Wed, 26 Apr 2023 14:50:50 +0000 (10:50 -0400)]
Merge pull request #2850 from cgwalters/ci-no-error-deprecated-declarations

ci: Turn off errors for deprecated-declarations

2 years agoci: Drop workaround for fedora-release-container
Colin Walters [Wed, 26 Apr 2023 13:46:57 +0000 (09:46 -0400)]
ci: Drop workaround for fedora-release-container

I think this isn't necessary anymore, and is now actively broken
with f38.

2 years agoci: Turn off errors for deprecated-declarations
Colin Walters [Wed, 26 Apr 2023 13:37:22 +0000 (09:37 -0400)]
ci: Turn off errors for deprecated-declarations

Having `-Werror` on in CI only by default has generally worked OK,
but I don't think it's worth trying to immediately scramble to port
when they deprecate APIs.

Motivated in this case by
```
 src/libostree/ostree-fetcher-curl.c: In function 'initiate_next_curl_request':
src/libostree/ostree-fetcher-curl.c:876:3: error: 'CURLOPT_PROTOCOLS' is deprecated: since 7.85.0. Use CURLOPT_PROTOCOLS_STR [-Werror=deprecated-declarations]
  876 |   rc = curl_easy_setopt (req->easy, CURLOPT_PROTOCOLS, (long)(CURLPROTO_HTTP | CURLPROTO_HTTPS | CURLPROTO_FILE));
      |   ^~
```

2 years agotests/kolainst: Add `make localinstall`
Jonathan Lebon [Fri, 14 Apr 2023 16:21:05 +0000 (12:21 -0400)]
tests/kolainst: Add `make localinstall`

When hacking and testing locally with `cosa build-fast` and `kola run`,
I prefer to leave testing framework stuff within the work directory
rather than installed in my pet container. Add a `localinstall` target
for this which puts the tests in `tests/kola`. Then a simple `kola run`
will pick it up.

2 years agotests/kola: delete unused .gitignore
Jonathan Lebon [Fri, 14 Apr 2023 16:19:30 +0000 (12:19 -0400)]
tests/kola: delete unused .gitignore

AFAICT, I don't see how `runkola.sh` or the Makefile in `tests/kolainst`
can create files in `tests/kola` since it's geared towards installing
under `/usr`.

2 years agolib/sysroot-deploy: Nuke `finalize-failure.stamp` on successful finalization
Jonathan Lebon [Fri, 14 Apr 2023 16:11:05 +0000 (12:11 -0400)]
lib/sysroot-deploy: Nuke `finalize-failure.stamp` on successful finalization

In the unusual case where one is manually finalizing staged deployments,
as can happen in testing, we expect a successful finalization to remove
the failure stamp file.

2 years agoMerge pull request #2848 from jlebon/pr/calculate-and-cleanup-prep
Colin Walters [Fri, 14 Apr 2023 18:44:38 +0000 (14:44 -0400)]
Merge pull request #2848 from jlebon/pr/calculate-and-cleanup-prep

Prep patches for automatic early prune

2 years agolibotutil: add utility functions for calculating directory size
Jonathan Lebon [Thu, 13 Apr 2023 21:22:42 +0000 (17:22 -0400)]
libotutil: add utility functions for calculating directory size

Prep for future patch.

2 years agolib/sysroot-cleanup: Make bootfs cleanup function global
Jonathan Lebon [Thu, 13 Apr 2023 21:22:41 +0000 (17:22 -0400)]
lib/sysroot-cleanup: Make bootfs cleanup function global

Prep for future patch.

2 years agolib/sysroot-cleanup: Factor out bootfs cleanup
Jonathan Lebon [Thu, 13 Apr 2023 21:22:40 +0000 (17:22 -0400)]
lib/sysroot-cleanup: Factor out bootfs cleanup

Crawling through the bootfs and the deployment dirs was already mostly
separate. The only inefficiency here is that we now iterate over the
array of active deployments twice when building the hash tables. No
functional change otherwise.

Prep for future patch.

2 years agolib/sysroot-cleanup: Drop dead code
Jonathan Lebon [Thu, 13 Apr 2023 21:22:39 +0000 (17:22 -0400)]
lib/sysroot-cleanup: Drop dead code

We weren't actually using this `stbuf` anywhere.

2 years agolib/sysroot-cleanup: Make some static utility functions global
Jonathan Lebon [Thu, 13 Apr 2023 21:22:38 +0000 (17:22 -0400)]
lib/sysroot-cleanup: Make some static utility functions global

Prep for future patch.

2 years agolib/sysroot-cleanup: Convert bootdir listing to dfd-relative
Jonathan Lebon [Thu, 13 Apr 2023 21:22:37 +0000 (17:22 -0400)]
lib/sysroot-cleanup: Convert bootdir listing to dfd-relative

No functional change.

2 years agoMerge pull request #2547 from q66/soup3
Dan Nicholson [Thu, 13 Apr 2023 16:05:01 +0000 (10:05 -0600)]
Merge pull request #2547 from q66/soup3

port to libsoup3

2 years agofetcher/soup3: Rewrite without threads
Dan Nicholson [Fri, 7 Apr 2023 15:47:14 +0000 (09:47 -0600)]
fetcher/soup3: Rewrite without threads

soup3 works best using only the async API from a single thread[1].
Rework the fetcher to stop using worker threads. In order to maximize
session usage across requests, sessions will be reused for each main
context.

1. https://libsoup.org/libsoup-3.0/client-thread-safety.html

2 years agoci: Add test configuration with soup3
Dan Nicholson [Thu, 13 Apr 2023 04:34:23 +0000 (22:34 -0600)]
ci: Add test configuration with soup3

This needs to be on Debian testing for now since bullseye doesn't have
soup3.

2 years agofetcher: add libsoup3 backend
Daniel Kolesa [Thu, 17 Feb 2022 19:12:18 +0000 (20:12 +0100)]
fetcher: add libsoup3 backend

The default is still soup2, you can use --with-soup3 to enable
the soup3 backend instead.

2 years agotests: Ensure real GIO backends aren't used
Dan Nicholson [Wed, 5 Apr 2023 22:26:10 +0000 (16:26 -0600)]
tests: Ensure real GIO backends aren't used

Set a few environment variables during tests to ensure fake GIO backends
are used. This is particularly important with the soup fetcher backend
as it can cause strange test errors in containerized test environments.
Upstream soup has been setting these 3 environment variables for their
tests since 2015.

2 years agoMerge pull request #2839 from cgwalters/treegen-race
Colin Walters [Thu, 23 Mar 2023 21:55:36 +0000 (17:55 -0400)]
Merge pull request #2839 from cgwalters/treegen-race

treegen: Require at least one mutation

2 years agotreegen: Require at least one mutation
Colin Walters [Fri, 17 Mar 2023 17:17:11 +0000 (13:17 -0400)]
treegen: Require at least one mutation

Since a later assertion would otherwise trigger.  We saw
this happen in CI.

2 years agoMerge pull request #2842 from cgwalters/release
Colin Walters [Wed, 22 Mar 2023 17:07:43 +0000 (13:07 -0400)]
Merge pull request #2842 from cgwalters/release

Release 2023.2

2 years agoconfigure: post-release version bump
Colin Walters [Wed, 22 Mar 2023 13:58:54 +0000 (09:58 -0400)]
configure: post-release version bump

2 years agoRelease 2023.2
Colin Walters [Wed, 22 Mar 2023 13:57:57 +0000 (09:57 -0400)]
Release 2023.2

2 years agoMerge pull request #2823 from jlebon/pr/testiso-update
Colin Walters [Fri, 17 Mar 2023 18:22:50 +0000 (14:22 -0400)]
Merge pull request #2823 from jlebon/pr/testiso-update

ci: update for new kolaTestIso()

2 years agoMerge pull request #2838 from cgwalters/more-binding-fixes
Colin Walters [Fri, 17 Mar 2023 18:08:18 +0000 (14:08 -0400)]
Merge pull request #2838 from cgwalters/more-binding-fixes

More binding fixes

2 years agorust-bindings: Regenerate
Colin Walters [Fri, 17 Mar 2023 15:54:14 +0000 (11:54 -0400)]
rust-bindings: Regenerate

This picks up more of tintou's recent changes.

2 years agoRevert "repo: Fix nullability for remote options"
Colin Walters [Fri, 17 Mar 2023 15:53:20 +0000 (11:53 -0400)]
Revert "repo: Fix nullability for remote options"

This reverts commit c4d03d28500c75ad2bcf7b75383fc60fe7b83ca8.

2 years agoMerge pull request #2812 from tintou/tintou/g-ir-fix
Colin Walters [Fri, 17 Mar 2023 15:36:22 +0000 (11:36 -0400)]
Merge pull request #2812 from tintou/tintou/g-ir-fix

build: Do not include private headers in the introspection

2 years agoMerge pull request #2813 from tintou/tintou/asyncprogress-typedef
Colin Walters [Fri, 17 Mar 2023 15:32:18 +0000 (11:32 -0400)]
Merge pull request #2813 from tintou/tintou/asyncprogress-typedef

libostree: Ignore new_and_connect in the introspection

2 years agoci: update for new kolaTestIso()
Jonathan Lebon [Wed, 1 Mar 2023 14:42:46 +0000 (09:42 -0500)]
ci: update for new kolaTestIso()

The `skipMetal4k` and `skipMultipath` parameters no longer do anything.
Instead use `--denylist-test` which is interpreted directly by the
new `kola testiso` code.

This will run more tests than before. We'll likely cut down tests we
consider redundant soon, but that should be transparent to this code.

2 years agoMerge pull request #2836 from smcv/file-info-size
Colin Walters [Fri, 17 Mar 2023 15:28:18 +0000 (11:28 -0400)]
Merge pull request #2836 from smcv/file-info-size

Cope with GLib 2.76 being more strict about GFileInfo standard::size

2 years agoMerge pull request #2837 from smcv/g-steal-fd
Colin Walters [Fri, 17 Mar 2023 15:27:03 +0000 (11:27 -0400)]
Merge pull request #2837 from smcv/g-steal-fd

Use g_steal_fd() in preference to glnx_steal_fd()

2 years agoMerge pull request #2705 from cgwalters/always-boot
Joseph Marrero Corchado [Fri, 17 Mar 2023 15:09:19 +0000 (11:09 -0400)]
Merge pull request #2705 from cgwalters/always-boot

Add `sysroot.bootprefix` option

2 years agoMerge pull request #2791 from cgwalters/enable-trust-return-nullability
Jonathan Lebon [Fri, 17 Mar 2023 13:37:40 +0000 (09:37 -0400)]
Merge pull request #2791 from cgwalters/enable-trust-return-nullability

2 years agoUse g_steal_fd() in preference to glnx_steal_fd()
Simon McVittie [Fri, 17 Mar 2023 13:32:26 +0000 (13:32 +0000)]
Use g_steal_fd() in preference to glnx_steal_fd()

g_steal_fd() exists in GLib since 2.70, and libglnx has a backport for
older GLib versions, equivalent to the libglnx-specific glnx_steal_fd().

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agowrite_content_object: Don't assume file info has standard::size
Simon McVittie [Fri, 17 Mar 2023 12:56:39 +0000 (12:56 +0000)]
write_content_object: Don't assume file info has standard::size

The file info object for symlinks might validly not have this attribute.
If not, behave as though it was 0, matching what happened with older
versions of GLib.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years ago_ostree_zlib_file_header_new: Default size to 0
Simon McVittie [Fri, 17 Mar 2023 12:54:33 +0000 (12:54 +0000)]
_ostree_zlib_file_header_new: Default size to 0

Similar to the previous commit, but for
ostree_raw_file_to_archive_z2_stream() and similar public APIs.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agoostree_raw_file_to_content_stream: Make size default to 0
Simon McVittie [Fri, 17 Mar 2023 12:53:42 +0000 (12:53 +0000)]
ostree_raw_file_to_content_stream: Make size default to 0

Some existing code calls into ostree_raw_file_to_content_stream() with
file objects that do not have the standard::size attribute. Since GLib
2.76.0, attempting to access the size of such an object raises a
critical warning. Handle this more gracefully by defaulting the size
to 0, like earlier versions of GLib did.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2 years agorust: Renerate bindings
Colin Walters [Fri, 17 Mar 2023 12:25:16 +0000 (08:25 -0400)]
rust: Renerate bindings

To pick up the latest introspection changes.

2 years agorepo: Fix nullability for remote options
Colin Walters [Fri, 17 Mar 2023 12:20:16 +0000 (08:20 -0400)]
repo: Fix nullability for remote options

Unfortunately, the nullability of the output value here is
dependent on whether the `default_value` parameter is provided.  There's
no way to express this in introspection or Rust.

2 years agolib: Fix two nullable annotations
Colin Walters [Fri, 17 Mar 2023 12:19:22 +0000 (08:19 -0400)]
lib: Fix two nullable annotations

- commit parents are optional
- remote URLs are optional

2 years agorust: Bump semver
Colin Walters [Tue, 14 Mar 2023 23:50:28 +0000 (19:50 -0400)]
rust: Bump semver

Since we did a bunch of API changes due to nullability and
other introspection cleanups.

2 years agoAdd docs and fix annotations for ostree-repo-file.c
Colin Walters [Tue, 14 Mar 2023 22:11:30 +0000 (18:11 -0400)]
Add docs and fix annotations for ostree-repo-file.c

The code here is not great, embarassing we've gone this
long without docs for some of these public API functions too.

I think this is right though.

2 years agoEnable `trust_return_value_nullability`
Colin Walters [Thu, 1 Dec 2022 13:10:15 +0000 (08:10 -0500)]
Enable `trust_return_value_nullability`

Several commonly used APIs currently unnecessarily return
`Option<T>`, like `ostree_deployment_get_csum()`.

Flip the gir flag for this to on; I think our annotations are
correct.

2 years agoMerge pull request #2835 from cgwalters/more-gfileinfo
Colin Walters [Fri, 17 Mar 2023 00:27:20 +0000 (20:27 -0400)]
Merge pull request #2835 from cgwalters/more-gfileinfo

tests: Set size on fileinfo

2 years agotests: Set size on fileinfo
Colin Walters [Thu, 16 Mar 2023 22:31:03 +0000 (18:31 -0400)]
tests: Set size on fileinfo

Closes: https://github.com/ostreedev/ostree/issues/2827
2 years agoMerge pull request #2834 from evan-a-a/fix_glib
Colin Walters [Thu, 16 Mar 2023 11:56:56 +0000 (07:56 -0400)]
Merge pull request #2834 from evan-a-a/fix_glib

core: Ensure glib standard::size attribute is always set