Skip to content

Commit

Permalink
feat(build: set_build_package_path): if -debug package was built, c…
Browse files Browse the repository at this point in the history
…opy it to pikaur ./pkgs/ cache dir
  • Loading branch information
actionless committed Sep 28, 2024
1 parent d2cb8ac commit 6d78019
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions pikaur/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ def install_built_deps(
finally:
PackageDB.discard_local_cache()

def set_built_package_path(self) -> None:
def set_built_package_path(self) -> None: # pylint: disable=too-many-branches
pkg_paths_spawn = spawn(
isolate_root_cmd(
[*MakePkgCommand.get(), "--packagelist"],
Expand All @@ -546,7 +546,14 @@ def set_built_package_path(self) -> None:
if not pkg_paths_spawn.stdout_text:
return
logger.debug("Package names: {}", pkg_paths_spawn)
pkg_paths = [Path(line) for line in pkg_paths_spawn.stdout_text.splitlines()]
pkg_paths: list[Path] = []
debug_pkg_paths: list[Path] = []
for line in pkg_paths_spawn.stdout_text.splitlines():
for pkg_name in self.package_names:
if f"{pkg_name}-debug-" in line:
debug_pkg_paths.append(Path(line))
elif pkg_name in line:
pkg_paths.append(Path(line))
if not pkg_paths:
return
pkg_dest = get_pkgdest()
Expand Down Expand Up @@ -580,8 +587,19 @@ def set_built_package_path(self) -> None:
new_package_path.name + ".sig"
)
mkdir(PackageCachePath())
replace_file(pkg_path, new_package_path)
replace_file(pkg_sig_path, new_package_sig_path)
for path_from, path_to in (
(pkg_path, new_package_path),
(pkg_sig_path, new_package_sig_path),
):
if path_from.exists():
logger.debug("Copying {} to {}", path_from, path_to)
replace_file(path_from, path_to)
logger.debug("Found debug packages: {}", debug_pkg_paths)
for debug_pkg_path in debug_pkg_paths:
new_debug_pkg_path = new_package_path.parent / debug_pkg_path.name
if debug_pkg_path.exists():
logger.debug("Copying {} to {}", debug_pkg_path, new_debug_pkg_path)
replace_file(debug_pkg_path, new_debug_pkg_path)
pkg_path = new_package_path
if pkg_path and pkg_path.exists():
self.built_packages_paths[pkg_name] = pkg_path
Expand Down

0 comments on commit 6d78019

Please sign in to comment.