From b778ad7dbe3b0c2a63579a4cd3c79bfd45ec3b9c Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 1 Oct 2026 17:44:11 +0200 Subject: [PATCH] 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) --- src/pkgmgr/actions/install/installers/makefile.py | 4 +--- .../install/installers/test_makefile_installer.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/pkgmgr/actions/install/installers/makefile.py b/src/pkgmgr/actions/install/installers/makefile.py index 9d173c6..1fe9109 100644 --- a/src/pkgmgr/actions/install/installers/makefile.py +++ b/src/pkgmgr/actions/install/installers/makefile.py @@ -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) diff --git a/tests/unit/pkgmgr/actions/install/installers/test_makefile_installer.py b/tests/unit/pkgmgr/actions/install/installers/test_makefile_installer.py index 055ed3f..ecab6b3 100644 --- a/tests/unit/pkgmgr/actions/install/installers/test_makefile_installer.py +++ b/tests/unit/pkgmgr/actions/install/installers/test_makefile_installer.py @@ -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()