fix(install): treat install-* as what it is, not as an install target
The detection accepted any target starting with install-, while the run
below it has always called plain make install. A repository carrying
install-python and no install therefore pulled the installer in and died on
"No rule to make target 'install'" instead of being skipped, which is what
the surrounding branch is there for. meta-infinite-graph, universal-logout
and file-dedupe all failed this way, and with them two e2e tests.
775c301 added the parsing to run make install only where an install target
exists. The prefix arm undid that, so it goes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,9 +31,7 @@ class MakefileInstaller(BaseInstaller):
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
if re.search(r"^install\s*:", content, flags=re.MULTILINE):
|
||||
return True
|
||||
return bool(re.search(r"^install-[a-zA-Z0-9_-]*\s*:", content, flags=re.MULTILINE))
|
||||
return bool(re.search(r"^install\s*:", content, flags=re.MULTILINE))
|
||||
|
||||
def run(self, ctx: RepoContext) -> None:
|
||||
makefile_path = os.path.join(ctx.repo_dir, self.MAKEFILE_NAME)
|
||||
|
||||
@@ -81,6 +81,19 @@ class TestMakefileInstaller(unittest.TestCase):
|
||||
)
|
||||
mock_run_command.assert_not_called()
|
||||
|
||||
@patch("pkgmgr.actions.install.installers.makefile.run_command")
|
||||
@patch(
|
||||
"builtins.open",
|
||||
new_callable=mock_open,
|
||||
read_data="install-python:\n\tpip install -r requirements.txt\n",
|
||||
)
|
||||
@patch("os.path.exists", return_value=True)
|
||||
def test_run_skips_a_makefile_that_only_has_a_prefixed_target(
|
||||
self, mock_exists, mock_file, mock_run_command
|
||||
):
|
||||
self.installer.run(self.ctx)
|
||||
mock_run_command.assert_not_called()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user