From 1214c69fba60065f028516ba574fa99a4042f2f9 Mon Sep 17 00:00:00 2001 From: Kivi Kaitaniemi Date: Sat, 7 Feb 2026 13:13:14 +0200 Subject: [PATCH] Fix installing CustomPackages with 'install=' in PKGBUILD #45 --- .../src/decman/plugins/aur/package.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/plugins/decman-pacman/src/decman/plugins/aur/package.py b/plugins/decman-pacman/src/decman/plugins/aur/package.py index aa105d9..0616a66 100644 --- a/plugins/decman-pacman/src/decman/plugins/aur/package.py +++ b/plugins/decman-pacman/src/decman/plugins/aur/package.py @@ -269,15 +269,20 @@ class CustomPackage: self.git_url, self.pkgbuild_directory, f"No PKGBUILD found in '{path}'." ) + # Since makepkg cannot run as root even when just printing the SRCINFO, + # use a tmpdir and the user 'nobody' try: with tempfile.TemporaryDirectory(prefix="decman-pkgbuild-") as tmpdir: - tmp_path = pathlib.Path(tmpdir) - # Allow the user 'nobody' to use this directory - os.chmod(tmpdir, 0o777) - shutil.copy(path / "PKGBUILD", tmp_path / "PKGBUILD") - os.chmod(tmp_path / "PKGBUILD", 0o644) + shutil.copytree(path, tmpdir, dirs_exist_ok=True) - return self._run_makepkg_printsrcinfo(tmp_path, commands) + # Allow the user 'nobody' to use this directory + mode = 0o777 + for root, dirs, files in os.walk(tmpdir): + for name in dirs + files: + os.chmod(os.path.join(root, name), mode) + os.chmod(tmpdir, 0o777) + + return self._run_makepkg_printsrcinfo(pathlib.Path(tmpdir), commands) except OSError as error: raise PKGBUILDParseError( self.git_url,