From 03f560bb4aaeda0e06c95684c187a394593c88e3 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Thu, 1 Oct 2026 16:58:47 +0200 Subject: fix(packaging): meshbay-common clears its compiled bytecode before an upgrade The postinst compiles __pycache__ directories the package does not own; on the next upgrade they kept dpkg from removing directories the new version no longer ships, and it warned. preinst/prerm (deb) and %pre/%preun (rpm) remove them first. Co-Authored-By: Claude Opus 5.5 --- packaging/rpm/meshbay-common.spec | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'packaging/rpm/meshbay-common.spec') diff --git a/packaging/rpm/meshbay-common.spec b/packaging/rpm/meshbay-common.spec index 948de9a..147dc17 100644 --- a/packaging/rpm/meshbay-common.spec +++ b/packaging/rpm/meshbay-common.spec @@ -17,6 +17,20 @@ Installs to /opt/meshbay-common/venv/. %install cp -a %{_staging_root}/* %{buildroot}/ +# Bytecode written at run time into __pycache__ is not the package's, and would +# keep rpm from removing a directory the new version no longer ships. +%pre +if [ "$1" -ge 2 ]; then + find /opt/meshbay-common/venv -depth -type d -name __pycache__ \ + -exec rm -rf {} + 2>/dev/null || true +fi + +%preun +if [ "$1" -eq 0 ]; then + find /opt/meshbay-common/venv -depth -type d -name __pycache__ \ + -exec rm -rf {} + 2>/dev/null || true +fi + %files /opt/meshbay-common -- cgit v1.2.3