From 879e140d9438ab491aceea766d0cf0ae3595dae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abril=20Rinc=C3=B3n=20Blanco?= Date: Tue, 10 Dec 2024 10:28:09 +0100 Subject: [PATCH] Fix bare `self.version` comparisions in CCI (#26143) * Fix self.version string comparisons * Fix pcapplusplus 21.x cross-compilation by fixing typo in patch --- recipes/orc/all/conanfile.py | 2 +- recipes/pcapplusplus/all/conanfile.py | 7 ++++--- ...s-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch | 2 +- recipes/quantlib/all/conanfile.py | 6 +++--- recipes/quickjs/all/conanfile.py | 3 ++- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/recipes/orc/all/conanfile.py b/recipes/orc/all/conanfile.py index 8ffc69bfa533d..e14e204bb80e0 100644 --- a/recipes/orc/all/conanfile.py +++ b/recipes/orc/all/conanfile.py @@ -49,7 +49,7 @@ def _compilers_minimum_version(self): @property def _should_patch_thirdparty_toolchain(self): - return self.version < "2.0.0" + return Version(self.version) < "2.0.0" def export_sources(self): if self._should_patch_thirdparty_toolchain: diff --git a/recipes/pcapplusplus/all/conanfile.py b/recipes/pcapplusplus/all/conanfile.py index 398650c106206..1def001fa9bdf 100644 --- a/recipes/pcapplusplus/all/conanfile.py +++ b/recipes/pcapplusplus/all/conanfile.py @@ -7,6 +7,7 @@ from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc, unix_path, MSBuild, MSBuildToolchain +from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration required_conan_version = ">=1.57.0" @@ -43,7 +44,7 @@ def layout(self): def requirements(self): if self.settings.os == "Windows": self.requires("npcap/1.70") - if self.version < "22.11": + if Version(self.version) < "22.11": self.requires("pthreads4w/3.0.0") else: self.requires("libpcap/1.10.1") @@ -122,7 +123,7 @@ def _build_windows(self): "--pcap-sdk", self.dependencies["npcap"].package_folder, "--vs-version", "vs2015", # this will be later overridden by the props file generated by MSBuildToolchain ] - if self.version < "22.11": + if Version(self.version) < "22.11": config_args += ["--pthreads-home", self.dependencies["pthreads4w"].package_folder] self.run(" ".join(config_args), env="conanbuild") msbuild = MSBuild(self) @@ -137,7 +138,7 @@ def package(self): def package_info(self): self.cpp_info.libs = ["Pcap++", "Packet++", "Common++"] - if self.version < "22.11" and self.settings.os in ("FreeBSD", "Linux"): + if Version(self.version) < "22.11" and self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs.append("pthread") if self.settings.os == "Macos": self.cpp_info.frameworks.extend(["CoreFoundation", "Security", "SystemConfiguration"]) diff --git a/recipes/pcapplusplus/all/patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch b/recipes/pcapplusplus/all/patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch index 9f23a37847f60..507cb1098ab2f 100644 --- a/recipes/pcapplusplus/all/patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch +++ b/recipes/pcapplusplus/all/patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch @@ -5,7 +5,7 @@ Obj/%.o: LightPcapNg/src/%.c @echo Building file: $< - @$(CC) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" -+ @$(CC) $(CPPFLAGS) $(CLFAGS) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" ++ @$(CC) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) -Wall -O2 $(GLOBAL_FLAGS) $(DEFS) -g -c -o "$@" "$<" CUR_TARGET := $(notdir $(shell pwd)) diff --git a/recipes/quantlib/all/conanfile.py b/recipes/quantlib/all/conanfile.py index 117151188f5e9..18e4b9adf7ede 100644 --- a/recipes/quantlib/all/conanfile.py +++ b/recipes/quantlib/all/conanfile.py @@ -47,10 +47,10 @@ def requirements(self): def validate(self): if self.info.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 14 if self.version >= "1.24" else 11) + check_min_cppstd(self, 14 if Version(self.version) >= "1.24" else 11) if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 not supported") - if self.version >= "1.24" and is_msvc(self) and self.options.shared: + if Version(self.version) >= "1.24" and is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("MSVC DLL build is not supported by upstream") def source(self): @@ -61,7 +61,7 @@ def generate(self): tc = CMakeToolchain(self) # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - if self.version >= "1.24": + if Version(self.version) >= "1.24": tc.cache_variables["QL_BUILD_BENCHMARK"] = False tc.cache_variables["QL_BUILD_EXAMPLES"] = False tc.cache_variables["QL_BUILD_TEST_SUITE"] = False diff --git a/recipes/quickjs/all/conanfile.py b/recipes/quickjs/all/conanfile.py index 6d4979abaf7f7..938f04d5b02f0 100644 --- a/recipes/quickjs/all/conanfile.py +++ b/recipes/quickjs/all/conanfile.py @@ -2,6 +2,7 @@ from conan.tools.files import get, copy from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os @@ -35,7 +36,7 @@ def export_sources(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.version >= "2023-12-09": + if Version(self.version) >= "2023-12-09": del self.options.use_bignum def configure(self):