|
@@ -328,6 +328,10 @@ def configure_text(text: str, context: dict[str, str]) -> str:
|
|
|
return text
|
|
|
|
|
|
|
|
|
+def configure_text_list(text_list: list[str], context: dict[str, str]) -> list[str]:
|
|
|
+ return [configure_text(text=e, context=context) for e in text_list]
|
|
|
+
|
|
|
+
|
|
|
class ArchiveFileTree:
|
|
|
def __init__(self):
|
|
|
self._tree: dict[str, NodeInArchive] = {}
|
|
@@ -349,7 +353,6 @@ class ArchiveFileTree:
|
|
|
target = dest_dir + s.symtarget
|
|
|
while True:
|
|
|
new_target, n = re.subn(r"([^/]+/+[.]{2}/)", "", target)
|
|
|
- print(f"{target=} {new_target=}")
|
|
|
target = new_target
|
|
|
if not n:
|
|
|
break
|
|
@@ -357,13 +360,14 @@ class ArchiveFileTree:
|
|
|
|
|
|
# Add files in first pass
|
|
|
for arcpath, node in self._tree.items():
|
|
|
+ assert node is not None, f"{arcpath} -> node"
|
|
|
if node.data is not None:
|
|
|
archiver.add_file_data(arcpath=arc_join(archive_base, arcpath), data=node.data, time=node.time, mode=node.mode)
|
|
|
- assert node.arcpath is not None, f"{node=} has arcpath=None"
|
|
|
+ assert node.arcpath is not None, f"{node=}"
|
|
|
added_files[node.arcpath] = node
|
|
|
elif node.path is not None:
|
|
|
archiver.add_file_path(arcpath=arc_join(archive_base, arcpath), path=node.path)
|
|
|
- assert node.arcpath is not None, f"{node=} has arcpath=None"
|
|
|
+ assert node.arcpath is not None, f"{node=}"
|
|
|
added_files[node.arcpath] = node
|
|
|
elif node.symtarget is not None:
|
|
|
remaining_symlinks.add(node)
|
|
@@ -372,6 +376,8 @@ class ArchiveFileTree:
|
|
|
else:
|
|
|
raise ValueError(f"Invalid Archive Node: {repr(node)}")
|
|
|
|
|
|
+ assert None not in added_files
|
|
|
+
|
|
|
# Resolve symlinks in second pass: zipfile does not support symlinks, so add files to zip archive
|
|
|
while True:
|
|
|
if not remaining_symlinks:
|
|
@@ -547,6 +553,7 @@ class Releaser:
|
|
|
"PROJECT_VERSION": self.version,
|
|
|
"PROJECT_COMMIT": self.commit,
|
|
|
"PROJECT_REVISION": self.revision,
|
|
|
+ "PROJECT_ROOT": str(self.root),
|
|
|
}
|
|
|
if extra_context:
|
|
|
ctx.update(extra_context)
|
|
@@ -743,15 +750,21 @@ class Releaser:
|
|
|
install_path = build_parent_dir / f"install-{triplet}"
|
|
|
shutil.rmtree(install_path, ignore_errors=True)
|
|
|
build_path.mkdir(parents=True, exist_ok=True)
|
|
|
+ context = self.get_context({
|
|
|
+ "ARCH": arch,
|
|
|
+ "DEP_PREFIX": str(mingw_deps_path / triplet),
|
|
|
+ })
|
|
|
+ extra_args = configure_text_list(text_list=self.release_info["mingw"]["autotools"]["args"], context=context)
|
|
|
+
|
|
|
with self.section_printer.group(f"Configuring MinGW {triplet} (autotools)"):
|
|
|
- extra_args = [arg.replace("@DEP_PREFIX@", str(mingw_deps_path / triplet)) for arg in self.release_info["mingw"]["autotools"]["args"]]
|
|
|
assert "@" not in " ".join(extra_args), f"@ should not be present in extra arguments ({extra_args})"
|
|
|
self.executer.run([
|
|
|
self.root / "configure",
|
|
|
f"--prefix={install_path}",
|
|
|
- f"--includedir={install_path}/include",
|
|
|
- f"--libdir={install_path}/lib",
|
|
|
- f"--bindir={install_path}/bin",
|
|
|
+ f"--includedir=${{prefix}}/include",
|
|
|
+ f"--libdir=${{prefix}}/lib",
|
|
|
+ f"--bindir=${{prefix}}/bin",
|
|
|
+ f"--exec-prefix=${{prefix}}/bin",
|
|
|
f"--host={triplet}",
|
|
|
f"--build=x86_64-none-linux-gnu",
|
|
|
] + extra_args, cwd=build_path, env=new_env)
|
|
@@ -778,6 +791,12 @@ class Releaser:
|
|
|
assert arch not in mingw_archs
|
|
|
mingw_archs.add(arch)
|
|
|
|
|
|
+ context = self.get_context({
|
|
|
+ "ARCH": arch,
|
|
|
+ "DEP_PREFIX": str(mingw_deps_path / triplet),
|
|
|
+ })
|
|
|
+ extra_args = configure_text_list(text_list=self.release_info["mingw"]["cmake"]["args"], context=context)
|
|
|
+
|
|
|
build_path = build_parent_dir / f"build-{triplet}"
|
|
|
install_path = build_parent_dir / f"install-{triplet}"
|
|
|
shutil.rmtree(install_path, ignore_errors=True)
|
|
@@ -788,7 +807,6 @@ class Releaser:
|
|
|
args_for_shared_static = (["-DBUILD_SHARED_LIBS=ON"], ["-DBUILD_SHARED_LIBS=OFF"])
|
|
|
for arg_for_shared_static in args_for_shared_static:
|
|
|
with self.section_printer.group(f"Configuring MinGW {triplet} (CMake)"):
|
|
|
- extra_args = [arg.replace("@DEP_PREFIX@", str(mingw_deps_path / triplet)) for arg in self.release_info["mingw"]["cmake"]["args"]]
|
|
|
assert "@" not in " ".join(extra_args), f"@ should not be present in extra arguments ({extra_args})"
|
|
|
self.executer.run([
|
|
|
f"cmake",
|
|
@@ -1246,6 +1264,10 @@ class Releaser:
|
|
|
zip_path = self.dist_path / f"{self.project}-devel-{self.version}-VC.zip"
|
|
|
arc_root = f"{self.project}-{self.version}"
|
|
|
|
|
|
+ def copy_files_devel(ctx):
|
|
|
+ archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["files-devel"], file_mapping_root=self.root, context=ctx, time=self.arc_time)
|
|
|
+
|
|
|
+
|
|
|
logger.info("Collecting files...")
|
|
|
archive_file_tree = ArchiveFileTree()
|
|
|
if "msbuild" in self.release_info["msvc"]:
|
|
@@ -1253,12 +1275,13 @@ class Releaser:
|
|
|
arch_platform = self._arch_to_vs_platform(arch=arch)
|
|
|
platform_context = self.get_context(arch_platform.extra_context())
|
|
|
archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["msbuild"]["files-devel"], file_mapping_root=self.root, context=platform_context, time=self.arc_time)
|
|
|
+ copy_files_devel(ctx=platform_context)
|
|
|
if "cmake" in self.release_info["msvc"]:
|
|
|
for arch in self.release_info["msvc"]["cmake"]["archs"]:
|
|
|
arch_platform = self._arch_to_vs_platform(arch=arch)
|
|
|
platform_context = self.get_context(arch_platform.extra_context())
|
|
|
archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["cmake"]["files-devel"], file_mapping_root=self._arch_platform_to_install_path(arch_platform), context=platform_context, time=self.arc_time)
|
|
|
- archive_file_tree.add_file_mapping(arc_dir=arc_root, file_mapping=self.release_info["msvc"]["files-devel"], file_mapping_root=self.root, context=self.get_context(), time=self.arc_time)
|
|
|
+ copy_files_devel(ctx=platform_context)
|
|
|
|
|
|
with Archiver(zip_path=zip_path) as archiver:
|
|
|
archive_file_tree.add_to_archiver(archive_base="", archiver=archiver)
|