Skip to content

Commit 08c3171

Browse files
committed
Remove references to legacy bro naming
This intentionally leaves behind references to bro-pkg.meta and __bro_plugin__ but removes all of the other references to scripts and files that have been deprecated and/or removed since Zeek 3.0.
1 parent c152666 commit 08c3171

File tree

8 files changed

+54
-216
lines changed

8 files changed

+54
-216
lines changed

doc/man/zkg.1

Lines changed: 15 additions & 15 deletions
Large diffs are not rendered by default.

doc/package.rst

Lines changed: 15 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ last component of its git URL. E.g. a package at ``https://github.com/zeek/foo``
3636
may be referred to as **foo** when using :program:`zkg` and a Zeek
3737
script that wants to load all the scripts within that package can use:
3838

39-
.. code-block:: bro
39+
.. code-block:: zeek
4040
4141
@load foo
4242
@@ -229,11 +229,6 @@ though the following step are the essentials needed to create a package.
229229
script_dir = scripts/Demo/Rot13
230230
build_command = ./configure && make
231231

232-
.. note::
233-
234-
See :ref:`legacy-bro-support` for notes on configuring packages to
235-
support Bro 2.5 or earlier.
236-
237232
#. Add example script code:
238233

239234
.. code-block:: console
@@ -257,9 +252,7 @@ though the following step are the essentials needed to create a package.
257252
*p = (*p - b + 13) % 26 + b;
258253
}
259254
260-
BroString* bs = new BroString(1, reinterpret_cast<byte_vec>(rot13),
261-
strlen(rot13));
262-
return new StringVal(bs);
255+
return make_intrusive<StringVal>(strlen(rot13), rot13);
263256
%}
264257

265258
#. Commit everything to git:
@@ -576,11 +569,6 @@ An example :file:`zkg.meta`::
576569
script_dir = scripts/Demo/Rot13
577570
build_command = ./configure && make
578571

579-
.. note::
580-
581-
See :ref:`legacy-bro-support` for notes on configuring packages to
582-
support Bro 2.5 or earlier.
583-
584572
The default CMake skeleton for Zeek plugins will use :file:`build/` as the
585573
directory for the final/built version of the plugin, which matches the defaulted
586574
value of the omitted `plugin_dir` metadata field.
@@ -591,31 +579,6 @@ script components, the "plugin" part is always unconditionally loaded by Zeek,
591579
but the "script" components must either be explicitly loaded (e.g. :samp:`@load
592580
{<package_name>}`) or the package marked as :ref:`loaded <load-command>`.
593581

594-
.. _legacy-bro-support:
595-
596-
Supporting Older Bro Versions
597-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
598-
599-
Plugin skeletons generated before Bro v2.6 and also any packages
600-
that generally want to support such Bro versions need to pass
601-
an additional configuration option such as::
602-
603-
build_command = ./configure --bro-dist=%(bro_dist)s && make
604-
605-
See the :ref:`Value Interpolation <metadata-interpolation>`
606-
section for more information on what the ``%(bro_dist)s``
607-
string does, but a brief explanation is that it will expand to
608-
a path containing the Bro source-code on the user's system.
609-
For newer versions of Bro, packages are able to work entirely
610-
with the installation path and don't require original source code.
611-
612-
Also note that other various Zeek scripting and CMake infrastructure may
613-
have changed between Bro v2.6 and Zeek v3.0. So if you plan to support
614-
older version of Bro (before the Zeek rename), then you should keep an eye
615-
out for various things that got renamed. For example, the `zeek_init` event
616-
won't exist in any version before Zeek v3.0, nor will any CMake macros
617-
that start with `zeek_plugin`.
618-
619582
.. _metadata-interpolation:
620583

621584
Value Interpolation
@@ -624,18 +587,14 @@ Value Interpolation
624587
The `build_command field`_ may reference the settings any given user has in
625588
their customized :ref:`package manager config file <zkg-config-file>`.
626589

