Skip to content

Commit 964b0e7

Browse files
committed
Remove references to bro-pkg.meta and bro-pkg.index
1 parent 08c3171 commit 964b0e7

File tree

13 files changed

+54
-105
lines changed

13 files changed

+54
-105
lines changed

doc/package.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ This is the package's metadata file in INI file format and may contain
2222
:ref:`additional fields <metadata-fields>` that describe the package as well
2323
as how it inter-operates with Zeek, the package manager, or other packages.
2424

25-
.. note::
26-
27-
:file:`zkg.meta` is the canonical metadata file name used :program:`since
28-
zkg v2.0`. The previous metadata file name of :file:`bro-pkg.meta` is also
29-
accepted when no :file:`zkg.meta` exists.
30-
3125
.. _package-shorthand-name:
3226

3327
Note that the shorthand name for your package that may be used by :ref:`zkg

doc/source.rst

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ usernames or some unique way of identifying the organization/person that
2222
maintains Zeek packages. However, a source is free to use a flat organization
2323
with a single, top-level :file:`zkg.index`.
2424

25-
.. note::
26-
27-
The magic index file name of :file:`zkg.index` is available :program:`since
28-
zkg v2.0`. For compatibility purposes, the old index file name of
29-
:file:`bro-pkg.index` is also still supported.
30-
3125
After creating a git repo for the package source and adding package index files
3226
to it, it's ready to be used by :ref:`zkg <zkg>`.
3327

@@ -36,10 +30,9 @@ to it, it's ready to be used by :ref:`zkg <zkg>`.
3630
Package Index Files
3731
-------------------
3832

39-
Files named :file:`zkg.index` (or the legacy :file:`bro-pkg.index`) are used to
40-
describe the :doc:`Zeek Packages <package>` found within the package source.
41-
They are simply a list of git URLs pointing to the git repositories of
42-
packages. For example::
33+
Files named :file:`zkg.index` are used to describe the :doc:`Zeek Packages
34+
<package>` found within the package source. They are simply a list of git URLs
35+
pointing to the git repositories of packages. For example::
4336

4437
https://github.com/zeek/foo
4538
https://github.com/zeek/bar
@@ -75,9 +68,8 @@ Aggregating Metadata
7568
--------------------
7669

7770
The maintainer/operator of a package source may choose to periodically aggregate
78-
the metadata contained in its packages' :file:`zkg.meta` (and legacy
79-
:file:`bro-pkg.meta`) files. The :ref:`zkg refresh <refresh-command>`
80-
is used to perform the task. For example:
71+
the metadata contained in its packages' :file:`zkg.meta` files. The :ref:`zkg
72+
refresh <refresh-command>` is used to perform the task. For example:
8173

8274
.. code-block:: console
8375

testing/baselines/tests.install-bro-pkg-warning/stderr

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
22
XXXX-XX-XX XX:XX:XX DEBUG found source clone of "one" at <...>/one
33
XXXX-XX-XX XX:XX:XX DEBUG refresh "one": pulling <...>/one
4-
XXXX-XX-XX XX:XX:XX WARNING <...>/bro-pkg.meta: missing metadata file
5-
XXXX-XX-XX XX:XX:XX WARNING skipping aggregation of <...>/bad_pkg: bad metadata: missing zkg.meta (or bro-pkg.meta) metadata file
4+
XXXX-XX-XX XX:XX:XX WARNING <...>/zkg.meta: missing metadata file
5+
XXXX-XX-XX XX:XX:XX WARNING skipping aggregation of <...>/bad_pkg: bad metadata: missing zkg.meta metadata file
66
XXXX-XX-XX XX:XX:XX DEBUG metadata refresh: 8 additions (alice/bar, alice/baz, alice/foo, alice/i-have-no-scripts, alice/new_pkg, alice/qux, bob/corge, bob/grault), 0 changes, 0 removals
77
XXXX-XX-XX XX:XX:XX INFO committed package source "one" metadata update
88
XXXX-XX-XX XX:XX:XX DEBUG fetch package one<...>/foo
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
22
XXXX-XX-XX XX:XX:XX DEBUG found source clone of "one" at <...>/one
33
XXXX-XX-XX XX:XX:XX DEBUG refresh "one": pulling <...>/one
4-
XXXX-XX-XX XX:XX:XX WARNING <...>/bro-pkg.meta: missing metadata file
5-
XXXX-XX-XX XX:XX:XX WARNING skipping aggregation of <...>/bad_pkg: bad metadata: missing zkg.meta (or bro-pkg.meta) metadata file
4+
XXXX-XX-XX XX:XX:XX WARNING <...>/zkg.meta: missing metadata file
5+
XXXX-XX-XX XX:XX:XX WARNING skipping aggregation of <...>/bad_pkg: bad metadata: missing zkg.meta metadata file
66
XXXX-XX-XX XX:XX:XX DEBUG metadata refresh: 8 additions (alice/bar, alice/baz, alice/foo, alice/i-have-no-scripts, alice/new_pkg, alice/qux, bob/corge, bob/grault), 0 changes, 0 removals
77
XXXX-XX-XX XX:XX:XX DEBUG fetch package one<...>/foo

testing/baselines/tests.refresh/agg.fail.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
Refresh package source: one
33
No membership changes
44
WARNING: Metadata aggregated, but excludes the following packages due to described problems:
5-
<...>/bad_pkg: missing zkg.meta (or bro-pkg.meta) metadata file
5+
<...>/bad_pkg: missing zkg.meta metadata file
66
Refresh installed packages
77
No new outdated packages

testing/baselines/tests.refresh/agg.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Refresh package source: one
33
No membership changes
44
WARNING: Metadata aggregated, but excludes the following packages due to described problems:
5-
<...>/bad_pkg: missing zkg.meta (or bro-pkg.meta) metadata file
5+
<...>/bad_pkg: missing zkg.meta metadata file
66
Pushed aggregated metadata
77
Refresh installed packages
88
No new outdated packages

testing/tests/install-bro-pkg-warning

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

zeekpkg/manager.py

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
BUILTIN_SOURCE,
5050
BUILTIN_SCHEME,
5151
METADATA_FILENAME,
52-
LEGACY_METADATA_FILENAME,
5352
TRACKING_METHOD_VERSION,
5453
TRACKING_METHOD_BRANCH,
5554
TRACKING_METHOD_COMMIT,
@@ -190,20 +189,19 @@ class Manager:
190189
scratch_dir (str): a directory where the package manager performs
191190
miscellaneous/temporary file operations
192191
193-
script_dir (str): the directory where the package manager will
194-
copy each installed package's `script_dir` (as given by its
195-
:file:`zkg.meta` or :file:`bro-pkg.meta`). Each package gets a
196-
subdirectory within `script_dir` associated with its name.
192+
script_dir (str): the directory where the package manager will copy each
193+
installed package's `script_dir` (as given by its :file:`zkg.meta`).
194+
Each package gets a subdirectory within `script_dir` associated with
195+
its name.
197196
198-
plugin_dir (str): the directory where the package manager will
199-
copy each installed package's `plugin_dir` (as given by its
200-
:file:`zkg.meta` or :file:`bro-pkg.meta`). Each package gets a
201-
subdirectory within `plugin_dir` associated with its name.
197+
plugin_dir (str): the directory where the package manager will copy each
198+
installed package's `plugin_dir` (as given by its :file:`zkg.meta`).
199+
Each package gets a subdirectory within `plugin_dir` associated with
200+
its name.
202201
203202
bin_dir (str): the directory where the package manager will link
204203
executables into that are provided by an installed package through
205-
`executables` (as given by its :file:`zkg.meta` or
206-
:file:`bro-pkg.meta`)
204+
`executables` (as given by its :file:`zkg.meta`)
207205
208206
source_clonedir (str): the directory where the package manager
209207
will clone package sources. Each source gets a subdirectory
@@ -230,6 +228,7 @@ class Manager:
230228
in a directory named :file:`packages`, so as long as
231229
:envvar:`ZEEKPATH` is configured correctly, ``@load packages`` will
232230
load all installed packages that have been marked as loaded.
231+
233232
"""
234233

235234
def __init__(
@@ -1134,7 +1133,7 @@ def _refresh_source(self, name, aggregate=False, push=False):
11341133
aggregation_issues.append((url, msg))
11351134
continue
11361135

1137-
metadata_file = _pick_metadata_file(clone.working_dir)
1136+
metadata_file = os.path.join(clone.working_dir, METADATA_FILENAME)
11381137
metadata_parser = configparser.ConfigParser(interpolation=None)
11391138
invalid_reason = _parse_package_metadata(
11401139
metadata_parser, metadata_file
@@ -2716,7 +2715,7 @@ def _stage(self, package, version, clone, stage, env=None):
27162715
27172716
"""
27182717
LOG.debug('staging "%s": version %s', package, version)
2719-
metadata_file = _pick_metadata_file(clone.working_dir)
2718+
metadata_file = os.path.join(clone.working_dir, METADATA_FILENAME)
27202719
metadata_parser = configparser.ConfigParser(interpolation=None)
27212720
invalid_reason = _parse_package_metadata(metadata_parser, metadata_file)
27222721
if invalid_reason:
@@ -3007,7 +3006,7 @@ def _install(self, package, version, use_existing_clone=False):
30073006
status.current_hash = clone.head.object.hexsha
30083007
status.is_outdated = _is_clone_outdated(clone, version, status.tracking_method)
30093008

3010-
metadata_file = _pick_metadata_file(clone.working_dir)
3009+
metadata_file = os.path.join(clone.working_dir, METADATA_FILENAME)
30113010
metadata_parser = configparser.ConfigParser(interpolation=None)
30123011
invalid_reason = _parse_package_metadata(metadata_parser, metadata_file)
30133012

@@ -3183,7 +3182,7 @@ def ignore(_, files):
31833182
rval = []
31843183

31853184
for f in files:
3186-
if f in {".git", "bro-pkg.meta", "zkg.meta"}:
3185+
if f in {".git", "zkg.meta"}:
31873186
rval.append(f)
31883187

31893188
return rval
@@ -3233,22 +3232,11 @@ def _get_package_metadata(parser):
32333232
return metadata
32343233

32353234

3236-
def _pick_metadata_file(directory):
3237-
rval = os.path.join(directory, METADATA_FILENAME)
3238-
3239-
if os.path.exists(rval):
3240-
return rval
3241-
3242-
return os.path.join(directory, LEGACY_METADATA_FILENAME)
3243-
3244-
32453235
def _parse_package_metadata(parser, metadata_file):
32463236
"""Return string explaining why metadata is invalid, or '' if valid."""
32473237
if not parser.read(metadata_file):
32483238
LOG.warning("%s: missing metadata file", metadata_file)
3249-
return "missing {} (or {}) metadata file".format(
3250-
METADATA_FILENAME, LEGACY_METADATA_FILENAME
3251-
)
3239+
return f"missing {METADATA_FILENAME} metadata file"
32523240

32533241
if not parser.has_section("package"):
32543242
LOG.warning("%s: metadata missing [package]", metadata_file)
@@ -3257,9 +3245,6 @@ def _parse_package_metadata(parser, metadata_file):
32573245
return ""
32583246

32593247

3260-
_legacy_metadata_warnings = set()
3261-
3262-
32633248
def _info_from_clone(clone, package, status, version):
32643249
"""Retrieves information about a package.
32653250
@@ -3276,7 +3261,7 @@ def _info_from_clone(clone, package, status, version):
32763261
else:
32773262
version_type = TRACKING_METHOD_BRANCH
32783263

3279-
metadata_file = _pick_metadata_file(clone.working_dir)
3264+
metadata_file = os.path.join(clone.working_dir, METADATA_FILENAME)
32803265
metadata_parser = configparser.ConfigParser(interpolation=None)
32813266
invalid_reason = _parse_package_metadata(metadata_parser, metadata_file)
32823267

@@ -3292,20 +3277,6 @@ def _info_from_clone(clone, package, status, version):
32923277
default_branch=default_branch,
32933278
)
32943279

3295-
# Remove in v3.0 by either silently ignoring LEGACY_METADATA_FILENAME
3296-
# completely or error with helpful instructions about zkg.meta.
3297-
if (
3298-
os.path.basename(metadata_file) == LEGACY_METADATA_FILENAME
3299-
and package.qualified_name() not in _legacy_metadata_warnings
3300-
):
3301-
LOG.warning(
3302-
"Package %s is using the legacy bro-pkg.meta metadata file. "
3303-
"It will soon stop working unless updated to use zkg.meta instead. "
3304-
"Please report this to the package maintainers.",
3305-
package.qualified_name(),
3306-
)
3307-
_legacy_metadata_warnings.add(package.qualified_name())
3308-
33093280
metadata = _get_package_metadata(metadata_parser)
33103281

33113282
return PackageInfo(

zeekpkg/package.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#: The name of files used by packages to store their metadata.
1717
METADATA_FILENAME = "zkg.meta"
18-
LEGACY_METADATA_FILENAME = "bro-pkg.meta"
1918

2019
TRACKING_METHOD_VERSION = "version"
2120
TRACKING_METHOD_BRANCH = "branch"
@@ -297,7 +296,7 @@ class PackageInfo:
297296
packages
298297
299298
metadata (dict of str -> str): the contents of the package's
300-
:file:`zkg.meta` or :file:`bro-pkg.meta`
299+
:file:`zkg.meta`
301300
302301
versions (list of str): a list of the package's availabe git version
303302
tags
@@ -311,10 +310,9 @@ class PackageInfo:
311310
invalid_reason (str): this attribute is set when there is a problem
312311
with gathering package information and explains what went wrong.
313312
314-
metadata_file: the absolute path to the :file:`zkg.meta` or
315-
:file:`bro-pkg.meta` for this package. Use this if you'd like to
316-
parse the metadata yourself. May not be defined, in which case the
317-
value is None.
313+
metadata_file: the absolute path to the :file:`zkg.meta` or for this
314+
package. Use this if you'd like to parse the metadata yourself.
315+
May not be defined, in which case the value is None.
318316
"""
319317

320318
def __init__(
@@ -427,10 +425,10 @@ class Package:
427425
or if it's located in a top-level :file:`zkg.index` file.
428426
429427
metadata (dict of str -> str): the contents of the package's
430-
:file:`zkg.meta` or :file:`bro-pkg.meta` file. If the package has
431-
not been installed then this information may come from the last
432-
aggregation of the source's :file:`aggregate.meta` file (it may not
433-
be accurate/up-to-date).
428+
:file:`zkg.meta` file. If the package has not been installed then
429+
this information may come from the last aggregation of the source's
430+
:file:`aggregate.meta` file (it may not be accurate/up-to-date).
431+
434432
"""
435433

436434
def __init__(

0 commit comments

Comments
 (0)