Skip to content

Commit

Permalink
fix: allow only one version (#137)
Browse files Browse the repository at this point in the history
* fix: allow only one version

* typo
  • Loading branch information
thesayyn authored Dec 12, 2024
1 parent 936081d commit 13b18ba
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 6 deletions.
7 changes: 6 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@ apt.install(
manifest = "apt/tests/resolution/arch_all.yaml",
nolock = True,
)
use_repo(apt, "arch_all_test", "arch_all_test_resolve", "bullseye", "bullseye_nolock", "noble", "resolution_test", "resolution_test_resolve")
apt.install(
name = "clang",
manifest = "apt/tests/resolution/clang.yaml",
nolock = True,
)
use_repo(apt, "arch_all_test", "arch_all_test_resolve", "bullseye", "bullseye_nolock", "clang", "noble", "resolution_test", "resolution_test_resolve")
3 changes: 1 addition & 2 deletions apt/private/apt_dep_resolver.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def _resolve_all(state, name, version, arch, include_transitive = True):

# If this package is not found but is not part of a dependency group, then add it to unmet dependencies.
if not package:
key = "%s~~%s" % (name, version[1] if version else "")
unmet_dependencies.append((name, version))
continue

Expand All @@ -89,7 +88,7 @@ def _resolve_all(state, name, version, arch, include_transitive = True):
if i == 0:
root_package = package

key = "%s~~%s" % (package["Package"], package["Version"])
key = package["Package"]

# If we encountered package before in the transitive closure, skip it
if key in already_recursed:
Expand Down
7 changes: 5 additions & 2 deletions apt/private/deb_translate_lock.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,14 @@ def _deb_translate_lock_impl(rctx):

if package["arch"] not in architectures:
architectures[package["arch"]] = []
architectures[package["arch"]].append(package["name"])

if package["name"] not in architectures[package["arch"]]:
architectures[package["arch"]].append(package["name"])

if package["name"] not in packages:
packages[package["name"]] = []
packages[package["name"]].append(package["arch"])
if package["arch"] not in packages[package["name"]]:
packages[package["name"]].append(package["arch"])

if not lock_content:
package_defs.append(
Expand Down
11 changes: 11 additions & 0 deletions apt/tests/resolution/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@aspect_bazel_lib//lib:testing.bzl", "assert_contains")
load("@bazel_skylib//rules:build_test.bzl", "build_test")

jq(
name = "pick_libuuid_version",
Expand Down Expand Up @@ -45,3 +46,13 @@ assert_contains(
actual = ":pick_quake_version",
expected = "73",
)

build_test(
name = "build_clang",
target_compatible_with = [
"@platforms//os:linux",
],
targets = [
"@clang//clang",
],
)
16 changes: 16 additions & 0 deletions apt/tests/resolution/clang.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# bazel run @jammy_cuda//:lock
version: 1
sources:
- channel: jammy main
url: https://snapshot.ubuntu.com/ubuntu/20240301T030400Z
- channel: jammy universe
url: https://snapshot.ubuntu.com/ubuntu/20240301T030400Z
- channel: jammy-updates main
url: https://snapshot.ubuntu.com/ubuntu/20240301T030400Z
- channel: jammy-security main
url: https://snapshot.ubuntu.com/ubuntu/20240301T030400Z
archs:
- "amd64"

packages:
- "clang"
2 changes: 1 addition & 1 deletion distroless/private/flatten.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _flatten_impl(ctx):
tools = bsdtar.default.files,
arguments = [args],
mnemonic = "Flatten",
progress_message = "Flattening %{label}}",
progress_message = "Flattening %{label}",
)

return [
Expand Down

0 comments on commit 13b18ba

Please sign in to comment.