Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions plugins/decman-pacman/src/decman/plugins/aur/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,20 @@ def _srcinfo_from_pkgbuild_directory(self, commands: AurCommands) -> str:
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)
shutil.copytree(path, tmpdir, dirs_exist_ok=True)

# 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)
shutil.copy(path / "PKGBUILD", tmp_path / "PKGBUILD")
os.chmod(tmp_path / "PKGBUILD", 0o644)

return self._run_makepkg_printsrcinfo(tmp_path, commands)
return self._run_makepkg_printsrcinfo(pathlib.Path(tmpdir), commands)
except OSError as error:
raise PKGBUILDParseError(
self.git_url,
Expand Down