Repository: conan-io/conan

Issue:
[feature] Supress Conan 2 compatibility message
### What is your suggestion?

When a recipe fails to build Conan 2 will print a migration note regarding v2 compatibility:

```
*********************************************************
Recipe 'conanfile.py (...)' cannot build its binary
It is possible that this recipe is not Conan 2.0 ready
If the recipe comes from ConanCenter check: https://conan.io/cci-v2.html
If it is your recipe, check if it is updated to 2.0
*********************************************************
```

This is confusing our developers though because they assume a Conan issue when in fact its a good old compiler failure right above that flashy message. Looking at the code I found now way to disable this - is there any plans to offer an option for that?

### Have you read the CONTRIBUTING guide?

- [X] I've read the CONTRIBUTING guide


Discussion:
Thanks for your feedback @mariuszwicker-cnhind 

That sounds right, lets remove that message, most of ConanCenter is now Conan 2.0 compatible, this message is probably more confusing at this stage than helpful.

Resolving patch:
diff --git a/conan/cli/cli.py b/conan/cli/cli.py
--- a/conan/cli/cli.py
+++ b/conan/cli/cli.py
@@ -191,16 +191,6 @@ def _conan2_migrate_recipe_msg(exception):
                     "If it is your recipe, check if it is updated to 2.0\n" \
                     "*********************************************************\n"
             ConanOutput().writeln(error, fg=Color.BRIGHT_MAGENTA)
-        result = re.search(r"(.*): Error in build\(\) method, line", message)
-        if result:
-            pkg = result.group(1)
-            error = "*********************************************************\n" \
-                    f"Recipe '{pkg}' cannot build its binary\n" \
-                    f"It is possible that this recipe is not Conan 2.0 ready\n" \
-                    "If the recipe comes from ConanCenter, report it at https://github.com/conan-io/conan-center-index/issues\n" \
-                    "If it is your recipe, check if it is updated to 2.0\n" \
-                    "*********************************************************\n"
-            ConanOutput().writeln(error, fg=Color.BRIGHT_MAGENTA)
 
     @staticmethod
     def exception_exit_error(exception):


Test patch:
diff --git a/conans/test/integration/conan_v2/test_legacy_cpp_info.py b/conans/test/integration/conan_v2/test_legacy_cpp_info.py
--- a/conans/test/integration/conan_v2/test_legacy_cpp_info.py
+++ b/conans/test/integration/conan_v2/test_legacy_cpp_info.py
@@ -65,20 +65,3 @@ class Pkg(ConanFile):
         assert "Recipe 'pkg/1.0' seems broken." in c.out
         assert "It is possible that this recipe is not Conan 2.0 ready" in c.out
 
-    def test_legacy_build(self):
-        c = TestClient()
-        conanfile = textwrap.dedent("""
-            from conan import ConanFile
-            class Pkg(ConanFile):
-                name = "pkg"
-                version = "1.0"
-
-                def build(self):
-                    raise Exception("Build broken")
-            """)
-        c.save({"pkg/conanfile.py": conanfile,
-                "app/conanfile.py": GenConanfile("app", "1.0").with_requires("pkg/1.0")})
-        c.run("export pkg")
-        c.run("install app --build=missing", assert_error=True)
-        assert "Recipe 'pkg/1.0' cannot build its binary" in c.out
-        assert "It is possible that this recipe is not Conan 2.0 ready" in c.out