Skip to content

Commit

Permalink
fixup! Do not export PMS variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Flowdalic committed Jan 8, 2025
1 parent ddf56a9 commit 5562b8e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/_emerge/EbuildMetadataPhase.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class EbuildMetadataPhase(SubProcess):
"repo_path",
"settings",
"deallocate_config",
"portage_ebuild_extra_source",
"write_auxdb",
) + (
"_eapi",
Expand Down Expand Up @@ -165,6 +166,9 @@ def _async_start_done(self, future):
self.cancel()
self._was_cancelled()

self.portage_ebuild_extra_source = self.settings.get(
"PORTAGE_EBUILD_EXTRA_SOURCE"
)
if self.deallocate_config is not None and not self.deallocate_config.done():
self.deallocate_config.set_result(self.settings)

Expand All @@ -191,6 +195,8 @@ def _unregister(self):
if self._files is not None:
self.scheduler.remove_reader(self._files.ebuild)
SubProcess._unregister(self)
if self.portage_ebuild_extra_source:
os.unlink(self.portage_ebuild_extra_source)

def _async_waitpid_cb(self, *args, **kwargs):
"""
Expand Down
15 changes: 12 additions & 3 deletions lib/portage/package/ebuild/doebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -2197,10 +2197,19 @@ def spawn(
env = orig_env.copy()

t = env["T"]
if not os.path.isdir(t):
os.makedirs(t)
if os.path.isdir(t):
ebuild_extra_source_path = os.path.join(t, ".portage-ebuild-extra-source")
else:
ebuild_extra_source_fd, ebuild_extra_source_path = tempfile.mkstemp(
prefix="portage-ebuild-extra-source-",
)
os.chmod(
ebuild_extra_source_path, stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH
)
os.close(ebuild_extra_source_fd)
# The file will be deleted by EbuildMetadataPhase._unregister()
mysettings["PORTAGE_EBUILD_EXTRA_SOURCE"] = ebuild_extra_source_path

ebuild_extra_source_path = os.path.join(t, ".portage-ebuild-extra-source")
with open(ebuild_extra_source_path, mode="w") as f:
for var_name in unexported_env_vars:
var_value = orig_env.get(var_name)
Expand Down

0 comments on commit 5562b8e

Please sign in to comment.