Skip to content

Commit

Permalink
Improve dependency handling
Browse files Browse the repository at this point in the history
It now won't report unsatisfiable dependencies between two nodes in the
dependency graph that are already installed.  E.g. previously, if one
used the --nodeps flag to install package "foo" that had a failed
dependency on Zeek, then installing unrelated package "bar" without
--nodeps would emit an error about "foo" dependencies being
unsatisfiable even though that has no relation to the current operation.
  • Loading branch information
jsiwek committed Sep 18, 2019
1 parent 685a625 commit 19ba89f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
11 changes: 11 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@

2.0.4-1 | 2019-09-18 16:09:19 -0700

* Improve dependency handling (Jon Siwek, Corelight)

It now won't report unsatisfiable dependencies between two nodes in the
dependency graph that are already installed. E.g. previously, if one
used the --nodeps flag to install package "foo" that had a failed
dependency on Zeek, then installing unrelated package "bar" without
--nodeps would emit an error about "foo" dependencies being
unsatisfiable even though that has no relation to the current operation.

2.0.4 | 2019-08-28 15:50:13 -0700

* Release 2.0.4.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.4
2.0.4-1
2 changes: 1 addition & 1 deletion doc/man/zkg.1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "ZKG" "1" "Aug 28, 2019" "2.0.4" "Zeek Package Manager"
.TH "ZKG" "1" "Sep 18, 2019" "2.0.4-1" "Zeek Package Manager"
.SH NAME
zkg \- Zeek Package Manager
.
Expand Down
2 changes: 1 addition & 1 deletion zeekpkg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import logging

__version__ = "2.0.4"
__version__ = "2.0.4-1"
__all__ = ['manager', 'package', 'source']

LOG = logging.getLogger(__name__)
Expand Down
22 changes: 14 additions & 8 deletions zeekpkg/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1531,8 +1531,16 @@ def __str__(self):
# Check that installed version doesn't conflict with dependers.
track_method, required_version = node.installed_version

if track_method == TRACKING_METHOD_BRANCH:
for depender_name, version_spec in node.dependers.items():
for depender_name, version_spec in node.dependers.items():
if ( depender_name in graph and
graph[depender_name].installed_version ):
# Both nodes already installed, so assume compatible.
# They're maybe not actually if the user installed via
# --nodeps, but if that's their desired state, it's
# better not to complain about it now.
continue

if track_method == TRACKING_METHOD_BRANCH:
if version_spec == '*':
continue

Expand All @@ -1547,8 +1555,7 @@ def __str__(self):
' but "{}" requires {}', node.name,
required_version, depender_name, version_spec),
new_pkgs)
elif track_method == TRACKING_METHOD_COMMIT:
for depender_name, version_spec in node.dependers.items():
elif track_method == TRACKING_METHOD_COMMIT:
if version_spec == '*':
continue

Expand All @@ -1561,11 +1568,10 @@ def __str__(self):
' but "{}" requires {}', node.name,
required_version, depender_name, version_spec),
new_pkgs)
else:
normal_version = _normalize_version_tag(required_version)
req_semver = semver.Version.coerce(normal_version)
else:
normal_version = _normalize_version_tag(required_version)
req_semver = semver.Version.coerce(normal_version)

for depender_name, version_spec in node.dependers.items():
if version_spec.startswith('branch='):
version_spec = version_spec[len('branch='):]
return (str.format(
Expand Down

0 comments on commit 19ba89f

Please sign in to comment.