Moved temporary files into a folder of their own below the data directory (#1245)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-29 18:45:34 +01:00
1 parent ddfc632b63
commit 12d3e1ec6c
52 files changed
+1219 -396

No files matched your search

+72 -1
View File
@@ -110,6 +110,74 @@ echo "${yq_sha256} $BUILD_DIRECTORY/tools/yq" | sha256sum --check --strict
chmod 755 "$BUILD_DIRECTORY/tools/yq"
export PATH="$BUILD_DIRECTORY/tools:$PATH"
# Since the image of 2026-11-29, flatpak-validate-icon loads images through glycin, which starts a loader for each
# image in a bwrap sandbox, with a seccomp filter and a limit on its address space. Under the emulation of another CPU
# architecture, e.g., x86_64 by Rosetta on Apple Silicon, neither works: the kernel refuses the filter, and Rosetta
# cannot start within the limit. glycin has no fallback, so flatpak build-export refuses every icon with "Format not
# recognized". A probe with a valid PNG tells whether the validator can load images here. When it cannot, the export
# checks the icons with a fallback instead, which reads their format and size but does not decode them. The CI of the
# Flatpak repository and Flathub build natively and check the icons in full.
stage "Checking the icon validator"
icon_validator="$(dirname "$(command -v flatpak)")/../libexec/flatpak-validate-icon"
[ -x "$icon_validator" ] || fail "the image lacks flatpak-validate-icon next to flatpak"
python3 -I - "$BUILD_DIRECTORY/tools/probe.png" <<'EOF'
import struct
import sys
import zlib
def chunk(kind, data):
return struct.pack(">I", len(data)) + kind + data + struct.pack(">I", zlib.crc32(kind + data))
rows = b"".join(b"\x00" + b"\x00\x00\x00\xff" * 16 for _ in range(16))
with open(sys.argv[1], "wb") as png:
png.write(b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", 16, 16, 8, 6, 0, 0, 0)) + chunk(b"IDAT", zlib.compress(rows)) + chunk(b"IEND", b""))
EOF
icon_check="full"
if "$icon_validator" --sandbox 512 512 "$BUILD_DIRECTORY/tools/probe.png" > /dev/null 2>&1; then
echo "flatpak-validate-icon loads images here and checks the icons in full"
else
icon_check="fallback"
{
printf '#!%s -I\n' "$(command -v python3)"
cat <<'EOF'
# Checks an icon for flatpak build-export in place of flatpak-validate-icon, with the same arguments:
# [--sandbox] MAX_WIDTH MAX_HEIGHT PATH. It reads the format and the size, but does not decode the image.
import struct
import sys
import xml.etree.ElementTree as ElementTree
arguments = [argument for argument in sys.argv[1:] if argument != "--sandbox"]
if len(arguments) != 3:
sys.exit("Usage: validate-icon [--sandbox] MAX_WIDTH MAX_HEIGHT PATH")
max_width, max_height, path = int(arguments[0]), int(arguments[1]), arguments[2]
with open(path, "rb") as icon:
head = icon.read(24)
if len(head) == 24 and head[:8] == b"\x89PNG\r\n\x1a\n" and head[12:16] == b"IHDR":
width, height = struct.unpack(">II", head[16:24])
if width > max_width or height > max_height:
sys.exit(f"Image too large ({width}x{height}). Max. size {max_width}x{max_height}")
sys.exit(0)
try:
if ElementTree.parse(path).getroot().tag.rpartition("}")[2] == "svg":
sys.exit(0)
except ElementTree.ParseError:
pass
sys.exit("Format not recognized by the fallback check, which knows PNG and SVG only")
EOF
} > "$BUILD_DIRECTORY/tools/validate-icon"
chmod 755 "$BUILD_DIRECTORY/tools/validate-icon"
export FLATPAK_VALIDATE_ICON="$BUILD_DIRECTORY/tools/validate-icon"
echo "flatpak-validate-icon cannot load images here, e.g., under Rosetta, since glycin needs seccomp"
echo "The export checks the format and the size of the icons instead, without decoding them"
fi
if [ "$SOURCE" = "local" ]; then
stage "Committing the local checkout in a repository of its own"
@@ -253,4 +321,7 @@ flatpak build-bundle \
"$(yq -r '.branch' "$PANDOC_MANIFEST")"
stage "Done"
ls -l "$OUT_DIRECTORY"
ls -l "$OUT_DIRECTORY"
if [ "$icon_check" = "fallback" ]; then
echo "Note: the icons got only the fallback check, see 'Checking the icon validator'. The CI of the Flatpak repository and Flathub check them in full."
fi