Skip to content

Commit a51bfd1

Browse files
authored
rocksdb: Stop publishing revisions for old versions and recipe cleanup (#28425)
* Stop maintaining old versions Signed-off-by: Uilian Ries <[email protected]> * Always has folly as option Signed-off-by: Uilian Ries <[email protected]> * Move replacement to a separate patch file Signed-off-by: Uilian Ries <[email protected]> * Apply patches in source step Signed-off-by: Uilian Ries <[email protected]> * Remove has lite Signed-off-by: Uilian Ries <[email protected]> * with_folly always present Signed-off-by: Uilian Ries <[email protected]> * Remove virtual component Signed-off-by: Uilian Ries <[email protected]> * Avoid collect_libs Signed-off-by: Uilian Ries <[email protected]> * Simplify test package Signed-off-by: Uilian Ries <[email protected]> * Remove 6.29.5 from config.yml Signed-off-by: Uilian Ries <[email protected]> * Unused Signed-off-by: Uilian Ries <[email protected]> * Keep all headers Signed-off-by: Uilian Ries <[email protected]> * Simplify test package to be compatible Signed-off-by: Uilian Ries <[email protected]> * Revert CMakeLists Signed-off-by: Uilian Ries <[email protected]> * Restore back legacy librocksdb component to avoid breaking users Signed-off-by: Uilian Ries <[email protected]> * Replace patch by replace_in_file for linker flag Signed-off-by: Uilian Ries <[email protected]> --------- Signed-off-by: Uilian Ries <[email protected]> Signed-off-by: Uilian Ries <[email protected]>
1 parent 4c0fde3 commit a51bfd1

File tree

10 files changed

+34
-270
lines changed

10 files changed

+34
-270
lines changed

recipes/rocksdb/all/conandata.yml

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,7 @@ sources:
22
"10.5.1":
33
url: "https://github.com/facebook/rocksdb/archive/refs/tags/v10.5.1.tar.gz"
44
sha256: "7EC942BAAB802B2845188D02BC5D4E42C29236E61BCBC08F5B3A6BDD92290C22"
5-
"10.0.1":
6-
url: "https://github.com/facebook/rocksdb/archive/refs/tags/v10.0.1.tar.gz"
7-
sha256: "3fdc9ca996971c4c039959866382c4a3a6c8ade4abf888f3b2ff77153e07bf28"
8-
"9.10.0":
9-
url: "https://github.com/facebook/rocksdb/archive/refs/tags/v9.10.0.tar.gz"
10-
sha256: "FDCCAB16133C9D927A183C2648BCEA8D956FB41EB1DF2AACAA73EB0B95E43724"
11-
"9.7.4":
12-
url: "https://github.com/facebook/rocksdb/archive/refs/tags/v9.7.4.tar.gz"
13-
sha256: "9b810c81731835fda0d4bbdb51d3199d901fa4395733ab63752d297da84c5a47"
14-
"9.5.2":
15-
url: "https://github.com/facebook/rocksdb/archive/refs/tags/v9.5.2.tar.gz"
16-
sha256: "B20780586D3DF4A3C5BCBDE341A2C1946B03D18237960BDA5BC5E9538F42AF40"
17-
"9.4.0":
18-
url: "https://github.com/facebook/rocksdb/archive/refs/tags/v9.4.0.tar.gz"
19-
sha256: "1f829976aa24b8ba432e156f52c9e0f0bd89c46dc0cc5a9a628ea70571c1551c"
20-
"8.8.1":
21-
url: "https://github.com/facebook/rocksdb/archive/refs/tags/v8.8.1.tar.gz"
22-
sha256: "056c7e21ad8ae36b026ac3b94b9d6e0fcc60e1d937fc80330921e4181be5c36e"
23-
"6.29.5":
24-
url: "https://github.com/facebook/rocksdb/archive/refs/tags/v6.29.5.tar.gz"
25-
sha256: "ddbf84791f0980c0bbce3902feb93a2c7006f6f53bfd798926143e31d4d756f0"
265
patches:
276
"10.5.1":
287
- patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch"
298
patch_description: "Do not include thirdparty.inc"
30-
patch_type: "portability"
31-
"10.0.1":
32-
- patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch"
33-
patch_description: "Do not include thirdparty.inc"
34-
patch_type: "portability"
35-
"9.10.0":
36-
- patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch"
37-
patch_description: "Do not include thirdparty.inc"
38-
patch_type: "portability"
39-
"9.7.4":
40-
- patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch"
41-
patch_description: "Do not include thirdparty.inc"
42-
patch_type: "portability"
43-
"9.5.2":
44-
- patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch"
45-
patch_description: "Do not include thirdparty.inc"
46-
patch_type: "portability"
47-
"9.4.0":
48-
- patch_file: "patches/9.x.x-0001-exclude-thirdparty.patch"
49-
patch_description: "Do not include thirdparty.inc"
50-
patch_type: "portability"
51-
"8.8.1":
52-
- patch_file: "patches/8.8.1-0001-exclude-thirdparty.patch"
53-
patch_description: "Do not include thirdparty.inc"
54-
patch_type: "portability"
55-
"6.29.5":
56-
- patch_file: "patches/6.29.5-0001-add-include-cstdint-for-gcc-13.patch"
57-
patch_description: "Fix build with gcc 13 by including cstdint"
58-
patch_type: "portability"
59-
patch_source: "https://github.com/facebook/rocksdb/pull/11118"
60-
- patch_file: "patches/6.29.5-0002-exclude-thirdparty.patch"
61-
patch_description: "Do not include thirdparty.inc"
62-
patch_type: "portability"

recipes/rocksdb/all/conanfile.py

Lines changed: 20 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import glob
22
import os
3-
import shutil
43

54
from conan import ConanFile
65
from conan.errors import ConanInvalidConfiguration
76
from conan.tools.build import check_min_cppstd
87
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
9-
from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rm, rmdir, replace_in_file
8+
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, replace_in_file
109
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
1110
from conan.tools.scm import Version
1211

@@ -25,7 +24,6 @@ class RocksDBConan(ConanFile):
2524
options = {
2625
"shared": [True, False],
2726
"fPIC": [True, False],
28-
"lite": [True, False],
2927
"with_gflags": [True, False],
3028
"with_snappy": [True, False],
3129
"with_lz4": [True, False],
@@ -40,7 +38,6 @@ class RocksDBConan(ConanFile):
4038
default_options = {
4139
"shared": False,
4240
"fPIC": True,
43-
"lite": False,
4441
"with_snappy": False,
4542
"with_lz4": False,
4643
"with_zlib": False,
@@ -52,22 +49,7 @@ class RocksDBConan(ConanFile):
5249
"enable_sse": False,
5350
"use_rtti": False,
5451
}
55-
56-
@property
57-
def _min_cppstd(self):
58-
return "11" if Version(self.version) < "8.8.1" else "17"
59-
60-
@property
61-
def _has_folly(self):
62-
# Folly became unvendored in 7.7.2
63-
# https://github.com/facebook/rocksdb/commit/be09943fb58a2dd3f70e6e30781ebfa3fcbcb8fa
64-
return Version(self.version) >= "7.7.2"
65-
66-
@property
67-
def _has_lite(self):
68-
# https://github.com/facebook/rocksdb/commit/4720ba4391eb016b05a30d09a8275624c3a4a87e
69-
return Version(self.version) < "8.0.0"
70-
52+
7153
def export_sources(self):
7254
export_conandata_patches(self)
7355

@@ -78,10 +60,6 @@ def config_options(self):
7860
del self.options.with_tbb
7961
if self.settings.build_type == "Debug":
8062
self.options.use_rtti = True # Rtti are used in asserts for debug mode...
81-
if not self._has_folly:
82-
del self.options.with_folly
83-
if not self._has_lite:
84-
del self.options.lite
8563

8664
def configure(self):
8765
if self.options.shared:
@@ -105,24 +83,32 @@ def requirements(self):
10583
self.requires("onetbb/2021.10.0")
10684
if self.options.with_jemalloc:
10785
self.requires("jemalloc/5.3.0")
108-
if self.options.get_safe("with_folly"):
86+
if self.options.with_folly:
10987
self.requires("folly/2024.08.12.00")
11088

11189
def validate(self):
112-
check_min_cppstd(self, self._min_cppstd)
90+
check_min_cppstd(self, 17)
11391

11492
if self.settings.arch not in ["x86_64", "ppc64le", "ppc64", "mips64", "armv8"]:
11593
raise ConanInvalidConfiguration("Rocksdb requires 64 bits")
11694

11795
if is_msvc(self) and Version(self.settings.compiler.version) < "191":
11896
raise ConanInvalidConfiguration("Rocksdb requires MSVC version >= 191")
11997

120-
if self.options.shared and self.options.get_safe("with_folly"):
98+
if self.options.shared and self.options.with_folly:
12199
# https://github.com/facebook/rocksdb/blob/v10.5.1/CMakeLists.txt#L603
122100
raise ConanInvalidConfiguration(f"{self.ref} does not support a shared build with folly")
123101

102+
def _patch_sources(self):
103+
# INFO: Avoid enforcing all linkers to use copy-dt-needed-entries
104+
# https://github.com/facebook/rocksdb/issues/13895
105+
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
106+
'set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--copy-dt-needed-entries")', "")
107+
124108
def source(self):
125109
get(self, **self.conan_data["sources"][self.version], strip_root=True)
110+
apply_conandata_patches(self)
111+
self._patch_sources()
126112

127113
def generate(self):
128114
tc = CMakeToolchain(self)
@@ -131,16 +117,10 @@ def generate(self):
131117
tc.variables["WITH_TOOLS"] = False
132118
tc.variables["WITH_CORE_TOOLS"] = False
133119
tc.variables["WITH_BENCHMARK_TOOLS"] = False
134-
if Version(self.version) < "7.2.0":
135-
# https://github.com/facebook/rocksdb/commit/efd035164b443e0ae552a82ad8b47a8048e652ca
136-
tc.variables["WITH_FOLLY_DISTRIBUTED_MUTEX"] = False
137-
if self._has_folly:
138-
tc.variables["USE_FOLLY"] = self.options.with_folly
120+
tc.variables["USE_FOLLY"] = self.options.with_folly
139121
if is_msvc(self):
140122
tc.variables["WITH_MD_LIBRARY"] = not is_msvc_static_runtime(self)
141123
tc.variables["ROCKSDB_INSTALL_ON_WINDOWS"] = self.settings.os == "Windows"
142-
if self._has_lite:
143-
tc.variables["ROCKSDB_LITE"] = self.options.lite
144124
tc.variables["WITH_GFLAGS"] = self.options.with_gflags
145125
tc.variables["WITH_SNAPPY"] = self.options.with_snappy
146126
tc.variables["WITH_LZ4"] = self.options.with_lz4
@@ -172,20 +152,11 @@ def generate(self):
172152
deps.set_property("jemalloc", "cmake_target_name", "JeMalloc::JeMalloc")
173153
if self.options.with_zstd:
174154
deps.set_property("zstd", "cmake_target_name", "zstd::zstd")
175-
if self.options.get_safe("with_folly"):
155+
if self.options.with_folly:
176156
deps.set_property("folly", "cmake_additional_variables_prefixes", ["FOLLY",])
177157
deps.generate()
178158

179-
def _patch_sources(self):
180-
# INFO: --copy-dt-needed-entries is only needed for ld.bfd and breaks other linkers like ld.gold and lld
181-
# https://github.com/facebook/rocksdb/issues/13895
182-
if self._has_folly:
183-
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
184-
'set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--copy-dt-needed-entries")', "")
185-
186159
def build(self):
187-
apply_conandata_patches(self)
188-
self._patch_sources()
189160
cmake = CMake(self)
190161
cmake.configure()
191162
cmake.build()
@@ -196,41 +167,29 @@ def _remove_static_libraries(self):
196167
if not lib.endswith(".dll.a"):
197168
os.remove(lib)
198169

