From f91783310563c90d48d4dcaa771cc367261a77fc Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 12 Aug 2021 13:04:21 +0200 Subject: [PATCH 1/5] Add warning when downloading recipes from bintray --- conans/client/graph/proxy.py | 4 ++++ .../integration/command/install/install_test.py | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/conans/client/graph/proxy.py b/conans/client/graph/proxy.py index 8cb149acbf2..f00be599240 100644 --- a/conans/client/graph/proxy.py +++ b/conans/client/graph/proxy.py @@ -113,6 +113,10 @@ def _download_recipe(self, layout, ref, output, remotes, remote, recorder): def _retrieve_from_remote(the_remote): output.info("Trying with '%s'..." % the_remote.name) # If incomplete, resolve the latest in server + if "https://conan.bintray.com" in the_remote.url: + output.warn("Remote https://conan.bintray.com is deprecated and will be shut down " + "soon. Please use the new 'conancenter' default remote " + "(https://center.conan.io).") _ref = self._remote_manager.get_recipe(ref, the_remote) output.info("Downloaded recipe revision %s" % _ref.revision) recorder.recipe_downloaded(ref, the_remote.url) diff --git a/conans/test/integration/command/install/install_test.py b/conans/test/integration/command/install/install_test.py index 97d60045f6b..10822ea95bd 100644 --- a/conans/test/integration/command/install/install_test.py +++ b/conans/test/integration/command/install/install_test.py @@ -447,3 +447,18 @@ def test_create_cli_override(self, client): "test_package/conanfile.py": GenConanfile().with_test("pass")}) client.run("create . pkg/0.1@ --require-override=zlib/2.0") assert "zlib/2.0: Already installed" in client.out + + +def test_install_bintray_warning(): + """ + IMPORTANT: This test is actually using https://conan.bintray.com + Warning is only displayed when downloading a recipe from the remote + """ + client = TestClient() + client.run("remote add whatever https://conan.bintray.com") + client.run("install zlib/1.2.8@conan/stable -r whatever") + assert "WARN: Remote https://conan.bintray.com is deprecated and will be shut down " \ + "soon" in client.out + client.run("install zlib/1.2.8@conan/stable -r whatever -s build_type=Debug") + assert "WARN: Remote https://conan.bintray.com is deprecated and will be shut down " \ + "soon" not in client.out From 6c295cc1930cadc6aeefeac5c4c426e087507633 Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 12 Aug 2021 13:13:32 +0200 Subject: [PATCH 2/5] fix msg format --- conans/client/graph/proxy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conans/client/graph/proxy.py b/conans/client/graph/proxy.py index f00be599240..e2223a112d8 100644 --- a/conans/client/graph/proxy.py +++ b/conans/client/graph/proxy.py @@ -115,8 +115,9 @@ def _retrieve_from_remote(the_remote): # If incomplete, resolve the latest in server if "https://conan.bintray.com" in the_remote.url: output.warn("Remote https://conan.bintray.com is deprecated and will be shut down " - "soon. Please use the new 'conancenter' default remote " - "(https://center.conan.io).") + "soon.") + output.warn("Please use the new 'conancenter' default remote " + "(https://center.conan.io).") _ref = self._remote_manager.get_recipe(ref, the_remote) output.info("Downloaded recipe revision %s" % _ref.revision) recorder.recipe_downloaded(ref, the_remote.url) From 091f5786e4280ec8150e2b905054549f7794dd4e Mon Sep 17 00:00:00 2001 From: danimtb Date: Thu, 12 Aug 2021 13:14:01 +0200 Subject: [PATCH 3/5] change test --- conans/test/integration/command/install/install_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conans/test/integration/command/install/install_test.py b/conans/test/integration/command/install/install_test.py index 10822ea95bd..658b866ab32 100644 --- a/conans/test/integration/command/install/install_test.py +++ b/conans/test/integration/command/install/install_test.py @@ -455,10 +455,10 @@ def test_install_bintray_warning(): Warning is only displayed when downloading a recipe from the remote """ client = TestClient() - client.run("remote add whatever https://conan.bintray.com") - client.run("install zlib/1.2.8@conan/stable -r whatever") + client.run("remote add conan-center https://conan.bintray.com") + client.run("install zlib/1.2.8@conan/stable -r conan-center") assert "WARN: Remote https://conan.bintray.com is deprecated and will be shut down " \ "soon" in client.out - client.run("install zlib/1.2.8@conan/stable -r whatever -s build_type=Debug") + client.run("install zlib/1.2.8@conan/stable -r conan-center -s build_type=Debug") assert "WARN: Remote https://conan.bintray.com is deprecated and will be shut down " \ "soon" not in client.out From b85a5f8d365605d375bdb234af937869562c035a Mon Sep 17 00:00:00 2001 From: danimtb Date: Wed, 18 Aug 2021 11:40:16 +0200 Subject: [PATCH 4/5] Use mocked remote --- conans/client/graph/proxy.py | 10 +++++++--- .../command/install/install_test.py | 19 +++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/conans/client/graph/proxy.py b/conans/client/graph/proxy.py index e2223a112d8..46f4d81cf3d 100644 --- a/conans/client/graph/proxy.py +++ b/conans/client/graph/proxy.py @@ -13,6 +13,9 @@ from conans.util.tracer import log_recipe_got_from_local_cache +DEPRECATED_CONAN_CENTER_BINTRAY_URL = "https://conan.bintray.com" + + class ConanProxy(object): def __init__(self, cache, output, remote_manager): # collaborators @@ -113,11 +116,12 @@ def _download_recipe(self, layout, ref, output, remotes, remote, recorder): def _retrieve_from_remote(the_remote): output.info("Trying with '%s'..." % the_remote.name) # If incomplete, resolve the latest in server - if "https://conan.bintray.com" in the_remote.url: + if the_remote.url.startswith(DEPRECATED_CONAN_CENTER_BINTRAY_URL): output.warn("Remote https://conan.bintray.com is deprecated and will be shut down " "soon.") - output.warn("Please use the new 'conancenter' default remote " - "(https://center.conan.io).") + output.warn("Please use the new 'conancenter' default remote.") + output.warn("Add it to your remotes with: conan remote add -i 0 conancenter " + "https://center.conan.io") _ref = self._remote_manager.get_recipe(ref, the_remote) output.info("Downloaded recipe revision %s" % _ref.revision) recorder.recipe_downloaded(ref, the_remote.url) diff --git a/conans/test/integration/command/install/install_test.py b/conans/test/integration/command/install/install_test.py index 658b866ab32..615568c5b65 100644 --- a/conans/test/integration/command/install/install_test.py +++ b/conans/test/integration/command/install/install_test.py @@ -450,15 +450,18 @@ def test_create_cli_override(self, client): def test_install_bintray_warning(): - """ - IMPORTANT: This test is actually using https://conan.bintray.com - Warning is only displayed when downloading a recipe from the remote - """ - client = TestClient() - client.run("remote add conan-center https://conan.bintray.com") - client.run("install zlib/1.2.8@conan/stable -r conan-center") + server = TestServer(complete_urls=True) + from conans.client.graph import proxy + proxy.DEPRECATED_CONAN_CENTER_BINTRAY_URL = server.fake_url # Mocking! + client = TestClient(servers={"conan-center": server}, + users={"conan-center": [("lasote", "mypass")]}) + client.save({"conanfile.py": GenConanfile()}) + client.run("create . zlib/1.0@lasote/testing") + client.run("upload zlib/1.0@lasote/testing --all -r conan-center") + client.run("remove * -f") + client.run("install zlib/1.0@lasote/testing -r conan-center") assert "WARN: Remote https://conan.bintray.com is deprecated and will be shut down " \ "soon" in client.out - client.run("install zlib/1.2.8@conan/stable -r conan-center -s build_type=Debug") + client.run("install zlib/1.0@lasote/testing -r conan-center -s build_type=Debug") assert "WARN: Remote https://conan.bintray.com is deprecated and will be shut down " \ "soon" not in client.out From a780ffa19a21aa031f1a0ad934664ba1786c3b8f Mon Sep 17 00:00:00 2001 From: Daniel Date: Thu, 19 Aug 2021 15:26:05 +0200 Subject: [PATCH 5/5] Update conans/client/graph/proxy.py --- conans/client/graph/proxy.py | 1 + 1 file changed, 1 insertion(+) diff --git a/conans/client/graph/proxy.py b/conans/client/graph/proxy.py index 46f4d81cf3d..a3ef9db76a3 100644 --- a/conans/client/graph/proxy.py +++ b/conans/client/graph/proxy.py @@ -13,6 +13,7 @@ from conans.util.tracer import log_recipe_got_from_local_cache +# TODO: Remove warning message when this URL is no longer available DEPRECATED_CONAN_CENTER_BINTRAY_URL = "https://conan.bintray.com"