import rpm-ostree-2022.10.112.g3d0ac35b-3.el8

This commit is contained in:
CentOS Sources 2023-05-16 06:04:09 +00:00 committed by Stepan Oksanichenko
parent 238807ddb8
commit e35bfc7f30
6 changed files with 100 additions and 187 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/rpm-ostree-2022.10.90.g4abaf4b4.tar.xz SOURCES/rpm-ostree-2022.10.112.g3d0ac35b.tar.xz

View File

@ -1 +1 @@
00674220f1468ad2f63062668cdd02022b2eba43 SOURCES/rpm-ostree-2022.10.90.g4abaf4b4.tar.xz cdce35bda2d188e33f236e06b4c6e1d39bf5f71b SOURCES/rpm-ostree-2022.10.112.g3d0ac35b.tar.xz

View File

@ -1,143 +0,0 @@
From 0049dbdd91cc0c1900132374645c5114063db04d Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 29 Sep 2022 14:01:07 -0400
Subject: [PATCH] compose: Handle embedded whiteouts
This pairs with
https://github.com/ostreedev/ostree/pull/2722/commits/0085494e350c72599fc5c0e00422885d80b3c660
Basically, while I think it'd make sense actually for the baseline
`ostree commit` process to handle this, for now let's put it
here in rpm-ostree (where it can be in Rust too). Though
a definite negative is that we're now traversing the whole filesystem
again.
(cherry picked from commit fea26bdd5db59fcf0853a9bb4ab6dcb340be9470)
---
rust/src/composepost.rs | 63 ++++++++++++++++++++++++++++++-
tests/compose/test-installroot.sh | 8 ++++
2 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/rust/src/composepost.rs b/rust/src/composepost.rs
index ab5cc176..70a01497 100644
--- a/rust/src/composepost.rs
+++ b/rust/src/composepost.rs
@@ -202,6 +202,47 @@ fn postprocess_presets(rootfs_dfd: &Dir) -> Result<()> {
Ok(())
}
+fn is_overlay_whiteout(meta: &cap_std::fs::Metadata) -> bool {
+ (meta.mode() & libc::S_IFMT) == libc::S_IFCHR && meta.rdev() == 0
+}
+
+/// Auto-synthesize embedded overlayfs whiteouts; for more information
+/// see https://github.com/ostreedev/ostree/pull/2722/commits/0085494e350c72599fc5c0e00422885d80b3c660
+#[context("Postprocessing embedded overlayfs")]
+fn postprocess_embedded_ovl_whiteouts(root: &Dir) -> Result<()> {
+ const OSTREE_WHITEOUT_PREFIX: &str = ".ostree-wh.";
+ fn recurse(root: &Dir, path: &Utf8Path) -> Result<u32> {
+ let mut n = 0;
+ for entry in root.read_dir(path)? {
+ let entry = entry?;
+ let meta = entry.metadata()?;
+ let name = PathBuf::from(entry.file_name());
+ let name: Utf8PathBuf = name.try_into()?;
+ if meta.is_dir() {
+ n += recurse(root, &path.join(name))?;
+ continue;
+ }
+ if !is_overlay_whiteout(&meta) {
+ continue;
+ };
+ let srcpath = path.join(&name);
+ let targetname = format!("{OSTREE_WHITEOUT_PREFIX}{name}");
+ let destpath = path.join(&targetname);
+ root.remove_file(srcpath)?;
+ root.atomic_write_with_perms(destpath, "", meta.permissions())?;
+ n += 1;
+ }
+ Ok(n)
+ }
+ let n = recurse(root, ".".into())?;
+ if n > 0 {
+ println!("Processed {n} embedded whiteouts");
+ } else {
+ println!("No embedded whiteouts found");
+ }
+ Ok(())
+}
+
/// Write an RPM macro file to ensure the rpmdb path is set on the client side.
pub fn compose_postprocess_rpm_macro(rootfs_dfd: i32) -> CxxResult<()> {
let rootfs = unsafe { &crate::ffiutil::ffi_dirfd(rootfs_dfd)? };
@@ -290,13 +331,17 @@ pub(crate) fn postprocess_cleanup_rpmdb(rootfs_dfd: i32) -> CxxResult<()> {
/// on the target host.
pub fn compose_postprocess_final(rootfs_dfd: i32) -> CxxResult<()> {
let rootfs_dfd = unsafe { &crate::ffiutil::ffi_dirfd(rootfs_dfd)? };
+ // These tasks can safely run in parallel, so just for fun we do so via rayon.
let tasks = [
postprocess_useradd,
postprocess_presets,
postprocess_subs_dist,
postprocess_rpm_macro,
];
- Ok(tasks.par_iter().try_for_each(|f| f(rootfs_dfd))?)
+ tasks.par_iter().try_for_each(|f| f(rootfs_dfd))?;
+ // This task recursively traverses the filesystem and hence should be serial.
+ postprocess_embedded_ovl_whiteouts(rootfs_dfd)?;
+ Ok(())
}
#[context("Handling treefile 'units'")]
@@ -1290,6 +1335,22 @@ OSTREE_VERSION='33.4'
Ok(())
}
+ #[test]
+ fn test_overlay() -> Result<()> {
+ // We don't actually test creating whiteout devices here as that
+ // may not work.
+ let td = cap_tempfile::tempdir(cap_std::ambient_authority())?;
+ // Verify no-op case
+ postprocess_embedded_ovl_whiteouts(&td).unwrap();
+ td.create("foo")?;
+ td.symlink("foo", "bar")?;
+ postprocess_embedded_ovl_whiteouts(&td).unwrap();
+ assert!(td.try_exists("foo")?);
+ assert!(td.try_exists("bar")?);
+
+ Ok(())
+ }
+
#[test]
fn test_tmpfiles_d_translation() {
use nix::sys::stat::{umask, Mode};
diff --git a/tests/compose/test-installroot.sh b/tests/compose/test-installroot.sh
index 1ac09b9a..3e40f679 100755
--- a/tests/compose/test-installroot.sh
+++ b/tests/compose/test-installroot.sh
@@ -54,6 +54,8 @@ echo "ok postprocess with treefile"
testdate=$(date)
runasroot sh -xec "
+# https://github.com/ostreedev/ostree/pull/2717/commits/e234b630f85b97e48ecf45d5aaba9b1aa64e6b54
+mknod -m 000 ${instroot}-directcommit/usr/share/foowhiteout c 0 0
echo \"${testdate}\" > ${instroot}-directcommit/usr/share/rpm-ostree-composetest-split.txt
! test -f ${instroot}-directcommit/${integrationconf}
rpm-ostree compose commit --repo=${repo} ${treefile} ${instroot}-directcommit
@@ -61,6 +63,12 @@ ostree --repo=${repo} ls ${treeref} /usr/bin/bash
if ostree --repo=${repo} ls ${treeref} /var/lib/rpm >/dev/null; then
echo found /var/lib/rpm in commit 1>&2; exit 1
fi
+
+# Verify whiteout renames
+ostree --repo=${repo} ls ${treeref} /usr/share
+ostree --repo=${repo} ls ${treeref} /usr/share/.ostree-wh.foowhiteout >out.txt
+grep -Ee '^-00000' out.txt
+
ostree --repo=${repo} cat ${treeref} /usr/share/rpm-ostree-composetest-split.txt >out.txt
grep \"${testdate}\" out.txt
ostree --repo=${repo} cat ${treeref} /${integrationconf}
--
2.38.1

View File

@ -0,0 +1,74 @@
From a0f1275dfbd835b704355d095e610ac1f1254f25 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Sun, 11 Dec 2022 13:40:15 -0500
Subject: [PATCH] daemon: Make failure to query base image non-fatal
We had a GC bug which then propagates into a hard daemon
failure right now because we try to gather data on all deployments.
Make this non-fatal; we should try to stumble forward as much
as possible so that one can e.g. perform an upgrade operation.
(cherry picked from commit 8dd45f293afc1ca32b42bda86dde47c66e652dda)
---
src/app/rpmostree-builtin-status.cxx | 12 +++++++++---
src/daemon/rpmostreed-deployment-utils.cxx | 20 ++++++++++++++------
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/src/app/rpmostree-builtin-status.cxx b/src/app/rpmostree-builtin-status.cxx
index cec0a2e3..ee82e589 100644
--- a/src/app/rpmostree-builtin-status.cxx
+++ b/src/app/rpmostree-builtin-status.cxx
@@ -688,9 +688,15 @@ print_one_deployment (RPMOSTreeSysroot *sysroot_proxy, GVariant *child, gint ind
break;
case rpmostreecxx::RefspecType::Container:
{
- g_assert (g_variant_dict_lookup (dict, "container-image-reference-digest", "s",
- &container_image_reference_digest));
- g_print ("%s", origin_refspec);
+ if (g_variant_dict_lookup (dict, "container-image-reference-digest", "s",
+ &container_image_reference_digest))
+ {
+ g_print ("%s", origin_refspec);
+ }
+ else
+ {
+ g_print ("(error fetching image metadata)");
+ }
}
break;
}
diff --git a/src/daemon/rpmostreed-deployment-utils.cxx b/src/daemon/rpmostreed-deployment-utils.cxx
index b7b27fed..48480509 100644
--- a/src/daemon/rpmostreed-deployment-utils.cxx
+++ b/src/daemon/rpmostreed-deployment-utils.cxx
@@ -214,12 +214,20 @@ rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot, OstreeDeployment
case rpmostreecxx::RefspecType::Container:
{
g_variant_dict_insert (dict, "container-image-reference", "s", refspec);
- CXX_TRY_VAR (state, rpmostreecxx::query_container_image_commit (*repo, base_checksum),
- error);
- g_variant_dict_insert (dict, "container-image-reference-digest", "s",
- state->image_digest.c_str ());
- if (state->version.size () > 0)
- g_variant_dict_insert (dict, "version", "s", state->version.c_str ());
+ // For now, make this non-fatal https://github.com/coreos/rpm-ostree/issues/4185
+ try
+ {
+ auto state = rpmostreecxx::query_container_image_commit (*repo, base_checksum);
+ g_variant_dict_insert (dict, "container-image-reference-digest", "s",
+ state->image_digest.c_str ());
+ if (state->version.size () > 0)
+ g_variant_dict_insert (dict, "version", "s", state->version.c_str ());
+ }
+ catch (std::exception &e)
+ {
+ sd_journal_print (LOG_ERR, "failed to query container image base metadata: %s",
+ e.what ());
+ }
}
break;
case rpmostreecxx::RefspecType::Checksum:
--
2.31.1

View File

@ -1,29 +0,0 @@
diff --color -urN rpm-ostree-2022.10.90.g4abaf4b4-orig/src/app/rpmostree-builtin-status.cxx rpm-ostree-2022.10.90.g4abaf4b4/src/app/rpmostree-builtin-status.cxx
--- rpm-ostree-2022.10.90.g4abaf4b4-orig/src/app/rpmostree-builtin-status.cxx 2022-08-16 08:40:32.000000000 -0400
+++ rpm-ostree-2022.10.90.g4abaf4b4/src/app/rpmostree-builtin-status.cxx 2023-02-07 19:56:17.018048420 -0500
@@ -489,10 +489,7 @@
g_autoptr (GVariant) reposdata = g_variant_dict_lookup_value (
commit_meta, "rpmostree.rpmmd-repos", G_VARIANT_TYPE ("aa{sv}"));
- if (!reposdata)
- return;
-
- const guint n = g_variant_n_children (reposdata);
+ const guint n = reposdata ? g_variant_n_children (reposdata) : 0;
if (n == 0 || !opt_verbose)
{
/* no repos to print, so this is just a pure kv print */
diff --color -urN rpm-ostree-2022.10.90.g4abaf4b4-orig/tests/vmcheck/test-misc-2.sh rpm-ostree-2022.10.90.g4abaf4b4/tests/vmcheck/test-misc-2.sh
--- rpm-ostree-2022.10.90.g4abaf4b4-orig/tests/vmcheck/test-misc-2.sh 2022-08-16 08:40:32.000000000 -0400
+++ rpm-ostree-2022.10.90.g4abaf4b4/tests/vmcheck/test-misc-2.sh 2023-02-07 19:57:05.111019172 -0500
@@ -26,6 +26,10 @@
# More miscellaneous tests
+# Verify that the commit is printed in the output
+vm_rpmostree status > status.txt
+assert_file_has_content status.txt 'Commit:'
+
# Locked finalization
booted_csum=$(vm_get_booted_csum)
commit=$(vm_cmd ostree commit -b vmcheck --tree=ref=vmcheck)

View File

@ -3,17 +3,15 @@
Summary: Hybrid image/package system Summary: Hybrid image/package system
Name: rpm-ostree Name: rpm-ostree
Version: 2022.10.90.g4abaf4b4 Version: 2022.10.112.g3d0ac35b
Release: 6%{?dist} Release: 3%{?dist}
License: LGPLv2+ License: LGPLv2+
URL: https://github.com/coreos/rpm-ostree URL: https://github.com/coreos/rpm-ostree
# This tarball is generated via "cd packaging && make -f Makefile.dist-packaging dist-snapshot" # This tarball is generated via "cd packaging && make -f Makefile.dist-packaging dist-snapshot"
# in the upstream git. It also contains vendored Rust sources. This is generated from the "rhel8" branch. # in the upstream git. It also contains vendored Rust sources. This is generated from the "rhel8" branch.
Source0: https://github.com/coreos/rpm-ostree/releases/download/v%{version}/rpm-ostree-%{version}.tar.xz Source0: https://github.com/coreos/rpm-ostree/releases/download/v%{version}/rpm-ostree-%{version}.tar.xz
# https://bugzilla.redhat.com/show_bug.cgi?id=2137905 Patch0: 0001-daemon-Make-failure-to-query-base-image-non-fatal.patch
Patch0: 0001-compose-Handle-embedded-whiteouts.patch
Patch1: 0002-fix-printing-commits-on-status.patch
ExclusiveArch: %{rust_arches} ExclusiveArch: %{rust_arches}
@ -231,15 +229,28 @@ $PYTHON autofiles.py > files.devel \
%files devel -f files.devel %files devel -f files.devel
%changelog %changelog
* Wed Feb 15 2023 Joseph Marrero <jmarrero@redhat.com> - 2022.10.90.g4abaf4b4-6 * Thu Feb 16 2023 Colin Walters <walters@verbum.org> - 2022.10.112.g3d0ac35b-3
- Backport - Cherry pick
https://github.com/coreos/rpm-ostree/commit/9dc5dcd0594d122172493695e31b0c63e7ea2e74 https://github.com/coreos/rpm-ostree/pull/4311/commits/a0f1275dfbd835b704355d095e610ac1f1254f25
Resolves: rhbz#2167476 Resolves: rhbz#2170579
* Tue Dec 13 2022 Colin Walters <walters@verbum.org> - 2022.10.90.g4abaf4b4-5 * Tue Feb 14 2023 Colin Walters <walters@verbum.org> - 2022.10.112.g3d0ac35b-2
- Backport - Sync to latest rhel8 branch
https://github.com/coreos/rpm-ostree/commit/0049dbdd91cc0c1900132374645c5114063db04d Resolves: rhbz#2169429
Resolves: rhbz#2137905
* Fri Oct 14 2022 Colin Walters <walters@verbum.org> - 2022.10.99.g0049dbdd-3
- Resolves: rhbz#2134630
* Wed Sep 28 2022 Colin Walters <walters@verbum.org> - 2022.10.97.gade6df33-2
- Update to latest https://github.com/coreos/rpm-ostree/tree/rhel8 at commit
https://github.com/coreos/rpm-ostree/commit/ac182cb920f84946bb155e9cf061db7f5f26e917
- Resolves: rhbz#2122289
* Wed Aug 31 2022 Colin Walters <walters@verbum.org> - 2022.10.94.g89f58028-2
- Update to latest https://github.com/coreos/rpm-ostree/tree/rhel8 at commit
https://github.com/coreos/rpm-ostree/commit/89f58028f0bea5b6fa59bdb3506078e09957ec00
- Resolves: rhbz#2122289
- Resolves: rhbz#2122299
* Tue Aug 16 2022 Colin Walters <walters@verbum.org> - 2022.10.90.g4abaf4b4-4 * Tue Aug 16 2022 Colin Walters <walters@verbum.org> - 2022.10.90.g4abaf4b4-4
- Update to latest https://github.com/coreos/rpm-ostree/tree/rhel8 at commit - Update to latest https://github.com/coreos/rpm-ostree/tree/rhel8 at commit