From 277add8fc9d1dcd8877b2819c5fa586d57a2a819 Mon Sep 17 00:00:00 2001 From: Sebastian Parborg Date: Fri, 28 Feb 2025 17:53:36 +0100 Subject: [PATCH] Add ability to create a test data archive with make_source_archive This makes it so that we ship the test data for every major release in its own separate archive. (In case someone wants to easily run the tests for a specific older release without using git) Pull Request: https://projects.blender.org/blender/blender/pulls/135293 --- GNUmakefile | 2 ++ build_files/utils/make_source_archive.py | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index c251905cf8d..d39524454a1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -572,6 +572,8 @@ source_archive_complete: .FORCE -DCMAKE_BUILD_TYPE_INIT:STRING=$(BUILD_TYPE) -DPACKAGE_USE_UPSTREAM_SOURCES=OFF # This assumes CMake is still using a default `PACKAGE_DIR` variable: @$(PYTHON) ./build_files/utils/make_source_archive.py --include-packages "$(BUILD_DIR)/source_archive/packages" +# We assume that the tests will not change for minor releases so only package them for major versions + @$(PYTHON) ./build_files/utils/make_source_archive.py --package-test-data icons_geom: .FORCE @BLENDER_BIN=$(BLENDER_BIN) \ diff --git a/build_files/utils/make_source_archive.py b/build_files/utils/make_source_archive.py index 0d065f3ac90..6eb2b060aaf 100755 --- a/build_files/utils/make_source_archive.py +++ b/build_files/utils/make_source_archive.py @@ -51,7 +51,8 @@ def main() -> None: description="Create a tarball of the Blender sources, optionally including sources of dependencies.", epilog="This script is intended to be run by `make source_archive_complete`.", ) - cli_parser.add_argument( + group = cli_parser.add_mutually_exclusive_group() + group.add_argument( "-p", "--include-packages", type=Path, @@ -59,6 +60,12 @@ def main() -> None: metavar="PACKAGE_PATH", help="Include all source files from the given package directory as well.", ) + group.add_argument( + "-t", + "--package-test-data", + action='store_true', + help="Package all test data into its own archive", + ) cli_args = cli_parser.parse_args() @@ -79,7 +86,12 @@ def main() -> None: manifest = manifest_path(tarball) packages_dir = packages_path(curdir, cli_args) - create_manifest(version, manifest, blender_srcdir, packages_dir) + if cli_args.package_test_data: + print("Creating an archive of all test data.") + create_manifest(version, manifest, blender_srcdir / "tests/data", packages_dir) + else: + create_manifest(version, manifest, blender_srcdir, packages_dir) + create_tarball(version, tarball, manifest, blender_srcdir, packages_dir) create_checksum_file(tarball) cleanup(manifest) @@ -90,6 +102,8 @@ def tarball_path(output_dir: Path, version: make_utils.BlenderVersion, cli_args: extra = "" if cli_args.include_packages: extra = "-with-libraries" + elif cli_args.package_test_data: + extra = "-test-data" return output_dir / f"blender{extra}-{version}.tar.xz"