From 3ef1256cd3c3878ab2d10a3efee5619e6d5e15b1 Mon Sep 17 00:00:00 2001 From: renner <80410025+renner0e@users.noreply.github.com> Date: Fri, 16 Oct 2026 07:11:44 +0000 Subject: [PATCH] feat: timestamp all files with epoch 0 (#3028) * feat: timestamp all files with epoch 0 We have been using this chunkah feature [1] to put non-rpm content like the brew tarball in dedicated layers, we didn't actually save any bandwith on downloads with this as the copying sets the file modification and access time. Which makes it non-reproducible and every single update would re-download everything not in RPMs. This should make updates smaller especially noticeable on daily/multiple daily image builds. I'm not sure how much of a positive effect this is gonna have on the stable weekly images as the brew tarball is refreshed weekly. Things like the wallpapers should at least no longer be downloaded when they haven't changed. There are still some files we could do but I think it's mostly not worth it. xref: https://github.com/ublue-os/aurora/issues/2579 [1] https://github.com/coreos/chunkah#customizing-the-layers * typo Co-authored-by: Adam Fidel --------- Co-authored-by: Adam Fidel --- Containerfile.in | 2 +- build_scripts/base/19-initramfs.sh | 3 +- build_scripts/shared/chunkah-xattr.sh | 23 ----------- build_scripts/shared/unpackaged.sh | 56 +++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 25 deletions(-) delete mode 100755 build_scripts/shared/chunkah-xattr.sh create mode 100755 build_scripts/shared/unpackaged.sh diff --git a/Containerfile.in b/Containerfile.in index f378cf2e..5441968a 100644 --- a/Containerfile.in +++ b/Containerfile.in @@ -94,7 +94,7 @@ RUN --network=none \ /ctx/build_scripts/base/18-image-info.sh && \ /ctx/build_scripts/base/19-initramfs.sh && \ /ctx/build_scripts/shared/clean-stage.sh && \ - /ctx/build_scripts/shared/chunkah-xattr.sh && \ + /ctx/build_scripts/shared/unpackaged.sh && \ /ctx/build_scripts/base/20-tests.sh CMD ["/sbin/init"] diff --git a/build_scripts/base/19-initramfs.sh b/build_scripts/base/19-initramfs.sh index fa105ab2..7d97726e 100755 --- a/build_scripts/base/19-initramfs.sh +++ b/build_scripts/base/19-initramfs.sh @@ -37,7 +37,8 @@ rm "${TMP_OS_RELEASE}" chmod 0600 "${INITRAMFS}" # for reproducibility -touch -a -m -d "1970-01-01T00:00:00Z" "${INITRAMFS}" +# This is done globally now +# touch -a -m -d "1970-01-01T00:00:00Z" "${INITRAMFS}" # for debugging sha256sum "${INITRAMFS}" diff --git a/build_scripts/shared/chunkah-xattr.sh b/build_scripts/shared/chunkah-xattr.sh deleted file mode 100755 index 8a9b4e41..00000000 --- a/build_scripts/shared/chunkah-xattr.sh +++ /dev/null @@ -1,23 +0,0 @@ -# See: https://github.com/coreos/chunkah#customizing-the-layers -#!/usr/bin/env bash - -set -eoux pipefail - -setfattr -n user.component -v "aurora-wallpapers" /usr/share/backgrounds/aurora -setfattr -n user.update-interval -v "monthly" /usr/share/backgrounds/aurora - -setfattr -n user.component -v "aurora-assets" /usr/share/plasma/avatars/{echo,lumina,scope,tina,vincent}.png -setfattr -n user.component -v "aurora-assets" /etc/bazaar/*.jxl -setfattr -n user.update-interval -v "quarterly" /etc/bazaar/*.jxl - -setfattr -n user.component -v "aurora-plasma-theme" /usr/share/plasma/look-and-feel/dev.getaurora.aurora{,light}.desktop -setfattr -n user.update-interval -v "quarterly" /usr/share/plasma/look-and-feel/dev.getaurora.aurora{,light}.desktop - -setfattr -n user.component -v "aurora-config" /usr/share/ublue-os -setfattr -n user.component -v "homebrew" /usr/share/homebrew.tar.zst - -setfattr -n user.component -v "aurora-offline-docs" /usr/share/doc/aurora/aurora.pdf - -setfattr -n user.component -v "aurora-config" /usr/lib/systemd/system-generators/coreos-sulogin-force-generator - -setfattr -n user.component -v "aurora-config" /usr/share/bash-preexec diff --git a/build_scripts/shared/unpackaged.sh b/build_scripts/shared/unpackaged.sh new file mode 100755 index 00000000..a450ce42 --- /dev/null +++ b/build_scripts/shared/unpackaged.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# See: https://github.com/coreos/chunkah#customizing-the-layers +echo "::group:: ===$(basename "$0")===" + +set -eoux pipefail + +HOMEBREW_TARBALL=/usr/share/homebrew.tar.zst +setfattr -n user.component -v "homebrew" "${HOMEBREW_TARBALL}" + +# rpm-ostree creates tmpfiles from packages having owned files in /{var,run} +RPM_OSTREE_TMPFILES=/usr/lib/rpm-ostree/tmpfiles.d +setfattr -n user.component -v "rpm-ostree-tmpfiles.d" "${RPM_OSTREE_TMPFILES}" +# vibes, shouldn't change super often +setfattr -n user.update-interval -v "quarterly" "${RPM_OSTREE_TMPFILES}" + +FONTCONFIG_CACHE=/usr/lib/fontconfig/cache +setfattr -n user.component -v "fontconfig-cache" "${FONTCONFIG_CACHE}" +# also vibes, no idea how often this changes, but it seems to change often +setfattr -n user.update-interval -v "daily" "${FONTCONFIG_CACHE}" + +WALLPAPERS=/usr/share/backgrounds/aurora +setfattr -n user.component -v "aurora-wallpapers" "${WALLPAPERS}" +setfattr -n user.update-interval -v "monthly" "${WALLPAPERS}" + +AURORA_CHARS=(/usr/share/plasma/avatars/{echo,lumina,scope,tina,vincent}.png) +setfattr -n user.component -v "aurora-assets" "${AURORA_CHARS[@]}" + +BAZAAR=(/etc/bazaar/*.jxl) +setfattr -n user.component -v "aurora-assets" "${BAZAAR[@]}" +setfattr -n user.update-interval -v "quarterly" "${BAZAAR[@]}" + +AURORA_DOCS_PDF="/usr/share/doc/aurora/aurora.pdf" +setfattr -n user.component -v "aurora-offline-docs" "${AURORA_DOCS_PDF}" + +# TODO: everything else we can probably add here +FRAMEWORK_ICC=(/usr/share/color/icc/colord/framework1{3,6}.icc) +setfattr -n user.component -v "never-change" "${FRAMEWORK_ICC[@]}" +setfattr -n user.update-interval -v "yearly" "${FRAMEWORK_ICC[@]}" + +# This is absolutely nasty, ideally we'd use SOURCE_DATE_EPOCH=0 on chunkah for +# all the touch invocations but this (potentially) affects the layer plan +# negatively +# See: https://github.com/coreos/chunkah/issues/160 +# +# on the composefs backend this also makes it so that bootc (uupd notification) +# flags the image as outdated with label org.opencontainers.image.created and +# ".Created" (it's set to 1970 after all) this doesn't happen on ostree +# https://github.com/bootc-dev/bootc/issues/2227 + +# This shouldn't hurt anything, Epoch 0 is what RPMs are using, we don't want to override that +find /usr /etc /opt -exec touch -h -a -m -d '1970-01-01T00:00:00Z' {} + + +# getfattr -R -d /usr 2> /dev/null || true +# getfattr -R -d /etc 2> /dev/null || true + +echo "::endgroup::"