mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/awelzel/3619-zeekygen-spicyc-mtime'
* origin/topic/awelzel/3619-zeekygen-spicyc-mtime: spicy/zeekygen: Remove mtime from generated code
This commit is contained in:
commit
e33bf64dc9
9 changed files with 33 additions and 20 deletions
18
CHANGES
18
CHANGES
|
@ -1,3 +1,21 @@
|
||||||
|
7.0.0-dev.29 | 2024-02-27 15:18:49 +0100
|
||||||
|
|
||||||
|
* GH-3619: spicy/zeekygen: Remove mtime from generated code (Arne Welzel, Corelight)
|
||||||
|
|
||||||
|
Zeekygen implements its own make-style update logic to prevent
|
||||||
|
re-creation of files that have not changed. To fulfill this, we
|
||||||
|
currently encode the current time into spicyz generated .cc files.
|
||||||
|
|
||||||
|
This degrades ccache efficiency for built-in analyzers and also
|
||||||
|
for all .evt files compiled during testing. Switch SpicyModuleInfo
|
||||||
|
to return current time instead. This results in the re-generation
|
||||||
|
of documentation files unconditionally when running Zeekygen, but
|
||||||
|
that seems more acceptable IMO.
|
||||||
|
|
||||||
|
Generally wonder if Zeekygen should produce output unconditionally
|
||||||
|
and if we need to clobber prevention, compare with the content of
|
||||||
|
the existing file.
|
||||||
|
|
||||||
7.0.0-dev.26 | 2024-02-26 21:15:59 +0100
|
7.0.0-dev.26 | 2024-02-26 21:15:59 +0100
|
||||||
|
|
||||||
* signatures/iso-9660: Add \x01 suffix to CD001 (Arne Welzel, Corelight)
|
* signatures/iso-9660: Add \x01 suffix to CD001 (Arne Welzel, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
7.0.0-dev.26
|
7.0.0-dev.29
|
||||||
|
|
|
@ -17,7 +17,7 @@ type ZeekTypeTag = enum {
|
||||||
Addr, Any, Bool, Count, Double, Enum, Error, File, Func, Int, Interval, List, Opaque, Pattern, Port, Record, String, Subnet, Table, Time, Type, Vector, Void
|
Addr, Any, Bool, Count, Double, Enum, Error, File, Func, Int, Interval, List, Opaque, Pattern, Port, Record, String, Subnet, Table, Time, Type, Vector, Void
|
||||||
} &cxxname="::zeek::spicy::rt::ZeekTypeTag";
|
} &cxxname="::zeek::spicy::rt::ZeekTypeTag";
|
||||||
|
|
||||||
declare public void register_spicy_module_begin(string name, string description, time mtime) &cxxname="zeek::spicy::rt::register_spicy_module_begin";
|
declare public void register_spicy_module_begin(string name, string description) &cxxname="zeek::spicy::rt::register_spicy_module_begin";
|
||||||
declare public void register_protocol_analyzer(string name, hilti::Protocol protocol, vector<PortRange> ports, string parser_orig, string parser_resp, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_protocol_analyzer" &have_prototype;
|
declare public void register_protocol_analyzer(string name, hilti::Protocol protocol, vector<PortRange> ports, string parser_orig, string parser_resp, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_protocol_analyzer" &have_prototype;
|
||||||
declare public void register_file_analyzer(string name, vector<string> mime_types, string parser, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_file_analyzer" &have_prototype;
|
declare public void register_file_analyzer(string name, vector<string> mime_types, string parser, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_file_analyzer" &have_prototype;
|
||||||
declare public void register_packet_analyzer(string name, string parser, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_packet_analyzer" &have_prototype;
|
declare public void register_packet_analyzer(string name, string parser, string replaces, string linker_scope) &cxxname="zeek::spicy::rt::register_packet_analyzer" &have_prototype;
|
||||||
|
|
|
@ -47,10 +47,9 @@ static std::pair<std::string, std::string> parseID(const std::string& s) {
|
||||||
|
|
||||||
Manager::~Manager() {}
|
Manager::~Manager() {}
|
||||||
|
|
||||||
void Manager::registerSpicyModuleBegin(const std::string& name, const std::string& description, hilti::rt::Time mtime) {
|
void Manager::registerSpicyModuleBegin(const std::string& name, const std::string& description) {
|
||||||
assert(! _module_info);
|
assert(! _module_info);
|
||||||
_module_info =
|
_module_info = std::make_unique<zeekygen::detail::SpicyModuleInfo>(name, description);
|
||||||
std::make_unique<zeekygen::detail::SpicyModuleInfo>(name, description, static_cast<time_t>(mtime.seconds()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::registerSpicyModuleEnd() {
|
void Manager::registerSpicyModuleEnd() {
|
||||||
|
|
|
@ -75,10 +75,8 @@ public:
|
||||||
* and to index it, inside the Zeekygen documentation.
|
* and to index it, inside the Zeekygen documentation.
|
||||||
* @param description textual description in reST that will be shown for
|
* @param description textual description in reST that will be shown for
|
||||||
* this module inside the Zeekygen documentation
|
* this module inside the Zeekygen documentation
|
||||||
* @param mtime timestamp indicating last time of modification of any of
|
|
||||||
* the module's content; used by Zeekygen to trigger rebuilds as necessary
|
|
||||||
*/
|
*/
|
||||||
void registerSpicyModuleBegin(const std::string& name, const std::string& description, hilti::rt::Time mtime);
|
void registerSpicyModuleBegin(const std::string& name, const std::string& description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runtime method to register a protocol analyzer with its Zeek-side
|
* Runtime method to register a protocol analyzer with its Zeek-side
|
||||||
|
|
|
@ -20,9 +20,8 @@
|
||||||
using namespace zeek;
|
using namespace zeek;
|
||||||
using namespace zeek::spicy;
|
using namespace zeek::spicy;
|
||||||
|
|
||||||
void rt::register_spicy_module_begin(const std::string& name, const std::string& description,
|
void rt::register_spicy_module_begin(const std::string& name, const std::string& description) {
|
||||||
const hilti::rt::Time& mtime) {
|
spicy_mgr->registerSpicyModuleBegin(name, description);
|
||||||
spicy_mgr->registerSpicyModuleBegin(name, description, mtime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rt::register_spicy_module_end() { spicy_mgr->registerSpicyModuleEnd(); }
|
void rt::register_spicy_module_end() { spicy_mgr->registerSpicyModuleEnd(); }
|
||||||
|
|
|
@ -94,7 +94,7 @@ public:
|
||||||
* Begins registration of a Spicy EVT module. All subsequent, other `register_*()`
|
* Begins registration of a Spicy EVT module. All subsequent, other `register_*()`
|
||||||
* function call will be associated with this module for documentation purposes.
|
* function call will be associated with this module for documentation purposes.
|
||||||
*/
|
*/
|
||||||
void register_spicy_module_begin(const std::string& name, const std::string& description, const hilti::rt::Time& mtime);
|
void register_spicy_module_begin(const std::string& name, const std::string& description);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a Spicy protocol analyzer with its EVT meta information with the
|
* Registers a Spicy protocol analyzer with its EVT meta information with the
|
||||||
|
|
|
@ -987,10 +987,10 @@ bool GlueCompiler::compile() {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ( ! _doc_id.empty() ) {
|
if ( ! _doc_id.empty() ) {
|
||||||
auto mtime = hilti::expression::Ctor(hilti::ctor::Time(hilti::rt::time::current_time()));
|
preinit_body.addCall("zeek_rt::register_spicy_module_begin", {
|
||||||
preinit_body.addCall("zeek_rt::register_spicy_module_begin",
|
hilti::builder::string_mut(_doc_id),
|
||||||
{hilti::builder::string_mut(_doc_id), hilti::builder::string_mut(_doc_description),
|
hilti::builder::string_mut(_doc_description),
|
||||||
mtime});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( auto& a : _protocol_analyzers ) {
|
for ( auto& a : _protocol_analyzers ) {
|
||||||
|
|
|
@ -22,8 +22,8 @@ public:
|
||||||
* @param name name of the Spicy EVT module.
|
* @param name name of the Spicy EVT module.
|
||||||
* @param description text describing the module further
|
* @param description text describing the module further
|
||||||
*/
|
*/
|
||||||
explicit SpicyModuleInfo(const std::string& name, const std::string& description, time_t mtime)
|
explicit SpicyModuleInfo(const std::string& name, const std::string& description)
|
||||||
: name(name), description(description), mtime(mtime) {}
|
: name(name), description(description) {}
|
||||||
|
|
||||||
/** @return textual description of the module */
|
/** @return textual description of the module */
|
||||||
const auto& Description() const { return description; }
|
const auto& Description() const { return description; }
|
||||||
|
@ -45,13 +45,12 @@ public:
|
||||||
void AddBifItem(const std::string& id, plugin::BifItem::Type type) { bif_items.emplace_back(id, type); }
|
void AddBifItem(const std::string& id, plugin::BifItem::Type type) { bif_items.emplace_back(id, type); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
time_t DoGetModificationTime() const override { return mtime; }
|
time_t DoGetModificationTime() const override { return time(nullptr); }
|
||||||
std::string DoName() const override { return name; }
|
std::string DoName() const override { return name; }
|
||||||
std::string DoReStructuredText(bool roles_only) const override { return ""; }
|
std::string DoReStructuredText(bool roles_only) const override { return ""; }
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string description;
|
std::string description;
|
||||||
time_t mtime;
|
|
||||||
|
|
||||||
std::list<plugin::Component*> components;
|
std::list<plugin::Component*> components;
|
||||||
std::list<plugin::BifItem> bif_items;
|
std::list<plugin::BifItem> bif_items;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue