Repository: conan-io/conan-center-index

Issue:
[package] libcurl/7.74.0+: Outdated URL (https://curl.haxx.se)
### Package and Environment Details

* Package Name/Version: **libcurl/7.74.0+**
* Operating System+version: (not relevant)
* Compiler+version: (not relevant)
* Docker image: (not relevant)
* Conan version: (not relevant)
* Python version: (not relevant)


### Conan profile

_No response_

### Steps to reproduce

The official homepage of libcurl is https//curl.se since version 7.74.0 (released 2020-12-09).
See:
 - https://curl.se/changes.html#7_74_0
 - https://github.com/curl/curl/pull/6172
(Old homepage https://curl.haxx.se forwards to curl.se)

Should be fixed in https://github.com/conan-io/conan-center-index/blob/master/recipes/libcurl/all/conanfile.py

### Logs

<details><summary>Click to expand log</summary>

```
Put your log output here
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/libcurl/all/conanfile.py b/recipes/libcurl/all/conanfile.py
--- a/recipes/libcurl/all/conanfile.py
+++ b/recipes/libcurl/all/conanfile.py
@@ -3,19 +3,23 @@
 import re
 import functools
 from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools
-from conans.errors import ConanInvalidConfiguration
+from conan.errors import ConanInvalidConfiguration
 from conan.tools.microsoft import is_msvc
 from conan.tools.build import cross_building
+from conan.tools.scm import Version
+from conan.tools.files import replace_in_file, rmdir, chdir, get, download, save, load, apply_conandata_patches
+from conan.tools.apple import is_apple_os
 
-required_conan_version = ">=1.45.0"
+
+required_conan_version = ">=1.51.3"
 
 
 class LibcurlConan(ConanFile):
     name = "libcurl"
     description = "command line tool and library for transferring data with URLs"
-    license = "MIT"
+    license = "curl"
     url = "https://github.com/conan-io/conan-center-index"
-    homepage = "https://curl.haxx.se"
+    homepage = "https://curl.se"
     topics = ("curl", "data-transfer",
             "ftp", "gopher", "http", "imap", "ldap", "mqtt", "pop3", "rtmp", "rtsp",
             "scp", "sftp", "smb", "smtp", "telnet", "tftp")
@@ -136,12 +140,12 @@ def _is_using_cmake_build(self):
 
     @property
     def _has_zstd_option(self):
-        return tools.Version(self.version) >= "7.72.0"
+        return Version(self.version) >= "7.72.0"
 
     @property
     def _has_metalink_option(self):
         # Support for metalink was removed in version 7.78.0 https://github.com/curl/curl/pull/7176
-        return tools.Version(self.version) < "7.78.0" and not self._is_using_cmake_build
+        return Version(self.version) < "7.78.0" and not self._is_using_cmake_build
 
     def export_sources(self):
         self.copy("CMakeLists.txt")
@@ -150,6 +154,8 @@ def export_sources(self):
             self.copy(patch["patch_file"])
 
     def config_options(self):
+        if Version(self.version) < "7.10.4":
+            self.license = "MIT"
         if self.settings.os == "Windows":
             del self.options.fPIC
         if not self._has_zstd_option:
@@ -157,7 +163,7 @@ def config_options(self):
         if not self._has_metalink_option:
             del self.options.with_libmetalink
         # Default options
-        self.options.with_ssl = "darwinssl" if tools.is_apple_os(self.settings.os) else "openssl"
+        self.options.with_ssl = "darwinssl" if is_apple_os(self) else "openssl"
 
     def configure(self):
         if self.options.shared:
@@ -167,7 +173,7 @@ def configure(self):
 
         # These options are not used in CMake build yet
         if self._is_using_cmake_build:
-            if tools.Version(self.version) < "7.75.0":
+            if Version(self.version) < "7.75.0":
                 del self.options.with_libidn
             del self.options.with_libpsl
 
@@ -192,9 +198,9 @@ def requirements(self):
     def validate(self):
         if self.options.with_ssl == "schannel" and self.settings.os != "Windows":
             raise ConanInvalidConfiguration("schannel only suppported on Windows.")
-        if self.options.with_ssl == "darwinssl" and not tools.is_apple_os(self.settings.os):
+        if self.options.with_ssl == "darwinssl" and not is_apple_os(self):
             raise ConanInvalidConfiguration("darwinssl only suppported on Apple like OS (Macos, iOS, watchOS or tvOS).")
-        if self.options.with_ssl == "wolfssl" and self._is_using_cmake_build and tools.Version(self.version) < "7.70.0":
+        if self.options.with_ssl == "wolfssl" and self._is_using_cmake_build and Version(self.version) < "7.70.0":
             raise ConanInvalidConfiguration("Before 7.70.0, libcurl has no wolfssl support for Visual Studio or \"Windows to Android cross compilation\"")
         if self.options.with_ssl == "openssl":
             if self.options.with_ntlm and self.options["openssl"].no_des:
@@ -203,17 +209,17 @@ def validate(self):
     def build_requirements(self):
         if self._is_using_cmake_build:
             if self._is_win_x_android:
-                self.build_requires("ninja/1.11.0")
+                self.tool_requires("ninja/1.11.0")
         else:
-            self.build_requires("libtool/2.4.6")
-            self.build_requires("pkgconf/1.7.4")
+            self.tool_requires("libtool/2.4.6")
+            self.tool_requires("pkgconf/1.7.4")
             if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"):
-                self.build_requires("msys2/cci.latest")
+                self.tool_requires("msys2/cci.latest")
 
     def source(self):
-        tools.get(**self.conan_data["sources"][self.version],
+        get(self, **self.conan_data["sources"][self.version],
                   destination=self._source_subfolder, strip_root=True)
-        tools.download("https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True)
+        download(self, "https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True)
 
     # TODO: remove imports once rpath of shared libs of libcurl dependencies fixed on macOS
     def imports(self):
@@ -235,15 +241,14 @@ def build(self):
             self._build_with_autotools()
 
     def _patch_sources(self):
-        for patch in self.conan_data.get("patches", {}).get(self.version, []):
-            tools.patch(**patch)
+        apply_conandata_patches(self)
         self._patch_misc_files()
         self._patch_autotools()
         self._patch_cmake()
 
     def _patch_misc_files(self):
         if self.options.with_largemaxwritesize:
-            tools.replace_in_file(os.path.join(self._source_subfolder, "include", "curl", "curl.h"),
+            replace_in_file(self, os.path.join(self._source_subfolder, "include", "curl", "curl.h"),
                                   "define CURL_MAX_WRITE_SIZE 16384",
                                   "define CURL_MAX_WRITE_SIZE 10485760")
 
@@ -251,7 +256,7 @@ def _patch_misc_files(self):
         # for additional info, see this comment https://github.com/conan-io/conan-center-index/pull/1008#discussion_r386122685
         if self.settings.compiler == "apple-clang" and self.settings.compiler.version == "9.1":
             if self.options.with_ssl == "darwinssl":
-                tools.replace_in_file(os.path.join(self._source_subfolder, "lib", "vtls", "sectransp.c"),
+                replace_in_file(self, os.path.join(self._source_subfolder, "lib", "vtls", "sectransp.c"),
                                       "#define CURL_BUILD_MAC_10_13 MAC_OS_X_VERSION_MAX_ALLOWED >= 101300",
                                       "#define CURL_BUILD_MAC_10_13 0")
 
@@ -263,38 +268,38 @@ def _patch_autotools(self):
         # - link errors if mingw shared or iOS/tvOS/watchOS
         # - it makes recipe consistent with CMake build where we don't build curl tool
         top_makefile = os.path.join(self._source_subfolder, "Makefile.am")
-        tools.replace_in_file(top_makefile, "SUBDIRS = lib src", "SUBDIRS = lib")
-        tools.replace_in_file(top_makefile, "include src/Makefile.inc", "")
+        replace_in_file(self, top_makefile, "SUBDIRS = lib src", "SUBDIRS = lib")
+        replace_in_file(self, top_makefile, "include src/Makefile.inc", "")
 
         if self._is_mingw:
             # patch for zlib naming in mingw
             if self.options.with_zlib:
                 configure_ac = os.path.join(self._source_subfolder, "configure.ac")
                 zlib_name = self.deps_cpp_info["zlib"].libs[0]
-                tools.replace_in_file(configure_ac,
+                replace_in_file(self, configure_ac,
                                       "AC_CHECK_LIB(z,",
                                       "AC_CHECK_LIB({},".format(zlib_name))
-                tools.replace_in_file(configure_ac,
+                replace_in_file(self, configure_ac,
                                       "-lz ",
                                       "-l{} ".format(zlib_name))
 
             if self.options.shared:
                 # patch for shared mingw build
                 lib_makefile = os.path.join(self._source_subfolder, "lib", "Makefile.am")
-                tools.replace_in_file(lib_makefile,
+                replace_in_file(self, lib_makefile,
                                       "noinst_LTLIBRARIES = libcurlu.la",
                                       "")
-                tools.replace_in_file(lib_makefile,
+                replace_in_file(self, lib_makefile,
                                       "noinst_LTLIBRARIES =",
                                       "")
-                tools.replace_in_file(lib_makefile,
+                replace_in_file(self, lib_makefile,
                                       "lib_LTLIBRARIES = libcurl.la",
                                       "noinst_LTLIBRARIES = libcurl.la")
                 # add directives to build dll
                 # used only for native mingw-make
                 if not cross_building(self):
-                    added_content = tools.load("lib_Makefile_add.am")
-                    tools.save(lib_makefile, added_content, append=True)
+                    added_content = load(self, "lib_Makefile_add.am")
+                    save(self, lib_makefile, added_content, append=True)
 
     def _patch_cmake(self):
         if not self._is_using_cmake_build:
@@ -302,24 +307,24 @@ def _patch_cmake(self):
         cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt")
         # Custom findZstd.cmake file relies on pkg-config file, make sure that it's consumed on all platforms
         if self._has_zstd_option:
-            tools.replace_in_file(os.path.join(self._source_subfolder, "CMake", "FindZstd.cmake"),
+            replace_in_file(self, os.path.join(self._source_subfolder, "CMake", "FindZstd.cmake"),
                                   "if(UNIX)", "if(TRUE)")
         # TODO: check this patch, it's suspicious
-        tools.replace_in_file(cmakelists,
+        replace_in_file(self, cmakelists,
                               "include(CurlSymbolHiding)", "")
 
         # libnghttp2
-        tools.replace_in_file(
+        replace_in_file(self,
             cmakelists,
             "find_package(NGHTTP2 REQUIRED)",
             "find_package(libnghttp2 REQUIRED)",
         )
-        tools.replace_in_file(
+        replace_in_file(self,
             cmakelists,
             "include_directories(${NGHTTP2_INCLUDE_DIRS})",
             "",
         )
-        tools.replace_in_file(
+        replace_in_file(self,
             cmakelists,
             "list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES})",
             "list(APPEND CURL_LIBS libnghttp2::nghttp2)",
@@ -327,8 +332,8 @@ def _patch_cmake(self):
 
         # INTERFACE_LIBRARY (generated by the cmake_find_package generator) targets doesn't have the LOCATION property.
         # So skipp the LOCATION check in the CMakeLists.txt
-        if tools.Version(self.version) >= "7.80.0":
-            tools.replace_in_file(
+        if Version(self.version) >= "7.80.0":
+            replace_in_file(self,
                 cmakelists,
                 'get_target_property(_lib "${_libname}" LOCATION)',
                 """get_target_property(_type "${_libname}" TYPE)
@@ -415,7 +420,7 @@ def _get_configure_command_args(self):
 
         # ntlm will default to enabled if any SSL options are enabled
         if not self.options.with_ntlm:
-            if tools.Version(self.version) <= "7.77.0":
+            if Version(self.version) <= "7.77.0":
                 params.append("--disable-crypto-auth")
             else:
                 params.append("--disable-ntlm")
@@ -468,13 +473,13 @@ def _arm_version(self, arch):
         return version
 
     def _build_with_autotools(self):
-        with tools.chdir(self._source_subfolder):
+        with chdir(self, self._source_subfolder):
             # autoreconf
             self.run("{} -fiv".format(tools.get_env("AUTORECONF") or "autoreconf"), win_bash=tools.os_info.is_windows, run_environment=True)
 
             # fix generated autotools files to have relocatable binaries
-            if tools.is_apple_os(self.settings.os):
-                tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/")
+            if is_apple_os(self):
+                replace_in_file(self, "configure", "-install_name \\$rpath/", "-install_name @rpath/")
 
             self.run("chmod +x configure")
 
@@ -507,7 +512,7 @@ def _configure_autotools(self):
         if self._is_mingw:
             autotools.defines.append("_AMD64_")
 
-        if cross_building(self) and tools.is_apple_os(self.settings.os):
+        if cross_building(self) and is_apple_os(self):
             autotools.defines.extend(['HAVE_SOCKET', 'HAVE_FCNTL_O_NONBLOCK'])
 
         configure_args = self._get_configure_command_args()
@@ -532,26 +537,26 @@ def _configure_cmake(self):
         cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared
         cmake.definitions["CURL_STATICLIB"] = not self.options.shared
         cmake.definitions["CMAKE_DEBUG_POSTFIX"] = ""
-        if tools.Version(self.version) >= "7.81.0":
+        if Version(self.version) >= "7.81.0":
             cmake.definitions["CURL_USE_SCHANNEL"] = self.options.with_ssl == "schannel"
-        elif tools.Version(self.version) >= "7.72.0":
+        elif Version(self.version) >= "7.72.0":
             cmake.definitions["CMAKE_USE_SCHANNEL"] = self.options.with_ssl == "schannel"
         else:
             cmake.definitions["CMAKE_USE_WINSSL"] = self.options.with_ssl == "schannel"
-        if tools.Version(self.version) >= "7.81.0":
+        if Version(self.version) >= "7.81.0":
             cmake.definitions["CURL_USE_OPENSSL"] = self.options.with_ssl == "openssl"
         else:
             cmake.definitions["CMAKE_USE_OPENSSL"] = self.options.with_ssl == "openssl"
-        if tools.Version(self.version) >= "7.81.0":
+        if Version(self.version) >= "7.81.0":
             cmake.definitions["CURL_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl"
-        elif tools.Version(self.version) >= "7.70.0":
+        elif Version(self.version) >= "7.70.0":
             cmake.definitions["CMAKE_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl"
         cmake.definitions["USE_NGHTTP2"] = self.options.with_nghttp2
         cmake.definitions["CURL_ZLIB"] = self.options.with_zlib
         cmake.definitions["CURL_BROTLI"] = self.options.with_brotli
         if self._has_zstd_option:
             cmake.definitions["CURL_ZSTD"] = self.options.with_zstd
-        if tools.Version(self.version) >= "7.81.0":
+        if Version(self.version) >= "7.81.0":
             cmake.definitions["CURL_USE_LIBSSH2"] = self.options.with_libssh2
         else:
             cmake.definitions["CMAKE_USE_LIBSSH2"] = self.options.with_libssh2
@@ -560,7 +565,7 @@ def _configure_cmake(self):
             cmake.definitions["ENABLE_THREADED_RESOLVER"] = self.options.with_threaded_resolver
         cmake.definitions["CURL_DISABLE_PROXY"] = not self.options.with_proxy
         cmake.definitions["USE_LIBRTMP"] = self.options.with_librtmp
-        if tools.Version(self.version) >= "7.75.0":
+        if Version(self.version) >= "7.75.0":
             cmake.definitions["USE_LIBIDN2"] = self.options.with_libidn
         cmake.definitions["CURL_DISABLE_RTSP"] = not self.options.with_rtsp
         cmake.definitions["CURL_DISABLE_CRYPTO_AUTH"] = not self.options.with_crypto_auth
@@ -568,7 +573,7 @@ def _configure_cmake(self):
 
         # Also disables NTLM_WB if set to false
         if not self.options.with_ntlm:
-            if tools.Version(self.version) <= "7.77.0":
+            if Version(self.version) <= "7.77.0":
                 cmake.definitions["CURL_DISABLE_CRYPTO_AUTH"] = True
             else:
                 cmake.definitions["CURL_DISABLE_NTLM"] = True
@@ -597,13 +602,13 @@ def package(self):
         if self._is_using_cmake_build:
             cmake = self._configure_cmake()
             cmake.install()
-            tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
+            rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
         else:
             with tools.run_environment(self):
-                with tools.chdir(self._source_subfolder):
+                with chdir(self, self._source_subfolder):
                     autotools, autotools_vars = self._configure_autotools()
                     autotools.install(vars=autotools_vars)
-            tools.rmdir(os.path.join(self.package_folder, "share"))
+            rmdir(self, os.path.join(self.package_folder, "share"))
             for la_file in glob.glob(os.path.join(self.package_folder, "lib", "*.la")):
                 os.remove(la_file)
             if self._is_mingw and self.options.shared:
@@ -611,7 +616,7 @@ def package(self):
                 self.copy(pattern="*.dll", dst="bin", keep_path=False)
                 self.copy(pattern="*.dll.a", dst="lib", keep_path=False)
                 self.copy(pattern="*.lib", dst="lib", keep_path=False)
-        tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
+        rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
 
     def package_info(self):
         self.cpp_info.set_property("cmake_file_name", "CURL")
@@ -638,8 +643,8 @@ def package_info(self):
                 self.cpp_info.components["curl"].system_libs.append("wldap32")
             if self.options.with_ssl == "schannel":
                 self.cpp_info.components["curl"].system_libs.append("crypt32")
-        elif tools.is_apple_os(self.settings.os):
-            if tools.Version(self.version) >= "7.77.0":
+        elif is_apple_os(self):
+            if Version(self.version) >= "7.77.0":
                 self.cpp_info.components["curl"].frameworks.append("SystemConfiguration")
             if self.options.with_ldap:
                 self.cpp_info.components["curl"].system_libs.append("ldap")


Test patch:
diff --git a/recipes/libcurl/all/test_package/conanfile.py b/recipes/libcurl/all/test_package/conanfile.py
--- a/recipes/libcurl/all/test_package/conanfile.py
+++ b/recipes/libcurl/all/test_package/conanfile.py
@@ -1,4 +1,5 @@
-from conans import ConanFile, CMake, tools
+from conans import ConanFile, CMake
+from conan.tools.build import cross_building
 import os
 import subprocess
 import re
@@ -30,7 +31,7 @@ def _test_executable(self):
             return os.path.join("bin", "test_package")
 
     def test(self):
-        if not tools.cross_building(self):
+        if not cross_building(self):
             self.run(self._test_executable, run_environment=True)
         else:
             # We will dump information for the generated executable