Move tests/data and assets to the main repository

This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Co-authored-by: Brecht Van Lommel <brecht@blender.org>

Pull Request: https://projects.blender.org/blender/blender/pulls/137219

Pull Request: https://projects.blender.org/blender/blender/pulls/138487
This commit is contained in:
Sergey Sharybin
2025-05-06 13:42:47 +02:00
committed by Sergey Sharybin
parent 60ad563e62
commit af21da1282
7568 changed files with 267052 additions and 1456 deletions
+100
View File
@@ -0,0 +1,100 @@
*.a filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.egg filter=lfs diff=lfs merge=lfs -text
*.8svx filter=lfs diff=lfs merge=lfs -text
*.pyc filter=lfs diff=lfs merge=lfs -text
*.pyd filter=lfs diff=lfs merge=lfs -text
*.o filter=lfs diff=lfs merge=lfs -text
*.dylib filter=lfs diff=lfs merge=lfs -text
*.dylib* filter=lfs diff=lfs merge=lfs -text
*.lib filter=lfs diff=lfs merge=lfs -text
*.exe filter=lfs diff=lfs merge=lfs -text
*.dll filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text
*.so\.* filter=lfs diff=lfs merge=lfs -text
*.blend filter=lfs diff=lfs merge=lfs -text
*.blend? filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.exr filter=lfs diff=lfs merge=lfs -text
*.tx filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.bzip2 filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.ptx filter=lfs diff=lfs merge=lfs -text
*.cubin filter=lfs diff=lfs merge=lfs -text
*.fatbin filter=lfs diff=lfs merge=lfs -text
*.metallib filter=lfs diff=lfs merge=lfs -text
*.webp filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -text
*.aifc filter=lfs diff=lfs merge=lfs -text
*.aiff filter=lfs diff=lfs merge=lfs -text
*.au filter=lfs diff=lfs merge=lfs -text
*.bmp filter=lfs diff=lfs merge=lfs -text
*.gif filter=lfs diff=lfs merge=lfs -text
*.pbm filter=lfs diff=lfs merge=lfs -text
*.pgm filter=lfs diff=lfs merge=lfs -text
*.ppm filter=lfs diff=lfs merge=lfs -text
*.ras filter=lfs diff=lfs merge=lfs -text
*.sgi filter=lfs diff=lfs merge=lfs -text
*.tiff filter=lfs diff=lfs merge=lfs -text
*.xbm filter=lfs diff=lfs merge=lfs -text
*.sndt filter=lfs diff=lfs merge=lfs -text
*.usdz filter=lfs diff=lfs merge=lfs -text
*.voc filter=lfs diff=lfs merge=lfs -text
*.mp4 filter=lfs diff=lfs merge=lfs -text
*.3ds filter=lfs diff=lfs merge=lfs -text
*.abc filter=lfs diff=lfs merge=lfs -text
*.avi filter=lfs diff=lfs merge=lfs -text
*.blend_DISABLED filter=lfs diff=lfs merge=lfs -text
*.bphys filter=lfs diff=lfs merge=lfs -text
*.cin filter=lfs diff=lfs merge=lfs -text
*.dpx filter=lfs diff=lfs merge=lfs -text
*.hdr filter=lfs diff=lfs merge=lfs -text
*.j2c filter=lfs diff=lfs merge=lfs -text
*.jp2 filter=lfs diff=lfs merge=lfs -text
*.mkv filter=lfs diff=lfs merge=lfs -text
*.mts filter=lfs diff=lfs merge=lfs -text
*.obj filter=lfs diff=lfs merge=lfs -text
*.ogg filter=lfs diff=lfs merge=lfs -text
*.stl filter=lfs diff=lfs merge=lfs -text
*.tga filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.uni filter=lfs diff=lfs merge=lfs -text
*.vdb filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text
*.pdd filter=lfs diff=lfs merge=lfs -text
*.psb filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.dds filter=lfs diff=lfs merge=lfs -text
*.TTF filter=lfs diff=lfs merge=lfs -text
*.otf filter=lfs diff=lfs merge=lfs -text
*.aif filter=lfs diff=lfs merge=lfs -text
*.aac filter=lfs diff=lfs merge=lfs -text
*.flac filter=lfs diff=lfs merge=lfs -text
*.oga filter=lfs diff=lfs merge=lfs -text
*.wma filter=lfs diff=lfs merge=lfs -text
*.rns filter=lfs diff=lfs merge=lfs -text
*.mp3 filter=lfs diff=lfs merge=lfs -text
*.flv filter=lfs diff=lfs merge=lfs -text
*.mov filter=lfs diff=lfs merge=lfs -text
*.wmv filter=lfs diff=lfs merge=lfs -text
*.mpg filter=lfs diff=lfs merge=lfs -text
*.mpeg filter=lfs diff=lfs merge=lfs -text
*.webm filter=lfs diff=lfs merge=lfs -text
*.FBX filter=lfs diff=lfs merge=lfs -text
*.fbx filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.7z filter=lfs diff=lfs merge=lfs -text
*.gltf filter=lfs diff=lfs merge=lfs -text
*.glb filter=lfs diff=lfs merge=lfs -text
*.ply filter=lfs diff=lfs merge=lfs -text
*.nvdb filter=lfs diff=lfs merge=lfs -text
*.usd filter=lfs diff=lfs merge=lfs -text
*.usdc filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.dat filter=lfs diff=lfs merge=lfs -text
+14 -1
View File
@@ -22,6 +22,7 @@ CMakeLists.txt.user
Thumbs.db
ehthumbs.db
Desktop.ini
.DS_Store
# commonly used paths in blender
/blender.bin
@@ -38,8 +39,9 @@ Desktop.ini
/doc/python_api/sphinx-out/
/doc/python_api/rst/bmesh.ops.rst
# in-source lib downloads
# in-source lib downloads and staging
/build_files/build_environment/downloads/
/build_files/build_environment/windows/build/
# in-source buildbot signing configuration
/build_files/buildbot/codesign/config_server.py
@@ -66,6 +68,8 @@ waveletNoiseTile.bin
/release/datafiles/locale/
/release/scripts/addons_contrib/
/source/tools/
/release/datafiles/assets/
/tests/data/
# Build files for VS and VS Code.
/build/
@@ -73,3 +77,12 @@ waveletNoiseTile.bin
CMakeSettings.json
CMakePresets.json
CMakeUserPresets.json
# Compile commands generated by CMake that may be linked into the source code
# folder to make it easier for tools like clangd to discover.
compile_commands.json
# Temporary Blender files.
blendcache_*
*.blend1
*.blend2
-9
View File
@@ -23,12 +23,3 @@
path = lib/windows_arm64
url = https://projects.blender.org/blender/lib-windows_arm64.git
branch = blender-v4.2-release
[submodule "release/datafiles/assets"]
path = release/datafiles/assets
url = https://projects.blender.org/blender/blender-assets.git
branch = blender-v4.2-release
[submodule "tests/data"]
update = none
path = tests/data
url = https://projects.blender.org/blender/blender-test-data.git
branch = blender-v4.2-release
+121
View File
@@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
+16
View File
@@ -0,0 +1,16 @@
# This is an Asset Catalog Definition file for Blender.
#
# Empty lines and lines starting with `#` will be ignored.
# The first non-ignored line should be the version indicator.
# Other lines are of the format "UUID:catalog/path/for/assets:simple catalog name"
VERSION 1
f14d3c5d-8223-4e8c-b3b3-cbce81e4b3ee:Hair:Hair
87cbaad7-ae4e-404c-9b6b-4fe60ecc39dc:Hair/Deformation:Hair-Deformation
40aedbf9-be4b-4ddb-8eec-8a9cd37d0921:Hair/Generation:Hair-Generation
09af8c50-8c07-4039-821c-be801761d7cf:Hair/Guides:Hair-Guides
c676fe02-8d25-49a1-b672-11aee0918221:Hair/Read:Hair-Read
9dedc75a-afe5-472a-9e3f-a555a8df3dff:Hair/Utility:Hair-Utility
63a83f9c-5a95-476a-9bd5-fcb72414ea0b:Hair/Write:Hair-Write
9e98eca8-e987-44d3-88a1-6633d0a8ad82:Normals:Normals
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1055e24ff98818f59c51ab85680a686eadff5a9bef4b55160e6bb38f25b6ad4e
size 2458890
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:25bc52499f2198abe432afa65403f3f9634b780c1d918e42f3f8d61f37a10048
size 266230
+2 -2
View File
@@ -163,14 +163,14 @@ function(blender_add_ctests)
TEST_PREFIX ${ARGS_SUITE_NAME}
WORKING_DIRECTORY "${TEST_INSTALL_DIR}"
EXTRA_ARGS
--test-assets-dir "${CMAKE_SOURCE_DIR}/tests/data"
--test-assets-dir "${CMAKE_SOURCE_DIR}/tests/files"
--test-release-dir "${_test_release_dir}"
)
else()
add_test(
NAME ${ARGS_SUITE_NAME}
COMMAND ${ARGS_TARGET}
--test-assets-dir "${CMAKE_SOURCE_DIR}/tests/data"
--test-assets-dir "${CMAKE_SOURCE_DIR}/tests/files"
--test-release-dir "${_test_release_dir}"
WORKING_DIRECTORY ${TEST_INSTALL_DIR}
)
+98 -35
View File
@@ -3,13 +3,26 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
__all__ = (
"main",
)
import argparse
import make_utils
import os
import subprocess
import sys
from pathlib import Path
from typing import Iterable, TextIO, Optional, Any, Union
from typing import (
TextIO,
Any,
Tuple,
Union,
# Proxies for `collections.abc`
Iterable,
List,
)
# This script can run from any location,
# output is created in the $CWD
@@ -17,15 +30,24 @@ from typing import Iterable, TextIO, Optional, Any, Union
# NOTE: while the Python part of this script is portable,
# it relies on external commands typically found on GNU/Linux.
# Support for other platforms could be added by moving GNU `tar` & `md5sum` use to Python.
# This also relies on having a Unix shell (sh) to run some git commands.
SKIP_NAMES = {
SKIP_NAMES: Tuple[str, ...] = (
".gitignore",
".gitmodules",
".gitattributes",
".git-blame-ignore-revs",
".arcconfig",
".svn",
}
)
# Tuple with folder names relative to the main repository root that are to be excluded.
SKIP_FOLDERS: Tuple[str, ...] = (
)
# Generated list of Paths to be ignored based on the SKIP_FOLDERS and some rum-time rules like
# the type of package that is being created.
SKIP_PATHS: List[Path] = []
def main() -> None:
@@ -35,7 +57,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,
@@ -43,6 +66,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()
@@ -52,6 +81,10 @@ def main() -> None:
os.chdir(curdir)
blender_srcdir = blender_srcdir.relative_to(curdir)
# Update our SKIP_FOLDERS blacklist with the source directory name
global SKIP_PATHS
SKIP_PATHS = [blender_srcdir / entry for entry in SKIP_FOLDERS]
print(f"Output dir: {curdir}")
version = make_utils.parse_blender_version()
@@ -59,7 +92,13 @@ 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/files", packages_dir)
else:
SKIP_PATHS.append(blender_srcdir / "tests/files")
create_manifest(version, manifest, blender_srcdir, packages_dir)
create_tarball(version, tarball, manifest, blender_srcdir, packages_dir)
create_checksum_file(tarball)
cleanup(manifest)
@@ -70,6 +109,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"
@@ -78,24 +119,24 @@ def manifest_path(tarball: Path) -> Path:
"""Return the manifest path for the given tarball path.
>>> from pathlib import Path
>>> tarball = Path("/home/sybren/workspace/blender-git/blender-test.tar.gz")
>>> tarball = Path("/home/user/workspace/blender-git/blender-test.tar.gz")
>>> manifest_path(tarball).as_posix()
'/home/sybren/workspace/blender-git/blender-test-manifest.txt'
'/home/user/workspace/blender-git/blender-test-manifest.txt'
"""
# ".tar.gz" is seen as two suffixes.
# Note that `.tar.gz` is seen as two suffixes.
without_suffix = tarball.with_suffix("").with_suffix("")
name = without_suffix.name
return without_suffix.with_name(f"{name}-manifest.txt")
def packages_path(current_directory: Path, cli_args: Any) -> Optional[Path]:
def packages_path(current_directory: Path, cli_args: Any) -> Union[Path, None]:
if not cli_args.include_packages:
return None
abspath = cli_args.include_packages.absolute()
# os.path.relpath() can return paths like "../../packages", where
# Path.relative_to() will not go up directories (so its return value never
# `os.path.relpath()` can return paths like "../../packages", where
# `Path.relative_to()` will not go up directories (so its return value never
# has "../" in there).
relpath = os.path.relpath(abspath, current_directory)
@@ -109,12 +150,12 @@ def create_manifest(
version: make_utils.BlenderVersion,
outpath: Path,
blender_srcdir: Path,
packages_dir: Optional[Path],
packages_dir: Union[Path, None],
exclude: List[Path] = []
) -> None:
print(f'Building manifest of files: "{outpath}"...', end="", flush=True)
with outpath.open("w", encoding="utf-8") as outfile:
main_files_to_manifest(blender_srcdir, outfile)
assets_to_manifest(blender_srcdir, outfile)
if packages_dir:
packages_to_manifest(outfile, packages_dir)
@@ -123,20 +164,9 @@ def create_manifest(
def main_files_to_manifest(blender_srcdir: Path, outfile: TextIO) -> None:
assert not blender_srcdir.is_absolute()
for path in git_ls_files(blender_srcdir):
print(path, file=outfile)
def assets_to_manifest(blender_srcdir: Path, outfile: TextIO) -> None:
assert not blender_srcdir.is_absolute()
assets_dir = blender_srcdir.parent / "lib" / "assets"
for path in assets_dir.glob("*"):
if path.name == "working":
continue
if path.name in SKIP_NAMES:
continue
print(path, file=outfile)
for git_repo in git_gather_all_folders_to_package(blender_srcdir):
for path in git_ls_files(git_repo):
print(path, file=outfile)
def packages_to_manifest(outfile: TextIO, packages_dir: Path) -> None:
@@ -157,7 +187,7 @@ def create_tarball(
tarball: Path,
manifest: Path,
blender_srcdir: Path,
packages_dir: Optional[Path],
packages_dir: Union[Path, None],
) -> None:
print(f'Creating archive: "{tarball}" ...', end="", flush=True)
@@ -174,8 +204,6 @@ def create_tarball(
command += [
"--transform",
f"s,^{blender_srcdir.name}/,blender-{version}/,g",
"--transform",
f"s,^lib/assets/,blender-{version}/release/datafiles/assets/,g",
"--use-compress-program=xz -1",
"--create",
f"--file={tarball}",
@@ -218,28 +246,63 @@ def cleanup(manifest: Path) -> None:
# Low-level commands
def git_gather_all_folders_to_package(directory: Path = Path(".")) -> Iterable[Path]:
"""Generator, yields lines which represents each directory to gather git files from.
Each directory represents either the top level git repository or a submodule.
All submodules that have the 'update = none' setting will be excluded from this list.
The directory path given to this function will be included in the yielded paths
"""
# For each submodule (recurse into submodules within submodules if they exist)
git_main_command = "submodule --quiet foreach --recursive"
# Return the path to the submodule and what the value is of their "update" setting
# If the "update" setting doesn't exist, only the path to the submodule is returned
git_command_args = "'echo $displaypath $(git config --file \"$toplevel/.gitmodules\" --get submodule.$name.update)'"
# Yield the root directory as this is our top level git repo
yield directory
for line in git_command(f"-C '{directory}' {git_main_command} {git_command_args}"):
# Check if we shouldn't include the directory on this line
split_line = line.rsplit(maxsplit=1)
if len(split_line) > 1 and split_line[-1] == "none":
continue
path = directory / split_line[0]
yield path
def is_path_ignored(file: Path) -> bool:
for skip_folder in SKIP_PATHS:
if file.is_relative_to(skip_folder):
return True
return False
def git_ls_files(directory: Path = Path(".")) -> Iterable[Path]:
"""Generator, yields lines of output from 'git ls-files'.
Only lines that are actually files (so no directories, sockets, etc.) are
returned, and never one from SKIP_NAMES.
"""
for line in git_command("-C", str(directory), "ls-files"):
for line in git_command(f"-C '{directory}' ls-files"):
path = directory / line
if not path.is_file() or path.name in SKIP_NAMES:
continue
yield path
if not is_path_ignored(path):
yield path
def git_command(*cli_args: Union[bytes, str, Path]) -> Iterable[str]:
def git_command(cli_args: str) -> Iterable[str]:
"""Generator, yields lines of output from a Git command."""
command = ("git", *cli_args)
command = "git " + cli_args
# import shlex
# print(">", " ".join(shlex.quote(arg) for arg in command))
git = subprocess.run(
command, stdout=subprocess.PIPE, check=True, text=True, timeout=30
command, stdout=subprocess.PIPE, shell=True, check=True, text=True, timeout=30
)
for line in git.stdout.split("\n"):
if line:
+39 -34
View File
@@ -5,7 +5,7 @@
"""
"make update" for all platforms, updating Git LFS submodules for libraries and
tests, and Blender git repository.
Blender git repository.
For release branches, this will check out the appropriate branches of
submodules and libraries.
@@ -48,13 +48,17 @@ def parse_arguments() -> argparse.Namespace:
parser.add_argument("--no-libraries", action="store_true")
parser.add_argument("--no-blender", action="store_true")
parser.add_argument("--no-submodules", action="store_true")
parser.add_argument("--use-tests", action="store_true")
parser.add_argument("--no-lfs-fallback", action="store_true")
parser.add_argument("--git-command", default="git")
parser.add_argument("--use-linux-libraries", action="store_true")
parser.add_argument("--architecture", type=str,
choices=("x86_64", "amd64", "arm64",))
parser.add_argument("--prune-destructive", action="store_true",
help="Destructive! Detect and remove stale files from older checkouts")
# Deprecated options, kept for compatibility with old configurations.
parser.add_argument("--use-tests", action="store_true", help=argparse.SUPPRESS)
return parser.parse_args()
@@ -201,21 +205,6 @@ def initialize_precompiled_libraries(args: argparse.Namespace) -> str:
return ""
def initialize_tests_data_files(args: argparse.Namespace) -> str:
"""
Configure submodule with files used by regression tests
"""
print_stage("Configuring Tests Data Files")
submodule_dir = "tests/data"
print(f"* Enabling tests data at {submodule_dir}")
make_utils.git_enable_submodule(args.git_command, Path(submodule_dir))
return ""
def git_update_skip(args: argparse.Namespace, check_remote_exists: bool = True) -> str:
"""Test if git repo can be updated."""
@@ -515,21 +504,6 @@ def floating_checkout_update(
return skip_msg
def external_scripts_update(
args: argparse.Namespace,
repo_name: str,
directory_name: str,
branch: Optional[str],
) -> str:
return floating_checkout_update(
args,
repo_name,
Path("scripts") / directory_name,
branch,
old_submodules_dir=Path("release") / "scripts" / directory_name,
)
def floating_libraries_update(args: argparse.Namespace, branch: Optional[str]) -> str:
"""Update libraries checkouts which are floating (not attached as Git submodules)"""
msg = ""
@@ -605,8 +579,34 @@ def submodules_lib_update(args: argparse.Namespace, branch: Optional[str]) -> st
return msg
def lfs_fallback_setup(args: argparse.Namespace) -> None:
"""
Set up an additional projects.blender.org remote, for LFS fetching fallback
in case the fork does not include LFS files.
"""
remotes = make_utils.git_get_remotes(args.git_command)
add_fallback_remote = True
fallback_remote = "lfs-fallback"
for remote in remotes:
url = make_utils.git_get_remote_url(args.git_command, remote)
if "projects.blender.org" not in url:
make_utils.git_set_config(args.git_command, f"lfs.{remote}.searchall", "true")
else:
add_fallback_remote = False
if add_fallback_remote and not make_utils.git_remote_exist(args.git_command, fallback_remote):
print_stage("Adding Git LFS fallback remote")
print("Used to fetch files from projects.blender.org if missing.")
url = "https://projects.blender.org/blender/blender.git"
push_url = "no_push"
make_utils.git_add_remote(args.git_command, fallback_remote, url, push_url)
if __name__ == "__main__":
args = parse_arguments()
blender_skip_msg = ""
libraries_skip_msg = ""
submodules_skip_msg = ""
@@ -625,6 +625,9 @@ if __name__ == "__main__":
if args.prune_destructive:
prune_stale_files()
if not args.no_lfs_fallback:
lfs_fallback_setup(args)
if not args.no_blender:
blender_skip_msg = git_update_skip(args)
if not blender_skip_msg:
@@ -634,8 +637,6 @@ if __name__ == "__main__":
if not args.no_libraries:
libraries_skip_msg += initialize_precompiled_libraries(args)
if args.use_tests:
libraries_skip_msg += initialize_tests_data_files(args)
libraries_skip_msg += submodules_lib_update(args, branch)
# Report any skipped repositories at the end, so it's not as easy to miss.
@@ -644,6 +645,10 @@ if __name__ == "__main__":
print_stage("Update finished with the following messages")
print(skip_msg.strip())
if args.use_tests:
print()
print('NOTE: --use-tests is a deprecated command line argument, kept for compatibility purposes.')
# For failed submodule update we throw an error, since not having correct
# submodules can make Blender throw errors.
# For Blender itself we don't and consider "make update" to be a command
+14
View File
@@ -111,6 +111,20 @@ def git_is_remote_repository(git_command: str, repo: str) -> bool:
return exit_code == 0
def git_get_remotes(git_command: str) -> Sequence[str]:
"""Get a list of git remotes"""
# Additional check if the remote exists, for safety in case the output of this command
# changes in the future.
remotes = check_output([git_command, "remote"]).split()
return [remote for remote in remotes if git_remote_exist(git_command, remote)]
def git_add_remote(git_command: str, name: str, url: str, push_url: str) -> None:
"""Add a git remote"""
call((git_command, "remote", "add", name, url), silent=True)
call((git_command, "remote", "set-url", "--push", name, push_url), silent=True)
def git_branch(git_command: str) -> str:
"""Get current branch name."""
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More