From b8777d789300ee9c2d860c7156f4cd9b8da43f76 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 18 Feb 2025 11:25:04 +1300 Subject: [PATCH 1/3] Makefile: Warn if submodule status '+'-prefixed A '+'-prefix means that the submodule is initialized and checked out, but a different commit is checked out. If this is accidental then the user should run `git submodule update` to fix it. If it is intentional (because e.g. the user is explicitly wanting to test Yosys with a different version of abc), then creating a new commit in Yosys to update the expected commit is also a valid solution. --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index fd4d27915..b1853f77a 100644 --- a/Makefile +++ b/Makefile @@ -775,6 +775,11 @@ check-git-abc: elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && ! grep -q '\$$Format:%[hH]\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \ echo "'abc' comes from a tarball. Continuing."; \ exit 0; \ + elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^+'; then \ + echo "'abc' submodule does not match expected commit."; \ + echo "Run 'git submodule update' to check out the correct version."; \ + echo "Note: If testing a different version of abc, call `git commit abc` in the Yosys source directory to update the expected commit."; \ + exit 1; \ elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && grep -q '\$$Format:%[hH]\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \ echo "Error: 'abc' is not configured as a git submodule."; \ echo "To resolve this:"; \ From 03d9138744907d9747b4fd394ba39de4609716a4 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 18 Feb 2025 11:33:06 +1300 Subject: [PATCH 2/3] Makefile: 'U'-prefixed submodule status Covering all the bases, I guess? '-'-prefix is already correctly handled by the base case message. If the user somehow gets merge conflicts in abc, hopefully they know what they're doing. --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index b1853f77a..61eac585d 100644 --- a/Makefile +++ b/Makefile @@ -780,6 +780,10 @@ check-git-abc: echo "Run 'git submodule update' to check out the correct version."; \ echo "Note: If testing a different version of abc, call `git commit abc` in the Yosys source directory to update the expected commit."; \ exit 1; \ + elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^U'; then \ + echo "'abc' submodule has merge conflicts."; \ + echo "Please resolve merge conflicts before continuing."; \ + exit 1; \ elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && grep -q '\$$Format:%[hH]\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \ echo "Error: 'abc' is not configured as a git submodule."; \ echo "To resolve this:"; \ From dc03e174af93ccdf86996f82b46ad911f0e923d0 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 18 Feb 2025 11:46:11 +1300 Subject: [PATCH 3/3] fixup! Makefile: Warn if submodule status '+'-prefixed --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 61eac585d..ea9fbc9e3 100644 --- a/Makefile +++ b/Makefile @@ -778,7 +778,7 @@ check-git-abc: elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^+'; then \ echo "'abc' submodule does not match expected commit."; \ echo "Run 'git submodule update' to check out the correct version."; \ - echo "Note: If testing a different version of abc, call `git commit abc` in the Yosys source directory to update the expected commit."; \ + echo "Note: If testing a different version of abc, call 'git commit abc' in the Yosys source directory to update the expected commit."; \ exit 1; \ elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^U'; then \ echo "'abc' submodule has merge conflicts."; \