627-
For example, if a metadata field's value contains the ``%(bro_dist)s`` string,
590+
For example, if a metadata field's value contains the ``%(zeek_dist)s`` string,
628591
then :program:`zkg` operations that use that field will automatically
629-
substitute the actual value of `bro_dist` that the user has in their local
592+
substitute the actual value of `zeek_dist` that the user has in their local
630593
config file. Note the trailing 's' character at the end of the interpolation
631-
string, ``%(bro_dist)s``, is intended/necessary for all such interpolation
632-
usages. Note that :program:`since zkg v2.0`, `zeek_dist` is the canonical name
633-
for `bro_dist` within the :ref:`zkg config file <zkg-config-file>`,
634-
but either one means the same thing and should work. To support older
635-
versions of :program:`bro-pkg`, you'd want to use `bro_dist` in package
636-
metadata files.
637-
638-
Besides the `bro_dist`/`zeek_dist` config keys, any key inside the
594+
string, ``%(zeek_dist)s``, is intended/necessary for all such interpolation
595+
usages.
596+
597+
Besides the `zeek_dist` config key, any key inside the
639598
`user_vars` sections of their :ref:`package manager config file
640599
<zkg-config-file>` that matches the key of an entry in the package's
641600
`user_vars field`_ will be interpolated.
@@ -777,38 +736,24 @@ An example :file:`zkg.meta`::
777736
The field is a list of dependency names and their version requirement
778737
specifications.
779738

780-
A dependency name may be either `zeek`, `zkg`, `bro`, `bro-pkg`,
739+
A dependency name may be either `zeek`, `zkg`,
781740
a full git URL of the package, or a :ref:`package shorthand name
782741
<package-shorthand-name>`.
783742

784-
- The special `zeek` and `bro` dependencies refers not to a package,
785-
but the version of Zeek that the package requires in order to function. If
786-
the user has :program:`zeek-config` or :program:`bro-config` in their
787-
:envvar:`PATH` when installing/upgrading a package that specifies a `zeek` or
788-
`bro` dependency, then :program:`zkg` will enforce that the requirement is
789-
satisfied.
743+
- The special `zeek` dependency refers not to a package, but the version of Zeek
744+
that the package requires in order to function. If the user has
745+
:program:`zeek-config` in their :envvar:`PATH` when installing/upgrading a
746+
package that specifies a `zeek` dependency, then :program:`zkg` will enforce
747+
that the requirement is satisfied.
790748

791-
.. note::
792-
793-
In this context, `zeek` and `bro` mean the same thing -- the
794-
later is maintained for backwards compatibility while the former
795-
became available :program:`since zkg v2.0`.
796-
797-
- The special `zkg` and `bro-pkg` dependencies refers to the version of the
749+
- The special `zkg` dependency refers to the version of the
798750
package manager that is required by the package. E.g. if a package takes
799751
advantage of new features that are not present in older versions of the
800752
package manager, then it should indicate that so users of those old version
801753
will see an error message an know to upgrade instead of seeing a cryptic
802754
error/exception, or worse, seeing no errors, but without the desired
803755
functionality being performed.
804756

805-
.. note::
806-
807-
This feature itself, via use of a `bro-pkg` dependency, is only
808-
available :program:`since bro-pkg v1.2` while a `zkg` dependency is only
809-
recognized :program:`since zkg v2.0`. Otherwise, `zkg` and `bro-pkg` mean
810-
the same thing in this context.
811-
812757
- The full git URL may be directly specified in the `depends` metadata if you
813758
want to force the dependency to always resolve to a single, canonical git
814759
repository. Typically this is the safe approach to take when listing

doc/quickstart.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ have Zeek automatically load the scripts from all
141141
:ref:`installed <install-command>` packages that are also marked as
142142
":ref:`loaded <load-command>`" add:
143143

144-
.. code-block:: bro
144+
.. code-block:: zeek
145145
146146
@load packages
147147

doc/zkg.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.. _bro-pkg:
2-
31
.. _zkg:
42

53
zkg Command-Line Tool
@@ -217,8 +215,6 @@ template info
217215
:prog: zkg
218216
:path: template info
219217

220-
.. _bro-pkg-config-file:
221-
222218
.. _zkg-config-file:
223219

224220
Config File

zeekpkg/_util.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,6 @@ def read_zeek_config_line(stdout):
360360
def get_zeek_version():
361361
zeek_config = find_program("zeek-config")
362362

363-
if not zeek_config:
364-
zeek_config = find_program("bro-config")
365-
366363
if not zeek_config:
367364
return ""
368365