199-
def _remove_cpp_headers(self):
200-
for path in glob.glob(os.path.join(self.package_folder, "include", "rocksdb", "*")):
201-
if path != os.path.join(self.package_folder, "include", "rocksdb", "c.h"):
202-
if os.path.isfile(path):
203-
os.remove(path)
204-
else:
205-
shutil.rmtree(path)
206-
207170
def package(self):
208171
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
209172
copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
210173
cmake = CMake(self)
211174
cmake.install()
212175
if self.options.shared:
213176
self._remove_static_libraries()
214-
self._remove_cpp_headers() # Force stable ABI for shared libraries
215177
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
216178
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
217179

218180
def package_info(self):
219181
cmake_target = "rocksdb-shared" if self.options.shared else "rocksdb"
220182
self.cpp_info.set_property("cmake_file_name", "RocksDB")
221183
self.cpp_info.set_property("cmake_target_name", f"RocksDB::{cmake_target}")
222-
# TODO: back to global scope in conan v2 once cmake_find_package* generators removed
223-
self.cpp_info.components["librocksdb"].libs = collect_libs(self)
184+
# INFO: Component librocksdb is legacy due cmake_find_package but may break a few users in case removed
185+
lib_suffix = "-shared" if is_msvc(self) and self.options.shared else ""
186+
self.cpp_info.components["librocksdb"].libs = [f"rocksdb{lib_suffix}"]
224187
if self.settings.os == "Windows":
225188
self.cpp_info.components["librocksdb"].system_libs = ["shlwapi", "rpcrt4"]
226189
if self.options.shared:
227190
self.cpp_info.components["librocksdb"].defines = ["ROCKSDB_DLL"]
228191
elif self.settings.os in ["Linux", "FreeBSD"]:
229192
self.cpp_info.components["librocksdb"].system_libs = ["pthread", "m"]
230-
if self.options.get_safe("lite"):
231-
self.cpp_info.components["librocksdb"].defines.append("ROCKSDB_LITE")
232-
233-
self.cpp_info.components["librocksdb"].set_property("cmake_target_name", f"RocksDB::{cmake_target}")
234193
if self.options.with_gflags:
235194
self.cpp_info.components["librocksdb"].requires.append("gflags::gflags")
236195
if self.options.with_snappy:
@@ -245,5 +204,5 @@ def package_info(self):
245204
self.cpp_info.components["librocksdb"].requires.append("onetbb::onetbb")
246205
if self.options.with_jemalloc:
247206
self.cpp_info.components["librocksdb"].requires.append("jemalloc::jemalloc")
248-
if self.options.get_safe("with_folly"):
249-
self.cpp_info.components["librocksdb"].requires.append("folly::folly")
207+
if self.options.with_folly:
208+
self.cpp_info.components["librocksdb"].requires.append("folly::folly")

