Some checks failed
Build and Test / build (debug, clang) (push) Has been cancelled
Build and Test / build (debug, gcc) (push) Has been cancelled
Build and Test / build (release, clang) (push) Has been cancelled
Build and Test / build (release, gcc) (push) Has been cancelled
Build and Test / docker (push) Has been cancelled
Nothing shipped used the library after the event store landed. A small reader/writer for its file format (src/store/legacy_kv) replaces it for the legacy code, and the submodule, subproject and library test are removed. A writer open now imports a legacy database.db file into the event store: indicators are replayed in an order consistent with the old hash/rule indexes, the result is verified against the old file, the old file is kept as database.db.migrated-<ts>, and an import interrupted between its final renames is finished on the next open. Read-only handles read a legacy file directly and switch to the store once it is imported. Ids re-stored under another hash are reported (their old index entries cannot be carried over). Tests: legacy import properties I1-I6 (locked and corrupt files are left untouched), the differential test now shares its comparisons, and fuzz_legacy_kv covers the file parser. A copy of a real 137 KB legacy database imported cleanly into 7 KB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
3 KiB
Python
79 lines
3 KiB
Python
from conan import ConanFile
|
|
from conan.errors import ConanInvalidConfiguration
|
|
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
|
|
from conan.tools.gnu import PkgConfigDeps
|
|
from conan.tools.meson.helpers import to_cppstd_flag
|
|
from conan.tools.meson import MesonToolchain
|
|
|
|
|
|
class StrawberryConan(ConanFile):
|
|
settings = "os", "arch", "compiler", "build_type"
|
|
options = {
|
|
"enable_tests": [True, False],
|
|
"with_libbpf": [True, False],
|
|
"with_yara": [True, False],
|
|
"with_packaged_tools": [True, False],
|
|
"with_updater": [True, False],
|
|
}
|
|
default_options = {
|
|
"enable_tests": True,
|
|
"with_libbpf": False,
|
|
"with_yara": False,
|
|
"with_packaged_tools": False,
|
|
"with_updater": False,
|
|
"openssl/*:shared": False,
|
|
"libbpf/*:shared": False,
|
|
}
|
|
|
|
def requirements(self):
|
|
self.requires("openssl/3.6.2")
|
|
# Required: control-socket payloads and policy/feed state are JSON.
|
|
self.requires("nlohmann_json/3.11.3")
|
|
# Required: event store blocks are zstd frames.
|
|
self.requires("zstd/1.5.7")
|
|
|
|
if self.options.with_updater:
|
|
# strawberry --update-rules (HTTPS download + archive extraction).
|
|
self.requires("libcurl/8.12.1")
|
|
self.requires("libarchive/3.7.9")
|
|
|
|
if self.options.with_libbpf:
|
|
self.requires("libbpf/1.3.0")
|
|
|
|
if self.options.with_yara:
|
|
yara_reference = self.conf.get("user.strawberry:yara_reference", default=None, check_type=str)
|
|
if not yara_reference:
|
|
raise ConanInvalidConfiguration(
|
|
"with_yara=True requires -c user.strawberry:yara_reference=<ref>. "
|
|
"Use the seeded local recipe under conan/local_recipes_index or another private remote."
|
|
)
|
|
self.requires(yara_reference)
|
|
|
|
def build_requirements(self):
|
|
if self.options.with_packaged_tools:
|
|
self.tool_requires("meson/1.10.1")
|
|
self.tool_requires("ninja/1.13.2")
|
|
self.tool_requires("pkgconf/2.5.1")
|
|
|
|
def layout(self):
|
|
self.folders.source = "."
|
|
self.folders.build = ""
|
|
self.folders.generators = "generators"
|
|
|
|
def generate(self):
|
|
toolchain = MesonToolchain(self)
|
|
compiler = self.settings.get_safe("compiler")
|
|
compiler_version = self.settings.get_safe("compiler.version")
|
|
if compiler and compiler_version:
|
|
# Strawberry requires a C++23-capable Meson toolchain.
|
|
# `conan profile detect` can default to older cppstd values (for example gnu17 on Apple Clang),
|
|
# so force the generated native file to use a C++23 dialect for the consumer build itself.
|
|
toolchain.cpp_std = to_cppstd_flag(self, compiler, compiler_version, "23")
|
|
toolchain.project_options["enable_tests"] = bool(self.options.enable_tests)
|
|
toolchain.generate()
|
|
|
|
pkg_config = PkgConfigDeps(self)
|
|
pkg_config.generate()
|
|
|
|
VirtualBuildEnv(self).generate()
|
|
VirtualRunEnv(self).generate()
|