diff --git a/tools/package_release.py b/tools/package_release.py index 476314e0e..52f0b3ffc 100644 --- a/tools/package_release.py +++ b/tools/package_release.py @@ -18,7 +18,7 @@ def package(platform, build, output, version): if missing: raise RuntimeError(f"Missing patched libraries: {', '.join(sorted(missing))}") executable = "relinker.exe" if platform == "windows" else "relinker" - files = list(libraries) + files = [library for library in libraries if library.name in expected] if platform == "windows": runtime = Path("C:/winlibs/mingw64/bin") files.extend(runtime / name for name in ("libgcc_s_seh-1.dll", "libstdc++-6.dll", "libwinpthread-1.dll")) diff --git a/tools/tests/test_package_release.py b/tools/tests/test_package_release.py index 2724ef6e4..a969a1692 100644 --- a/tools/tests/test_package_release.py +++ b/tools/tests/test_package_release.py @@ -56,6 +56,18 @@ class ReleasePackageTests(unittest.TestCase): with zipfile.ZipFile(self.output / "prx-linux-v1.0.zip") as archive: self.assertEqual(archive.namelist(), ["libs/libc.prx"]) + def test_removed_libraries_are_not_packaged_from_a_reused_build(self): + stale = self.library.with_name("libRemoved.prx") + stale.write_bytes(b"obsolete library") + package_release.package("linux", self.build, self.output, "v1.0") + with zipfile.ZipFile(self.output / "prx-linux-v1.0.zip") as archive: + self.assertEqual(archive.namelist(), ["libs/libc.prx"]) + self.assertEqual(archive.read("libs/libc.prx"), b"library bytes") + with tarfile.open(self.output / "prx-linux-v1.0.tar.gz") as archive: + self.assertEqual(archive.getnames(), ["libs/libc.prx"]) + self.assertEqual(archive.extractfile("libs/libc.prx").read(), b"library bytes") + self.assertEqual(stale.read_bytes(), b"obsolete library") + def test_tar_and_zip_include_the_same_symlink_contents(self): target = self.library.with_name("libc.target") self.library.rename(target)