recipes/rocksdb/all/patches/6.29.5-0001-add-include-cstdint-for-gcc-13.patch

Lines changed: 0 additions & 30 deletions
This file was deleted.

recipes/rocksdb/all/patches/6.29.5-0002-exclude-thirdparty.patch

Lines changed: 0 additions & 16 deletions
This file was deleted.

recipes/rocksdb/all/patches/8.8.1-0001-exclude-thirdparty.patch

Lines changed: 0 additions & 30 deletions
This file was deleted.
Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
11
cmake_minimum_required(VERSION 3.15)
22
project(test_package LANGUAGES CXX)
33

4-
enable_testing()
5-
64
find_package(RocksDB REQUIRED CONFIG)
75

8-
add_executable(${PROJECT_NAME}_stable_abi test_package_stable_abi.cpp)
9-
add_test(NAME ${PROJECT_NAME}_stable_abi COMMAND ${PROJECT_NAME}_stable_abi)
10-
if(ROCKSDB_SHARED)
11-
target_link_libraries(${PROJECT_NAME}_stable_abi PRIVATE RocksDB::rocksdb-shared)
12-
else()
13-
target_link_libraries(${PROJECT_NAME}_stable_abi PRIVATE RocksDB::rocksdb)
14-
15-
add_executable(${PROJECT_NAME}_cpp test_package.cpp)
16-
target_link_libraries(${PROJECT_NAME}_cpp PRIVATE RocksDB::rocksdb)
17-
if(RocksDB_VERSION VERSION_LESS "8.8.1")
18-
target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11)
19-
else()
20-
target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_17)
21-
endif()
22-
add_test(NAME ${PROJECT_NAME}_cpp COMMAND ${PROJECT_NAME}_cpp)
23-
endif()
6+
add_executable(${PROJECT_NAME} test_package.cpp)
7+
target_link_libraries(${PROJECT_NAME} PRIVATE $<IF:$<TARGET_EXISTS:RocksDB::rocksdb-shared>,RocksDB::rocksdb-shared,RocksDB::rocksdb>)
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1+
import os
12
from conan import ConanFile
23
from conan.tools.build import can_run
3-
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
4+
from conan.tools.cmake import CMake, cmake_layout
45

56

67
class TestPackageConan(ConanFile):
78
settings = "os", "arch", "compiler", "build_type"
8-
generators = "CMakeDeps", "VirtualRunEnv"
9-
test_type = "explicit"
9+
generators = "CMakeDeps", "CMakeToolchain"
1010

1111
def layout(self):
1212
cmake_layout(self)
1313

1414
def requirements(self):
1515
self.requires(self.tested_reference_str)
16-
17-
def generate(self):
18-
tc = CMakeToolchain(self)
19-
tc.variables["ROCKSDB_SHARED"] = self.dependencies["rocksdb"].options.shared
20-
tc.generate()
21-
16+
2217
def build(self):
2318
cmake = CMake(self)
2419
cmake.configure()
2520
cmake.build()
2621

2722
def test(self):
2823
if can_run(self):
29-
self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun")
24+
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
25+
self.run(bin_path, env="conanrun")

0 commit comments

Comments
 (0)