Skip to content

Commit

Permalink
fix resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn committed Nov 15, 2024
1 parent 61df75d commit d9d23da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apt/private/resolve.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ load("@aspect_bazel_lib//lib:repo_utils.bzl", "repo_utils")
load(":lockfile.bzl", "lockfile")
load(":package_index.bzl", "package_index")
load(":package_resolution.bzl", "package_resolution")
load(":util.bzl", "util")
load(":version_constraint.bzl", "version_constraint")

def _parse_manifest(rctx, yq_toolchain_prefix, manifest):
is_windows = repo_utils.is_windows(rctx)
Expand Down Expand Up @@ -59,7 +61,7 @@ def internal_resolve(rctx, yq_toolchain_prefix, manifest, include_transitive):
fail("Duplicate package, {}. Please remove it from your manifest".format(dep_constraint))
dep_constraint_set[dep_constraint] = True

constraint = package_resolution.parse_depends(dep_constraint).pop()
constraint = version_constraint.parse_depends(dep_constraint).pop()

rctx.report_progress("Resolving %s" % dep_constraint)
(package, dependencies, unmet_dependencies) = pkgresolution.resolve_all(
Expand All @@ -74,7 +76,7 @@ def internal_resolve(rctx, yq_toolchain_prefix, manifest, include_transitive):

if len(unmet_dependencies):
# buildifier: disable=print
print("the following packages have unmet dependencies: %s" % ",".join([up[0] for up in unmet_dependencies]))
util.warning(rctx, "Following dependencies could not be resolved for %s: %s" % (constraint["name"], ",".join([up[0] for up in unmet_dependencies])))

lockf.add_package(package, arch)

Expand Down
7 changes: 7 additions & 0 deletions apt/private/util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ def _get_dict(struct, keys = [], default_value = None):
def _sanitize(str):
return str.replace("+", "-p-").replace(":", "-").replace("~", "_")

def _warning(rctx, message):
rctx.execute([
"echo",
"\033[0;33mWARNING:\033[0m {}".format(message),
], quiet = False)

util = struct(
sanitize = _sanitize,
set_dict = _set_dict,
get_dict = _get_dict,
warning = _warning,
)

0 comments on commit d9d23da

Please sign in to comment.