zeekpkg/manager.py

Lines changed: 13 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,15 @@ def populate(self):
119119
make_symlink(entry.path, os.path.join(self.clone_dir, entry.name))
120120

121121
def get_subprocess_env(self):
122-
zeekpath = os.environ.get("ZEEKPATH") or os.environ.get("BROPATH")
123-
pluginpath = os.environ.get("ZEEK_PLUGIN_PATH") or os.environ.get(
124-
"BRO_PLUGIN_PATH"
125-
)
122+
zeekpath = os.environ.get("ZEEKPATH")
123+
pluginpath = os.environ.get("ZEEK_PLUGIN_PATH")
126124

127125
if not (zeekpath and pluginpath):
128126
zeek_config = find_program("zeek-config")
129-
path_option = "--zeekpath"
130-
131-
if not zeek_config:
132-
zeek_config = find_program("bro-config")
133-
path_option = "--bropath"
134127

135128
if zeek_config:
136129
cmd = subprocess.Popen(
137-
[zeek_config, path_option, "--plugin_dir"],
130+
[zeek_config, "--zeekpath", "--plugin_dir"],
138131
stdout=subprocess.PIPE,
139132
stderr=subprocess.STDOUT,
140133
bufsize=1,
@@ -149,7 +142,7 @@ def get_subprocess_env(self):
149142
if not pluginpath:
150143
pluginpath = line2
151144
else:
152-
return None, 'no "zeek-config" or "bro-config" found in PATH'
145+
return None, 'no "zeek-config" found in PATH'
153146

154147
zeekpath = os.path.dirname(self.script_dir) + os.pathsep + zeekpath
155148
pluginpath = os.path.dirname(self.plugin_dir) + os.pathsep + pluginpath
@@ -158,8 +151,6 @@ def get_subprocess_env(self):
158151
env["PATH"] = self.bin_dir + os.pathsep + os.environ.get("PATH", "")
159152
env["ZEEKPATH"] = zeekpath
160153
env["ZEEK_PLUGIN_PATH"] = pluginpath
161-
env["BROPATH"] = zeekpath
162-
env["BRO_PLUGIN_PATH"] = pluginpath
163154

164155
return env, ""
165156

@@ -277,8 +268,6 @@ def __init__(
277268
self.installed_pkgs = {}
278269
self._builtin_packages = None # Cached Zeek built-in packages.
279270
self._builtin_packages_discovered = False # Flag if discovery even worked.
280-
# The bro_dist attribute exists just for backward compatibility
281-
self.bro_dist = zeek_dist
282271
self.zeek_dist = zeek_dist
283272
self.state_dir = state_dir
284273
self.user_vars = {} if user_vars is None else user_vars
@@ -380,14 +369,6 @@ def __init__(
380369
self._write_autoloader()
381370
make_symlink("packages.zeek", self.autoload_package)
382371

383-
# Backward compatibility (Pre-Zeek 3.0 does not handle .zeek files)
384-
autoload_script_fallback = os.path.join(self.script_dir, "packages.bro")
385-
autoload_package_fallback = os.path.join(self.script_dir, "__load__.bro")
386-
delete_path(autoload_script_fallback)
387-
delete_path(autoload_package_fallback)
388-
make_symlink("packages.zeek", autoload_script_fallback)
389-
make_symlink("packages.zeek", autoload_package_fallback)
390-
391372
def _write_autoloader(self):
392373
"""Write the :file:`packages.zeek` loader script.
393374
@@ -516,13 +497,6 @@ def zeekpath(self):
516497
"""
517498
return os.path.dirname(self.script_dir)
518499

519-
def bropath(self):
520-
"""Same as :meth:`zeekpath`.
521-
522-
Using :meth:`zeekpath` is preferred since this may later be deprecated.
523-
"""
524-
return self.zeekpath()
525-
526500
def zeek_plugin_path(self):
527501
"""Return the path where installed package plugins are located.
528502
@@ -531,14 +505,6 @@ def zeek_plugin_path(self):
531505
"""
532506
return os.path.dirname(self.plugin_dir)
533507

534-
def bro_plugin_path(self):
535-
"""Same as :meth:`zeek_plugin_path`.
536-
537-
Using :meth:`zeek_plugin_path` is preferred since this may later be
538-
deprecated.
539-
"""
540-
return self.zeek_plugin_path()
541-
542508
def add_source(self, name, git_url):
543509
"""Add a git repository that acts as a source of packages.
544510
@@ -1493,16 +1459,8 @@ def load(self, pkg_path):
14931459
pkg_load_script = os.path.join(
14941460
self.script_dir, ipkg.package.name, "__load__.zeek"
14951461
)
1496-
# Check if __load__.bro exists for compatibility with older packages
1497-
pkg_load_fallback = os.path.join(
1498-
self.script_dir, ipkg.package.name, "__load__.bro"
1499-
)
15001462

1501-
if (
1502-
not os.path.exists(pkg_load_script)
1503-
and not os.path.exists(pkg_load_fallback)
1504-
and not self.has_plugin(ipkg)
1505-
):
1463+
if not os.path.exists(pkg_load_script) and not self.has_plugin(ipkg):
15061464
LOG.debug(
15071465
'loading "%s": %s not found and package has no plugin',
15081466
pkg_path,
@@ -2067,11 +2025,11 @@ def __str__(self):
20672025
all_deps.update(ds)
20682026

20692027
for dep_name, _ in all_deps.items():
2070-
if dep_name == "bro" or dep_name == "zeek":
2028+
if dep_name == "zeek":
20712029
# A zeek node will get added later.
20722030
continue
20732031

2074-
if dep_name == "bro-pkg" or dep_name == "zkg":
2032+
if dep_name == "zkg":
20752033
# A zkg node will get added later.
20762034
continue
20772035

@@ -2140,9 +2098,7 @@ def __str__(self):
21402098
)
21412099
graph["zeek"] = node
21422100
else:
2143-
LOG.warning(
2144-
'could not get zeek version: no "zeek-config" or "bro-config" in PATH ?'
2145-
)
2101+
LOG.warning('could not get zeek version: no "zeek-config" in PATH ?')
21462102

21472103
node = Node("zkg")
21482104
node.installed_version = PackageVersion(
@@ -2196,11 +2152,11 @@ def __str__(self):
21962152
all_deps.update(ds)
21972153

21982154
for dep_name, dep_version in all_deps.items():
2199-
if dep_name == "bro" or dep_name == "zeek":
2155+
if dep_name == "zeek":
22002156
if "zeek" in graph:
22012157
graph["zeek"].dependers[name] = dep_version
22022158
node.dependees["zeek"] = dep_version
2203-
elif dep_name == "bro-pkg" or dep_name == "zkg":
2159+
elif dep_name == "zkg":
22042160
if "zkg" in graph:
22052161
graph["zkg"].dependers[name] = dep_version
22062162
node.dependees["zkg"] = dep_version
@@ -2838,10 +2794,9 @@ def _stage(self, package, version, clone, stage, env=None):
28382794
"package's 'script_dir' does not exist: {}", pkg_script_dir
28392795
)
28402796

2841-
pkgload = os.path.join(script_dir_src, "__load__.")
2797+
pkgload = os.path.join(script_dir_src, "__load__.zeek")
28422798

2843-
# Check if __load__.bro exists for compatibility with older packages
2844-
if os.path.isfile(pkgload + "zeek") or os.path.isfile(pkgload + "bro"):
2799+
if os.path.isfile(pkgload):
28452800
try:
28462801
symlink_path = os.path.join(
28472802
os.path.dirname(stage.script_dir), package.name
@@ -3095,7 +3050,6 @@ def _interpolate_package_metadata(self, metadata, stage):
30953050
return None, "package has malformed 'user_vars' metadata field"
30963051

30973052
substitutions = {
3098-
"bro_dist": self.zeek_dist,
30993053
"zeek_dist": self.zeek_dist,
31003054
"package_base": stage.clone_dir,
31013055
}
@@ -3368,4 +3322,4 @@ def _info_from_clone(clone, package, status, version):
33683322

33693323

33703324
def _is_reserved_pkg_name(name):
3371-
return name == "bro" or name == "zeek" or name == "zkg"
3325+
return name == "zeek" or name == "zkg"

0 commit comments

Comments
 (0)